calculateTradeTargetAmount()
CarbonController.sol
This function is used to get the number of source tokens that would be required to trade to receive the indicated number of target tokens.
Function Arguments
Name | Type | Description |
---|---|---|
sourceToken | Token | The address of the token being swapped into the trade |
targetToken | Token | The address of the token received from the trade |
tradeActions | array | The list of TradeAction objects that specify the route of the trade The TradeAction object contains the strategy ID of the strategy that is being swapped into, and the number of tokens being swapped in. For example: {712, 1500000000000000000} |
Returns
This returns the number of source tokens expected to be returned by the specified trade.
Example
For the ETH token, use the contract address: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
Last updated