ConditionalEscrow.sol 735 B

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