You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fira: read the UZR market's borrow rate from its own IRM instead of publishing 0 - #3260
getUzrPool() published apyBaseBorrow: 0 for the UZR market while the market charges 0.1%. The rate is
one call away, and it is the call this file already makes for every other market: idToMarketParams(id)
for the market params, then borrowRateView(marketParams, market) on the market's own IRM through getVariableBorrowRate(), then toApyPercent().
field
before
after
apyBaseBorrow
0
0.10005001356532262
mintedCoin
absent
USD0
mintedCoin is the second half. The borrower receives USD0 against USD0++ collateral, fira's own api
sets mintedCoin: USD0 for this market, and buildPool() sets it for every other market, so without it
the row reads as a same asset money market whose suppliers earn 1.47% while borrowers pay nothing.
where the number comes from
The market is 0xa428723eE8ffD87088C36121d72100B43F11fb6A, id 0xa597b5a3...340e, both already in CONFIG.ETHEREUM:
fira's own app.fira.money/api/apr/pools reports the same figure to every digit for its bUSD0-USD0
entry, "apyBaseBorrow":0.10005001356532262, which is the market this pool is.
testing
I could not get npm run test --adapter=fira to finish here, and it fails the same way on master, so
the failure is not from this change:
Error: Jest: Got error running globalSetup, reason: Failed to call: function borrowRateView(...)
target: 0x73C288826347af3718e6F09c2A24AaFDA77684cD params: 0xA0b86991...,0x00e2B6D1...,0x48F7E36E...
call reverted, reason: invalid BytesLike value (argument="value", value=null)
The failing market differs between runs, which points at a null marketStatesRes.output[i]?.output from
a rate limited public RPC rather than at a specific market: getVariableBorrowRate() hands that null
straight to the encoder, so permitFailure: true never gets a chance and the throw takes the whole
adapter down with it. In production a transient null would blank every fira pool for that run. I did not
touch it here because it is a different change; happy to send a guard for it if you want one.
So the verification above is the on-chain one: the three calls, run against mainnet, and fira's own api
agreeing on the number this change publishes.
Summary by CodeRabbit
New Features
UZR market details now include USD0 as the minted coin.
Borrow APY now reflects the market’s variable borrow rate instead of a fixed zero value.
No actionable comments were generated in the recent review.
Walkthrough
The UZR pool now reports borrow APY calculated from its market IRM instead of a fixed zero. The returned pool also sets mintedCoin to USD0.
Changes: UZR borrow APY
Layer / File(s)
Summary
Market rate and pool output src/adaptors/fira/index.js
getUzrPool fetches the UZR market parameters and calculates borrow APY from the IRM. The pool returns that rate and sets mintedCoin to USD0. The TODO comment now describes the carry-based apyBase and IRM-derived borrow APY.
The UZR pool now reports its borrow APY from the market's own rate model and sets the minted coin to USD0. No concrete merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title states the main change: the Fira UZR pool reads its borrow rate from the market's own IRM instead of publishing a hardcoded 0. This matches the raw summary (getVariableBorrowRate and toApyPe…
Linked Issues check
Issue #3259 has two coding requirements. (1) Publish a non-zero apyBaseBorrow for the UZR market from its own IRM. The diff at head adds an idToMarketParams call using UZRLendingMarketId (the id alrea…
Out of Scope Changes check
All changes in src/adaptors/fira/index.js are limited to getUzrPool(). They add the idToMarketParams call, compute apyBaseBorrow with the existing getVariableBorrowRate and toApyPercent helpers, and a…
Full details: Title check
Explanation
The title states the main change: the Fira UZR pool reads its borrow rate from the market's own IRM instead of publishing a hardcoded 0. This matches the raw summary (getVariableBorrowRate and toApyPercent replace the fixed apyBaseBorrow: 0) and the linked issue #3259. The title is specific, single-sentence, and free of file lists or vague wording. It omits the mintedCoin change, which is acceptable because the title need not cover every detail.
Full details: Linked Issues check
Explanation
Issue #3259 has two coding requirements. (1) Publish a non-zero apyBaseBorrow for the UZR market from its own IRM. The diff at head adds an idToMarketParams call using UZRLendingMarketId (the id already in CONFIG.ETHEREUM). It passes the returned params and the market state to getVariableBorrowRate(), the existing helper that calls borrowRateView on the market IRM. toApyPercent() converts the result. The hardcoded apyBaseBorrow: 0 is removed. (2) Set mintedCoin to USD0. The returned pool object now includes mintedCoin: 'USD0'. The change matches the issue's described approach. The PR description reports the on-chain value 0.10005001356532262, which is consistent with rate 3.1709791e-11 per second over 31536000 seconds. I did not execute the adapter. The PASS rests on reading the code, not on a test run. The test failure reported in the PR description is an environment issue and is not a requirement of this issue.
Full details: Out of Scope Changes check
Explanation
All changes in src/adaptors/fira/index.js are limited to getUzrPool(). They add the idToMarketParams call, compute apyBaseBorrow with the existing getVariableBorrowRate and toApyPercent helpers, and add mintedCoin. The TODO comment is reworded to note that the borrow side now uses the market IRM. The reworded comment is documentation for the same change. No changes touch buildPool(), the fixed or variable market paths, or other pools. The diff does not include unrelated work.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Fix failing CI checks
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 2687b71f-27fd-4661-95e4-716690ffe747
Commits
Reviewing files that changed from the base of the PR and between 0afc7f3 and c187fe3.
Files selected for processing: 1
src/adaptors/fira/index.js
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3259
getUzrPool()publishedapyBaseBorrow: 0for the UZR market while the market charges 0.1%. The rate isone call away, and it is the call this file already makes for every other market:
idToMarketParams(id)for the market params, then
borrowRateView(marketParams, market)on the market's own IRM throughgetVariableBorrowRate(), thentoApyPercent().apyBaseBorrowmintedCoinUSD0mintedCoinis the second half. The borrower receives USD0 against USD0++ collateral, fira's own apisets
mintedCoin: USD0for this market, andbuildPool()sets it for every other market, so without itthe row reads as a same asset money market whose suppliers earn 1.47% while borrowers pay nothing.
where the number comes from
The market is
0xa428723eE8ffD87088C36121d72100B43F11fb6A, id0xa597b5a3...340e, both already inCONFIG.ETHEREUM:fira's own
app.fira.money/api/apr/poolsreports the same figure to every digit for itsbUSD0-USD0entry,
"apyBaseBorrow":0.10005001356532262, which is the market this pool is.testing
I could not get
npm run test --adapter=firato finish here, and it fails the same way on master, sothe failure is not from this change:
The failing market differs between runs, which points at a null
marketStatesRes.output[i]?.outputfroma rate limited public RPC rather than at a specific market:
getVariableBorrowRate()hands that nullstraight to the encoder, so
permitFailure: truenever gets a chance and the throw takes the wholeadapter down with it. In production a transient null would blank every fira pool for that run. I did not
touch it here because it is a different change; happy to send a guard for it if you want one.
So the verification above is the on-chain one: the three calls, run against mainnet, and fira's own api
agreeing on the number this change publishes.
Summary by CodeRabbit