PoolInitializer.sol
PoolInitializer
PoolInitializer
Contract that acquires the initial balances for an index pool.
This uses a short-term UniSwap price oracle to determine the ether value of tokens sent to the contract. When users contribute tokens they are credited for the moving average ether value of said tokens.
When all the tokens needed are acquired, the index pool will be initialized and this contract will receive the initial token supply (100).
Once the contract receives the index pool tokens, users can claim their share of the tokens proportional to their credited contribution value.
Start and Finish
initialize
initialize
Sets the initializer's pool address and desired token amount.
finish
finish
Finishes the pool initializer and triggers pool initialization.
Notes
The desired amounts of all tokens must be 0.
Token Claims
claimTokens
claimTokens
Claims the tokens owed to msg.sender
based on their proportion of the total credits.
claimTokens
claimTokens
Claims the tokens owed to account
based on their proportion of the total credits.
claimTokens
claimTokens
Claims the tokens owed to account
based on their proportion of the total credits.
Token Contribution
contributeTokens
contributeTokens
Contribute up to amountIn
of token
to the pool for credit.
The caller will be credited for the average weth value of the provided tokens.
Notes
Caller must receive at least minimumCredit
to not revert. If amountIn
is greater than the desired amount of token
, the desired amount will be used instead.
contributeTokens
contributeTokens
Contribute maximum values from amountsIn
of the corresponding tokens in tokens
to the pool for credit.
The caller will be credited for the average weth value of the provided tokens.
Caller must receive at least minimumCredit
to not revert. If any input amount is greater than the desired amount of the corresponding token, the desired amount will be used instead.
Price Updates
updatePrices
updatePrices
Updates the prices of all desired tokens on the price oracle.
Status Queries
isFinished
isFinished
Returns whether the pool has been initialized.
Credit Queries
getTotalCredit
getTotalCredit
Returns the total value credited for token contributions.
getCreditOf
getCreditOf
Returns the amount of credit owed to account
.
Token Queries
getDesiredTokens
getDesiredTokens
Returns the array of desired tokens.
getDesiredAmount
getDesiredAmount
Returns the remaining amount of token
the pool needs.
getCreditForTokens
getCreditForTokens
Returns the amount of WETH the contract will credit a user for providing amountIn
of token
.
Notes
If amountIn
is greater than the desired amount of token
, this will calculate the output using the desired amount instead of amountIn
.
Last updated