These Ethereum smart contracts are used by Diginex's Token Sale platform. The smart contracts support multiple sales periods over time, token locking and flexible token vesting configuration.
Follow these steps:
- If you want to change the smart contract template variables (such as name, symbol, etc.), you need to set the
following environment variables according to your token parameters (see
scripts/test.env
for an example):
$ ENV_VARS_OVERRIDE=whatever
$ ERC20_NAME=Token
$ ERC20_SYMBOL=TOK
$ ERC20_DECIMALS=18
Similarly, you can import this repo into your repo as a git submodule and define these environment variables from your repo.
- Run
scripts/build.sh
to generate the*.sol
contract code and the build filestruffle/build/contracts/*.json
.
$ scripts/build.sh
Please see the contracts/ directory.
Contracts are written in Solidity and tested using Truffle and ganache-cli.
# Install local node dependencies
$ npm install
# Compile all smart contracts
$ npm run build
# Run all tests
$ npm test
# Run test coverage analysis
$ npm run coverage
A Docker image to run containerized testing is provided. Requires Docker Compose.
# Build the container and run all tests
$ make build test
# Run a test for a single contract
$ docker-compose run --rm truffle npm test test/<TEST_NAME>.test.js