-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeed.sol
27 lines (23 loc) · 902 Bytes
/
Deed.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.13;
//contrato para hacer un trato/acuerdo con un tiempo estipulado para retirar el dinero.
contract Deed{
//Dirección del abogado
address public lawyer;
//Dirección del beneficiario
address payable public beneficiary;
//Establecer un tiempo.
uint public earliest;
//Constructor del smart contract
constructor(address _lawyer, address payable _beneficiary, uint fromNow)payable{
lawyer = _lawyer;
beneficiary= _beneficiary;
earliest = block.timestamp + fromNow;
}
//Función para retirar el dinero con un tiempo estipulado (tiempo minimo a cumplir).
function withdraw() public{
require(msg.sender==lawyer,"Lawyer only");
require(block.timestamp>=earliest,"too early");
beneficiary.transfer(address(this).balance);
}
}