Files
openzeppelin-contracts/contracts/utils/escrow/ConditionalEscrowUpgradeable.sol
2022-01-31 19:54:20 +00:00

40 lines
1.4 KiB
Solidity

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/escrow/ConditionalEscrow.sol)
pragma solidity ^0.8.0;
import "./EscrowUpgradeable.sol";
import "../../proxy/utils/Initializable.sol";
/**
* @title ConditionalEscrow
* @dev Base abstract escrow to only allow withdrawal if a condition is met.
* @dev Intended usage: See {Escrow}. Same usage guidelines apply here.
*/
abstract contract ConditionalEscrowUpgradeable is Initializable, EscrowUpgradeable {
function __ConditionalEscrow_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __ConditionalEscrow_init_unchained() internal onlyInitializing {
}
/**
* @dev Returns whether an address is allowed to withdraw their funds. To be
* implemented by derived contracts.
* @param payee The destination address of the funds.
*/
function withdrawalAllowed(address payee) public view virtual returns (bool);
function withdraw(address payable payee) public virtual override {
require(withdrawalAllowed(payee), "ConditionalEscrow: payee is not allowed to withdraw");
super.withdraw(payee);
}
/**
* This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}