kerne-usd: resolve kUSD (id 402) price from USDC instead of hardcoding it - #871
kerne-usd: resolve kUSD (id 402) price from USDC instead of hardcoding it#871enerzy17 wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthrough
ChangesPrice mapping
Estimated code review effort: 1 (Trivial) | ~2 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
hey @enerzy17 will KUSD have a coingecko listing? this would be a much better option than hardcoding the price |
|
Yes, a CoinGecko listing is the plan, but I cannot submit one honestly yet. CG requires live trading with real liquidity and volume, and kUSD does not have that today. The audit engagement with Hexens is signed with the report due in the coming weeks, and the plan is to seed real liquidity once it lands, so the CG application goes in when it can actually clear their bar. The id 402 entry from #819 already carries gecko_id kerne-usd with onCoinGecko false for that reason. Once CG lists kUSD, this line gets deleted and the price resolves through the normal path, either the Base contract address on coins.llama.fi once CG indexes it, or with priceSource flipped to coingecko. On the interim number, kUSD mints and redeems 1:1 for USDC through an on-chain PSM, and reserves are published live at kerne.fi/api/por. Right now that shows 1,115.85 USDC held in the PSM against 1,114.74 kUSD outstanding, and the response includes the cast commands to recompute it from chain. If you would rather not carry a hardcode in the interim, pointing kerne-usd at USDC as an alias works for me too, or I can close this and come back once the CG listing is live. Whatever is easiest on your side. |
|
Following up on this one, since my last reply ended by handing you three options and no recommendation, which was not much help. On the mechanism, what I am asking for is the same shape as what that function already does. Being straight about what the 1 is: it is a par value backed by permissionless 1:1 USDC redemption through the on-chain PSM, not a market observed price. kUSD has no real secondary market yet, which is the same reason I am not submitting to CoinGecko. If you would rather the API never serve a par price, aliasing kerne-usd to USDC gets the same result through a live feed and I can push that commit today. Alias, or the hardcode as it stands, whichever you prefer? If neither, close it and I will come back once CoinGecko lists us. I mostly did not want to leave it sitting on you with no decision in it. |
Replaces the hardcode this PR originally proposed. kUSD (id 402) reads price: null because coins.llama.fi returns nothing for base:0x5C2EfdF0D8D286959b42308966bc2B97f5680AA3, so the asset has no price on the stablecoins list or on its detail page. Rather than pin it to 1, this reads the USDC price already fetched in the same call. kUSD is minted and redeemed 1:1 for USDC through a permissionless on-chain PSM on Base, so what a holder can redeem is a USDC claim, and the reported price now tracks USDC's own deviation instead of asserting a constant. If USDC does not resolve, kUSD stays unpriced rather than falling back to a hardcoded value. Verified against the live prices call with the full pegged asset list: usd-coin 0.9998355475266617, kerne-usd 0.9998355475266617.
c41a585 to
9bc62f0
Compare
kUSD (peggedasset id 402, added in #819) is a USDC-backed stablecoin on Base. It is minted and redeemed 1:1 against USDC through an on-chain Peg Stability Module.
#863 fixed the chain prefix so the balance is now read on Base, and that merged, but the price still resolves null: coins.llama.fi returns no entry for
base:0x5C2EfdF0D8D286959b42308966bc2B97f5680AA3and the gecko_idkerne-usddoes not exist, so api.llama.fi shows kUSD with a null price on the stablecoins board.This is the one-line follow-up I offered in #863: hardcode
finalRes["kerne-usd"] = 1, directly beside the existingfinalRes["m-2"] = 1precedent in the same file, so the peg reads 1.00. Because kUSD is 1:1 USDC redeemable through the PSM, 1.00 is the correct pegged price.If you would rather point the price at USDC through a coins alias instead of hardcoding, I am happy to do that instead. No rush on either.
Summary by CodeRabbit