GithubHelp home page GithubHelp logo

Comments (2)

jahabeebs avatar jahabeebs commented on September 25, 2024

Create a function to fetch liquidity details for ODG and OD. This will be used for the stats page

* [ ]  Fetch pool data from camelot https://docs.camelot.exchange/

* [ ]  Add addresses for existing pools. Later we will update the address to our own pools
  
  * a stablecoin pool for OD
  * any token pool for ODG

* [ ]  Fetch both price and liquidity data

@pi0neerpat I found two example pools to use:
Stablecoin V2 pair: https://arbiscan.io/address/0x87425d8812f44726091831a9a109f4bdc3ea34b4#readContract
Concentrated liquidity V3 pair: https://arbiscan.io/address/0x8cc8093218bcac8b1896a1eed4d925f6f6ab289f#readContract

Price data V3:

I found that we can get price data for V3 by querying globalState which returns a unint160 "price" value according to these docs: https://docs.quickswap.exchange/reference/smart-contracts/v3/pool/

Liquidity data V3:

I'm not sure about getting liquidity for V3--there's a a liquidity function but it "has no relationship to the total liquidity across all ticks" and returns a uint128 According to the analytics dashboard the current liquidity for GRAIL-USDC is 7 million https://info.camelot.exchange/pair/v3/0x8cc8093218bcac8b1896a1eed4d925f6f6ab289f but I'm not sure yet how this is related to the total liquidity in USD--I'll try to see if the SDK has this logic

Price data V2:

Seems like people usually rely on SDK methods to calculate the price because the contract itself doesn't have this as a read function like in V3--see info in getReserves (I know we aren't using quickswap but same idea): https://docs.quickswap.exchange/reference/smart-contracts/v2/pair

Liquidity data V2:

This info isn't on the contract either and will require some more research

I'm going to ask around in the Camelot Discord to get info on calculating liquidity/price data (I'm hoping their analytics app is open source but seems it's not because I couldn't find it in their GitHub)

Edit: found V2 and V3 subgraphs--will have to query these:

https://thegraph.com/hosted-service/subgraph/camelotlabs/camelot-amm

https://thegraph.com/hosted-service/subgraph/camelotlabs/camelot-amm

from od-sdk.

pi0neerpat avatar pi0neerpat commented on September 25, 2024

Focusing just on OD for now

contract systemCoinOracle.priceSource() returns UniV3Relayer 
contract UniV3Relayer.uniV3Pool() 
systemCoin.balanceOf(uniV3PoolAddress)
WETH.balanceOf(uniV3PoolAddress)
Total liquidity for the pool
WETH balance price of WETH 
OD balance = 1$
Sum (OD balance, WETH balance)

from od-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.