The EVNTToken is an ERC20 token that uses ERC1363 extentions. The ERC20 implementation is provided by OpenZeppelin, and ERC1363 extensions are by https://github.com/vittominacori/erc1363-payable-token.
When a transfer methods is used, the extensions allow the token to inform the receiver whether it is a smart contract on transfer, which provides similar functionality to the fallback function in the case of native ETH.
Extensions are intendend to be used within Wallfair Platform, that is, to stake tokens in the PLP contract without the need of an additional approve transaction.
The EVNTToken contract immediately mints the requested supply to the msg.sender. For what happens after that - see the Deployment section.
TokenLock implements simple vesting schedule. Within the contract we define vesting function which, for a given total amount of tokens, tells how much of the tokens may be released at a given moment. This function is defined as follows:
- It releases tokens linearly proportionally to the time elapsed from the vesting start timestamp. Effectively it will release tokens block by block
- It realeases tokens fully after vesting period has elapsed from the vesting start.
- A cliff period may be defined which works like standard cliff, see. https://www.investopedia.com/ask/answers/09/what-is-cliff-vesting.asp
- An initial release fraction may be defined which will release such fraction of the tokens on vesting start
TokenLock fulfills several implementation requirements
- Only one vesting function may be defined per contract instance.
- Tokens belonging to several addresses may be locked in single instance (with same vesting schedule). Addresses may be simple addresses and contracts
- Cliff and initial release may not be defined together in single instance
- vesting start may be specified to happen in the past or in the future in reference to the time of the deployment of the contract
- Contract will execute
transferfunction to the address defined as the owner and keep track of how much was already released. Actual release happens via owner-executed transaction. Release will be impossible if theTokenLockdoes not held enough EVNT tokens. - There are no methods to "reclaim" non-released tokens. Tokens that can't be released (owner lost the private key for example) are locked forever.
- All time periods must be multiples of 30 days.
- List of stakes (owner address : total amount due mapping) is provided at the deployment time and cannot be changed later.
The actual deployment will require several instances of the TokenLock to be created to cover all the vesting schedules we need.
The deployment procedure will be as follows:
EVNTTokeninstance is deployed and all full supply is minted tomsg.sender(deployer).- Several
TokenLockinstances are deployed, depending on the actual allocations and vesting schedules of Wallfair, final lists of addresses are provided to that instances. deployertransfers the tokens it holds to theTokenLockinstances (and other wallets if needed) - as per Wallfair token allocation. At this pointdeployerdoes not hold any tokens and its private key may be destroyed.
Clone the repository:
git clone https://github.com/wallfair-organization/EVNT-Token.git
Ensure you have node.js and npm installed. You must be using npm version >= 7.
Then install the required packages for the Hardhat toolchain:
npm install
Then try compiling the contracts to see if it has all worked:
npx hardhat compile
We use the Truffle plugin to write tests. Tests can be run using:
npm run test
We use solhint and eslint for linting. Relevant commands are npm run lint, npm run lint:sol and npm run lint:js.
We use solidity-coverage with npm run hardhat:coverage.
Create an empty .env file with touch .env.
By default hardhat.config.js is used when executing Hardhat commands. It is configured to only
support the in-memory or local standalone network. If no network is specified, the in-memory
network is used by default.
You can start a local standalone network with npx hardhat node and then run Hardhat commands
on it with the network option --network localhost.
For full deployment, you will need to correctly configure a .env file. See .env.example for the format,
and comment out any networks that you are not using.
Then run your Hardhat commands using the config option:
npx hardhat <COMMAND> --config hardhat-deploy.config.js --network <NETWORK>
Remember to be careful with your keys! Share your keys and you share your coins.
To learn more about the utility of the token, read the litepaper.
© 2021 Wallfair.