ConditionalEscrow.sol 872 B

12345678910111213141516171819202122232425
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts v4.4.1 (utils/escrow/ConditionalEscrow.sol)
  3. pragma solidity ^0.8.0;
  4. import "./Escrow.sol";
  5. /**
  6. * @title ConditionalEscrow
  7. * @dev Base abstract escrow to only allow withdrawal if a condition is met.
  8. * @dev Intended usage: See {Escrow}. Same usage guidelines apply here.
  9. */
  10. abstract contract ConditionalEscrow is Escrow {
  11. /**
  12. * @dev Returns whether an address is allowed to withdraw their funds. To be
  13. * implemented by derived contracts.
  14. * @param payee The destination address of the funds.
  15. */
  16. function withdrawalAllowed(address payee) public view virtual returns (bool);
  17. function withdraw(address payable payee) public virtual override {
  18. require(withdrawalAllowed(payee), "ConditionalEscrow: payee is not allowed to withdraw");
  19. super.withdraw(payee);
  20. }
  21. }