Skip to main content

IRouter

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new IRouter(at): IRouter

Wraps a smart contract exposing standard token FFI.

Parameters

NameTypeDescription
atAddressAddress of the smart contract.

Returns

IRouter

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

NameTypeDescription
liquidityParametersLiquidityParametersThe liquidity parameters
masToSendu64The 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

NameTypeDescription
liquidityParametersLiquidityParametersThe liquidity parameters
amountTotalu256The amount of MAS to deposit + the amount of MAS to send for storage
masToSendu64The 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

NameTypeDescription
tokenXIERC20The address of the first token
tokenYIERC20The address of the second token
activeIdu32The active id of the pair
binStepu32The bin step in basis point, used to calculate log(1 + binStep)
masToSendu64The 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

NameType
_pairIPair
_amountOutu256
_swapForYbool

Returns

GetSwapInReturn

Defined in

assembly/interfaces/IRouter.ts:506


getSwapOut

getSwapOut(_pair, _amountIn, _swapForY): GetSwapOutReturn

Parameters

NameType
_pairIPair
_amountInu256
_swapForYbool

Returns

GetSwapOutReturn

Defined in

assembly/interfaces/IRouter.ts:515


init

init(wmas, factory): void

Calls the constructor.

Parameters

NameTypeDescription
wmasAddressThe address of WMAS
factoryAddressThe 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

NameTypeDescription
tokenXAddressThe address of token X
tokenYAddressThe address of token Y
binStepu32The bin step of the LBPair
amountXMinu256The min amount to receive of token X
amountYMinu256The min amount to receive of token Y
idsu64[]The list of ids to burn
amountsu256[]The list of amounts to burn of each id in ids
toAddressThe address of the recipient
deadlineu64The deadline of the tx
masToSendu64The 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

NameTypeDescription
tokenAddressThe address of token
binStepu32The bin step of the LBPair
amountTokenMinu256The min amount to receive of token
amountMasMinu256The min amount to receive of MAS
idsu64[]The list of ids to burn
amountsu256[]The list of amounts to burn of each id in ids
toAddressThe address of the recipient
deadlineu64The deadline of the tx
masToSendu64The 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

NameTypeDescription
amountInu256The amount of MAS to send for swap and storage
amountOutMinu256The min amount of token to receive
pairBinStepsu64[]The bin step of the pairs
tokenPathIERC20[]The swap path using the binSteps following _pairBinSteps
toAddressThe address of the recipient
deadlineu64The deadline of the tx
masToSendu64The 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

NameTypeDescription
amountInu256The amount of MAS to send for swap and storage
amountOutMinu256The min amount of token to receive
pairBinStepsu64[]The bin step of the pairs
tokenPathIERC20[]The swap path using the binSteps following _pairBinSteps
toAddressThe address of the recipient
deadlineu64The deadline of the tx
masToSendu64The 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

NameTypeDescription
amountInu256The amount of tokens to send
amountOutMinMASu256The min amount of MAS to receive
pairBinStepsu64[]The bin step of the pairs
tokenPathIERC20[]The swap path using the binSteps following _pairBinSteps
toAddressThe address of the recipient
deadlineu64The deadline of the tx
masToSendu64The 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

NameTypeDescription
amountInu256The amount of token to send
amountOutMinMASu256The min amount of MAS to receive
pairBinStepsu64[]The bin step of the pairs
tokenPathIERC20[]The swap path using the binSteps following _pairBinSteps
toAddressThe address of the recipient
deadlineu64The deadline of the tx
masToSendu64The 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

NameTypeDescription
amountInu256The amount of tokens to send
amountOutMinu256The min amount of tokens to receive
pairBinStepsu64[]The bin step of the pairs
tokenPathIERC20[]The swap path using the binSteps following _pairBinSteps
toAddressThe address of the recipient
deadlineu64The deadline of the tx
masToSendu64The 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

NameTypeDescription
amountInu256The amount of token to send
amountOutMinu256The min amount of token to receive
pairBinStepsu64[]The bin step of the pairs
tokenPathIERC20[]The swap path using the binSteps following _pairBinSteps
toAddressThe address of the recipient
deadlineu64The deadline of the tx
masToSendu64The 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

NameTypeDescription
amountOutu256The amount of token to receive
amountInMaxu256The max amount of Mas to send
pairBinStepsu64[]The bin step of the pairs
tokenPathIERC20[]The swap path using the binSteps following _pairBinSteps
toAddressThe address of the recipient
deadlineu64The deadline of the tx
masToSendu64The 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

NameTypeDescription
amountOutu256The amount of MAS to receive
amountInMaxu256The max amount of token to send
pairBinStepsu64[]The bin step of the pairs
tokenPathIERC20[]The swap path using the binSteps following _pairBinSteps
toAddressThe address of the recipient
deadlineu64The deadline of the tx
masToSendu64The 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

NameTypeDescription
amountOutu256The amount of token to receive
amountInMaxu256The max amount of token to send
pairBinStepsu64[]The bin step of the pairs
tokenPathIERC20[]The swap path using the binSteps following _pairBinSteps
toAddressThe address of the recipient
deadlineu64The deadline of the tx
masToSendu64The amount of Massa to send for storage

Returns

u256

  • The output amount of the swap

Defined in

assembly/interfaces/IRouter.ts:306