Skip to content

add Zentra Finance#2486

Merged
0xkr3p merged 1 commit intoDefiLlama:masterfrom
eyusufatik:add-zentra
Mar 18, 2026
Merged

add Zentra Finance#2486
0xkr3p merged 1 commit intoDefiLlama:masterfrom
eyusufatik:add-zentra

Conversation

@eyusufatik
Copy link
Contributor

@eyusufatik eyusufatik commented Mar 16, 2026

Adds Zentra Finance on Citrea.

https://zentra.finance/

Summary by CodeRabbit

  • New Features
    • Added support for Zentra Finance on the Citrea chain, providing APY and TVL metrics for liquidity pools with key financial data including borrowing rates, loan-to-value ratios, and underlying token valuations.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 16, 2026

📝 Walkthrough

Walkthrough

A new adaptor for ZentRa Finance is introduced at src/adaptors/zentra-finance/index.js. The adaptor computes Yearly APY and TVL metrics for pools on the Citrea chain by fetching reserve data, aToken supplies, and token prices from coins.llama.fi, then performing calculations to generate standardized pool objects with financial metrics.

Changes

Cohort / File(s) Summary
ZentRa Finance Adaptor
src/adaptors/zentra-finance/index.js
New adaptor module that retrieves ZentRa Finance pool data via parallel multicalls, normalizes decimal values, fetches token prices, and computes APY and TVL metrics. Exports apy function and configuration with timetravel set to false.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant Adaptor as ZentRa Adaptor
    participant PoolData as Pool Data Provider
    participant Blockchain as Blockchain (Citrea)
    participant PriceAPI as coins.llama.fi

    Caller->>Adaptor: call apy()
    Adaptor->>PoolData: fetch reserve & aToken lists
    PoolData-->>Adaptor: reserve data
    
    Adaptor->>Blockchain: multicall(getReserveData, getConfiguration,<br/>totalSupply, balanceOf)
    Blockchain-->>Adaptor: reserve state & config
    
    Adaptor->>PriceAPI: request token prices
    PriceAPI-->>Adaptor: price data
    
    Adaptor->>Adaptor: normalize decimals & compute<br/>APY, TVL, LTV metrics
    Adaptor-->>Caller: array of pool objects with<br/>financial metrics
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A new pool arrives in Citrea's glow,
ZentRa Finance rates begin to flow!
With APY metrics shining bright,
Our adaptor hops through price and height.
Decimals balanced, TVL calculated right! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'add Zentra Finance' directly corresponds to the main change: adding a new Zentra Finance adaptor with APY and TVL computation functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review 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.

❤️ Share

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

Tip

CodeRabbit can enforce grammar and style rules using `languagetool`.

Configure the reviews.tools.languagetool setting to enable/disable rules and categories. Refer to the LanguageTool Community to learn more.

@llamatester
Copy link

The zentra-finance adapter exports pools:

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

Nb of pools: 3
 

Sample pools:
┌─────────┬─────────────────────────────────────────────────────┬──────────┬──────────────────┬──────────┬───────────────────┬─────────────────────┬──────────────────────────────────────────────────┬────────────────────┬────────────────────┬────────────────────┬──────┬────────────┬────────────────────────────────────────┐
│ (index) │ pool                                                │ chain    │ project          │ symbol   │ tvlUsd            │ apyBase             │ underlyingTokens                                 │ totalSupplyUsd     │ totalBorrowUsd     │ apyBaseBorrow      │ ltv  │ borrowable │ url                                    │
├─────────┼─────────────────────────────────────────────────────┼──────────┼──────────────────┼──────────┼───────────────────┼─────────────────────┼──────────────────────────────────────────────────┼────────────────────┼────────────────────┼────────────────────┼──────┼────────────┼────────────────────────────────────────┤
│ 0       │ '0xba2a69b92e0071924c387a200409b658e4f6cac8-citrea' │ 'Citrea' │ 'zentra-finance' │ 'ctUSD'  │ 148432.9693745182 │ 1.3554560473414463  │ [ '0x8D82c4E3c936C7B5724A382a9c5a4E6Eb7aB6d5D' ] │ 297985.99299996096 │ 149553.02362544276 │ 3.000605466353028  │ 0.8  │ true       │ 'https://zentra.finance/markets/ctusd' │
│ 1       │ '0x21edc56532b6e92e676aa260b2a1f968b20eb1f5-citrea' │ 'Citrea' │ 'zentra-finance' │ 'WCBTC'  │ 59585.73387854826 │ 0.03805351834711536 │ [ '0x3100000000000000000000000000000000000006' ] │ 64888.47165219486  │ 5302.7377736466005 │ 0.5820180771659313 │ 0.7  │ true       │ 'https://zentra.finance/markets/wcbtc' │
│ 2       │ '0x01465912c8cec266237050f429fe1b88daa56c0a-citrea' │ 'Citrea' │ 'zentra-finance' │ 'USDC.e' │ 6814.834046282901 │ 0.6369895587501992  │ [ '0xE045e6c36cF77FAA2CfB54466D71A3aEF7bbE839' ] │ 10388.97439429068  │ 3574.1403480077797 │ 2.0569907236321736 │ 0.85 │ true       │ 'https://zentra.finance/markets/usdc'  │
└─────────┴─────────────────────────────────────────────────────┴──────────┴──────────────────┴──────────┴───────────────────┴─────────────────────┴──────────────────────────────────────────────────┴────────────────────┴────────────────────┴────────────────────┴──────┴────────────┴────────────────────────────────────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

Copy link
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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/adaptors/zentra-finance/index.js`:
- Around line 27-57: The code assumes reserves[i] matches atokens[i] when
building multiCall inputs (used with POOL_DATA_PROVIDER, aTokenAbi methods
totalSupply/balanceOf/decimals), which is brittle; fix by explicitly resolving
each reserve's aToken via getReserveTokensAddresses(reserve.tokenAddress) or by
fetching getAllReservesTokens() and getAllATokens() then creating a map from
tokenAddress→aToken before joining so calls to totalSupply/balanceOf/decimals
use the correct aToken for each reserve (update the multiCall call inputs to
reference the mapped aToken addresses rather than relying on array indexes).
- Around line 61-62: The axios request calling
`axios.get(\`https://coins.llama.fi/prices/current/${priceKeys}\`)` must include
an explicit timeout to avoid hanging; modify the call to pass an options object
with `timeout: 10_000` (matching other adapters) so the request will fail fast,
e.g., add the timeout option alongside any existing config for this external
price call that uses `priceKeys` and the llama.fi URL.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f73bec18-88ae-4057-bec5-4366e4ddf253

📥 Commits

Reviewing files that changed from the base of the PR and between 0e09631 and e55ad09.

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

Comment on lines +61 to +62
await axios.get(`https://coins.llama.fi/prices/current/${priceKeys}`)
).data.coins;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

What is Axios v1.7.2 default timeout behavior when timeout is not set, and is it effectively unbounded?

💡 Result:

In Axios v1.7.2, if you don’t set timeout, the effective value is 0, and Axios does not create/apply any request timeout (i.e., it will wait indefinitely from Axios’s perspective). This is explicitly documented (“default is 0 (no timeout)”) and in the v1.7.2 defaults (timeout: 0, “a timeout is not created”). [1], [2]

So yes: Axios’s own timeout is effectively unbounded when timeout is not set—but the request still might end due to non-Axios limits (server/proxy idle timeouts, browser/network stack behavior, Node/socket timeouts you configure elsewhere, etc.). [1], [2]

Sources
[1] Axios Docs – Request Config (timeout: 1000, // default is '0' (no timeout)) https://axios-http.com/docs/req_config
[2] Axios v1.7.2 source – lib/defaults/index.js (timeout: 0 and comment “timeout is not created”) https://github.com/axios/axios/blob/v1.7.2/lib/defaults/index.js


🏁 Script executed:

cat -n src/adaptors/zentra-finance/index.js | head -80 | tail -30

Repository: DefiLlama/yield-server

Length of output: 1310


🏁 Script executed:

rg "timeout" src/adaptors/ -B 2 -A 2

Repository: DefiLlama/yield-server

Length of output: 16262


Add an explicit timeout for the external price call.

Without a timeout, the axios call to https://coins.llama.fi/prices/current/ can hang indefinitely and block this adapter. This pattern is already established across the codebase (e.g., supernova-amm, harbor, glif all use timeout: 10_000 for the same endpoint).

Proposed fix
-  const prices = (
-    await axios.get(`https://coins.llama.fi/prices/current/${priceKeys}`)
-  ).data.coins;
+  const prices = (
+    await axios.get(`https://coins.llama.fi/prices/current/${priceKeys}`, {
+      timeout: 10_000,
+    })
+  ).data.coins;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/adaptors/zentra-finance/index.js` around lines 61 - 62, The axios request
calling `axios.get(\`https://coins.llama.fi/prices/current/${priceKeys}\`)` must
include an explicit timeout to avoid hanging; modify the call to pass an options
object with `timeout: 10_000` (matching other adapters) so the request will fail
fast, e.g., add the timeout option alongside any existing config for this
external price call that uses `priceKeys` and the llama.fi URL.

Copy link
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.

great work - thanks for the PR @eyusufatik

@0xkr3p 0xkr3p merged commit fee6bee into DefiLlama:master Mar 18, 2026
2 checks passed
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.

3 participants