This contract implements the Interactive Coin Offering token sale as described in this paper: https://people.cs.uchicago.edu/~teutsch/papers/ico.pdf
Implementation details and modifications compared to the paper:
Security notes:
setToken
.finalize
function cost more gas to finish or require calling it multiple times due to gas limit.
The griefing factor is small as the attacker needs to pay gas for storage write operations while the defender only needs to pay for storage read operations (plus a constant amount of storage write operations per finalize
call).search
to give the starting value of the search. Again, an attacker could make a lot of bids at high gas price in order in order to make a TX fail (due to the search taking more time than the max gas because the insertion point would have been changed by the new bids). But again this is a O(1) griefing factor with a really low griefing factor.The LevelWhitelistedIICO contract inherits from the IICO contract. It implements a basic KYC where users individual contributions are capped and a reinforced KYC where contributions are not limited.
truffle test
Truffle should be installed: npm install -g truffle
There is also a stress test that handles 5000 bid and takes 20-30 minutes to run and has intermittent failures for no obvious reasons. See this issue. In order to run it:
truffle test test-stress-finalize/StressFinalize.js
The bounty program includes contracts develloped by the Kleros team and the third-party ones we will rely upon:
token
will be a MiniMeToken (with a slight modification of the approve function to follow ERC20 recommendations) as deployed here.beneficiary
will be a Gnosis MultiSigWallet that you can find here at commit e1b25e8.This contract has up to 50 ETH of bug and vulnerabilities bounties attached. Only vulnerabilities which can lead to real issues are covered by the bug bounty program. As an example, finding an addition which can overflow leading to someone else loosing money is a vulnerability, but simply stating "Not using SafeMath is bad" isn't (in our case, we chose not to use SafeMath, as blocking the finalization would be a more critical failure mode than an overflow).
The vulnerability payout ranges from 1 ETH (display issue which is unlikely to lead to any significant loss of funds) to 50 ETH (vulnerabilities which would make someone likely to steal ETH from the bidders or the beneficiary).
The OWASP matrix is used to determine payouts:
Critical: Up to 50 ETH.
High: Up to 30 ETH.
Medium: Up to 20 ETH.
Low: Up to 4 ETH.
Note: Up to 1 ETH.
The final vulnerability classification belongs to the Kleros team, but we are obviously committed to ensure a fair remuneration for bounty hunters in order to improve the security of the Ethereum ecosystem.
Vulnerabilities should be disclosed to contact@kleros.io, please includes [BUG BOUNTY] in the subject. Note that only the first party to report a vulnerabilty is eligible to bounties. The last submissions are due for May 14 in order for us not to start the sale would a vulnerability be discovered. Later submission would still be eligible but at a reduce payout. Please refrain of any action damaging property that you don't own.
Note that this program is not the only security measure which have been put in place (there was a previous bug bounty program with a lower payout, there are exernal audits and reviews by team members and partners).
Token.mint(IICOContractAddress)
to mint tokens for the IICO contract on the token contract.IICO.setToken(tokenContractAddress)
to set the token on the IICO contract.IICO.setWhitelister(whitelisterAddress)
so the whitelister can add addresses to the whitelist.You can also run the deployment script in the repository with openiico dapp
Step-by-step tutorial also available.