Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
f641feab
Commit
f641feab
authored
Jan 12, 2022
by
github-actions
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Transpile
fd483a59
parent
bd45e2d3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
TokenTimelockUpgradeable.sol
contracts/token/ERC20/utils/TokenTimelockUpgradeable.sol
+10
-4
No files found.
contracts/token/ERC20/utils/TokenTimelockUpgradeable.sol
View file @
f641feab
...
@@ -25,6 +25,11 @@ contract TokenTimelockUpgradeable is Initializable {
...
@@ -25,6 +25,11 @@ contract TokenTimelockUpgradeable is Initializable {
// timestamp when token release is enabled
// timestamp when token release is enabled
uint256 private _releaseTime;
uint256 private _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).
*/
function __TokenTimelock_init(
function __TokenTimelock_init(
IERC20Upgradeable token_,
IERC20Upgradeable token_,
address beneficiary_,
address beneficiary_,
...
@@ -45,28 +50,29 @@ contract TokenTimelockUpgradeable is Initializable {
...
@@ -45,28 +50,29 @@ contract TokenTimelockUpgradeable is Initializable {
}
}
/**
/**
* @
return
the token being held.
* @
dev Returns
the token being held.
*/
*/
function token() public view virtual returns (IERC20Upgradeable) {
function token() public view virtual returns (IERC20Upgradeable) {
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");
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment