IRouter
Table of contents
Constructors
Properties
Methods
- addLiquidity
- addLiquidityMAS
- createLBPair
- getSwapIn
- getSwapOut
- init
- removeLiquidity
- removeLiquidityMAS
- swapExactMASForTokens
- swapExactMASForTokensSupportingFeeOnTransferTokens
- swapExactTokensForMAS
- swapExactTokensForMASSupportingFeeOnTransferTokens
- swapExactTokensForTokens
- swapExactTokensForTokensSupportingFeeOnTransferTokens
- swapMASForExactTokens
- swapTokensForExactMAS
- swapTokensForExactTokens
Constructors
constructor
• new IRouter(at
): IRouter
Wraps a smart contract exposing standard token FFI.
Parameters
Name | Type | Description |
---|---|---|
at | Address | Address of the smart contract. |
Returns
Defined in
assembly/interfaces/IRouter.ts:22
Properties
_origin
• _origin: Address
Defined in
assembly/interfaces/IRouter.ts:15
Methods
addLiquidity
▸ addLiquidity(liquidityParameters
, masToSend
): AddLiquidity
Add liquidity while performing safety checks This function is compliant with fee on transfer tokens
Parameters
Name | Type | Description |
---|---|---|
liquidityParameters | LiquidityParameters | The liquidity parameters |
masToSend | u64 | The amount of MAS to send for storage |
Returns
AddLiquidity
- The amount of tokens minted and the ids of the deposits
Defined in
assembly/interfaces/IRouter.ts:73
addLiquidityMAS
▸ addLiquidityMAS(liquidityParameters
, amountTotal
, masToSend
): AddLiquidity
Add liquidity with MAS while performing safety checks This function is compliant with fee on transfer tokens
Parameters
Name | Type | Description |
---|---|---|
liquidityParameters | LiquidityParameters | The liquidity parameters |
amountTotal | u256 | The amount of MAS to deposit + the amount of MAS to send for storage |
masToSend | u64 | The amount of MAS to send for storage |
Returns
AddLiquidity
- The amount of tokens minted and the ids of the deposits
Defined in
assembly/interfaces/IRouter.ts:94
createLBPair
▸ createLBPair(tokenX
, tokenY
, activeId
, binStep
, masToSend
): Address
Create a liquidity bin LBPair for _tokenX and _tokenY using the factory
Parameters
Name | Type | Description |
---|---|---|
tokenX | IERC20 | The address of the first token |
tokenY | IERC20 | The address of the second token |
activeId | u32 | The active id of the pair |
binStep | u32 | The bin step in basis point, used to calculate log(1 + binStep) |
masToSend | u64 | The amount of MAS to send for storage |
Returns
Address
- The address of the newly created LBPair
Defined in
assembly/interfaces/IRouter.ts:49
getSwapIn
▸ getSwapIn(_pair
, _amountOut
, _swapForY
): GetSwapInReturn
Parameters
Name | Type |
---|---|
_pair | IPair |
_amountOut | u256 |
_swapForY | bool |
Returns
GetSwapInReturn
Defined in
assembly/interfaces/IRouter.ts:506
getSwapOut
▸ getSwapOut(_pair
, _amountIn
, _swapForY
): GetSwapOutReturn
Parameters
Name | Type |
---|---|
_pair | IPair |
_amountIn | u256 |
_swapForY | bool |
Returns
GetSwapOutReturn
Defined in
assembly/interfaces/IRouter.ts:515
init
▸ init(wmas
, factory
): void
Calls the constructor.
Parameters
Name | Type | Description |
---|---|---|
wmas | Address | The address of WMAS |
factory | Address | The address of the factory |
Returns
void
Defined in
assembly/interfaces/IRouter.ts:32
removeLiquidity
▸ removeLiquidity(tokenX
, tokenY
, binStep
, amountXMin
, amountYMin
, ids
, amounts
, to
, deadline
, masToSend
): Amounts
Remove liquidity while performing safety checks This function is compliant with fee on transfer tokens
Parameters
Name | Type | Description |
---|---|---|
tokenX | Address | The address of token X |
tokenY | Address | The address of token Y |
binStep | u32 | The bin step of the LBPair |
amountXMin | u256 | The min amount to receive of token X |
amountYMin | u256 | The min amount to receive of token Y |
ids | u64 [] | The list of ids to burn |
amounts | u256 [] | The list of amounts to burn of each id in ids |
to | Address | The address of the recipient |
deadline | u64 | The deadline of the tx |
masToSend | u64 | The amount of MAS to send for storage |
Returns
Amounts
- The amount of tokens received
Defined in
assembly/interfaces/IRouter.ts:125
removeLiquidityMAS
▸ removeLiquidityMAS(token
, binStep
, amountTokenMin
, amountMasMin
, ids
, amounts
, to
, deadline
, masToSend
): Amounts
Remove liquidity with MAS while performing safety checks This function is compliant with fee on transfer tokens
Parameters
Name | Type | Description |
---|---|---|
token | Address | The address of token |
binStep | u32 | The bin step of the LBPair |
amountTokenMin | u256 | The min amount to receive of token |
amountMasMin | u256 | The min amount to receive of MAS |
ids | u64 [] | The list of ids to burn |
amounts | u256 [] | The list of amounts to burn of each id in ids |
to | Address | The address of the recipient |
deadline | u64 | The deadline of the tx |
masToSend | u64 | The amount of MAS to send for storage |
Returns
Amounts
Defined in
assembly/interfaces/IRouter.ts:167
swapExactMASForTokens
▸ swapExactMASForTokens(amountIn
, amountOutMin
, pairBinSteps
, tokenPath
, to
, deadline
, masToSend
): u256
Swaps exact MAS for tokens while performing safety checks
Parameters
Name | Type | Description |
---|---|---|
amountIn | u256 | The amount of MAS to send for swap and storage |
amountOutMin | u256 | The min amount of token to receive |
pairBinSteps | u64 [] | The bin step of the pairs |
tokenPath | IERC20 [] | The swap path using the binSteps following _pairBinSteps |
to | Address | The address of the recipient |
deadline | u64 | The deadline of the tx |
masToSend | u64 | The amount of Massa to send for storage |
Returns
u256
- The output amount of the swap
Defined in
assembly/interfaces/IRouter.ts:269
swapExactMASForTokensSupportingFeeOnTransferTokens
▸ swapExactMASForTokensSupportingFeeOnTransferTokens(amountIn
, amountOutMin
, pairBinSteps
, tokenPath
, to
, deadline
, masToSend
): u256
Swaps exact MAS for tokens while performing safety checks supporting for fee on transfer tokens
Parameters
Name | Type | Description |
---|---|---|
amountIn | u256 | The amount of MAS to send for swap and storage |
amountOutMin | u256 | The min amount of token to receive |
pairBinSteps | u64 [] | The bin step of the pairs |
tokenPath | IERC20 [] | The swap path using the binSteps following _pairBinSteps |
to | Address | The address of the recipient |
deadline | u64 | The deadline of the tx |
masToSend | u64 | The amount of Massa to send for storage |
Returns
u256
- The output amount of the swap
Defined in
assembly/interfaces/IRouter.ts:481
swapExactTokensForMAS
▸ swapExactTokensForMAS(amountIn
, amountOutMinMAS
, pairBinSteps
, tokenPath
, to
, deadline
, masToSend
): u256
Swaps exact tokens for MAS while performing safety checks
Parameters
Name | Type | Description |
---|---|---|
amountIn | u256 | The amount of tokens to send |
amountOutMinMAS | u256 | The min amount of MAS to receive |
pairBinSteps | u64 [] | The bin step of the pairs |
tokenPath | IERC20 [] | The swap path using the binSteps following _pairBinSteps |
to | Address | The address of the recipient |
deadline | u64 | The deadline of the tx |
masToSend | u64 | The amount of Massa to send for storage |
Returns
u256
- The output amount of the swap
Defined in
assembly/interfaces/IRouter.ts:237
swapExactTokensForMASSupportingFeeOnTransferTokens
▸ swapExactTokensForMASSupportingFeeOnTransferTokens(amountIn
, amountOutMinMAS
, pairBinSteps
, tokenPath
, to
, deadline
, masToSend
): u256
Swaps exact tokens for MAS while performing safety checks supporting for fee on transfer tokens
Parameters
Name | Type | Description |
---|---|---|
amountIn | u256 | The amount of token to send |
amountOutMinMAS | u256 | The min amount of MAS to receive |
pairBinSteps | u64 [] | The bin step of the pairs |
tokenPath | IERC20 [] | The swap path using the binSteps following _pairBinSteps |
to | Address | The address of the recipient |
deadline | u64 | The deadline of the tx |
masToSend | u64 | The amount of Massa to send for storage |
Returns
u256
- The output amount of the swap
Defined in
assembly/interfaces/IRouter.ts:444
swapExactTokensForTokens
▸ swapExactTokensForTokens(amountIn
, amountOutMin
, pairBinSteps
, tokenPath
, to
, deadline
, masToSend
): u256
Swaps exact tokens for tokens while performing safety checks
Parameters
Name | Type | Description |
---|---|---|
amountIn | u256 | The amount of tokens to send |
amountOutMin | u256 | The min amount of tokens to receive |
pairBinSteps | u64 [] | The bin step of the pairs |
tokenPath | IERC20 [] | The swap path using the binSteps following _pairBinSteps |
to | Address | The address of the recipient |
deadline | u64 | The deadline of the tx |
masToSend | u64 | The amount of Massa to send for storage |
Returns
u256
- The output amount of the swap
Defined in
assembly/interfaces/IRouter.ts:205
swapExactTokensForTokensSupportingFeeOnTransferTokens
▸ swapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn
, amountOutMin
, pairBinSteps
, tokenPath
, to
, deadline
, masToSend
): u256
Swaps exact tokens for tokens while performing safety checks supporting for fee on transfer tokens
Parameters
Name | Type | Description |
---|---|---|
amountIn | u256 | The amount of token to send |
amountOutMin | u256 | The min amount of token to receive |
pairBinSteps | u64 [] | The bin step of the pairs |
tokenPath | IERC20 [] | The swap path using the binSteps following _pairBinSteps |
to | Address | The address of the recipient |
deadline | u64 | The deadline of the tx |
masToSend | u64 | The amount of Massa to send for storage |
Returns
u256
- The output amount of the swap
Defined in
assembly/interfaces/IRouter.ts:407
swapMASForExactTokens
▸ swapMASForExactTokens(amountOut
, amountInMax
, pairBinSteps
, tokenPath
, to
, deadline
, masToSend
): u256
Swaps MAS for exact tokens while performing safety checks
Parameters
Name | Type | Description |
---|---|---|
amountOut | u256 | The amount of token to receive |
amountInMax | u256 | The max amount of Mas to send |
pairBinSteps | u64 [] | The bin step of the pairs |
tokenPath | IERC20 [] | The swap path using the binSteps following _pairBinSteps |
to | Address | The address of the recipient |
deadline | u64 | The deadline of the tx |
masToSend | u64 | The amount of Massa to send for storage |
Returns
u256
- The output amount of the swap
Defined in
assembly/interfaces/IRouter.ts:370
swapTokensForExactMAS
▸ swapTokensForExactMAS(amountOut
, amountInMax
, pairBinSteps
, tokenPath
, to
, deadline
, masToSend
): u256
Swaps tokens for exact MAS while performing safety checks
Parameters
Name | Type | Description |
---|---|---|
amountOut | u256 | The amount of MAS to receive |
amountInMax | u256 | The max amount of token to send |
pairBinSteps | u64 [] | The bin step of the pairs |
tokenPath | IERC20 [] | The swap path using the binSteps following _pairBinSteps |
to | Address | The address of the recipient |
deadline | u64 | The deadline of the tx |
masToSend | u64 | The amount of Massa to send for storage |
Returns
u256
- The output amount of the swap
Defined in
assembly/interfaces/IRouter.ts:338
swapTokensForExactTokens
▸ swapTokensForExactTokens(amountOut
, amountInMax
, pairBinSteps
, tokenPath
, to
, deadline
, masToSend
): u256
Swaps tokens for exact tokens while performing safety checks
Parameters
Name | Type | Description |
---|---|---|
amountOut | u256 | The amount of token to receive |
amountInMax | u256 | The max amount of token to send |
pairBinSteps | u64 [] | The bin step of the pairs |
tokenPath | IERC20 [] | The swap path using the binSteps following _pairBinSteps |
to | Address | The address of the recipient |
deadline | u64 | The deadline of the tx |
masToSend | u64 | The amount of Massa to send for storage |
Returns
u256
- The output amount of the swap