router_dry.gno

Simulates the swap router.

DrySwapRoute

func SwapRoute(
	inputToken string,
	outputToken string,
	_amountSpecified string,
	swapType string,
	strRouteArr string, // []string
	quoteArr string, // []int
) string

Simulates a swap through the route that offers the most favorable exchange rate.

Parameters

NameTypeDescription

inputToken

string

The path of the input token.

outputToken

string

The path of the output token.

amountSpecified

string

The amount of the specified token.

swapType

string

The type of the swap. EXACT_IN for specifying an exact amount of inputToken, and EXACT_OUT for specifying an exact amount of outputToken.

strRouteArr

string

The route of the swap.

quoteArr

string

The share of each split of the route.

Return Values

NameTypeDescription

resultAmountOut or resultAmountIn

string

The result of the swap. Returns resultAmountOut on EXACT_IN and resultAmountIn on EXACT_OUT.

Last updated