Skip to content

AhaOfficial/AHT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AHT Token contract and vesting contract

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.

Specification

AHT Token

NOTES This token conforms EIP20 standard. This specification includes methods only that are not included in ERC20 standard.

Methods

approveAndCall

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)

increaseAllwance

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)

decreaseAllowance

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)

burn

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

Vesting

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.

Methods

beneficiary

returns the beneficiary of the tokens.

function  beneficiary() public  view  returns(address)

cliff

returns the cliff time of the token vesting.

function  cliff() public  view  returns(uint256)

start

returns the start time of the token vesting.

function  start() public  view  returns(uint256)

duration

returns the duration of the token vesting.

function  duration() public  view  returns(uint256)

revocable

returns true if the vesting is revocable.

function  revocable() public  view  returns(bool)

released

returns the amount of the token released.

function  released(address token) public  view  returns(uint256)

revoked

returns true if the token is revoked.

function  revoked(address token) public  view  returns(bool)

release

Transfers vested tokens to beneficiary.

function release(IERC20 token) public

revoke

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

Requirements

  • NodeJS 5.0+ recommended.
  • Truffle

Initialize

npm install
truffle compile
truffle migrate

Test

This repo has a comprehensive test suite. You can run it via following command.

truffle test

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published