Indexed Finance
  • README
  • Introduction
    • Product FAQs
      • Index Pools
      • Yield Aggregator Vaults
    • Fees
    • Who We Are
  • Day-To-Day Operations
    • Using Your Vote
    • The Sigma Program
  • Index Pool Protocol
    • Terminology
    • Governance
    • Security
    • Index Controller
    • Index Pools
    • Rebalancing
      • Bootstrapping New Tokens
      • Removing Tokens
  • Index Pool Smart Contracts
    • Deployments
    • IndexPool.sol
    • PoolInitializer.sol
    • UnboundTokenSeller.sol
    • MarketCapSqrtController.sol
    • @indexed-finance/proxies
      • DelegateCallProxyManager.sol
      • DelegateCallProxyManyToOne.sol
      • DelegateCallProxyOneToOne.sol
      • ManyToOneImplementationHolder.sol
      • SaltyLib.sol
    • @indexed-finance/uniswap-v2-oracle
    • Interfaces
      • IIndexPool.sol
      • IFlashLoanRecipient.sol
  • Yield Aggregator Protocol
    • Supported Assets
  • Yield Aggregator Smart Contracts
    • Deployments
Powered by GitBook
On this page
  • PoolInitializer
  • Start and Finish
  • initialize
  • finish
  • Token Claims
  • claimTokens
  • claimTokens
  • claimTokens
  • Token Contribution
  • contributeTokens
  • contributeTokens
  • Price Updates
  • updatePrices
  • Status Queries
  • isFinished
  • Credit Queries
  • getTotalCredit
  • getCreditOf
  • Token Queries
  • getDesiredTokens
  • getDesiredAmount
  • getCreditForTokens

Was this helpful?

  1. Index Pool Smart Contracts

PoolInitializer.sol

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

function initialize(
  address poolAddress,
  address[] tokens,
  uint256[] amounts
)

Sets the initializer's pool address and desired token amount.

finish

function finish()

Finishes the pool initializer and triggers pool initialization.

Notes

The desired amounts of all tokens must be 0.

Token Claims

claimTokens

function claimTokens()

Claims the tokens owed to msg.sender based on their proportion of the total credits.

claimTokens

function claimTokens(address account)

Claims the tokens owed to account based on their proportion of the total credits.

claimTokens

function claimTokens(address[] accounts)

Claims the tokens owed to account based on their proportion of the total credits.

Token Contribution

contributeTokens

function contributeTokens(
  address token,
  uint256 amountIn,
  uint256 minimumCredit
) returns (uint256 credit)

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

function contributeTokens(
  address[] tokens,
  uint256[] amountsIn,
  uint256 minimumCredit
) returns (uint256 credit)

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

function updatePrices()

Updates the prices of all desired tokens on the price oracle.

Status Queries

isFinished

function isFinished() returns (bool)

Returns whether the pool has been initialized.

Credit Queries

getTotalCredit

function getTotalCredit() returns (uint256)

Returns the total value credited for token contributions.

getCreditOf

function getCreditOf(address account) returns (uint256)

Returns the amount of credit owed to account.

Token Queries

getDesiredTokens

function getDesiredTokens() returns (address[] tokens)

Returns the array of desired tokens.

getDesiredAmount

function getDesiredAmount(address token) returns (uint256)

Returns the remaining amount of token the pool needs.

getCreditForTokens

function getCreditForTokens(
  address token,
  uint256 amountIn
) returns (uint144 amountOut)

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.

PreviousIndexPool.solNextUnboundTokenSeller.sol

Last updated 4 years ago

Was this helpful?