UnboundTokenSeller.sol
UnboundTokenSeller
UnboundTokenSeller
Contract for swapping undesired tokens to desired tokens for an index pool.
This contract is deployed as a proxy for each index pool. When tokens are unbound from a pool, they are transferred to this contract and sold on UniSwap or to anyone who calls the contract in exchange for any token which is currently bound to its index pool and which has a desired weight about zero.
It uses a short-term uniswap price oracle to price swaps and has a configurable slippage rate which determines the range around the moving average for which it will accept a trade.
constructor
constructor
Controls
initialize
initialize
Initialize the proxy contract with the acceptable premium rate and the address of the pool it is for.
setPremiumRate
setPremiumRate
Set the premium rate as a percent.
emergencyExecuteSwapTokensForExactTokens
emergencyExecuteSwapTokensForExactTokens
Emergency function that allows the controller to force a token sale through UniSwap. This exists in case of an emergency which demands immediate removal of a token.
Pool Interaction
handleUnbindToken
handleUnbindToken
Receive amount
of token
from the pool.
UniSwap Trades
executeSwapTokensForExactTokens
executeSwapTokensForExactTokens
Execute a trade with UniSwap to sell some tokens held by the contract for some tokens desired by the pool and pays the caller any tokens received above the minimum acceptable output.
executeSwapExactTokensForTokens
executeSwapExactTokensForTokens
Executes a trade with UniSwap to sell some tokens held by the contract for some tokens desired by the pool and pays the caller any tokens received above the minimum acceptable output.
Caller Trades
swapExactTokensForTokens
swapExactTokensForTokens
Swap exactly amountIn
of tokenIn
for at least minAmountOut
of tokenOut
.
swapTokensForExactTokens
swapTokensForExactTokens
Swap up to maxAmountIn
of tokenIn
for exactly amountOut
of tokenOut
.
Price Queries
calcInGivenOut
calcInGivenOut
Calculate the amount of tokenIn
the pool will accept for amountOut
of tokenOut
.
calcOutGivenIn
calcOutGivenIn
Calculate the amount of tokenOut
the pool will give for amountIn
of tokenIn
.
Last updated