expectedTradeReturn()

CarbonPOL.sol
    function expectedTradeReturn(Token token, uint128 sourceAmount) external view returns (uint128 targetAmount);

Using this function, one can query the contract indicating the source token amount they would like to use, and receive an indication of the expected target token amount.

Note that since the rate changes over time, the target amount of tokens might grow with time as the price changes.

Function Arguments

NameTypeDescription

token

Token

The token address of the token you would like to trade out of the contract

sourceAmount

uint128

The amount of source tokens you are willing to trade out of your wallet against the indicated token

Example

expectedTradeReturn(
0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c, //token address
1000000000000000000 //source token amount indicated in wei
)
returns (
4027872880331900000000 //the returned amount of target tokens 
)

Last updated