Giter Club home page Giter Club logo

token-vesting-contracts's Introduction

Actions Status code style: prettier license npm version

Token Vesting Contracts

Overview

On-Chain vesting scheme enabled by smart contracts.

TokenVesting contract can release its token balance gradually like a typical vesting scheme, with a cliff and vesting period. The vesting schedules are optionally revocable by the owner.

πŸŽ­πŸ§‘β€πŸ’» Security audits

This repository is compatible with both Forge and Hardhat. Forge needs to be ran (install and build) before Hardhat is used in order to load dependency contracts. You can find the specific instructions for each tool below.

Forge

πŸ“¦ Installation

forge install

⛏️ Compile

forge build

🌑️ Testing

$ forge test

Hardhat

πŸ“¦ Installation

$ yarn

⛏️ Compile

$ yarn compile

This task will compile all smart contracts in the contracts directory. ABI files will be automatically exported in build/abi directory.

πŸ“š Documentation

Documentation is auto-generated after each build in docs directory.

The generated output is a static website containing smart contract documentation.

🌑️ Testing

Note: make sure to have ran forge build and compile before you run tests.

$ yarn test

πŸ“Š Code coverage

$ yarn coverage

The report will be printed in the console and a static website containing full report will be generated in coverage directory.

✨ Code style

$ yarn prettier

πŸ±β€πŸ’» Verify & Publish contract source code

$ npx hardhat  verify --network mainnet $CONTRACT_ADDRESS $CONSTRUCTOR_ARGUMENTS

πŸ“„ License

Token Vesting Contracts is released under the Apache-2.0.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Abdel @ StarkWare
Abdel @ StarkWare

πŸ’»
Vaclav Pavlin
Vaclav Pavlin

πŸ’»
Brendan Baker
Brendan Baker

πŸ’»
Oren Gampel
Oren Gampel

πŸ’»

This project follows the all-contributors specification. Contributions of any kind welcome!

token-vesting-contracts's People

Contributors

abdelstark avatar dependabot[bot] avatar joelamouche avatar owlen avatar themightyyak1 avatar vpavlin avatar zerodev68 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

token-vesting-contracts's Issues

Non-linear Vesting

Hi @abdelhamidbakhta

Thank you so much for your work.
How can i handle the case of non-linear vesting?

For example, i have 3 months vesting.
First month i want to release 25%
the second month 25%
and the third 50%.

How this can be achieve here?
Thank you so much.

Error with yarn test

After running yarn, I get this error when running yarn test:

➜  token-vesting-contracts git:(main) βœ— yarn test
yarn run v1.22.10
$ npx hardhat test --logs
Error HH404: File lib/solmate/src/tokens/ERC20.sol, imported from src/TokenVesting.sol, not found.

For more info go to https://hardhat.org/HH404 or run Hardhat with --show-stack-traces
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Erc20 in vesting

hello! I have a little question.
Why do we use ERC20.sol in the vesting.sol contract and not IERC20.sol?

Function/Mapping not updated

Hi,
if you revoke or release a vestingScheduleId for one recipient having multiple vestings

  • getVestingSchedulesCountByBeneficiary should reduce
  • getVestingSchedulesCount should reduce

I was thinking to create a mapping of released and revoked and substract from the total count

AutoDrop

Thank you so much for your work.
How can I implement an autodrop to the beneficiary wallets once the tokens are unlocked?

Error: cannot create vesting schedule because not sufficient tokens

Thanks for the great code!

But I have a problem that makes working with this smart contract almost impossible.

I cloned this project and deployed (to BSC Testnet) both smart contracts (Token and TokenVesting) using the deploy.js script, successfully verified the source code of both contracts on the BscScan. After that, when the createVestingSchedule() method is called in the BscScan, the error Fail with error 'TokenVesting: cannot create vesting schedule because not sufficient tokens occurs. The reason for this error is that the TokenVesting contract does not have access to the tokens of the Token contract, because only the owner of the Token contract, which is a different address from which the deployment took place, has access to these tokens.

What should be done to avoid this error?

Error with yarn coverage

Even after building with forge, I get these errors when running yarn coverage :

yarn run v1.22.10
$ npx hardhat coverage --solcoverjs ./.solcover.js

Version
=======
> solidity-coverage: v0.7.22

Instrumenting for coverage...
=============================

> MockTokenVesting.sol
> Token.sol
> TokenVesting.sol

Compilation:
============

Compiling 7 files with 0.8.19
ParserError: Source "solmate/tokens/ERC20.sol" not found: File not found. Searched the following locations: "".
 --> src/Token.sol:7:1:
  |
7 | import {ERC20} from "solmate/tokens/ERC20.sol";
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


ParserError: Source "solmate/tokens/ERC20.sol" not found: File not found. Searched the following locations: "".
 --> src/TokenVesting.sol:8:1:
  |
8 | import {ERC20} from "solmate/tokens/ERC20.sol";
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


ParserError: Source "solmate/auth/Owned.sol" not found: File not found. Searched the following locations: "".
 --> src/TokenVesting.sol:9:1:
  |
9 | import {Owned} from "solmate/auth/Owned.sol";
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


ParserError: Source "solmate/utils/SafeTransferLib.sol" not found: File not found. Searched the following locations: "".
  --> src/TokenVesting.sol:10:1:
   |
10 | import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol";
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


ParserError: Source "solmate/utils/ReentrancyGuard.sol" not found: File not found. Searched the following locations: "".
  --> src/TokenVesting.sol:11:1:
   |
11 | import {ReentrancyGuard} from "solmate/utils/ReentrancyGuard.sol";
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


Error in plugin solidity-coverage: HardhatError: HH600: Compilation failed

For more info run Hardhat with --show-stack-traces
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Decimal Issues.

After deploy the vesting contract. everything is fine.

But when tried to release the token by vestingID, I put 100 token, [added token has 18 decimals], its released 0.0000000000000001 token.

and when I checked vesting contract Total Amount, it showing 100 less here? So, how to resolve this decimal issues.

I am trying to release 100, its receiver getting 0.0000000000000001 and deducting from contract is 100

Hope to get solution to resolve this issue.

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.