ConditionalEscrowUpgradeable.sol 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. __Ownable_init_unchained();
  14. }
  15. function __ConditionalEscrow_init_unchained() internal onlyInitializing {
  16. }
  17. /**
  18. * @dev Returns whether an address is allowed to withdraw their funds. To be
  19. * implemented by derived contracts.
  20. * @param payee The destination address of the funds.
  21. */
  22. function withdrawalAllowed(address payee) public view virtual returns (bool);
  23. function withdraw(address payable payee) public virtual override {
  24. require(withdrawalAllowed(payee), "ConditionalEscrow: payee is not allowed to withdraw");
  25. super.withdraw(payee);
  26. }
  27. /**
  28. * This empty reserved space is put in place to allow future versions to add new
  29. * variables without shifting down storage in the inheritance chain.
  30. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  31. */
  32. uint256[50] private __gap;
  33. }