Git Product home page Git Product logo

tokens-vesting-contract's Introduction

Tokens vesting contract

Install

Clone this repository:
git clone https://github.com/daomaker/tokens-vesting-contract.git

Install dependencies:
tokens-vesting-contract && npm install

Tests

The project uses HardHat, so all additional methods and plugins can bee found on their documentation.

For UNIT tests run:
npx hardhat test

Deploy

Before running deployment you need to write out setup variables. Run cp .env.prod .env and write down all params of .env file. Then go to ./scripts/deploy.js and write down token, beneficiary, start, cliff, release period, releases count variables.

  • token: Address of token, which beneficiary should receive
  • beneficiary: Address of beneficiary, who should receive vested tokens
  • start: Time when vesting start (should be UNIX timestamp of the certain date)
  • cliff: Additional time in seconds which will added to start. During the cliff releases is not available (can be setted as 0 if no cliff)
  • releasePeriod: Time in seconds for releases (e.g. 3 months should be as 7776000)
  • releaseCount: Total amount of upcoming releases

All popular networks are supported, for deploy run:
npx hardhat run scripts/deploy.js --network [NETWORK]

Verification on Etherscan

For Etherscan verification after deployment run this commands:

npx hardhat verify --network [NETWORK_NAME] [FACTORY_CONTRACT] "BENEFICIARY" "START" "CLIFF" "RELEASE_PERIOD" "RELEASE_COUNT"

How it works

After deploying the Vesting contract, it should receive tokens for future vesting logic. Owner can simply transfer required amount of tokens to the contract address. There are multiply releases with the same delay. When time will be reached release tokens will be available for claiming.

Methods for UI

  1. vesting.release(): Beneficiary receives releasable tokens
  2. vesting.getAvailableTokens(): Get tokens amount, which beneficiary can receive at that moment

tokens-vesting-contract's People

Contributors

tonoyandev 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.