ConditionalEscrowUpgradeable.sol 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts v4.4.1 (utils/escrow/ConditionalEscrow.sol)
  3. pragma solidity ^0.8.0;
  4. import "./EscrowUpgradeable.sol";
  5. import "../../proxy/utils/Initializable.sol";
  6. /**
  7. * @title ConditionalEscrow
  8. * @dev Base abstract escrow to only allow withdrawal if a condition is met.
  9. * @dev Intended usage: See {Escrow}. Same usage guidelines apply here.
  10. */
  11. abstract contract ConditionalEscrowUpgradeable is Initializable, EscrowUpgradeable {
  12. function __ConditionalEscrow_init() internal onlyInitializing {
  13. __Context_init_unchained();
  14. __Ownable_init_unchained();
  15. __Escrow_init_unchained();
  16. __ConditionalEscrow_init_unchained();
  17. }
  18. function __ConditionalEscrow_init_unchained() internal onlyInitializing {
  19. }
  20. /**
  21. * @dev Returns whether an address is allowed to withdraw their funds. To be
  22. * implemented by derived contracts.
  23. * @param payee The destination address of the funds.
  24. */
  25. function withdrawalAllowed(address payee) public view virtual returns (bool);
  26. function withdraw(address payable payee) public virtual override {
  27. require(withdrawalAllowed(payee), "ConditionalEscrow: payee is not allowed to withdraw");
  28. super.withdraw(payee);
  29. }
  30. uint256[50] private __gap;
  31. }