# tradeBySourceAmount()

### Function **tradeBySourceAmount()**

{% code title="BancorNetwork.sol" %}

```solidity
    function tradeBySourceAmount(
        Token sourceToken,
        Token targetToken,
        uint256 sourceAmount,
        uint256 minReturnAmount,
        uint256 deadline,
        address beneficiary
    ) external payable
```

{% endcode %}

Trades the exact amount of **source** tokens for as many **target** tokens as possible.&#x20;

### **Function Arguments**

<table><thead><tr><th>Name</th><th width="222.00000000000003">Type</th><th>Description</th></tr></thead><tbody><tr><td>sourceToken</td><td>Token</td><td>The source token address</td></tr><tr><td>targetToken</td><td>Token</td><td>The target token address</td></tr><tr><td>sourceAmount</td><td>uint256</td><td>The amount of source tokens</td></tr><tr><td>minReturnAmount</td><td>uint256</td><td>The minimum amount of target tokens that must be received for the transaction to not revert</td></tr><tr><td>deadline</td><td>uint256</td><td>Unix timestamp after which the transaction will revert</td></tr><tr><td>beneficiary</td><td>address</td><td>The address receiving the target tokens</td></tr></tbody></table>

See [Errors and Troubleshooting](https://docs.bancor.network/developer-guides/write-functions/trading/trading-troubleshooting) for a list of common errors and how to resolve them.&#x20;

{% hint style="info" %}
To trade directly with the Ether token, use the contract address: *0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE*&#x20;
{% endhint %}
