Commit e6d5379e by Francisco Giordano

convert TokenVesting to initializers

parent 8bf7356f
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
pragma solidity ^0.4.24; pragma solidity ^0.4.24;
import "../Initializable.sol";
import "../token/ERC20/SafeERC20.sol"; import "../token/ERC20/SafeERC20.sol";
import "../ownership/Ownable.sol"; import "../ownership/Ownable.sol";
import "../math/SafeMath.sol"; import "../math/SafeMath.sol";
...@@ -13,7 +14,7 @@ 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 * typical vesting scheme, with a cliff and vesting period. Optionally revocable by the
* owner. * owner.
*/ */
contract TokenVesting is Ownable { contract TokenVesting is Initializable, Ownable {
using SafeMath for uint256; using SafeMath for uint256;
using SafeERC20 for IERC20; using SafeERC20 for IERC20;
...@@ -42,7 +43,7 @@ contract TokenVesting is Ownable { ...@@ -42,7 +43,7 @@ contract TokenVesting is Ownable {
* @param duration duration in seconds of the period in which the tokens will vest * @param duration duration in seconds of the period in which the tokens will vest
* @param revocable whether the vesting is revocable or not * @param revocable whether the vesting is revocable or not
*/ */
constructor( function initialize(
address beneficiary, address beneficiary,
uint256 start, uint256 start,
uint256 cliffDuration, uint256 cliffDuration,
...@@ -50,7 +51,10 @@ contract TokenVesting is Ownable { ...@@ -50,7 +51,10 @@ contract TokenVesting is Ownable {
bool revocable bool revocable
) )
public public
initializer
{ {
Ownable.initialize();
require(beneficiary != address(0)); require(beneficiary != address(0));
require(cliffDuration <= duration); require(cliffDuration <= duration);
......
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
);
}
}
...@@ -10,8 +10,8 @@ require('chai') ...@@ -10,8 +10,8 @@ require('chai')
.use(require('chai-bignumber')(BigNumber)) .use(require('chai-bignumber')(BigNumber))
.should(); .should();
const ERC20Mintable = artifacts.require('ERC20Mintable'); const ERC20Mintable = artifacts.require('ERC20MintableMock');
const TokenVesting = artifacts.require('TokenVesting'); const TokenVesting = artifacts.require('TokenVestingMock');
contract('TokenVesting', function ([_, owner, beneficiary]) { contract('TokenVesting', function ([_, owner, beneficiary]) {
const amount = new BigNumber(1000); const amount = new BigNumber(1000);
......
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