bancorprotocol / contracts-solidity

Bancor Protocol Contracts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Any doc about in-EVM price discovery

k06a opened this issue · comments

Is there any documentation how my smart contract can discover token prices?

Hey,

There's no documentation yet but the price can be queried using the getReturn function.

Yudi

You will need to add connectors to that converter - tokens that you want to allow the smart token to be convertible against.
You will also need to deposit balance in each of them.

@yudilevi I wanna be able to get prices of tokens currently added to Bancor.

Remember that Bancor is a network of tokens (graph actually) which is composed of many different converter contracts that work together.
To get the conversion price on chain, you'll need to access a specific converter that has the tokens that you're interested connected to it.
Getting a price between any token on the network to any other token can currently only be achieved through our server APIs since it requires more processing than we care to put on chain.

@yudilevi why there is no any kind of facade for Bancor Network contracts? I need to fetch token prices to ETH.

We're actually working on an on-chain one these days but it's a work in progress.
The main reason it's not there yet is that it requires extra computations (figure out how the balances change with each 'hop' on a path in the token graph) that are simply not needed for the network to function.
But it's a nice feature that will make life easier for some contract developers, so we'd like to add that functionality.

@yudilevi On-Chain Token Price Discovery will be really a cool feature!

Yup, on our todo list :)

@k06a This is now done, see getReturnByPath.

@yudilevi, when new contract with this method will be deployed?

We're making a few more changes to the contracts these days so I expect it to go live in about 2 weeks or so.

@yudilevi found and fixed bug in your current implementation: #281