This repo contains Solidity smart contract code for Aha Knowledge Token which conforms EIP20 standard on Ethereum and vesting contract which is used for token vesting to a beneficiary.
NOTES This token conforms EIP20 standard. This specification includes methods only that are not included in ERC20 standard.
msg.sender
approves _spender
to send _amount
tokens on its behalf, and then a function is triggered in the contract that is being approved, _spender
. This allows users to use their tokens to interact with contracts in one function call instead of two.
function approveAndCall(address _spender, uint256 _amount, bytes _extraData) public returns (bool success)
Increase the amount of tokens that an owner allowed to a spender. approve
should be called when allowed[_spender] == 0
. To increment allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined).
NOTES It is to prevent attack vectors like the one described here and discussed here.
function increaseAllowance(address spender, uint256 addedValue) public returns (bool)
Decrease the amount of tokens that an owner allowed to a spender. approve
should be called when allowed[_spender] == 0
. To decrement allowed value is better to use this function to avoid 2 calls (and wait until the first transaction is mined).
NOTES It is to prevent attack vectors like the one described here and discussed here.
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool)
Burns a specific amount of tokens of burer. This method is allowed for privileged burners only to prevent mass burning by anonymous token holders.
function burn(uint256 value) public onlyBurner
A token holder contract that can release its token balance gradually like a typical vesting scheme, with a cliff and vesting period. Optionally revocable by the owner. Implementations are provided by OpenZeppelin implementation which is well tested.
returns the beneficiary of the tokens.
function beneficiary() public view returns(address)
returns the cliff time of the token vesting.
function cliff() public view returns(uint256)
returns the start time of the token vesting.
function start() public view returns(uint256)
returns the duration of the token vesting.
function duration() public view returns(uint256)
returns true if the vesting is revocable.
function revocable() public view returns(bool)
returns the amount of the token released.
function released(address token) public view returns(uint256)
returns true if the token is revoked.
function revoked(address token) public view returns(bool)
Transfers vested tokens to beneficiary.
function release(IERC20 token) public
Allows the owner to revoke the vesting. Tokens already vested remain in the contract, the rest are returned to the owner.
function revoke(IERC20 token) public onlyOwner
- NodeJS 5.0+ recommended.
- Truffle
npm install
truffle compile
truffle migrate
This repo has a comprehensive test suite. You can run it via following command.
truffle test