0

How to get price of my own token with chainlink? They provides proxy for pairs already in chainlink. But how can we get price of our own token? With external API or chainlink node?

Proxy: https://docs.chain.link/docs/binance-smart-chain-addresses/

GET request: https://docs.chain.link/docs/make-a-http-get-request/

Can anyone share your expirience?

1 Answer 1

1

You have two options:

  1. Contact Chainlink in order to get them to deploy your price feed and they'll give you a quote for the feed deployment and maintenance. This is the typical route of how projects get their tokens listed.
  2. Implement your own price feed contract using the Chainlink feed interface. You could create a contract that calculates current price by dividing current Uniswap reserves and exposing the price via that same Chainlink interface. This is not recommended, as you do not want to cheap out on your token's price feed. Also, don't expect Chainlink to list your feed on their website just because you implemented the contract using the Chainlink interface.
7
  • Understood. So if i create pair on dex, i need to create external contract to check price of this pair and get it from it by request to main contract? Any example?
    – Ched
    Commented Oct 11, 2021 at 11:44
  • You create external contracts to calculate the price on demand. This would only be a work-around, and will not have ability to store historical prices like Chainlink's price feeds. An example of such a contract is the following test contract: github.com/hifi-finance/hifi/blob/main/packages/protocol/… Commented Oct 11, 2021 at 15:04
  • I saw examples like this with proxy provided by chainlink, but how to use it with my own token/pair? This contracts works with data but not provided it.
    – Ched
    Commented Oct 11, 2021 at 15:25
  • To use it with your own token, just make a simple calculcation based on the Uniswap reserves like: reserve0/reserve1, where reserve0 is a USD-pegged stablecoin. You could then do more fancy things like including other DEX liquidity and averaging prices. Commented Oct 11, 2021 at 16:50
  • I didnt see the full picture. If we get pair on uniswap with two tokens, how we provide pair address to this contract every time, how we call this chain from uni->this contract->main contract? idk, i watching at this repo but didn't understood this pipeline of iteraction from basic token contract to price of it. Can you please provide example?
    – Ched
    Commented Oct 11, 2021 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.