tradeBySourceAmount()
The function parameters must include the list of orders (tradeActions) to interact with.
Using the SDK is highly recommended. See Performing Trades for details.
Function tradeBySourceAmount()
This function will trade the exact amount of indicated source tokens for as many target tokens as possible.
Function Arguments
Name | Type | Description |
---|---|---|
sourceToken | Token address | The source token address |
targetToken | Token address | The target token address |
tradeActions | list | This is a list of TradeAction objects, each of which contain the strategyId and amount of source tokens to trade into the strategy |
deadline | uint256 | Unix timestamp after which the transaction will revert |
minReturn | uint128 | The minimum amount of target tokens that must be received for the transaction to not revert |
tradeActionamount
needs to follow the relevant token decimal.
tradeBySourceAmount, follows the sourceToken decimals
Example
While all required data is available on-chain, it is recommended to use the Carbon DeFi SDK.
To trade directly with the ETH token, use the contract address: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
Last updated