Skip to content

add monolith-market saving vaults & cdp markets#2660

Open
webmass wants to merge 6 commits into
DefiLlama:masterfrom
webmass:add-monolith-market-yields
Open

add monolith-market saving vaults & cdp markets#2660
webmass wants to merge 6 commits into
DefiLlama:masterfrom
webmass:add-monolith-market-yields

Conversation

@webmass
Copy link
Copy Markdown
Contributor

@webmass webmass commented May 7, 2026

Summary by CodeRabbit

  • New Features
    • Introduced Monolith Market protocol adapter with real-time APY metrics for lending markets and savings vaults, including TVL calculations and collateral factor tracking across supported chains.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR introduces a new adapter for the Monolith Market protocol. It defines contract ABIs for Lender, Lens, and Vault; queries Factory events to discover pools; multicalls to gather rates, balances, and pricing; and builds CDP lending and savings vault market objects with computed TVL and APY metrics.

Changes

Monolith Market Adaptor Implementation

Layer / File(s) Summary
Contract ABIs
src/adaptors/monolith-market/lenderAbi.ts, lensAbi.ts, vaultAbi.ts
Lender contract ABI exports constructor, view/transaction functions for pricing and position management, and events; Lens ABI exports eight view functions for rates, debts, and interest queries; Vault ABI exports ERC4626-style deposit/withdraw/preview methods and permit support.
Configuration and Helpers
src/adaptors/monolith-market/index.js (lines 1–16)
FACTORIES mapping for Ethereum, PROJECT constant, and simpleCalls helper function to shape multicall descriptors with permitFailure flag.
Pool Discovery and Aggregation
src/adaptors/monolith-market/index.js (lines 17–151)
getChainPools() fetches latest block, reads Factory Deployed events, and multicalls Lens/Lender/Vault/ERC20 contracts to gather rates, debt totals, collateral deposits, vault assets, and ERC20 metadata. USD price service fetches coin and collateral prices. Data is transformed into CDP lending market objects (tvlUsd from collateral value, totalBorrowUsd from debt, borrow APY from lens rates) and savings vault market objects (tvlUsd from asset balance, APY from vault rate component). Results are concatenated and filtered with keepFinite.
Adaptor Entry Point & Export
src/adaptors/monolith-market/index.js (lines 153–167)
Main apy() function iterates all configured chains, aggregates getChainPools() results, flattens pool arrays, and exports adapter metadata with timetravel: false and protocol URL.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • 0xkr3p

Poem

🐰 A market emerges where lenders and vaults unite,
Monolith's ABIs gleam bright in the blockchain light,
Multicalls gather secrets from Factory's eyes,
CDP and savings dance as TVL and APY rise!
Three ABI friends hop forth to compute the yield's true prize. 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding support for monolith-market saving vaults and CDP markets, which aligns with the new adapter implementation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@webmass webmass force-pushed the add-monolith-market-yields branch 5 times, most recently from 2ddbdce to 861ecd7 Compare May 8, 2026 06:33
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (1)
src/adaptors/monolith-market/index.js (1)

133-148: ⚡ Quick win

Avoid hardcoding 'Ethereum' and chainId 1 in pool fields/URLs.

getChainPools already receives chain and resolves chainId from FACTORIES[chain] (line 49 — though chainId is currently unused). Hardcoding will silently produce wrong values the moment a second chain is added to FACTORIES. Use the resolved chain/chainId here and in the savings vault block (lines 160 & 166).

🛠️ Proposed fix
     return {
       pool: `monolith-market-lending-${m}`,
-      chain: 'Ethereum',
+      chain: utils.formatChain(chain),
       project: PROJECT,
       symbol: collateralSymbol,
       mintedCoin,
       tvlUsd: totalSupplyUsd - totalBorrowUsd,
       underlyingTokens: [collateral],
-      url: 'https://app.monolith.market/1/coin/' + marketIndex,
+      url: `https://app.monolith.market/${chainId}/coin/${marketIndex}`,

Apply the same change to the savings vault object on lines 160 and 166.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/adaptors/monolith-market/index.js` around lines 133 - 148, The pool
objects returned in getChainPools are hardcoding 'Ethereum' and the chainId 1 in
the URL; update the returned object to use the resolved chain variable (use the
function parameter/variable named chain) for the chain property and use the
resolved chainId (from FACTORIES[chain] or the local chainId variable already
computed) in the URL (replace '/1/' with `/${chainId}/`); also make the same
replacements in the savings vault object referenced around the savings vault
block (the same returned object structure near lines 160/166) so both pool and
savings vault use dynamic chain and chainId values instead of hardcoded ones.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/adaptors/monolith-market/index.js`:
- Line 139: The tvlUsd calculation currently uses "tvlUsd: totalSupplyUsd -
totalBorrowUsd", which undercounts collateral for CDP-style markets and can
become negative; change tvlUsd to reflect collateral only (assign "tvlUsd" =
totalSupplyUsd) for CDP markets and keep totalSupplyUsd and totalBorrowUsd as
separate fields so downstream consumers can compute net positions if needed;
update the assignment where "tvlUsd", "totalSupplyUsd", and "totalBorrowUsd" are
constructed (the tvlUsd property in the same object) and, if needed, add a clear
comment indicating this is collateral-only for CDP adapters.
- Line 94: The multicall is using lensAbi.find('getCollateralPrice') but that
method is not in lensAbi and returns undefined; update the sdk.api.abi.multiCall
invocation to use the correct ABI that contains getCollateralPrice (the lender
ABI) — i.e., replace the lensAbi lookup with lenderAbi.find(a => a.name ===
'getCollateralPrice') or import/ensure lenderAbi is used where
sdk.api.abi.multiCall({ ..., abi: ... , calls: lenders }) is called so the calls
targeting lenders use the correct ABI.
- Around line 158-170: The returned savings vault object contains a duplicated
key tvlUsd (assigned twice); remove the redundant tvlUsd assignment so
totalSupplyUsd is only set once, and simplify the loop by iterating over the
vaults array directly instead of using lenders to derive marketIndex — update
the loop to for (let marketIndex = 0; marketIndex < vaults.length;
marketIndex++) (or equivalent), keeping the rest of the fields (pool, chain,
project, symbol/vaultSymbol, totalSupplyUsd, apyBase/stakingApr,
underlyingTokens/[underlying], url, borrowable) unchanged and referenced by
their existing names (vaults, lenders, marketIndex, vaultSymbol, underlying,
totalSupplyUsd, stakingApr).
- Around line 17-24: The function getPrices references superagent but the module
isn’t imported, causing a ReferenceError; fix by adding the appropriate import
for superagent at the top of the file (or replace the superagent call inside
getPrices with the project-preferred HTTP client such as axios/fetch) and ensure
the call signature and response access (body.coins) match the chosen client;
update getPrices to use the imported client so superagent is no longer
undefined.
- Around line 64-66: Remove the debug console.log calls that will spam
production logs: delete the console.log lines printing 'lenders', 'coins',
'vaults' and the later console.log('vaultSymbols', ...) in
src/adaptors/monolith-market/index.js so no temporary debug output remains;
search for those exact strings (console.log('lenders', lenders),
console.log('coins', coins), console.log('vaults', vaults),
console.log('vaultSymbols', ...)) and remove them or replace with an appropriate
logger at debug level if needed.
- Around line 119-148: Replace the undefined identifiers and normalize token
addresses when looking up prices: use coinSymbols[marketIndex] instead of
mintedSymbols, compute coinPriceUsd from
pricesByAddress[coins[marketIndex].toLowerCase()] and use oracle fallback from
collaterals[marketIndex].toLowerCase() for collateralPriceUsd; ensure you
.toLowerCase() when indexing pricesByAddress in the CDP loop (and mirror the
same lowercase lookup in the savings vault loop), and verify whether borrowApr
from rates[marketIndex][0] is already an APR or a per-second rate so you can
keep or adjust the apyBaseBorrow conversion (currently Number(borrowApr)/1e16)
accordingly.

---

Nitpick comments:
In `@src/adaptors/monolith-market/index.js`:
- Around line 133-148: The pool objects returned in getChainPools are hardcoding
'Ethereum' and the chainId 1 in the URL; update the returned object to use the
resolved chain variable (use the function parameter/variable named chain) for
the chain property and use the resolved chainId (from FACTORIES[chain] or the
local chainId variable already computed) in the URL (replace '/1/' with
`/${chainId}/`); also make the same replacements in the savings vault object
referenced around the savings vault block (the same returned object structure
near lines 160/166) so both pool and savings vault use dynamic chain and chainId
values instead of hardcoded ones.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9c37c458-6f09-4257-bdd3-04e9ad916fc0

📥 Commits

Reviewing files that changed from the base of the PR and between d78ab8a and 861ecd7.

📒 Files selected for processing (3)
  • src/adaptors/monolith-market/index.js
  • src/adaptors/monolith-market/lenderAbi.ts
  • src/adaptors/monolith-market/lensAbi.ts

Comment thread src/adaptors/monolith-market/index.js Outdated
Comment thread src/adaptors/monolith-market/index.js Outdated
Comment thread src/adaptors/monolith-market/index.js Outdated
Comment thread src/adaptors/monolith-market/index.js
Comment thread src/adaptors/monolith-market/index.js Outdated
Comment thread src/adaptors/monolith-market/index.js
@webmass webmass force-pushed the add-monolith-market-yields branch from 861ecd7 to 7548e51 Compare May 8, 2026 07:37
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (4)
src/adaptors/monolith-market/index.js (4)

145-145: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

tvlUsd: totalSupplyUsd - totalBorrowUsd can go negative.

When totalBorrowUsd > totalSupplyUsd (possible with price volatility or oracle lag), TVL turns negative and keepFinite silently drops the pool. For CDP markets the conventional TVL is the locked collateral value; subtracting the debt is atypical and risky. See Maker/Liquity adapters in this repo for reference.

🛠️ Proposed fix
-      tvlUsd: totalSupplyUsd - totalBorrowUsd,
+      tvlUsd: totalSupplyUsd,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/adaptors/monolith-market/index.js` at line 145, The tvlUsd calculation
currently uses tvlUsd: totalSupplyUsd - totalBorrowUsd which can produce
negative values and cause keepFinite to drop the pool; update the logic in the
tvlUsd assignment (where tvlUsd, totalSupplyUsd and totalBorrowUsd are computed)
to avoid negatives — for CDP-style markets set tvlUsd to the locked/total
collateral value (e.g., use the existing lockedCollateralUsd/totalCollateralUsd
field if present) and otherwise clamp the value to a non-negative number (e.g.,
replace the subtraction with a max(..., 0) semantics) before passing it on to
keepFinite. Ensure you only change the tvlUsd expression and leave other metrics
untouched.

128-133: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

coinPriceUsd uses wrong address; both lookups miss due to address case mismatch.

Two bugs remain from the previous review:

  1. Line 128coinPriceUsd looks up pricesByAddress[collateral] (the collateral address) when it should look up the minted coin's address (coins[marketIndex]). This causes totalBorrowUsd to always be 0.
  2. Lines 128 & 133pricesByAddress keys are lowercase (the API call lowercases the input URL), but collateral and coins[marketIndex] are checksummed EVM addresses from event log args, so all lookups silently return undefined.
🛠️ Proposed fix
-    const coinPriceUsd = pricesByAddress[collateral] || 0;
+    const coinAddress = coins[marketIndex].toLowerCase();
+    const coinPriceUsd = pricesByAddress[coinAddress] || 0;
 
     const { price: oraclePrice } = collateralsPriceData[marketIndex];
     const oraclePriceUsd = (Number(oraclePrice) / (10 ** (36 - collateralDecimal))) || 0;
     // use defillama if available otherwise fallback to oracle price
-    const collateralPriceUsd = pricesByAddress[collateral] || oraclePriceUsd;
+    const collateralPriceUsd = pricesByAddress[collateral.toLowerCase()] || oraclePriceUsd;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/adaptors/monolith-market/index.js` around lines 128 - 133, coinPriceUsd
is using the wrong key and both price lookups suffer from checksum vs lowercase
mismatch: change the coin lookup to use coins[marketIndex] (not collateral) and
normalize addresses to lowercase when indexing pricesByAddress (e.g.,
pricesByAddress[coins[marketIndex].toLowerCase()] and
pricesByAddress[collateral.toLowerCase()]) so both coinPriceUsd and
collateralPriceUsd correctly read DeFiLlama data (keep oraclePriceUsd fallback
logic via collateralsPriceData[marketIndex] unchanged).

171-179: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Duplicate tvlUsd key still present in savings vault object.

tvlUsd is assigned on line 171 and again on line 178; the second silently overwrites the first. Biome flags this as noDuplicateObjectKeys. Additionally, apy (line 172) is a non-standard DefiLlama field — apyBase on line 173 is the correct canonical field; the extra apy key can be dropped.

🛠️ Proposed fix
     return {
       pool: `monolith-market-savings-${vaults[marketIndex]}`,
       chain: 'Ethereum',
       project: PROJECT,
       symbol: vaultSymbol,
       tvlUsd: totalSupplyUsd,
-      apy: apy,
       apyBase: apy,
       apyReward: 0,
       underlyingTokens: [underlying],
       url: 'https://app.monolith.market/1/coin/' + marketIndex,
       totalSupplyUsd,
-      tvlUsd: totalSupplyUsd,
       borrowable: false,
     };
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/adaptors/monolith-market/index.js` around lines 171 - 179, Remove the
duplicate tvlUsd key and the non-standard apy field from the savings vault
object: keep a single tvlUsd assignment (e.g., tvlUsd: totalSupplyUsd) and
retain apyBase and apyReward as the canonical DefiLlama fields; delete the
second tvlUsd line and the apy line so the object contains tvlUsd, apyBase,
apyReward, underlyingTokens, url, totalSupplyUsd, and borrowable only once each.

161-161: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Savings vault coinPriceUsd lookup uses checksummed address — same mismatch as CDP loop.

underlying = coins[marketIndex] is a checksummed address from the event log. pricesByAddress keys are lowercase, so this lookup will always return undefined, making totalSupplyUsd always 0 for all savings vaults.

🛠️ Proposed fix
-    const coinPriceUsd = pricesByAddress[underlying] || 0;
+    const coinPriceUsd = pricesByAddress[underlying.toLowerCase()] || 0;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/adaptors/monolith-market/index.js` at line 161, The lookup for
coinPriceUsd uses a checksummed address (underlying from coins[marketIndex]) but
pricesByAddress keys are lowercase, so change the lookup to use a normalized
lowercase key (e.g., use underlying.toLowerCase()) when accessing
pricesByAddress in the savings vault logic (the expression that sets
coinPriceUsd and subsequently totalSupplyUsd); ensure the normalized lookup
still falls back to 0 if missing.
🧹 Nitpick comments (1)
src/adaptors/monolith-market/index.js (1)

10-10: ⚡ Quick win

Remove unused path import.

path is required but never referenced anywhere in the file.

🧹 Proposed fix
-const path = require('path');
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/adaptors/monolith-market/index.js` at line 10, Remove the unused import
by deleting the top-level require for the symbol `path` (the const path =
require('path') statement) since `path` is never referenced; ensure no other
code depends on `path` in this module and run lint/tests to confirm there are no
remaining references.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/adaptors/monolith-market/index.js`:
- Around line 150-151: The apyBase field is incorrectly set to the borrow rate;
for CDP collateral positions suppliers earn nothing, so change the object where
apyBase and apyBaseBorrow are assigned (look for apyBase: borrowApy,
apyBaseBorrow: borrowApy) to set apyBase to 0 and keep apyBaseBorrow as
borrowApy so depositors show 0% and borrowers show the borrow rate.

---

Duplicate comments:
In `@src/adaptors/monolith-market/index.js`:
- Line 145: The tvlUsd calculation currently uses tvlUsd: totalSupplyUsd -
totalBorrowUsd which can produce negative values and cause keepFinite to drop
the pool; update the logic in the tvlUsd assignment (where tvlUsd,
totalSupplyUsd and totalBorrowUsd are computed) to avoid negatives — for
CDP-style markets set tvlUsd to the locked/total collateral value (e.g., use the
existing lockedCollateralUsd/totalCollateralUsd field if present) and otherwise
clamp the value to a non-negative number (e.g., replace the subtraction with a
max(..., 0) semantics) before passing it on to keepFinite. Ensure you only
change the tvlUsd expression and leave other metrics untouched.
- Around line 128-133: coinPriceUsd is using the wrong key and both price
lookups suffer from checksum vs lowercase mismatch: change the coin lookup to
use coins[marketIndex] (not collateral) and normalize addresses to lowercase
when indexing pricesByAddress (e.g.,
pricesByAddress[coins[marketIndex].toLowerCase()] and
pricesByAddress[collateral.toLowerCase()]) so both coinPriceUsd and
collateralPriceUsd correctly read DeFiLlama data (keep oraclePriceUsd fallback
logic via collateralsPriceData[marketIndex] unchanged).
- Around line 171-179: Remove the duplicate tvlUsd key and the non-standard apy
field from the savings vault object: keep a single tvlUsd assignment (e.g.,
tvlUsd: totalSupplyUsd) and retain apyBase and apyReward as the canonical
DefiLlama fields; delete the second tvlUsd line and the apy line so the object
contains tvlUsd, apyBase, apyReward, underlyingTokens, url, totalSupplyUsd, and
borrowable only once each.
- Line 161: The lookup for coinPriceUsd uses a checksummed address (underlying
from coins[marketIndex]) but pricesByAddress keys are lowercase, so change the
lookup to use a normalized lowercase key (e.g., use underlying.toLowerCase())
when accessing pricesByAddress in the savings vault logic (the expression that
sets coinPriceUsd and subsequently totalSupplyUsd); ensure the normalized lookup
still falls back to 0 if missing.

---

Nitpick comments:
In `@src/adaptors/monolith-market/index.js`:
- Line 10: Remove the unused import by deleting the top-level require for the
symbol `path` (the const path = require('path') statement) since `path` is never
referenced; ensure no other code depends on `path` in this module and run
lint/tests to confirm there are no remaining references.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0284cd8c-6a8b-4c9b-b8af-f3588b60e228

📥 Commits

Reviewing files that changed from the base of the PR and between 861ecd7 and 7548e51.

📒 Files selected for processing (5)
  • src/adaptors/monolith-market/factoryAbi.ts
  • src/adaptors/monolith-market/index.js
  • src/adaptors/monolith-market/lenderAbi.ts
  • src/adaptors/monolith-market/lensAbi.ts
  • src/adaptors/monolith-market/vaultAbi.ts
✅ Files skipped from review due to trivial changes (4)
  • src/adaptors/monolith-market/lensAbi.ts
  • src/adaptors/monolith-market/factoryAbi.ts
  • src/adaptors/monolith-market/vaultAbi.ts
  • src/adaptors/monolith-market/lenderAbi.ts

Comment thread src/adaptors/monolith-market/index.js Outdated
@webmass webmass force-pushed the add-monolith-market-yields branch from 7548e51 to eca3a7b Compare May 8, 2026 07:48
@webmass webmass force-pushed the add-monolith-market-yields branch from eca3a7b to 78fa94b Compare May 8, 2026 07:54
Copy link
Copy Markdown
Contributor

@0xkr3p 0xkr3p left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @webmass thanks for the PR! pls refactor to use the defillama sdk instead of alchemy with environment variables, this is why the test is failing. Once refactored I will review fully.

@webmass webmass force-pushed the add-monolith-market-yields branch from cc4e139 to 9a05310 Compare May 14, 2026 13:00
@webmass webmass force-pushed the add-monolith-market-yields branch from 9a05310 to 72bb888 Compare May 14, 2026 13:08
@github-actions
Copy link
Copy Markdown

The monolith-market adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 36 passed, 36 total
Snapshots: 0 total
Time: 0.308 s
Ran all test suites.

Nb of pools: 4
 

Sample pools:
┌─────────┬──────────────────────────────────────────────────────────────────────┬────────────┬───────────────────┬───────────┬────────────┬────────────────────┬───────────────────┬──────────────────────────────────────────────────┬────────────────────────────────────────┬───────────────────┬────────────────────┬────────────────────┬────────────┬──────┐
│ (index) │ pool                                                                 │ chain      │ project           │ symbol    │ mintedCoin │ apyBase            │ tvlUsd            │ underlyingTokens                                 │ url                                    │ totalSupplyUsd    │ totalBorrowUsd     │ apyBaseBorrow      │ borrowable │ ltv  │
├─────────┼──────────────────────────────────────────────────────────────────────┼────────────┼───────────────────┼───────────┼────────────┼────────────────────┼───────────────────┼──────────────────────────────────────────────────┼────────────────────────────────────────┼───────────────────┼────────────────────┼────────────────────┼────────────┼──────┤
│ 0       │ 'monolith-market-lending-0xf8b349da9244253288f6853835e6582955fd49c9' │ 'Ethereum' │ 'monolith-market' │ 'sINV'    │ 'invUSD'   │ 0                  │ 64316.31822099457 │ [ '0x08d23468A467d2bb86FaE0e32F247A26C7E2e994' ] │ 'https://app.monolith.market/1/coin/0' │ 64316.31822099457 │ 22078.788242300416 │ 11.512170940299683 │ true       │ 0.65 │
│ 1       │ 'monolith-market-savings-0x3ff361197036ae1d24b939146d8a449a80f8427d' │ 'Ethereum' │ 'monolith-market' │ 'sinvUSD' │            │ 11.512170940299683 │ 70.17689194378887 │ [ '0x5377680b5986296aa4f9e684e5315a4f24832e56' ] │ 'https://app.monolith.market/1/coin/0' │ 70.17689194378887 │                    │                    │ false      │      │
│ 2       │ 'monolith-market-lending-0x0e538766693d536179e3105e686b9bee1957b8e3' │ 'Ethereum' │ 'monolith-market' │ 'XAUt'    │ 'GUSD'     │ 0                  │ 0                 │ [ '0x68749665FF8D2d112Fa859AA293F07A622782F38' ] │ 'https://app.monolith.market/1/coin/1' │ 0                 │ 0                  │ 61307.70874996349  │ true       │ 0.85 │
│ 3       │ 'monolith-market-savings-0x47a3d646a6de73fbcef16bd0d4b54a6c08ec39cf' │ 'Ethereum' │ 'monolith-market' │ 'sGUSD'   │            │ 0                  │ 0                 │ [ '0x525dbe23821fc2d26b126df1c2d7a5a1b8cfdeff' ] │ 'https://app.monolith.market/1/coin/1' │ 0                 │                    │                    │ false      │      │
└─────────┴──────────────────────────────────────────────────────────────────────┴────────────┴───────────────────┴───────────┴────────────┴────────────────────┴───────────────────┴──────────────────────────────────────────────────┴────────────────────────────────────────┴───────────────────┴────────────────────┴────────────────────┴────────────┴──────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

@webmass
Copy link
Copy Markdown
Contributor Author

webmass commented May 14, 2026

hi @webmass thanks for the PR! pls refactor to use the defillama sdk instead of alchemy with environment variables, this is why the test is failing. Once refactored I will review fully.

Hey,
Code refactored using the sdk, though I didn't see any other projects in the repo using that for events, using the sdk is kinda raw for events from what I see, but yeah it works.

@github-actions
Copy link
Copy Markdown

The monolith-market adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 36 passed, 36 total
Snapshots: 0 total
Time: 0.306 s
Ran all test suites.

Nb of pools: 4
 

Sample pools:
┌─────────┬──────────────────────────────────────────────────────────────────────┬────────────┬───────────────────┬───────────┬────────────┬────────────────────┬────────────────────┬──────────────────────────────────────────────────┬────────────────────────────────────────┬────────────────────┬────────────────────┬────────────────────┬────────────┬──────┐
│ (index) │ pool                                                                 │ chain      │ project           │ symbol    │ mintedCoin │ apyBase            │ tvlUsd             │ underlyingTokens                                 │ url                                    │ totalSupplyUsd     │ totalBorrowUsd     │ apyBaseBorrow      │ borrowable │ ltv  │
├─────────┼──────────────────────────────────────────────────────────────────────┼────────────┼───────────────────┼───────────┼────────────┼────────────────────┼────────────────────┼──────────────────────────────────────────────────┼────────────────────────────────────────┼────────────────────┼────────────────────┼────────────────────┼────────────┼──────┤
│ 0       │ 'monolith-market-lending-0xf8b349da9244253288f6853835e6582955fd49c9' │ 'Ethereum' │ 'monolith-market' │ 'sINV'    │ 'invUSD'   │ 0                  │ 64645.788132849135 │ [ '0x08d23468A467d2bb86FaE0e32F247A26C7E2e994' ] │ 'https://app.monolith.market/1/coin/0' │ 64645.788132849135 │ 22078.788242300416 │ 11.543297233536286 │ true       │ 0.65 │
│ 1       │ 'monolith-market-savings-0x3ff361197036ae1d24b939146d8a449a80f8427d' │ 'Ethereum' │ 'monolith-market' │ 'sinvUSD' │            │ 11.543297233536286 │ 70.17743299041976  │ [ '0x5377680b5986296aa4f9e684e5315a4f24832e56' ] │ 'https://app.monolith.market/1/coin/0' │ 70.17743299041976  │                    │                    │ false      │      │
│ 2       │ 'monolith-market-lending-0x0e538766693d536179e3105e686b9bee1957b8e3' │ 'Ethereum' │ 'monolith-market' │ 'XAUt'    │ 'GUSD'     │ 0                  │ 0                  │ [ '0x68749665FF8D2d112Fa859AA293F07A622782F38' ] │ 'https://app.monolith.market/1/coin/1' │ 0                  │ 0                  │ 64957.64339734211  │ true       │ 0.85 │
│ 3       │ 'monolith-market-savings-0x47a3d646a6de73fbcef16bd0d4b54a6c08ec39cf' │ 'Ethereum' │ 'monolith-market' │ 'sGUSD'   │            │ 0                  │ 0                  │ [ '0x525dbe23821fc2d26b126df1c2d7a5a1b8cfdeff' ] │ 'https://app.monolith.market/1/coin/1' │ 0                  │                    │                    │ false      │      │
└─────────┴──────────────────────────────────────────────────────────────────────┴────────────┴───────────────────┴───────────┴────────────┴────────────────────┴────────────────────┴──────────────────────────────────────────────────┴────────────────────────────────────────┴────────────────────┴────────────────────┴────────────────────┴────────────┴──────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

Comment thread src/adaptors/monolith-market/index.js Outdated

const { factory, chainId, lens, blocksPerYear, fromBlock } = FACTORIES[chain];

const logsRawData = await sdk.api.util.getLogs({
Copy link
Copy Markdown
Contributor

@0xkr3p 0xkr3p May 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should use sdk.getEventLogs its the more common pattern across the codebase, something like this:

const logs = await sdk.getEventLogs({
    target: factory,
    fromBlock,
    toBlock,
    chain,
    eventAbi: 'event Deployed(address indexed lender, address indexed coin,
  address indexed vault)',
  });
  const lenders = logs.map((l) => l.args.lender);
  const coins   = logs.map((l) => l.args.coin);
  const vaults  = logs.map((l) => l.args.vault);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should use sdk.getEventLogs its the more common pattern across the codebase, something like this:

const logs = await sdk.getEventLogs({
    target: factory,
    fromBlock,
    toBlock,
    chain,
    eventAbi: 'event Deployed(address indexed lender, address indexed coin,
  address indexed vault)',
  });
  const lenders = logs.map((l) => l.args.lender);
  const coins   = logs.map((l) => l.args.coin);
  const vaults  = logs.map((l) => l.args.vault);

Done, function undefined locally somehow but works with the pipeline here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0xkr3p anything else?

@github-actions
Copy link
Copy Markdown

Error while running monolith-market adapter:

Test Suites: 1 failed, 1 total
Tests: 2 failed, 36 passed, 38 total
Snapshots: 0 total
Time: 0.317 s
Ran all test suites.

Nb of pools: 4
 

Sample pools:
┌─────────┬──────────────────────────────────────────────────────────────────────┬────────────┬───────────────────┬───────────┬────────────┬────────────────────┬───────────────────┬──────────────────────────────────────────────────┬────────────────────────────────────────┬───────────────────┬────────────────────┬────────────────────┬────────────┬──────┐
│ (index) │ pool                                                                 │ chain      │ project           │ symbol    │ mintedCoin │ apyBase            │ tvlUsd            │ underlyingTokens                                 │ url                                    │ totalSupplyUsd    │ totalBorrowUsd     │ apyBaseBorrow      │ borrowable │ ltv  │
├─────────┼──────────────────────────────────────────────────────────────────────┼────────────┼───────────────────┼───────────┼────────────┼────────────────────┼───────────────────┼──────────────────────────────────────────────────┼────────────────────────────────────────┼───────────────────┼────────────────────┼────────────────────┼────────────┼──────┤
│ 0       │ 'monolith-market-lending-0xf8B349dA9244253288f6853835e6582955FD49c9' │ 'Ethereum' │ 'monolith-market' │ 'sINV'    │ 'invUSD'   │ 0                  │ 88377.01192790047 │ [ '0x08d23468A467d2bb86FaE0e32F247A26C7E2e994' ] │ 'https://app.monolith.market/1/coin/0' │ 88377.01192790047 │ 34025.535210586124 │ 11.734990861075346 │ true       │ 0.65 │
│ 1       │ 'monolith-market-savings-0x3FF361197036Ae1d24B939146D8a449A80F8427d' │ 'Ethereum' │ 'monolith-market' │ 'sinvUSD' │            │ 11.734990861075346 │ 2500.809255683676 │ [ '0x5377680B5986296AA4F9e684e5315a4F24832e56' ] │ 'https://app.monolith.market/1/coin/0' │ 2500.809255683676 │                    │                    │ false      │      │
│ 2       │ 'monolith-market-lending-0x0e538766693d536179e3105E686B9BeE1957b8E3' │ 'Ethereum' │ 'monolith-market' │ 'XAUt'    │ 'GUSD'     │ 0                  │ 0                 │ [ '0x68749665FF8D2d112Fa859AA293F07A622782F38' ] │ 'https://app.monolith.market/1/coin/1' │ 0                 │ 0                  │ 8660338310410.145  │ true       │ 0.85 │
│ 3       │ 'monolith-market-savings-0x47a3d646A6dE73fbcEF16bD0d4B54A6C08Ec39cf' │ 'Ethereum' │ 'monolith-market' │ 'sGUSD'   │            │ 0                  │ 0                 │ [ '0x525dBE23821Fc2D26B126DF1c2d7A5a1b8CFDeff' ] │ 'https://app.monolith.market/1/coin/1' │ 0                 │                    │                    │ false      │      │
└─────────┴──────────────────────────────────────────────────────────────────────┴────────────┴───────────────────┴───────────┴────────────┴────────────────────┴───────────────────┴──────────────────────────────────────────────────┴────────────────────────────────────────┴───────────────────┴────────────────────┴────────────────────┴────────────┴──────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

@github-actions
Copy link
Copy Markdown

The monolith-market adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 40 passed, 40 total
Snapshots: 0 total
Time: 0.281 s
Ran all test suites.

Nb of pools: 4
 

Sample pools:
┌─────────┬──────────────────────────────────────────────────────────────────────┬────────────┬───────────────────┬───────────┬────────────┬──────────────────────────────────────────────┬────────────────────┬────────────────────┬──────────────────────────────────────────────────┬────────────────────────────────────────┬────────────────────┬────────────────────┬────────────────────┬────────────┬──────┐
│ (index) │ pool                                                                 │ chain      │ project           │ symbol    │ mintedCoin │ borrowToken                                  │ apyBase            │ tvlUsd             │ underlyingTokens                                 │ url                                    │ totalSupplyUsd     │ totalBorrowUsd     │ apyBaseBorrow      │ borrowable │ ltv  │
├─────────┼──────────────────────────────────────────────────────────────────────┼────────────┼───────────────────┼───────────┼────────────┼──────────────────────────────────────────────┼────────────────────┼────────────────────┼──────────────────────────────────────────────────┼────────────────────────────────────────┼────────────────────┼────────────────────┼────────────────────┼────────────┼──────┤
│ 0       │ 'monolith-market-lending-0xf8B349dA9244253288f6853835e6582955FD49c9' │ 'Ethereum' │ 'monolith-market' │ 'sINV'    │ 'invUSD'   │ '0x5377680B5986296AA4F9e684e5315a4F24832e56' │ 0                  │ 88377.01192790047  │ [ '0x08d23468A467d2bb86FaE0e32F247A26C7E2e994' ] │ 'https://app.monolith.market/1/coin/0' │ 88377.01192790047  │ 34025.535210586124 │ 11.734990861075346 │ true       │ 0.65 │
│ 1       │ 'monolith-market-savings-0x3FF361197036Ae1d24B939146D8a449A80F8427d' │ 'Ethereum' │ 'monolith-market' │ 'sinvUSD' │            │                                              │ 11.734990861075346 │ 2500.8127399395717 │ [ '0x5377680B5986296AA4F9e684e5315a4F24832e56' ] │ 'https://app.monolith.market/1/coin/0' │ 2500.8127399395717 │                    │                    │ false      │      │
│ 2       │ 'monolith-market-lending-0x0e538766693d536179e3105E686B9BeE1957b8E3' │ 'Ethereum' │ 'monolith-market' │ 'XAUt'    │ 'GUSD'     │ '0x525dBE23821Fc2D26B126DF1c2d7A5a1b8CFDeff' │ 0                  │ 0                  │ [ '0x68749665FF8D2d112Fa859AA293F07A622782F38' ] │ 'https://app.monolith.market/1/coin/1' │ 0                  │ 0                  │ 9014101451334.246  │ true       │ 0.85 │
│ 3       │ 'monolith-market-savings-0x47a3d646A6dE73fbcEF16bD0d4B54A6C08Ec39cf' │ 'Ethereum' │ 'monolith-market' │ 'sGUSD'   │            │                                              │ 0                  │ 0                  │ [ '0x525dBE23821Fc2D26B126DF1c2d7A5a1b8CFDeff' ] │ 'https://app.monolith.market/1/coin/1' │ 0                  │                    │                    │ false      │      │
└─────────┴──────────────────────────────────────────────────────────────────────┴────────────┴───────────────────┴───────────┴────────────┴──────────────────────────────────────────────┴────────────────────┴────────────────────┴──────────────────────────────────────────────────┴────────────────────────────────────────┴────────────────────┴────────────────────┴────────────────────┴────────────┴──────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

@0xkr3p
Copy link
Copy Markdown
Contributor

0xkr3p commented May 20, 2026

hi @webmass, a few things remaining until we can merge:

  • pls fix the borrow apy for XAUT
  • delete the sdk.api.util.getLog line 24
  • delete unused imports (superagent, ethers, path, getUniqueAddresses)
  • add permitFailure: true to the multicalls
  • delete the duplicate tvlUsd key in the savings-vault object

@github-actions
Copy link
Copy Markdown

The monolith-market adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 40 passed, 40 total
Snapshots: 0 total
Time: 0.225 s
Ran all test suites.

Nb of pools: 4
 

Sample pools:
┌─────────┬──────────────────────────────────────────────────────────────────────┬────────────┬───────────────────┬───────────┬────────────┬──────────────────────────────────────────────┬────────────────────┬────────────────────┬──────────────────────────────────────────────────┬────────────────────────────────────────┬────────────────────┬───────────────────┬────────────────────┬────────────┬──────┐
│ (index) │ pool                                                                 │ chain      │ project           │ symbol    │ mintedCoin │ borrowToken                                  │ apyBase            │ tvlUsd             │ underlyingTokens                                 │ url                                    │ totalSupplyUsd     │ totalBorrowUsd    │ apyBaseBorrow      │ borrowable │ ltv  │
├─────────┼──────────────────────────────────────────────────────────────────────┼────────────┼───────────────────┼───────────┼────────────┼──────────────────────────────────────────────┼────────────────────┼────────────────────┼──────────────────────────────────────────────────┼────────────────────────────────────────┼────────────────────┼───────────────────┼────────────────────┼────────────┼──────┤
│ 0       │ 'monolith-market-lending-0xf8B349dA9244253288f6853835e6582955FD49c9' │ 'Ethereum' │ 'monolith-market' │ 'sINV'    │ 'invUSD'   │ '0x5377680B5986296AA4F9e684e5315a4F24832e56' │ 0                  │ 75094.06180545564  │ [ '0x08d23468A467d2bb86FaE0e32F247A26C7E2e994' ] │ 'https://app.monolith.market/1/coin/0' │ 75094.06180545564  │ 30594.37661908971 │ 11.734990861075346 │ true       │ 0.65 │
│ 1       │ 'monolith-market-savings-0x3FF361197036Ae1d24B939146D8a449A80F8427d' │ 'Ethereum' │ 'monolith-market' │ 'sinvUSD' │            │                                              │ 11.734990861075346 │ 2997.7573202323774 │ [ '0x5377680B5986296AA4F9e684e5315a4F24832e56' ] │ 'https://app.monolith.market/1/coin/0' │ 2997.7573202323774 │                   │                    │ false      │      │
│ 2       │ 'monolith-market-lending-0x0e538766693d536179e3105E686B9BeE1957b8E3' │ 'Ethereum' │ 'monolith-market' │ 'XAUt'    │ 'GUSD'     │ '0x525dBE23821Fc2D26B126DF1c2d7A5a1b8CFDeff' │ 0                  │ 0                  │ [ '0x68749665FF8D2d112Fa859AA293F07A622782F38' ] │ 'https://app.monolith.market/1/coin/1' │ 0                  │ 0                 │ 999999999          │ true       │ 0.85 │
│ 3       │ 'monolith-market-savings-0x47a3d646A6dE73fbcEF16bD0d4B54A6C08Ec39cf' │ 'Ethereum' │ 'monolith-market' │ 'sGUSD'   │            │                                              │ 0                  │ 0                  │ [ '0x525dBE23821Fc2D26B126DF1c2d7A5a1b8CFDeff' ] │ 'https://app.monolith.market/1/coin/1' │ 0                  │                   │                    │ false      │      │
└─────────┴──────────────────────────────────────────────────────────────────────┴────────────┴───────────────────┴───────────┴────────────┴──────────────────────────────────────────────┴────────────────────┴────────────────────┴──────────────────────────────────────────────────┴────────────────────────────────────────┴────────────────────┴───────────────────┴────────────────────┴────────────┴──────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/adaptors/monolith-market/index.js (1)

104-105: ⚡ Quick win

Consider guarding against null rates when multicalls fail with permitFailure.

With permitFailure: true, failed calls return null output. If rates[marketIndex] is null (e.g., lens call failed for a specific lender), accessing rates[marketIndex][0] throws TypeError. This would crash the entire adaptor rather than skipping the problematic pool.

♻️ Suggested defensive check
-    const borrowApr = Math.min(Number(rates[marketIndex][0]) / 1e16, 999_999_999);
-    const borrowApy = borrowApr < 999_999_999 ? Math.min(999_999_999, utils.aprToApy(borrowApr, blocksPerYear)) : 999_999_999;
+    const rateData = rates[marketIndex];
+    if (!rateData) return null; // Skip pool if rates call failed
+    const borrowApr = Math.min(Number(rateData[0]) / 1e16, 999_999_999);
+    const borrowApy = borrowApr < 999_999_999 ? Math.min(999_999_999, utils.aprToApy(borrowApr, blocksPerYear)) : 999_999_999;

The returned null would be filtered out by the .filter((p) => utils.keepFinite(p)) at line 150.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/adaptors/monolith-market/index.js` around lines 104 - 105, Guard against
null rows in rates before indexing: when computing borrowApr/borrowApy use a
null-check on rates[marketIndex] (referencing rates and marketIndex) and if it's
null/undefined produce a non-finite numeric result (e.g., NaN) so the later
.filter(p => utils.keepFinite(p)) will drop the pool; ensure the
borrowApr/borrowApy calculation (the borrowApr assignment and the borrowApy
assignment using utils.aprToApy and blocksPerYear) only runs when the rate row
exists to avoid a TypeError.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/adaptors/monolith-market/index.js`:
- Around line 104-105: Guard against null rows in rates before indexing: when
computing borrowApr/borrowApy use a null-check on rates[marketIndex]
(referencing rates and marketIndex) and if it's null/undefined produce a
non-finite numeric result (e.g., NaN) so the later .filter(p =>
utils.keepFinite(p)) will drop the pool; ensure the borrowApr/borrowApy
calculation (the borrowApr assignment and the borrowApy assignment using
utils.aprToApy and blocksPerYear) only runs when the rate row exists to avoid a
TypeError.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c521080a-c2cc-4ba4-b4a0-84e747eba0bb

📥 Commits

Reviewing files that changed from the base of the PR and between 9037325 and 35e7fac.

📒 Files selected for processing (1)
  • src/adaptors/monolith-market/index.js

@webmass webmass force-pushed the add-monolith-market-yields branch from 35e7fac to 9bef442 Compare May 22, 2026 21:28
@github-actions
Copy link
Copy Markdown

The monolith-market adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 40 passed, 40 total
Snapshots: 0 total
Time: 0.257 s
Ran all test suites.

Nb of pools: 4
 

Sample pools:
┌─────────┬──────────────────────────────────────────────────────────────────────┬────────────┬───────────────────┬───────────┬────────────┬──────────────────────────────────────────────┬────────────────────┬───────────────────┬──────────────────────────────────────────────────┬────────────────────────────────────────┬───────────────────┬────────────────────┬────────────────────┬────────────┬──────┐
│ (index) │ pool                                                                 │ chain      │ project           │ symbol    │ mintedCoin │ borrowToken                                  │ apyBase            │ tvlUsd            │ underlyingTokens                                 │ url                                    │ totalSupplyUsd    │ totalBorrowUsd     │ apyBaseBorrow      │ borrowable │ ltv  │
├─────────┼──────────────────────────────────────────────────────────────────────┼────────────┼───────────────────┼───────────┼────────────┼──────────────────────────────────────────────┼────────────────────┼───────────────────┼──────────────────────────────────────────────────┼────────────────────────────────────────┼───────────────────┼────────────────────┼────────────────────┼────────────┼──────┤
│ 0       │ 'monolith-market-lending-0xf8B349dA9244253288f6853835e6582955FD49c9' │ 'Ethereum' │ 'monolith-market' │ 'sINV'    │ 'invUSD'   │ '0x5377680B5986296AA4F9e684e5315a4F24832e56' │ 0                  │ 73948.05953969258 │ [ '0x08d23468A467d2bb86FaE0e32F247A26C7E2e994' ] │ 'https://app.monolith.market/1/coin/0' │ 73948.05953969258 │ 30644.806084610093 │ 11.734990861075346 │ true       │ 0.65 │
│ 1       │ 'monolith-market-savings-0x3FF361197036Ae1d24B939146D8a449A80F8427d' │ 'Ethereum' │ 'monolith-market' │ 'sinvUSD' │            │                                              │ 11.734990861075346 │ 3002.747375840804 │ [ '0x5377680B5986296AA4F9e684e5315a4F24832e56' ] │ 'https://app.monolith.market/1/coin/0' │ 3002.747375840804 │                    │                    │ false      │      │
│ 2       │ 'monolith-market-lending-0x0e538766693d536179e3105E686B9BeE1957b8E3' │ 'Ethereum' │ 'monolith-market' │ 'XAUt'    │ 'GUSD'     │ '0x525dBE23821Fc2D26B126DF1c2d7A5a1b8CFDeff' │ 0                  │ 0                 │ [ '0x68749665FF8D2d112Fa859AA293F07A622782F38' ] │ 'https://app.monolith.market/1/coin/1' │ 0                 │ 0                  │ 999999999          │ true       │ 0.85 │
│ 3       │ 'monolith-market-savings-0x47a3d646A6dE73fbcEF16bD0d4B54A6C08Ec39cf' │ 'Ethereum' │ 'monolith-market' │ 'sGUSD'   │            │                                              │ 0                  │ 0                 │ [ '0x525dBE23821Fc2D26B126DF1c2d7A5a1b8CFDeff' ] │ 'https://app.monolith.market/1/coin/1' │ 0                 │                    │                    │ false      │      │
└─────────┴──────────────────────────────────────────────────────────────────────┴────────────┴───────────────────┴───────────┴────────────┴──────────────────────────────────────────────┴────────────────────┴───────────────────┴──────────────────────────────────────────────────┴────────────────────────────────────────┴───────────────────┴────────────────────┴────────────────────┴────────────┴──────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/adaptors/monolith-market/index.js (1)

9-10: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Update the Ethereum Lens singleton address.

Monolith’s official contract-addresses page lists the Ethereum Lens singleton as 0x8aAb59675e123cEEFE5E05B0BC1bE8fe6101E60d, not the address configured here. Since every getRates multicall below uses this constant, the adapter will read rates from the wrong contract and return bad or empty APY data. (docs.monolith.market)

🛠️ Proposed fix
 const FACTORIES = {
-  ethereum: { chainId: 1, blocksPerYear: 2609750, factory: '0x6D961c9DCF1AD73566822BA4B087892e3839B849', lens: '0x0f3a7cd1828698D2B6daEf081d5c319c0734fA1c', fromBlock: 24949282 },
+  ethereum: { chainId: 1, blocksPerYear: 2609750, factory: '0x6D961c9DCF1AD73566822BA4B087892e3839B849', lens: '0x8aAb59675e123cEEFE5E05B0BC1bE8fe6101E60d', fromBlock: 24949282 },
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/adaptors/monolith-market/index.js` around lines 9 - 10, The FACTORIES
constant for the ethereum entry is using the wrong Lens singleton address,
causing getRates multicalls to query the wrong contract; update
FACTORIES.ethereum.lens to the official address
0x8aAb59675e123cEEFE5E05B0BC1bE8fe6101E60d so all places that reference
FACTORIES.ethereum.lens (including the getRates multicall logic) target the
correct Lens singleton and return valid APY data.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/adaptors/monolith-market/index.js`:
- Around line 9-10: The FACTORIES constant for the ethereum entry is using the
wrong Lens singleton address, causing getRates multicalls to query the wrong
contract; update FACTORIES.ethereum.lens to the official address
0x8aAb59675e123cEEFE5E05B0BC1bE8fe6101E60d so all places that reference
FACTORIES.ethereum.lens (including the getRates multicall logic) target the
correct Lens singleton and return valid APY data.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bd3c5ae1-89ff-4c6f-98e4-ee4791d53db6

📥 Commits

Reviewing files that changed from the base of the PR and between 35e7fac and 9bef442.

📒 Files selected for processing (1)
  • src/adaptors/monolith-market/index.js

@webmass
Copy link
Copy Markdown
Contributor Author

webmass commented May 23, 2026

hi @webmass, a few things remaining until we can merge:

  • pls fix the borrow apy for XAUT

  • delete the sdk.api.util.getLog line 24

  • delete unused imports (superagent, ethers, path, getUniqueAddresses)

  • add permitFailure: true to the multicalls

  • delete the duplicate tvlUsd key in the savings-vault object

Hey
Done.
The borrow apy for the XAUT market is technically correct fyi, capped at 999_999_999 now.

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.

2 participants