Conversation
📝 WalkthroughWalkthroughA new adaptor for ZentRa Finance is introduced at Changes
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 Tip CodeRabbit can enforce grammar and style rules using `languagetool`.Configure the |
|
The zentra-finance adapter exports pools: Test Suites: 1 passed, 1 total |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
src/adaptors/zentra-finance/index.js
| await axios.get(`https://coins.llama.fi/prices/current/${priceKeys}`) | ||
| ).data.coins; |
There was a problem hiding this comment.
🧩 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 -30Repository: DefiLlama/yield-server
Length of output: 1310
🏁 Script executed:
rg "timeout" src/adaptors/ -B 2 -A 2Repository: 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.
0xkr3p
left a comment
There was a problem hiding this comment.
great work - thanks for the PR @eyusufatik
Adds Zentra Finance on Citrea.
https://zentra.finance/
Summary by CodeRabbit