isBound(address T) -> (bool)
getSpotPricein terms of other tokens. However, disabling
isSwapPublicwill disable any interaction with this token in practice (assuming there are no existing tokens in the pool, which can always
getNumTokens() -> (uint)
getNormalizedWeight(address token) -> (uint)
getController() -> (address)
bind(address token, uint balance, uint denorm)
token. Tokens will be pushed/pulled from caller to adjust match new balance. Token must not already be bound.
balancemust be a valid balance and
denormmust be a valid denormalized weight.
bindcreates the token record and then calls
rebindfor updating pool weights and token transfers.
ERR_NOT_CONTROLLER-- caller is not the controller
Tis already bound
ERC20token returned false
ERR_MAX_TOKENS-- Only 8 tokens are allowed per pool
rebind(address token, uint balance, uint denorm)
_publicSwapRequires caller to be controller and pool not to be finalized. Finalized pools always have public swap.
setPublicSwapwill all throw
ERR_IS_FINALIZEDafter pool is finalized. This also switches
tokenwithin a pool with the actual
balanceregistered on the ERC20 contract. This is useful to account for airdropped tokens or any tokens sent to the pool without using the
COMPtokens can have the
COMPbalance updated with the rewards sent by Compound protocol. In order for any airdrop balance to be gulped, the token must be bound to the pool. So if a shared pool (which is immutable) does not have a given token, any airdrops in that token will be locked in the pool forever.
isFinalized() -> (bool)
tokenIntaken from the caller by the pool, in exchange for at least
tokenOutgiven to the caller from the pool, with a maximum marginal price of
(tokenAmountOut, spotPriceAfter), where
tokenAmountOutis the amount of token that came out of the pool, and
spotPriceAfteris the new marginal spot price, ie, the result of
getSpotPriceafter the call. (These values are what are limited by the arguments; you are guaranteed
tokenAmountOut >= minAmountOutand
spotPriceAfter <= maxPrice).
joinPool(uint poolAmountOut, uint calldata maxAmountsIn)
poolAmountOutpool tokens. This will pull some of each of the currently trading tokens in the pool, meaning you must have called
approvefor each token for this pool. These values are limited by the array of
maxAmountsInin the order of the pool tokens.
poolAmountOutas 10% of the current
poolSupply. Bear in mind that the proportions of the different underlying token balances might change until your transaction gets mined: therefore you should have a buffer to avoid the transaction being reverted. We usually suggest 1% if you use high gas prices for fast confirmation. So calculate
poolAmountOutas described above with 99% of the
exitPool(uint poolAmountIn, uint calldata minAmountsOut)
poolAmountInpool tokens and getting some of each of the currently trading tokens in return. These values are limited by the array of
minAmountsOutin the order of the pool tokens.
minAmountsOut, consider the percentage of the pool liquidity you are withdrawing, which is
poolAmountIn/poolSupplyand multiply that percentage by each of the underlying pool token balances. If you expect to receive say 10 units of each of the underlying tokens in the pool, consider setting
minAmountsOutas 9.9 to allow for variations in the balances proportions that may happen before your transaction gets mined.
joinswapExternAmountIn(address tokenIn, uint tokenAmountIn, uint minPoolAmountOut) -> (uint poolAmountOut)
tokenInto join the pool, getting
poolAmountOutof the pool shares.
exitswapExternAmountOut(address tokenOut, uint tokenAmountOut, uint maxPoolAmountIn) -> (uint poolAmountIn)
tokenOutthat you want to get out of the pool. This costs
poolAmountInpool shares (these went into the pool).
joinswapPoolAmountOut(address tokenIn, uint poolAmountOut, uint maxAmountIn) -> (uint tokenAmountIn)
poolAmountOutpool shares that you want to get, and a token
tokenInto pay with. This costs
tokenAmountIntokens (these went into the pool).
exitswapPoolAmountIn(address tokenOut, uint poolAmountIn, uint minAmountOut) -> (uint tokenAmountOut)
poolAmountInpool shares into the pool, getting
tokenAmountOutof the given token
tokenOutout of the pool.