Pool Contract
Info Methods
token0
token0Returns the address of the first token in the pool.
Example Usage:
address firstToken = pool.token0();
// Returns the address of the first token in the pool.
>>> 0x0000000000000000000000000000000000000000token1
token1Returns the address of the second token in the pool.
Example Usage:
address secondToken = pool.token1();
// Returns the address of the second token in the pool.
>>> 0x0000000000000000000000000000000000000000reserve0
reserve0Returns the reserve of the first token in the pool.
Example Usage:
reserve1
reserve1Returns the reserve of the second token in the pool.
Example Usage:
getAssets
getAssetsReturns the addresses of the assets in the pool.
Example Usage:
getReserves
getReservesReturns the current reserves of the tokens in the pool.
Example Usage:
Swap Methods
swap
swapSwaps one token for another within the pool. The function calculates the output amount based on the input amount and the current reserves, applies the swap fee, and updates the reserves accordingly.
Example Usage:
getAmountOut
getAmountOutCalculates the amount of output tokens received for a given input amount.
Example Usage:
Add/Remove Liquidity Methods
mint
mintMints LP tokens in exchange for adding liquidity to the pool.
Example Usage:
burn
burnBurns LP tokens in exchange for removing liquidity from the pool.
Example Usage:
burnSingle
burnSingleBurns LP tokens and swaps one of the output tokens for another, allowing the user to receive a single token.
Example Usage:
Last updated