The project contains:
- OZT Token Smart Contract
- OZT Crowdsale Smart Contract
- Supporting scripts
OZT token is standard ERC-20 token with 18 decimals.
Sources are located in OZTToken.sol.
It allows token sale to accept payments, distribute tokens.
Sources are located in OZTTokenSale.sol.
Note: scripts are to be run by the contract's owner
node script/transfer_tokens - transfer tokens from the OZT Token owner to address
node script/batch_assign_tokens - distribute tokens from the OZT Token owner to the list of addresses from CSV file
- OZT Token: 0x9aa9bab278c0ed84c104915bce9b5a9c1b96c4bf
- OZT Token: 0xc47f91d5acc5bc644bb2829c4ecd49a8c2dd7f1c
- OZT Token Sale: 0x7726df45d187a9880bbdc1e1bb720b331fd23809
npm install -g ethereumjs-testrpc
npm install -g [email protected]
npm install -g web3-provider-engine
npm install -g ethereumjs-wallet
Tests can be run using Test RPC. Run it with command
testrpc -m "warrior minimum breeze raven garden express solar flavor obvious twenty alpha actress"
Alternatively you can use Ganache:
npm install -g ganache-cli
ganache-cli
After server started, you can compile, run migrations and tests
$ truffle test
Using network 'development'.
Contract: OZTTokenSale
✓ should be deployed (5003ms)
✓ should have all properties set up (147ms)
✓ should have tokens to sell (88ms)
✓ should sell tokens (161ms)
✓ should transfer tokens manually (87ms)
✓ should allow transfer tokens manually only to owner (154ms)
✓ should pause / resume (163ms)
✓ should allow pause only to owner
✓ should not sell after finish (5005ms)
9 passing (11s)
Crowdsale contract deployment and management scripts are located in script directory. They are called as node scripts:
npm install
node script/transfer_tokens
Every script contains variable, defining the environment to run:
const environment = 'ropsten'; // ropsten/foundation, change to foundation to deploy to real
Configuration in script/config.js contains all properties for selected environment.
On script run, it asks for credentials, and asks to enter word 'Yes!' before actual execution. After successfull run, it logs the hash of transaction, that should be looked up in ethereum explorer.
Use the callback to get deployed instance of contract, as:
truffle console --network development
truffle(development)> OZTToken.deployed().then(function(instance){ ozt=instance})
truffle(development)> ozt.name()
When using direct address it is not needed:
truffle console --network production
truffle(production)> OZTToken.at('0x9aa9bab278c0ed84c104915bce9b5a9c1b96c4bf').name()
solidity_flattener generates full sources. Note, that the unsupported parameter --allow-paths required, Before it is integrated into release of solidity_flattener, use the installation from branch:
npm install -g solc
pip install git https://github.com/dostu/solidity-flattener.git
Then execute:
solidity_flattener --output build/src/OZTToken_flat.sol contracts/OZTToken.sol
solidity_flattener --solc-paths="zeppelin-solidity/=$(pwd)/node_modules/zeppelin-solidity/" --output build/src/OZTTokenSale_flat.sol contracts/OZTTokenSale.sol