SwapRouter

Handles the encoding of calldata for swap routing.

GitHub File: swapRouter.ts

Properties

Public

PropertyTypeModifierDescription

INTERFACE

static

The Application Binary Interface for the related Elastic contracts.

Constructor

Private constructor that cannot be constructed.

Methods

swapCallParameters() - public static

Based on the input parameters, handles the encoding of the relevant on-chain method that enables safe execution of swap routes.

Parameters

ParamsTypeDescription

trades

The trade to produce call parameters for.

options

The options for the swap operation: slippageTolerance:Percent = The % amount that the executed price can differ from the expected price before the transaction will revert. recipient: string = The address to which the output tokens will be sent to. deadline:BigintIsh = Time after which the fee collection transaction will fail, in epoch seconds. inputTokenPermit:PermitOptions = The permit options for the input token. Optional. sqrtPriceLimitX96:BigintIsh = The price limit for the trade. Optional. fee:FeeOptions = The fee options for the trade. Optional.

Returns

TypeDescription

An object containing: calldata: string = The hex encoded calldata to perform the given operation. value: string = The amount of ether (wei) to send in hex.

Last updated