GetBestRate

Curve Getter Plugin - GetBestRate

Description

Find the pool offering the best rate for a given swap.

Method

get_best_rate(address, address, uint256)

Input Parameters

No required input parameters

Method Parameters

NamePlugin TypeDescription

from

FctAddress

Address of coin being sent.

to

FctAddress

Address of coin being received.

amount

FctValue

Quantity of from being sent.

Returned Values

NamePlugin TypeDescription

poolAddress

FctAddress

Address of the pool offering the best rate

expectedAmount

FctValue

Expected amount received in the swap.

Example

Example with initParams

const getBestRate = new Curve.getter.GetBestRate({
   chainId: 1,
   initParams: {
     methodParams: {
       from: "0xdAC17F958D2ee523a2206206994597C13D831ec7", // USDT
       to: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
       amount: "10000",
     }
   }
})

Example without initParams

const getBestRate = new Curve.getter.GetBestRate({ chainId: 1 })

getBestRate.input.set({
    methodParams: {
       from: "0xdAC17F958D2ee523a2206206994597C13D831ec7", // USDT
       to: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
       amount: "10000",
    }
})

Learn more

Learn more about Curve exchange here

Last updated