The launchpool idea
In our February Otonomist, we talked about “launchpools” and their potential to turn capital formation on its head by letting the community stake in a refundable pool which turns into committed capital at the end of a pre-sale period.
We have now turned this idea into a smart contract which, in its first deployment, will be used to build a book of prospective token buyers for our own OtoCo token pre-sale starting 24 June.
We designed it such that, in a next release, it can be used by OtoCo users and other issuers who want to automate their token pre-sale the same way.
Objective
The objective is for project Sponsor to initialize a smart contract that lets prospective token buyers stake crypto assets (in our case, DAI, USDC and USDT).
The contract then calculates the number of tokens corresponding to the amount staked, using a price per token that programmatically increases under a bonding curve in function of staker’s place in the queue at the moment of staking.
The slope of the bonding curve is set by Sponsor together with the token’s initial price when the contract is initialized, and cannot be changed once the smart contract is activated.
The end result is a transparent process that gives investors a better price the earlier they reserve tokens, but does not commit their capital until the contract goes is Finalized mode (see below).
Up to that point, they can unstake. Unstaking causes them to lose their place in the queue and forfeit the token price of the place they vacated.
If they want to rejoin the pre-sale process, they’ll have to join at the tail of the queue and pay a higher price.
Design and specifications
The product consists of a Factory Contract that deploys customized launchpools with different attributes.
Each launchpool is controlled by its Sponsor, who is responsible for setting its attributes and who takes decisions during the lifetime of the pool.
The Sponsor is likely to be the issuer of the tokens.
The main specifications are as follows1:
NonInitialized - This is the first stage of the launchpool before it is initialized. We use the "initialize" function of the new launchpool to set its parameters.
Initialized - Right after a Launchpool is initialized the
stake
/unstake
is defined by values_startTimestamp
and_endTimestamp
. If_startTimestamp
isn't reached, no action can be taken by stakers. Once_startTimestamp
is reached, stakers couldstake
andunstake
freely. Once_endTimestamp
is reached,stake
could only be called if there is still space for within the defined hard cap.Paused - Paused stage has to be triggered by the Sponsor in case any problem occurs. Once a launchpool is in
pause
,stake
is no longer allowed but, following our code audit,unstake
is allowed.Calculating - Once
_endTimestamp
is reached, the Sponsor needs to calllock
function. Once called,lock
function will lead to Calculation stage. In this stage, Sponsor is allowed to triggercalculateSharesChunk
to calculate how much shares each staker will receive in return for the amount staked. The tokens are calculated as long hasgasLeft
> 100000 on the transaction. OncegasLeft
falls below 100000, the contract stops its calculation on the current index, and the function needs to be called again. This process is repeated until all stakers have their tokens calculated.Distributing - Once all tokens are calculated, the contract automatically triggers the stage Distributing. At this stage, Sponsor should trigger
distributeSharesChunk
on the smart contract, which transfers all calculated tokens to the respective stakers. The process is identical to thecalculateSharesChunk:
tokens are distributed as long as gasLeft > 100000 on the transaction. When gasLeft falls below 100000, the contract stops distributing on the current index, and the function needs to be called again. This process is repeated until all stakers receive their tokens.Finalized - Once the last tokens are distributed, the previous function automatically triggers Finalized stage. At this stage, the only function that could be triggered by the Sponsor is
withdrawStakes
. This will allow Sponsor to withdraw all amounts staked by the investors, whose capital is now committed.Aborted - At any moment during the launch pool phase, Sponsor can call the
abort
function. When aborted, the only function that stakers can call is theunstake
function, which will let each investor retrieve their stakes.
Audit
The smart contract was audited by Coinspect LLC and a copy of the audit will be made available in our OtoCo Pre-Order Guide and FAQs to be released 24 June.
GitHub
All our code is freely available on OtoCo’s GitHub.
Join our official OtoCo Telegram group for all announcements related to our forthcoming token pre-sale!
Shares/tokens, as well as stakers/investors are used interchangeably here. ↩