Giter VIP home page Giter VIP logo

aht's Introduction

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

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

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

truffle test

aht's People

Contributors

rubang avatar thecorpadmin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.