Comments (2)
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.
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)
- TVL project: Add dev & user deposit flow to deployment spell book HOT 1
- Enable multiple pools HOT 1
- Fetch market price using web3 HOT 1
- Fetch market price using web2 HOT 1
- Update mainnet collateral addresses HOT 1
- HAI Optimism tweaks HOT 1
- Hide warnings for duplicate definition HOT 2
- OP <-> Arbitrum Sepolia Integration Bugs
- Walletconnect domains check HOT 1
- Fix proxy-action.ts network routing logic HOT 3
- Implement NitroPools for Staking
- Get user deposit details HOT 1
- Enable multicall when wallet is not connected HOT 1
- Add spNFT balances
- Update camelot query to use API
- Add ETH oracle address to SDK
- Include internal balance in virtualUserSafes
- Testing internal balances HOT 2
- Add claim internal balance function
- Bring token icons to the SDK from app
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from od-sdk.