Trading

2 function that enable trade flexibility

Trading tokens on Bancor is as easy as calling a single function.

Bancor allows trading of native ETH tokens, wrapped ETH (wETH) and any other supported ERC20 tokens such as LINK, USDC, USDT, WBTC and many more.

As a developer, you can simulate the trading function call with the tokens you wish to trade to see if the transaction can be completed as is, or if there are unexpected issues. If the trade can't be completed it returns an error indicating the issue, such as un-supported tokens, permissions, etc, and includes a clear way to resolve them.

Bancor now supports 2 different “trade” functions that enable greater flexibility:

  1. tradeBySourceAmount - this is the “normal” trade function where you indicate the amount you wish to trade out and receive the max possible of the selected token based on the current pool rate.

  2. tradeByTargetAmount - this function allows you to indicate exactly how much you wish to receive at the end of the trade. Meaning you indicate the amount you wish to receive, and the trade will use the required amount in order to fulfill your request. The benefit of using this function is that you will know exactly how much you receive at the end.

Last updated