IndexPool
Trident exchange pool template with constant mean formula for swapping among an array of ERC-20 tokens.
The reserves are stored as bento shares. The curve is applied to shares as well. This pool does not care about the underlying amounts.
Functions
constructor
function constructor(
) public
mint
function mint(
) public returns (uint256 liquidity)
Mints LP tokens - should be called via the router after transferring bento
tokens.
The router must ensure that sufficient LP tokens are minted by using the return value.
burn
function burn(
) public returns (struct IPool.TokenAmount[] withdrawnAmounts)
Burns LP tokens sent to this contract. The router must ensure that the user gets sufficient output tokens.
burnSingle
function burnSingle(
) public returns (uint256 amountOut)
Burns LP tokens sent to this contract and swaps one of the output tokens for another
- i.e., the user gets a single token out by burning LP tokens.
swap
function swap(
) public returns (uint256 amountOut)
Swaps one token for another. The router must prefund this contract and ensure there isn’t too much slippage.
flashSwap
function flashSwap(
) public returns (uint256 amountOut)
Swaps one token for another. The router must support swap callbacks and ensure there isn’t too much slippage.
updateBarFee
function updateBarFee(
) public
Updates barFee
for Trident protocol.
_balance
function _balance(
) internal returns (uint256 balance)
_getAmountOut
function _getAmountOut(
) internal returns (uint256 amountOut)
_compute
function _compute(
) internal returns (uint256 output)
_computeSingleOutGivenPoolIn
function _computeSingleOutGivenPoolIn(
) internal returns (uint256 amountOut)
_pow
function _pow(
) internal returns (uint256 output)
_powApprox
function _powApprox(
) internal returns (uint256 sum)
_subFlag
function _subFlag(
) internal returns (uint256 difference, bool flag)
_mul
function _mul(
) internal returns (uint256 c2)
_div
function _div(
) internal returns (uint256 c2)
_transfer
function _transfer(
) internal
getAssets
function getAssets(
) public returns (address[] assets)
getAmountOut
function getAmountOut(
) public returns (uint256 amountOut)
getReservesAndWeights
function getReservesAndWeights(
) public returns (uint256[] reserves, uint136[] weights)
Events
Mint
event Mint(
)
Burn
event Burn(
)