Skip to content

fix: flamingo-finance#2280

Merged
0xkr3p merged 2 commits intoDefiLlama:masterfrom
0xkr3p:fix/flamingo-finance
Jan 22, 2026
Merged

fix: flamingo-finance#2280
0xkr3p merged 2 commits intoDefiLlama:masterfrom
0xkr3p:fix/flamingo-finance

Conversation

@0xkr3p
Copy link
Contributor

@0xkr3p 0xkr3p commented Jan 22, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Updated data source endpoint to secure HTTPS CDN for enhanced reliability
    • Improved pool data normalization to handle multiple data formats correctly

✏️ Tip: You can customize this high-level summary in your review settings.

@0xkr3p 0xkr3p changed the title Fix/flamingo finance fix: flamingo-finance Jan 22, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

📝 Walkthrough

Walkthrough

Updates the flamingo-finance data adaptor to use HTTPS CDN URLs instead of HTTP. Normalizes poolsData structure to support both array and object.pools formats, then enriches each pool object with standardized fields including chain, project, symbol, TVL, APY metrics, and token arrays.

Changes

Cohort / File(s) Summary
Flamingo Finance Data Enrichment
src/adaptors/flamingo-finance/index.js
URL migration from HTTP to HTTPS CDN; poolsData normalization to handle array or object.pools shapes; pool object enrichment with standardized fields (chain: 'Neo', project: 'flamingo-finance', symbol, tvlUsd, apyBase/apyReward defaults, rewardTokens/underlyingTokens arrays, poolMeta); deduplication logic updated for new enriched structure; trailing comma formatting in exports.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A bunny hops through CDN paths so secure,
Where pools now bloom in structures pure!
With tokens arrayed and chain names bright,
Flamingo finance shines in HTTPS light! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'fix: flamingo-finance' is vague and generic, using only 'fix' without specifying what aspect is being fixed or why. Consider a more descriptive title that highlights the main change, such as 'fix: update flamingo-finance data source to HTTPS CDN and normalize pool data structure' or similar.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 docstrings

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.

@llamatester
Copy link

The flamingo-finance adapter exports pools:

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

Nb of pools: 60
 

Sample pools:
┌─────────┬──────────────────────────────────────────────┬───────┬────────────────────┬───────────────┬────────────────────┬─────────┬────────────────────┬──────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────┬─────────────────┐
│ (index) │ pool                                         │ chain │ project            │ symbol        │ tvlUsd             │ apyBase │ apyReward          │ rewardTokens                                     │ underlyingTokens                                                                               │ poolMeta        │
├─────────┼──────────────────────────────────────────────┼───────┼────────────────────┼───────────────┼────────────────────┼─────────┼────────────────────┼──────────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────┼─────────────────┤
│ 0       │ '0x4d5a85b0c83777df72cfb665a933970e4e20c0ec' │ 'Neo' │ 'flamingo-finance' │ 'FLM-bNEO'    │ 588883.3508682124  │ 0       │ 10.593407866269322 │ [ '0xf0151f528127558851b39c2cd8aa47da7418ab28' ] │ [ '0x48c40d4666f93408be1bef038b6722404d9a4c2a', '0xf0151f528127558851b39c2cd8aa47da7418ab28' ] │ 'Flamingo Pool' │
│ 1       │ '0x9ef4d5c1a686e13d72184b66e4bda77d7b4bae9f' │ 'Neo' │ 'flamingo-finance' │ 'USDT-FUSD'   │ 261083.334578      │ 0       │ 0                  │ [ '0xf0151f528127558851b39c2cd8aa47da7418ab28' ] │ [ '0x1005d400bcc2a56b7352f09e273be3f9933a5fb1', '0x68b938cc42b6a2d54fb9040f5facf4290ebb8c5f' ] │ 'Flamingo Pool' │
│ 2       │ '0xc777a8032c1d9d7b885c7357d4c93e7a39f93942' │ 'Neo' │ 'flamingo-finance' │ 'bNEO-fWBTC'  │ 235676.02301502269 │ 0       │ 0                  │ [ '0xf0151f528127558851b39c2cd8aa47da7418ab28' ] │ [ '0x48c40d4666f93408be1bef038b6722404d9a4c2a', '0xd6abe115ecb75e1fa0b42f5e85934ce8c1ae2893' ] │ 'Flamingo Pool' │
│ 3       │ '0xb9f87cb4f741bc5dc299132fe1b8372f01d37ca4' │ 'Neo' │ 'flamingo-finance' │ 'WETH-FUSD'   │ 226047.2298360612  │ 0       │ 5.9593852896057005 │ [ '0xf0151f528127558851b39c2cd8aa47da7418ab28' ] │ [ '0x1005d400bcc2a56b7352f09e273be3f9933a5fb1', '0xd3a41b53888a733b549f5d4146e7a98d3285fa21' ] │ 'Flamingo Pool' │
│ 4       │ '0x3269ece5dc33adf17ed14be7780693f3c8b102d1' │ 'Neo' │ 'flamingo-finance' │ 'bNEO-FUSD'   │ 218180.9281018136  │ 0       │ 6.305183634981448  │ [ '0xf0151f528127558851b39c2cd8aa47da7418ab28' ] │ [ '0x1005d400bcc2a56b7352f09e273be3f9933a5fb1', '0x48c40d4666f93408be1bef038b6722404d9a4c2a' ] │ 'Flamingo Pool' │
│ 5       │ '0x73145563232df26ea2e42f5d1877062ad603e033' │ 'Neo' │ 'flamingo-finance' │ 'FUSD-USDC'   │ 212192.20823865538 │ 0       │ 0                  │ [ '0xf0151f528127558851b39c2cd8aa47da7418ab28' ] │ [ '0x1005d400bcc2a56b7352f09e273be3f9933a5fb1', '0x6627a4a0dfcb409bf1e0fb3e217441f3f9809fce' ] │ 'Flamingo Pool' │
│ 6       │ '0x3244fcadcccff190c329f7b3083e4da2af60fbce' │ 'Neo' │ 'flamingo-finance' │ 'bNEO-GAS'    │ 185801.69582938845 │ 0       │ 4.577635674911219  │ [ '0xf0151f528127558851b39c2cd8aa47da7418ab28' ] │ [ '0x48c40d4666f93408be1bef038b6722404d9a4c2a', '0xd2a4cff31913016155e38e474a2c06d08be276cf' ] │ 'Flamingo Pool' │
│ 7       │ '0x45d182227b5d753c7f358594b631838b92caf409' │ 'Neo' │ 'flamingo-finance' │ 'fWBTC-fUSDT' │ 156350.2294756204  │ 0       │ 0                  │ [ '0xf0151f528127558851b39c2cd8aa47da7418ab28' ] │ [ '0xcd48b160c1bbc9d74997b803b9a7ad50a4bef020', '0xd6abe115ecb75e1fa0b42f5e85934ce8c1ae2893' ] │ 'Flamingo Pool' │
│ 8       │ '0xaeae872ace15f87c117213c92c00944af789aed2' │ 'Neo' │ 'flamingo-finance' │ 'FLM-FUSD'    │ 131732.50695102318 │ 0       │ 10.505642477892922 │ [ '0xf0151f528127558851b39c2cd8aa47da7418ab28' ] │ [ '0x1005d400bcc2a56b7352f09e273be3f9933a5fb1', '0xf0151f528127558851b39c2cd8aa47da7418ab28' ] │ 'Flamingo Pool' │
│ 9       │ '0x2f6ef6baaf7a9129cf0edf364798e75d5ee5eaf0' │ 'Neo' │ 'flamingo-finance' │ 'GAS-FUSD'    │ 123197.07438864661 │ 0       │ 11.070165612989634 │ [ '0xf0151f528127558851b39c2cd8aa47da7418ab28' ] │ [ '0x1005d400bcc2a56b7352f09e273be3f9933a5fb1', '0xd2a4cff31913016155e38e474a2c06d08be276cf' ] │ 'Flamingo Pool' │
└─────────┴──────────────────────────────────────────────┴───────┴────────────────────┴───────────────┴────────────────────┴─────────┴────────────────────┴──────────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────┴─────────────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

Copy link

@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

🤖 Fix all issues with AI agents
In `@src/adaptors/flamingo-finance/index.js`:
- Around line 8-10: The code assumes poolsData is either an array or has a pools
property and will crash if poolsData is null/undefined or lacks pools; update
the assignment that creates pools (currently "const pools =
Array.isArray(poolsData) ? poolsData : poolsData.pools;") to defensively handle
these cases by using optional chaining and an empty-array fallback so pools is
always an array before the subsequent reduce call (reference symbols: poolsData,
pools, and the reduce invocation).

Comment on lines +8 to +10
const pools = Array.isArray(poolsData) ? poolsData : poolsData.pools;

return pools.reduce((acc, p) => {
Copy link

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

🏁 Script executed:

cat -n src/adaptors/flamingo-finance/index.js | head -30

Repository: DefiLlama/yield-server

Length of output: 1146


🏁 Script executed:

#!/bin/bash
# Inspect the live CDN payload shape
curl -s https://flamingo-us-1.b-cdn.net/flamingo/analytics/flamingo/defillama-yields | jq 'type, keys? // "is-array"' | head -20

Repository: DefiLlama/yield-server

Length of output: 173


🏁 Script executed:

rg -A 15 'getData\s*=' src/adaptors/utils.js | head -40

Repository: DefiLlama/yield-server

Length of output: 553


🏁 Script executed:

rg -B 5 -A 10 'exports\.getData|function getData' src/adaptors/utils.js

Repository: DefiLlama/yield-server

Length of output: 397


🏁 Script executed:

rg -B 5 -A 25 'poolsFunction|exports' src/adaptors/flamingo-finance/index.js

Repository: DefiLlama/yield-server

Length of output: 1054


🏁 Script executed:

# Check if there's error handling in the adapter index or wrapper
fd index.js src/adaptors/ | head -5 | xargs rg -l 'module.exports|exports' | head -1 | xargs cat -n | tail -20

Repository: DefiLlama/yield-server

Length of output: 676


Guard against null/undefined poolsData and missing pools property to prevent runtime crash.

The current code assumes poolsData.pools exists when poolsData is not an array. If the API returns null, undefined, or an object without a pools property, accessing .pools will throw a TypeError. Add defensive handling with optional chaining and an empty array fallback:

Proposed fix
-  const pools = Array.isArray(poolsData) ? poolsData : poolsData.pools;
+  const pools = Array.isArray(poolsData)
+    ? poolsData
+    : Array.isArray(poolsData?.pools)
+      ? poolsData.pools
+      : [];
🤖 Prompt for AI Agents
In `@src/adaptors/flamingo-finance/index.js` around lines 8 - 10, The code assumes
poolsData is either an array or has a pools property and will crash if poolsData
is null/undefined or lacks pools; update the assignment that creates pools
(currently "const pools = Array.isArray(poolsData) ? poolsData :
poolsData.pools;") to defensively handle these cases by using optional chaining
and an empty-array fallback so pools is always an array before the subsequent
reduce call (reference symbols: poolsData, pools, and the reduce invocation).

@0xkr3p 0xkr3p merged commit 4875374 into DefiLlama:master Jan 22, 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.

2 participants