Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity = 0.8.1;
- contract Trust{
- address public parent;
- address public kid;
- uint public timestampToWithdraw;
- constructor() {
- parent = msg.sender;
- }
- function addKid(address _kid, uint _timestampToWithdraw) external payable{
- require(msg.sender == parent, 'only the parent can add a kid');
- kid = _kid;
- timestampToWithdraw = _timestampToWithdraw;
- }
- function withdraw() external {
- require(block.timestamp >= timestampToWithdraw, 'too early');
- require(msg.sender == kid, 'only kid can withdraw');
- payable(msg.sender).transfer(address(this).balance);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement