Add GLORB token price via Uniswap V4 StateView (Base)#11347
Add GLORB token price via Uniswap V4 StateView (Base)#11347glorbwtf wants to merge 1 commit intoDefiLlama:masterfrom
Conversation
Reads sqrtPriceX96 from Uniswap V4 StateView contract to derive GLORB/WETH price from the GLORB/WETH pool on Base. - Pool ID: 0x3dbf9db7...6746cd - StateView: 0xa3c0c9b6...7a71 - Price derived from tick via 1.0001^tick formula - Both tokens are 18 decimals, no decimal adjustment needed Verified: output matches DexScreener/GeckoTerminal ($0.00000026) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughA new GLORB adapter is introduced that queries a GLORB/WETH pool on Base blockchain, retrieves the current tick, computes the GLORB price relative to WETH, and returns the price data. The adapter is then integrated into the adapters map for export. Changes
Sequence DiagramsequenceDiagram
participant Client
participant GLORB Adapter
participant Base Chain
participant GLORB/WETH Pool
Client->>GLORB Adapter: glorb(timestamp)
GLORB Adapter->>GLORB Adapter: Construct getSlot0 ABI
GLORB Adapter->>Base Chain: Query pool state
Base Chain->>GLORB/WETH Pool: getSlot0()
GLORB/WETH Pool-->>Base Chain: Return slot0 data (tick)
Base Chain-->>GLORB Adapter: Receive tick
GLORB Adapter->>GLORB Adapter: Compute price = 1/1.0001^tick
GLORB Adapter->>GLORB Adapter: Build pricesObject {glorb: {underlying, price}}
GLORB Adapter-->>Client: Return writes array with results
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
There isnt enough liquidity for us to price GLORB using this pool |
Summary
getSlot0(poolId)to get the current tick, then derives price via1.0001^tickDetails
0xa26303226Baa2299adA8D573a6FcD792aB1CFB07)0x3dbf9db7ebb1e81fc0f1ddb24ad492acfc778b2ff8eb0d373176a9583b6746cd0xa3c0c9b65bad0b08107aa264b0f3db444b867a71Verification
Tested the RPC call locally — tick 228250 yields GLORB price of 1.22e-10 WETH, which at $2,128/ETH = $0.00000026, matching GeckoTerminal and DexScreener.
Related
Summary by CodeRabbit
Release Notes