PresalePool
is a smart contract for pooling together contributions to invest in an ICO.
It supports the following configuration options:
- minimum contribution threshold applied to each contributor
- maximum contribution limit applied to each contributor
- cap on total contributions from the pool
- whitelist of addresses which are allowed to contribute to the pool
Once deployed, the PresalePool
contract can be in one of four states: Open
, Closed
, Failed
, or Paid
In the Open
state contributors are able to deposit funds to the pool or withdraw funds from their contributions.
In the Closed
state contributors can neither deposit nor withdraw funds.
In the Failed
state contributors can only withdraw their funds from the pool.
In the Paid
state contributors can withdraw funds which were not included in the pool's overall contribution to the ICO.
After the contract creator sets token contract on PresalePool
, contributors will able to obtain their tokens.
There is also a method for delivering the tokens to all the pool's contributors which can be invoked by the the contract creator.
The operation to transition to a Paid
state is O(1)
. Similarly, the contributor operations (deposit eth, withdraw eth, obtain tokens) are O(1)
. The operation to deliver tokens to all the pool's contributors is O(n)
where n
is the number of contributors. This operation is likely to fail for pools consisting of many contributors because of gas limits.
In some cases editing the contribution limits can be an O(n)
operation. Adding a whitelist is an O(n)
operation. Modifying an existing whitelist is an O(w)
operation where w
is the sum of additions and deletions on the whitelist.