Bancor Network's system of smart contracts work together to provide a complete solution to on-chain liquidity. We've highlighted some of the key network functions in the
Developer Quick Start and encourage you to begin your development process here. Down below in the
Other Guides section, you'll find some deeper dives into various elements of Bancor Network.
The network includes a contract address discovery mechanism - a contract that servers as a registry for all the core contracts, that queries the latest contract addresses by their names. These contracts are updated from time to time, so developers are advised to reference the registry directly in order to stay current with the network.
Each Quick Start guide has code snippets which demonstrate how to call the registry, however we've also outlined the process and the different approaches below.
For example, to get the latest contract address of the BancorNetwork contract, the following call should be used:
bancorNetwork = ContractRegistry.addressOf('BancorNetwork')
addressOf function on the ContractRegistry contract can receive any of the known contract names as an argument, in bytes32 format. Below is a list of all core contract names with their bytes32 representation
Every time an address is changed, the ContractRegistry will throw an AddressUpdate event.
NameAddressUpdate (index_topic_1 bytes32 _contractName, address _contractAddress)View SourceTopics0 0xfc08d1253c81bcd5444fc7056ef1f5a5df4c9220b6fd70d7449267f1f0f299181 0x42616e636f72436f6e766572746572466163746f727900000000000000000000Data_contractAddress : 0x3cc4a258aff14a88380ca3d9703d6bbfb7a8042e
For example, to get the latest contract address of the BancorNetwork contract, one should track an AddressUpdate event that indicates new address for BancorNetwork (using its bytes32 representation).