Commit fd483a59 by github-actions

Merge upstream master into patched/master

parents b073a381 dee772a5
...@@ -24,6 +24,11 @@ contract TokenTimelock { ...@@ -24,6 +24,11 @@ contract TokenTimelock {
// timestamp when token release is enabled // timestamp when token release is enabled
uint256 private immutable _releaseTime; uint256 private immutable _releaseTime;
/**
* @dev Deploys a timelock instance that is able to hold the token specified, and will only release it to
* `beneficiary_` when {release} is invoked after `releaseTime_`. The release time is specified as a Unix timestamp
* (in seconds).
*/
constructor( constructor(
IERC20 token_, IERC20 token_,
address beneficiary_, address beneficiary_,
...@@ -36,28 +41,29 @@ contract TokenTimelock { ...@@ -36,28 +41,29 @@ contract TokenTimelock {
} }
/** /**
* @return the token being held. * @dev Returns the token being held.
*/ */
function token() public view virtual returns (IERC20) { function token() public view virtual returns (IERC20) {
return _token; return _token;
} }
/** /**
* @return the beneficiary of the tokens. * @dev Returns the beneficiary that will receive the tokens.
*/ */
function beneficiary() public view virtual returns (address) { function beneficiary() public view virtual returns (address) {
return _beneficiary; return _beneficiary;
} }
/** /**
* @return the time when the tokens are released. * @dev Returns the time when the tokens are released in seconds since Unix epoch (i.e. Unix timestamp).
*/ */
function releaseTime() public view virtual returns (uint256) { function releaseTime() public view virtual returns (uint256) {
return _releaseTime; return _releaseTime;
} }
/** /**
* @notice Transfers tokens held by timelock to beneficiary. * @dev Transfers tokens held by the timelock to the beneficiary. Will only succeed if invoked after the release
* time.
*/ */
function release() public virtual { function release() public virtual {
require(block.timestamp >= releaseTime(), "TokenTimelock: current time is before release time"); require(block.timestamp >= releaseTime(), "TokenTimelock: current time is before release time");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment