Skip to content

fix symbiosis adapter#2286

Merged
0xkr3p merged 2 commits intoDefiLlama:masterfrom
0xkr3p:fix/symbiosis-adapter
Jan 23, 2026
Merged

fix symbiosis adapter#2286
0xkr3p merged 2 commits intoDefiLlama:masterfrom
0xkr3p:fix/symbiosis-adapter

Conversation

@0xkr3p
Copy link
Contributor

@0xkr3p 0xkr3p commented Jan 23, 2026

Summary by CodeRabbit

  • New Features

    • Broader asset coverage via comprehensive sToken configuration mapping
  • Improvements

    • Faster, parallelized data loading for APY and TVL
    • APY source updated for improved accuracy
    • Per-pool TVL aggregation, TVL-based sorting, and unified pool naming for clearer results
    • Service URL updated and chain names formatted for better readability
  • Refactor

    • Consolidated configuration and unified pool processing for simpler, consistent output

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

@coderabbitai
Copy link

coderabbitai bot commented Jan 23, 2026

📝 Walkthrough

Walkthrough

The adaptor moves from per-chain nested pool definitions to a flat, address-keyed sTokenPools plus CHAIN_CONFIG. APY and TVL loading were refactored to fetch APRs, token prices, and on-chain balances in parallel and build unified pool entries sorted by TVL.

Changes

Cohort / File(s) Summary
Configuration restructuring
src/adaptors/symbiosis/config.js
Removed pool/chains exports; added sTokenPools (map of lowercase sToken address → { chain, symbol, token, portal, decimals, ... }) and CHAIN_CONFIG (per-chain display metadata). Flat address-keyed pool mapping replaces nested per-chain grouping.
APY & TVL loading
src/adaptors/symbiosis/index.js
Replaced config import with sTokenPools & CHAIN_CONFIG; added OCTO_POOL_APR_URL, getPriceApiChain, formatChainName. loadApyData fetches APRs from OCTO API keyed by lowercase sToken. loadTvlData batches llama price requests and parallel ERC20 balanceOf calls per pool, computes TVL per sToken, logs missing prices, and handles errors. Pools built from sTokenPools, filtered when both APR and TVL are zero, and sorted by TVL desc.
Public surface & minor changes
src/adaptors/symbiosis/index.js
Kept exports (timetravel, apy), updated url to app.symbiosis.finance/liquidity-v2/pools. Pool identifier formatting changed to symbiosis-${chain}-${symbol} with dot→dash normalization.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Adapter as Symbiosis Adaptor
participant APR as OCTO APR API
participant Prices as Coins.llama API
participant RPC as Blockchain RPC / Multicall
Adapter->>APR: GET APR data (OCTO_POOL_APR_URL)
APR-->>Adapter: APR mapping keyed by sToken (lowercase)
Adapter->>Prices: POST batched price keys for pools
Prices-->>Adapter: Price responses per token:price
Adapter->>RPC: Parallel ERC20 balanceOf calls per sToken pool
RPC-->>Adapter: token balances
Adapter->>Adapter: Compute TVL = balance * price, combine with APR
Adapter-->>Client: Return pools list (filtered, sorted by TVL)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I nibbled through configs, tidy and neat,

sTokens aligned, each address a seat.
APRs fetched, prices and balances meet,
Pools sorted by riches, a harmonious feat.
Hoppity hops — the adaptor's complete! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'fix symbiosis adapter' is vague and generic, using non-descriptive language that doesn't convey meaningful information about what specifically was fixed or changed. Consider a more specific title such as 'Refactor symbiosis adapter config and data fetching' or 'Fix pricing and add missing chains to symbiosis adapter' to better reflect the substantive changes made.
✅ 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 symbiosis adapter exports pools:

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

Nb of pools: 38
 

Sample pools:
┌─────────┬────────────────────────────┬────────────┬─────────────┬──────────┬───────────────────┬─────────┬──────────────────────────────────────────────────┐
│ (index) │ pool                       │ chain      │ project     │ symbol   │ tvlUsd            │ apyBase │ underlyingTokens                                 │
├─────────┼────────────────────────────┼────────────┼─────────────┼──────────┼───────────────────┼─────────┼──────────────────────────────────────────────────┤
│ 0       │ 'symbiosis-ethereum-usdc'  │ 'Ethereum' │ 'symbiosis' │ 'USDC'   │ 1307649.641375    │ 4.19444 │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │
│ 1       │ 'symbiosis-tron-usdt'      │ 'Tron'     │ 'symbiosis' │ 'USDT'   │ 1173595.248058    │ 4.27455 │ [ 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t' ]         │
│ 2       │ 'symbiosis-bsc-usdc'       │ 'Binance'  │ 'symbiosis' │ 'USDC'   │ 845960.3850643552 │ 3.45021 │ [ '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d' ] │
│ 3       │ 'symbiosis-polygon-usdc-e' │ 'Polygon'  │ 'symbiosis' │ 'USDC.e' │ 405965.076456     │ 0.22943 │ [ '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174' ] │
│ 4       │ 'symbiosis-bsc-sis'        │ 'Binance'  │ 'symbiosis' │ 'SIS'    │ 331116.9125645884 │ 2.85947 │ [ '0xF98b660AdF2ed7d9d9D9dAACC2fb0CAce4F21835' ] │
│ 5       │ 'symbiosis-arbitrum-usdc'  │ 'Arbitrum' │ 'symbiosis' │ 'USDC'   │ 242302.144886     │ 4.33891 │ [ '0xaf88d065e77c8cC2239327C5EDb3A432268e5831' ] │
│ 6       │ 'symbiosis-boba-usdc'      │ 'Boba'     │ 'symbiosis' │ 'USDC'   │ 149547.272341     │ 0.00016 │ [ '0x66a2A913e447d6b4BF33EFbec43aAeF87890FBbc' ] │
│ 7       │ 'symbiosis-cronos-usdc'    │ 'Cronos'   │ 'symbiosis' │ 'USDC'   │ 128902.456818     │ 0.97271 │ [ '0xc21223249CA28397B4B6541dfFaEcC539BfF0c59' ] │
│ 8       │ 'symbiosis-gravity-usdc-e' │ 'Gravity'  │ 'symbiosis' │ 'USDC.e' │ 123168.335459     │ 0       │ [ '0xFbDa5F676cB37624f28265A144A48B0d6e87d3b6' ] │
│ 9       │ 'symbiosis-rsk-usdt0'      │ 'RSK'      │ 'symbiosis' │ 'USDT0'  │ 120547.153517     │ 0.24918 │ [ '0x779ded0c9e1022225f8e0630b35a9b54be713736' ] │
└─────────┴────────────────────────────┴────────────┴─────────────┴──────────┴───────────────────┴─────────┴──────────────────────────────────────────────────┘
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/symbiosis/index.js`:
- Around line 20-43: The TVL computed in loadTvlData is currently
token-denominated because tvlUsd is derived only from raw token balances
(variable tvlUsd inside loadTvlData) and not multiplied by each token's USD
price; fix by fetching USD prices for the tokens in pools (prefer a batch price
lookup before the Promise.all, e.g., gather pool.token addresses and call the
existing price oracle/price-fetcher) and multiply the token amount
(balance.div(10**pool.decimals)) by the fetched USD price before assigning
tvlData[pool.sToken]; ensure the price lookup handles chain differences
(pool.chain / pool.isTron) and falls back or logs if price unavailable.

@llamatester
Copy link

The symbiosis adapter exports pools:

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

Nb of pools: 57
 

Sample pools:
┌─────────┬────────────────────────────┬────────────┬─────────────┬──────────┬────────────────────┬─────────┬──────────────────────────────────────────────────┐
│ (index) │ pool                       │ chain      │ project     │ symbol   │ tvlUsd             │ apyBase │ underlyingTokens                                 │
├─────────┼────────────────────────────┼────────────┼─────────────┼──────────┼────────────────────┼─────────┼──────────────────────────────────────────────────┤
│ 0       │ 'symbiosis-ethereum-usdc'  │ 'Ethereum' │ 'symbiosis' │ 'USDC'   │ 1307774.9382584693 │ 4.19444 │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │
│ 1       │ 'symbiosis-tron-usdt'      │ 'Tron'     │ 'symbiosis' │ 'USDT'   │ 1170797.6056396975 │ 4.27455 │ [ 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t' ]         │
│ 2       │ 'symbiosis-bsc-usdc'       │ 'Binance'  │ 'symbiosis' │ 'USDC'   │ 840945.8032194255  │ 3.45021 │ [ '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d' ] │
│ 3       │ 'symbiosis-ethereum-weth'  │ 'Ethereum' │ 'symbiosis' │ 'WETH'   │ 518164.7971485669  │ 0.82018 │ [ '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' ] │
│ 4       │ 'symbiosis-polygon-usdc-e' │ 'Polygon'  │ 'symbiosis' │ 'USDC.e' │ 405792.1939382256  │ 0.22943 │ [ '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174' ] │
│ 5       │ 'symbiosis-arbitrum-usdc'  │ 'Arbitrum' │ 'symbiosis' │ 'USDC'   │ 245635.28814287213 │ 4.33891 │ [ '0xaf88d065e77c8cC2239327C5EDb3A432268e5831' ] │
│ 6       │ 'symbiosis-boba-usdc'      │ 'Boba'     │ 'symbiosis' │ 'USDC'   │ 149489.22431317595 │ 0.00016 │ [ '0x66a2A913e447d6b4BF33EFbec43aAeF87890FBbc' ] │
│ 7       │ 'symbiosis-bsc-weth'       │ 'Binance'  │ 'symbiosis' │ 'WETH'   │ 133647.49891444357 │ 1.6682  │ [ '0x2170Ed0880ac9A755fd29B2688956BD959F933F8' ] │
│ 8       │ 'symbiosis-cronos-usdc'    │ 'Cronos'   │ 'symbiosis' │ 'USDC'   │ 129827.27535022148 │ 0.97271 │ [ '0xc21223249CA28397B4B6541dfFaEcC539BfF0c59' ] │
│ 9       │ 'symbiosis-gravity-usdc-e' │ 'Gravity'  │ 'symbiosis' │ 'USDC.e' │ 123019.17303533161 │ 0       │ [ '0xFbDa5F676cB37624f28265A144A48B0d6e87d3b6' ] │
└─────────┴────────────────────────────┴────────────┴─────────────┴──────────┴────────────────────┴─────────┴──────────────────────────────────────────────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

@0xkr3p 0xkr3p merged commit e39fb21 into DefiLlama:master Jan 23, 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