/simple-token-sale

Contracts for a fixed-price, finite-supply token sale.

Primary LanguageJavaScript

Simple Token Sale

Codeship Status for skmgoldin/simple-token-launch

This codebase can be used to deploy fixed-price, finite-supply token sales. It uses json conf files to specify sale parameters, supports token distributions for pre-sale buyers, and the distribution of timelocked tokens for founders. It also includes a comprehensive test suite.

Initialize

npm install
npm run compile

The tests

To run the tests, simply npm run test.

The parameters tested are the same as those which will be deployed. This means the tests can take a very long time if your start block is up in the millions, and some tests will be skipped if signing keys cannot be unlocked for the required accounts, particularly the final test block for the founder timelocking mechanisms. The owner address in sale.json must be the first address generated by the mnemonic in secrets.json.

Composition of the repo

The repo is composed as a Truffle project. The test suite can be found in test/sale.json. The sale contract is in contracts/Sale.sol. The deployment scripts are in the migrations folder.

The Sale contract deploys the token contract, disburses funds to pre-sale purchasers and then deploys timelock contracts to store the founders tokens. Disbursement.sol and Filter.sol comprise the timelock contracts. Two Disbursement.sol contracts are deployed which unlock funds at a particular date. The Filter.sol contracts sit in front of them and allow particular addresses to withdraw particular amounts of funds.

Using the repo to deploy a real token

Config files where the parameters of your own sale can be filled in are in the conf directory.

Note that the owner in sale.json must be the first address generated by a mnemonic in a secrets.json at the project root.

{
  "mnemonic": "igor cannot dunk"
}

Having done all that you can truffle migrate --network mainnet. Save the contents of your build and logs directories, you'll want to have all that data.