Skip to content

Added examples of tokenvesting and tokentimelock #1570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
32 changes: 32 additions & 0 deletions contracts/examples/SampleTokenTimelock.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
pragma solidity ^0.4.24;

import "../token/ERC20/ERC20Mintable.sol";
import "../token/ERC20/ERC20Detailed.sol";
import "../token/ERC20/TokenTimelock.sol";

/**
* @title SampleTimelockToken
* @dev Very simple ERC20 Token that can be minted.
* It is meant to be used in a tokentimelock contract.
*/
contract SampleTimelockToken is ERC20Mintable, ERC20Detailed {
constructor() public ERC20Detailed("Sample Timelock Token", "STT", 18) {}
}


/**
* @title SampleTokenTimelock
* @dev This is an example of a token lock for certain time.
*/

contract SampleTokenTimelock is TokenTimelock{

constructor(
ERC20Mintable token,
address beneficiary,
uint256 releaseTime
)
public
TokenTimelock(token, beneficiary, releaseTime){}

}
23 changes: 23 additions & 0 deletions contracts/examples/SampleTokenVesting.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
pragma solidity ^0.4.24;

import "../drafts/TokenVesting.sol";

/**
* @title SampleTokenVesting
* @dev This is an example of a token vesting for defined time period.
* Tokens to be vested will be sent directly to this contract.
*/

contract SampleTokenVesting is TokenVesting{

constructor(
address beneficiary,
uint256 start,
uint256 cliffDuration,
uint256 duration,
bool revocable
)
public
TokenVesting(beneficiary, start, cliffDuration, duration, revocable){}

}
2 changes: 1 addition & 1 deletion contracts/mocks/SafeERC20Helper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ contract SafeERC20Helper {
function allowance() public view returns (uint256) {
return _succeeding.allowance(address(0), address(0));
}
}
}
2 changes: 1 addition & 1 deletion contracts/token/ERC20/IERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);

event Approval(address indexed owner, address indexed spender, uint256 value);
}
}
2 changes: 1 addition & 1 deletion contracts/token/ERC20/SafeERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ library SafeERC20 {
uint256 newAllowance = token.allowance(address(this), spender).sub(value);
require(token.approve(spender, newAllowance));
}
}
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.