Implementation of the Dutch auction for 100,000,000 DGTX.
- Token auction will start at 9am EST on February 15th, 2018.
- The price starts from $0.25 per 1 DGTX and linearly decreases by $0.01 every hour until it reaches $0.01.
- The auction lasts no more than 30 days.
- Public can participate in auction by sending ETH to the auction contract.
- Buyer’s bid is calculated in USD according to the ETH/USD exchange rate in the contract at the time the ether is received.
- Contributions are limited: maximum - $10000 per address, minimum - 0.01 ETH per transaction.
- The ETH/USD rate is updated every hour using an oracle.
- Auction is finished when amount of USD received (sum of all bids) is equal to the current valuation of the tokens offered (that is current auction token price multiplied by total amount of tokens offered).
- After the auction is finished buyers can claim tokens according to the final auction price and the size of their bid. Each buyer receives the portion of all tokens offered proportional to their bid (calculated in USD at the moment the ether is received as described above). This way each buyer receives tokens according to the final price at the moment of the end of auction. Each buyer is guaranteed to receive tokens at a price no higher than the price at which they bid.
- Bids can only be sent from external ethereum addresses (not contracts).
Note that at the end of auction the market price of ETH collected may (and will) be different from the sum of all bids that is used in calculating the final auction price.
- When a buyer sends transactions with or without ETH to the contract after the auction is finished, the contract will refund tokens to the buyer according to the final auction price.
- ETH collected in bids is sent to the address(es) provided by the owner immediately.
- After the auction is over the owner can trigger the function that sends tokens to buyers. This will be done in portions to avoid out-of-gas and ERC223 compatibility issues.
The auction can be finished in several ways:
- After a particular buyer sends ETH the target sum is collected. If the buyer sends more than needed to reach target sum, their extra ETH is refunded.
- After a step of price decrease the target sum is collected. However the equilibrium price will probably lay between the two steps of the price. For example, when the price is 0.5$ the target sum isn’t collected, but when price shifts to 0.49$ more than the target sum is collected, and on price 0.497$ equilibrium is reached. In this case, the intermediate value will be used by the contract as the final price.
- 30 days have passed and less than $1MM is collected. Buyers get tokens at the price of $0.01 and some tokens remain unsold (the owner gets them back).
- The owner deploys the contract.
- The owner calls startEthToCentsRateUpdateCycle function.
- The owner transfers 100,000,000 DGTX to the contract.
- Auction starts.
- Buyers send ETH to the contract. ETH is stored in the account provided by the owner.
- Auction ends in one of the ways described and the final token price is calculated.
- After the auction is finished if a buyer sends a transaction to the contract they claim tokens the contract owes them according to the final auction price and their bid.
- After the auction the owner can also trigger transfer of tokens to buyers.
Due to rounding issues small quantity of tokens (less than 1 DGTX) may be stuck in the contract forever.
npm install
npm run truffle compile
To deploy contracts to Ethereum network
Edit truffle-config.js
for proper network, like:
module.exports = {
networks: {
ropsten: {
network_id: 3,
host: "localhost",
port: 8546,
gas: 4600000,
gasPrice: 5000000000
}
...
And run
npm run truffle migrate
One must call startEthToCentsRateUpdateCycle function to launch rate update cycle.
To run test run
npm run test
To run test coverage run
npm run coverage
Folder test/DGTX
is DGTX token source code from repo.