Trading on Bancor - General

General guide for users on converting assets using the Bancor Network

Trading is the core value proposition to users of Bancor Network. The easiest way to trade is to use the Bancor Dapp. This is the recommended entry point to trading on Bancor for new users.

Bancor is also integrated with several decentralized exchange aggregators like 1inch, X Nation, Paraswap and DEX.AG. When you use these platforms, your trades may be routed through Bancor.

Other ways to trade via Bancor include the Bancor Widget, which can be embedded by third parties on their sites, and via smart contract interface, where a third party developer has integrated Bancor into their smart contract.

Developers should refer to the Trading with Bancor guide in the Developer Quick Start section.

Trading via Etherscan

If you want to trade directly on the BancorNetwork contract, Etherscan's web UI makes it quite easy. Additionally, this guide will be helpful for developers looking to interface with Bancor contracts via their own smart contract.

Step #1: Query for Latest BancorNetwork Address

Bancor contracts are regularly upgraded so the BancorNetwork address may change over time. To find the latest address:

  • In the Read Contract section, execute the getAddress function with the following parameter:

    • _contractName: 0x42616e636f724e6574776f726b. This is the bytes32 representation of "BancorNetwork"

  • This return value is the address of the BancorNetwork contract. Save this value for Step #3

Step #2: Generate Conversion Path

A key input for any trade on Bancor is the conversion path. The conversion path is the map between liquidity pools that allows for any token on Bancor to be exchanged for any other.

We recommend using the Bancor SDK for generating the most efficient path between two tokens. Reference the getPathAndRate function documented on the SDK Github. This API call will provide you with the conversion path and expected exchange rate of the trade. You'll need both of these inputs for Step #3.

If you'd like to generate a conversion path on-chain, the conversionPath function on the BancorNetwork contract provides a good approximation of the best path. This function is well-documented in the Trading with Bancor guide in the Developer Quick Start.

Step #3: Execute a Trade

  • Navigate to the Etherscan page of the contract address we queried for in Step #1 and head to the Write Contract view

  • If you're exchanging ether for another token, you'll be using the convert function (#25)

  • If you're exchanging one token for another token, you'll be using the claimAndConvert function (#19)

  • You have the _path parameter from Step #2 and you can use the rate return value from getPathAndRate as a reference point for how to determine the minReturn argument

  • Execute the correct function with the relevant inputs