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
8d28bd44
Commit
8d28bd44
authored
Sep 26, 2018
by
Francisco Giordano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
covnert TokenTimelock into initializers
parent
d643caf8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
4 deletions
+20
-4
TokenTimelockMock.sol
contracts/mocks/TokenTimelockMock.sol
+14
-0
TokenTimelock.sol
contracts/token/ERC20/TokenTimelock.sol
+4
-2
TokenTimelock.test.js
test/token/ERC20/TokenTimelock.test.js
+2
-2
No files found.
contracts/mocks/TokenTimelockMock.sol
0 → 100644
View file @
8d28bd44
pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../token/ERC20/TokenTimelock.sol";
contract TokenTimelockMock is Initializable, TokenTimelock {
constructor(
IERC20 token,
address beneficiary,
uint256 releaseTime
) public {
TokenTimelock.initialize(token, beneficiary, releaseTime);
}
}
contracts/token/ERC20/TokenTimelock.sol
View file @
8d28bd44
pragma solidity ^0.4.24;
import "../../Initializable.sol";
import "./SafeERC20.sol";
...
...
@@ -8,7 +9,7 @@ import "./SafeERC20.sol";
* @dev TokenTimelock is a token holder contract that will allow a
* beneficiary to extract the tokens after a given release time
*/
contract TokenTimelock {
contract TokenTimelock
is Initializable
{
using SafeERC20 for IERC20;
// ERC20 basic token contract being held
...
...
@@ -20,12 +21,13 @@ contract TokenTimelock {
// timestamp when token release is enabled
uint256 private _releaseTime;
constructor
(
function initialize
(
IERC20 token,
address beneficiary,
uint256 releaseTime
)
public
initializer
{
// solium-disable-next-line security/no-block-members
require(releaseTime > block.timestamp);
...
...
test/token/ERC20/TokenTimelock.test.js
View file @
8d28bd44
...
...
@@ -8,8 +8,8 @@ require('chai')
.
use
(
require
(
'chai-bignumber'
)(
BigNumber
))
.
should
();
const
ERC20Mintable
=
artifacts
.
require
(
'ERC20Mintable'
);
const
TokenTimelock
=
artifacts
.
require
(
'TokenTimelock'
);
const
ERC20Mintable
=
artifacts
.
require
(
'ERC20Mintable
Mock
'
);
const
TokenTimelock
=
artifacts
.
require
(
'TokenTimelock
Mock
'
);
contract
(
'TokenTimelock'
,
function
([
_
,
minter
,
beneficiary
])
{
const
amount
=
new
BigNumber
(
100
);
...
...
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