StableSwap Router

Getting StableSwap Info

SwapRouter.getSwap(address baseToken, address quoteToken) → IStableSwap

Getter for the swap instance for the given token pair.

>>> swapRouter.getSwap()
outQ: '1680635143255664'
feeQ: '1682317460716'

SwapRouter.getAmountsOut(uint256 amount, address[] path) → uint256[], IStableSwap[], bool[]

Calculate all subsequent maximum output amounts of the asset given reserves following the path of token addresses given an input asset amount.

SwapRouter.getAmountsIn(uint256 amount, address[] path) → uint256[], IStableSwap[], bool[]

Calculate all subsequent minimum input amounts of the asset given reserves following the path of token addresses given an output asset amount.

Making Exchanges

SwapRouter.addLiquidity(address baseAddress, address quoteAddress, uint256 baseIn, uint256 quoteIn, uint256 minLpOut, uint256 version, uint256 deadline)

Deposit baseIn amount of baseAddress and quoteIn amount of quoteAddress to StableSwap pool of baseAddress and quoteAddress. It enforces the resulting LP token to be at least minLpOut, the version to be the current rebalance version, and the Unix timestamp deadline after which the transaction will revert.

SwapRouter.swapExactTokensForTokens(uint256 amountIn, uint256 minAmountOut, address[] path, address recipient, address staking, uint256[] versions, uint256 deadline) → uint256[]

Swap the exact amountIn of input tokens for as many output tokens as possible for recipient, along the route determined by path. The first element of path is the input token, the last is the output token, and any intermediate elements represent intermediate pairs to trade through. If staking is non-zero address, it further stakes the resulting output token to staking contract for recipient. It enforces the resulting output token to be at least minAmountOut, every versions to be the current rebalance version, and the Unix timestamp deadline after which the transaction will revert.

SwapRouter.swapTokensForExactTokens(uint256 amountOut, uint256 maxAmountIn, address[] path, address recipient, address staking, uint256[] versions, uint256 deadline) → uint256[]

Receive the exact amountOut of output tokens for as few input tokens as possible for recipient, along the route determined by path. The first element of path is the input token, the last is the output token, and any intermediate elements represent intermediate pairs to trade through. If staking is non-zero address, it further stakes the resulting output token to staking contract for recipient. It enforces the resulting input token to be at most maxAmountIn, every versions to be the current rebalance version, and the Unix timestamp deadline after which the transaction will revert.

SwapRouter.swapExactTokensForTokensUnwrap(uint256 amountIn, uint256 minAmountOut, address[] path, address recipient, uint256[] versions, uint256 deadline) → uint256[]

Swap the exact amountIn of input tokens for as many output tokens as possible andunwrap the output tokens for recipient, along the route determined by path. The first element of path is the input token, the last is the output token, and any intermediate elements represent intermediate pairs to trade through. It enforces the resulting output token to be at least minAmountOut, every versions to be the current rebalance version, and the Unix timestamp deadline after which the transaction will revert.

SwapRouter.swapTokensForExactTokensUnwrap(uint256 amountOut, uint256 maxAmountIn, address[] path, address recipient, uint256[] versions, uint256 deadline) → uint256[]

Receive the exact amountOut of output tokens for as few input tokens as possible and unwrap the output tokens for for recipient, along the route determined by path. The first element of path is the input token, the last is the output token, and any intermediate elements represent intermediate pairs to trade through. It enforces the resulting input token to be at most maxAmountIn, every versions to be the current rebalance version, and the Unix timestamp deadline after which the transaction will revert.

Last updated