# tradeInputByTargetAmount()

### Function tradeInputByTargetAmount()

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

```javascript
function tradeInputByTargetAmount(Token sourceToken, Token targetToken, uint256 targetAmount) 
external view validTokensForTrade(sourceToken, targetToken) greaterThanZero(targetAmount) 
returns (uint256)
```

{% endcode %}

This function is used to determine how many source tokens need to be swapped to receive a specific number of target tokens.&#x20;

For example, this could be used to determine how many ETH would be required to swap for 1000 LINK.&#x20;

### Function Arguments

| Name         | Type    | Description                                         |
| ------------ | ------- | --------------------------------------------------- |
| sourceToken  | Token   | The token being sold.                               |
| targetToken  | Token   | The token being bought.                             |
| targetAmount | uint256 | The number of target tokens desired to be received. |

### Return Variables

This function returns the number of source tokens required to be swapped to receive a specific number of target tokens.&#x20;

| Variable Type | Returns                                                                             |
| ------------- | ----------------------------------------------------------------------------------- |
| uint256       | The number of source tokens required to receive a specific number of target tokens. |
