ExchangeOnPool

Curve Action Plugin - ExchangeOnPool

Description

Perform an exchange between two coins.

Method

exchangeOnPool(int128, int128, uint256, uint256)

Input Parameters

NamePlugin TypeDescription

to

FctAddress

Curve pool address

Method Parameters

NameTypeDescription

index1

FctInteger128

Index of the coin on Curve pool to send

index2

FctInteger128

Index of the coin on Curve pool to receive

amount

FctValue

Amount of index1 being exchanged

amountMinReceived

FctValue

Minimum amount of index2 to receive

Returned Values

NamePlugin TypeDescription

amountReceived

FctValue

Amount received in the exchange

Example

Example with initParams

const ExchangeOnPool = new Curve.actions.ExchangeOnPool({
   chainId: 1,
   initParams: {
     to: "0x...", // Curve 3Pool DAI/USDC/USDT
     methodParams: {
       index1: "0", // DAI Index
       index2: "1", // USDC Index
       amount: "10000",
       amountMinReceived: "9999",
     }
   }
})

Example without initParams

const exchangeOnPool = new Curve.actions.ExchangeOnPool({ chainId: 1 })

exchangeOnPool.input.set({
    to: "0x...", // Curve 3Pool DAI/USDC/USDT
    methodParams: {
       index1: "0", // DAI Index
       index2: "1", // USDC Index
       amount: "10000",
       amountMinReceived: "9999",
    }
})

Learn more

Learn more about Curve exchange on pool here

Last updated