GetExchangeAmount

Curve Getter Plugin - GetExchangeAmount

Description

Get the current number of coins received in an exchange.

Method

get_exchange_amount(address, address, address, uint256)

Input Parameters

No required input parameters

Method Parameters

NamePlugin TypeDescription

pool

FctAddress

Pool address.

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

toBeReceivedAmount

FctValue

Amount to be received in the exchange.

Example

Example with initParams

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

Example without initParams

const getExchangeAmount = new Curve.getter.GetExchangeAmount({ chainId: 1 })

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

Learn more

Learn more about Curve exchange here

Last updated