Skip to content

fira: read the UZR market's borrow rate from its own IRM instead of publishing 0 - #3260

Open
0xshubhs wants to merge 1 commit into
DefiLlama:masterfrom
0xshubhs:fira-uzr-borrow-apy
Open

0xshubhs wants to merge 1 commit into
DefiLlama:masterfrom
0xshubhs:fira-uzr-borrow-apy

Conversation

@0xshubhs

@0xshubhs 0xshubhs commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3259

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:

idToMarketParams(id) -> loanToken 0x73a15fed... (USD0), collateralToken 0x35d89493... (USD0++),
                        oracle 0x30da7835..., irm 0xdfcf197b0b65066183b04b88d50acdc0c4b01385,
                        ltv 0.88, lltv 0.9999
market(id)           -> totalSupplyAssets 445,874,522.59  totalBorrowAssets 424,476,018.44  fee 0
borrowRateView(...)  -> 0x1e3da5f = 3.1709791e-11 per second
toApyPercent(...)     = (e^(r * 31536000) - 1) * 100 = 0.10005001356532262

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.

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: slasher125

Merge Risk: Minimal · up to c187f

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: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 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 Passed 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 Passed 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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fira: the UZR market publishes apyBaseBorrow 0 on $424m of debt, its own IRM and api both say 0.10005%

1 participant