-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayone.sol
49 lines (33 loc) · 1.11 KB
/
playone.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// contracts/GLDToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract Vesting {
IERC20 public token;
address public receiver;
uint256 public amount;
uint256 public expiry;
bool public locked = false;
bool public claimed = false;
constructor (address _token) {
token = IERC20(_token);
}
function close(address _from , address _receiver, uint256 _amount,uint256 _expiry ) external {
require(!locked,"we have close token already ");
token.transferFrom(_from, address(this), _amount);
receiver = _receiver;
amount = _amount;
expiry = _expiry;
locked = true;
}
function withdraw() external {
require(locked,"Funds has been now locked");
require(!claimed,"token already claimed");
require(block.timestamp > expiry ,"token not have been unlocked");
claimed = true;
token.transfer(receiver,amount );
}
function getTime() external view returns (uint256) {
return block.timestamp;
}
}