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
e6d5379e
Commit
e6d5379e
authored
Sep 26, 2018
by
Francisco Giordano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
convert TokenVesting to initializers
parent
8bf7356f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
4 deletions
+30
-4
TokenVesting.sol
contracts/drafts/TokenVesting.sol
+6
-2
TokenVestingMock.sol
contracts/mocks/TokenVestingMock.sol
+22
-0
TokenVesting.test.js
test/token/ERC20/TokenVesting.test.js
+2
-2
No files found.
contracts/drafts/TokenVesting.sol
View file @
e6d5379e
...
...
@@ -2,6 +2,7 @@
pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../token/ERC20/SafeERC20.sol";
import "../ownership/Ownable.sol";
import "../math/SafeMath.sol";
...
...
@@ -13,7 +14,7 @@ import "../math/SafeMath.sol";
* typical vesting scheme, with a cliff and vesting period. Optionally revocable by the
* owner.
*/
contract TokenVesting is Ownable {
contract TokenVesting is
Initializable,
Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
...
...
@@ -42,7 +43,7 @@ contract TokenVesting is Ownable {
* @param duration duration in seconds of the period in which the tokens will vest
* @param revocable whether the vesting is revocable or not
*/
constructor
(
function initialize
(
address beneficiary,
uint256 start,
uint256 cliffDuration,
...
...
@@ -50,7 +51,10 @@ contract TokenVesting is Ownable {
bool revocable
)
public
initializer
{
Ownable.initialize();
require(beneficiary != address(0));
require(cliffDuration <= duration);
...
...
contracts/mocks/TokenVestingMock.sol
0 → 100644
View file @
e6d5379e
pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../drafts/TokenVesting.sol";
contract TokenVestingMock is Initializable, TokenVesting {
constructor(
address beneficiary,
uint256 start,
uint256 cliffDuration,
uint256 duration,
bool revocable
) public {
TokenVesting.initialize(
beneficiary,
start,
cliffDuration,
duration,
revocable
);
}
}
test/token/ERC20/TokenVesting.test.js
View file @
e6d5379e
...
...
@@ -10,8 +10,8 @@ require('chai')
.
use
(
require
(
'chai-bignumber'
)(
BigNumber
))
.
should
();
const
ERC20Mintable
=
artifacts
.
require
(
'ERC20Mintable'
);
const
TokenVesting
=
artifacts
.
require
(
'TokenVesting'
);
const
ERC20Mintable
=
artifacts
.
require
(
'ERC20Mintable
Mock
'
);
const
TokenVesting
=
artifacts
.
require
(
'TokenVesting
Mock
'
);
contract
(
'TokenVesting'
,
function
([
_
,
owner
,
beneficiary
])
{
const
amount
=
new
BigNumber
(
1000
);
...
...
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