# calculateTradeSourceAmount()

{% code title="CarbonController.sol" overflow="wrap" lineNumbers="true" %}

```solidity
    function calculateTradeSourceAmount(
        Token sourceToken,
        Token targetToken,
        TradeAction[] calldata tradeActions
    ) external view returns (uint128);
   
```

{% endcode %}

This function is used to get the number of target tokens that would be received by trading the indicated number of source tokens.

### **Function Arguments**

<table><thead><tr><th width="175">Name</th><th width="116.66666666666663">Type</th><th>Description</th></tr></thead><tbody><tr><td>sourceToken</td><td>Token</td><td>The address of the token being swapped into the trade</td></tr><tr><td>targetToken</td><td>Token</td><td>The address of the token received from the trade</td></tr><tr><td>tradeActions</td><td>array</td><td>The list of TradeAction objects that specify the route of the trade. <br><br>The TradeAction object contains the strategy ID of the strategy that is being swapped into, and the number of tokens being swapped in<br><br>For example:<br>{712,<br>1500000000000000000}</td></tr></tbody></table>

### Returns

This returns the number of target tokens expected to be returned by the specified trade.&#x20;

### Example

```
tradeSourceAmount(
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE, //token0
0x514910771AF9Ca656af840dff83E8264EcF986CA, //token1
[(712,1500000000000000000), (615, 2300000000000000000)] // TradeAction (id, amount)
)

// Return
// 7300000000000000000
```

{% hint style="info" %}
For the ETH token, use the contract address: *0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE*&#x20;
{% endhint %}
