Skip to content

add Phoenix Protocol TVL adapter#18699

Open
gititGoro wants to merge 1 commit intoDefiLlama:mainfrom
Behodler:sprint/tvl-adapter
Open

add Phoenix Protocol TVL adapter#18699
gititGoro wants to merge 1 commit intoDefiLlama:mainfrom
Behodler:sprint/tvl-adapter

Conversation

@gititGoro
Copy link
Copy Markdown

@gititGoro gititGoro commented Apr 9, 2026

Phoenix Protocol

Adds a TVL adapter for Phoenix Protocol on Ethereum mainnet.

Methodology

  • TVL: Underlying stablecoins (DOLA, USDC) held in ERC4626 yield vaults (AutoDOLA, AutoUSDC) on behalf of Phoenix's YieldStrategy* contracts. The adapter reads each strategy's vault share balance and converts to underlying assets via convertToAssets, then attributes the value to the underlying asset token (priced normally by DefiLlama).
  • Staking: phUSD deposited in the Phlimbo yield farm (0x3984eBC84d45a889dDAc595d13dc0aC2E54819F4), reported via the standard staking helper.

Contracts

Contract Address
phUSD 0xf3B5B661b92B75C71fA5Aba8Fd95D7514A9CD605
Phlimbo (yield farm) 0x3984eBC84d45a889dDAc595d13dc0aC2E54819F4
YieldStrategyDola 0xE7aEC21BF6420FF483107adCB9360C4b31d69D78
YieldStrategyUSDC 0x8b4A75290A1C4935eC1dfd990374AC4BD4D33952
AutoDOLA vault 0x79eB84B5E30Ef2481c8f00fD0Aa7aAd6Ac0AA54d
AutoUSDC vault 0xa7569A44f348d3D70d8ad5889e50F78E33d80D35

Checklist

  • No new npm dependencies
  • Allow edits by maintainers enabled
  • Methodology described in adapter and PR

Summary by CodeRabbit

  • New Features
    • Added Phoenix Protocol integration with Total Value Locked (TVL) calculations for vault strategies
    • Integrated protocol staking functionality
    • Implemented on-chain TVL aggregation across vault contracts
    • Added methodology documentation for TVL calculation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 9, 2026

📝 Walkthrough

Walkthrough

A new module introduces Ethereum TVL and staking logic for the Phoenix Protocol. The implementation fetches ERC4626 vault share balances, converts them to underlying asset amounts through batched on-chain calls, and attributes the resolved values to their respective token addresses.

Changes

Cohort / File(s) Summary
Phoenix Protocol Module
projects/phoenix-protocol/index.js
New module exporting TVL calculation handler that performs three batched Ethereum reads: fetches vault share balances, converts shares to assets via ERC4626 interface, resolves underlying token addresses, and attributes balances accordingly. Also exports staking handler and methodology description.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client/API
    participant Chain as Ethereum Blockchain
    participant Vault as ERC4626 Vault
    participant Token as Token Contract

    Client->>Chain: Batch call balanceOf(vault) on strategy
    Chain-->>Client: Returns share balances
    Client->>Vault: Batch call convertToAssets(shares)
    Vault->>Chain: Fetch conversion logic
    Chain-->>Vault: Return conversion data
    Vault-->>Client: Returns asset amounts
    Client->>Vault: Batch call asset() getter
    Vault->>Chain: Fetch token address
    Chain-->>Vault: Return token address
    Vault-->>Client: Returns token address
    Client->>Token: api.add(token, assets)
    Token-->>Client: TVL attributed
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 In Phoenix fields, a new protocol bloom,
Where vaults convert shares and banish gloom,
Three batched reads dance on the chain so bright,
Staking and TVL singing in the night! 🌙✨

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding a TVL adapter for Phoenix Protocol.
Description check ✅ Passed The PR description provides comprehensive information including website, category, chain, detailed methodology, contract addresses, and completed checklist items.

✏️ 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.

@llamabutler
Copy link
Copy Markdown

The adapter at projects/phoenix-protocol exports TVL:

ethereum                  25.05 k
ethereum-staking          0.00
staking                   0.00

total                    25.05 k 

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)
projects/phoenix-protocol/index.js (1)

6-14: Refactor away from index-coupled parallel arrays.

strategies[i] and vaults[i] work now, but this pattern is brittle for future edits and can silently mispair contracts. Prefer explicit { strategy, vault } tuples.

♻️ Proposed refactor
-const strategies = [
-  "0xE7aEC21BF6420FF483107adCB9360C4b31d69D78", // YieldStrategyDola
-  "0x8b4A75290A1C4935eC1dfd990374AC4BD4D33952", // YieldStrategyUSDC
-];
-
-const vaults = [
-  "0x79eB84B5E30Ef2481c8f00fD0Aa7aAd6Ac0AA54d", // AutoDOLA
-  "0xa7569A44f348d3D70d8ad5889e50F78E33d80D35", // AutoUSDC
-];
+const strategyVaultPairs = [
+  {
+    strategy: "0xE7aEC21BF6420FF483107adCB9360C4b31d69D78", // YieldStrategyDola
+    vault: "0x79eB84B5E30Ef2481c8f00fD0Aa7aAd6Ac0AA54d", // AutoDOLA
+  },
+  {
+    strategy: "0x8b4A75290A1C4935eC1dfd990374AC4BD4D33952", // YieldStrategyUSDC
+    vault: "0xa7569A44f348d3D70d8ad5889e50F78E33d80D35", // AutoUSDC
+  },
+];

 async function tvl(api) {
   const shares = await api.multiCall({
     abi: "erc20:balanceOf",
-    calls: vaults.map((vault, i) => ({ target: vault, params: strategies[i] })),
+    calls: strategyVaultPairs.map(({ vault, strategy }) => ({ target: vault, params: strategy })),
   });

   const assets = await api.multiCall({
     abi: "function convertToAssets(uint256) view returns (uint256)",
-    calls: vaults.map((vault, i) => ({ target: vault, params: shares[i] })),
+    calls: strategyVaultPairs.map(({ vault }, i) => ({ target: vault, params: shares[i] })),
   });

-  const tokens = await api.multiCall({ abi: "address:asset", calls: vaults });
+  const tokens = await api.multiCall({
+    abi: "address:asset",
+    calls: strategyVaultPairs.map(({ vault }) => vault),
+  });

Also applies to: 19-25

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@projects/phoenix-protocol/index.js` around lines 6 - 14, The code uses
parallel arrays strategies and vaults which can mispair; replace both arrays
with a single array of objects like [{ strategy: "0x...", vault: "0x..." }, ...]
and update any code that iterates or indexes strategies[i]/vaults[i] to
destructure each tuple (e.g., for (const {strategy, vault} of phoenixPairs) ...)
so pairing is explicit; apply the same refactor to the other parallel arrays in
this file (the second pair around the later block) and update referenced symbols
(strategies, vaults) to the new collection name (e.g., phoenixPairs) and their
usages (index-based accesses) accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@projects/phoenix-protocol/index.js`:
- Around line 6-14: The code uses parallel arrays strategies and vaults which
can mispair; replace both arrays with a single array of objects like [{
strategy: "0x...", vault: "0x..." }, ...] and update any code that iterates or
indexes strategies[i]/vaults[i] to destructure each tuple (e.g., for (const
{strategy, vault} of phoenixPairs) ...) so pairing is explicit; apply the same
refactor to the other parallel arrays in this file (the second pair around the
later block) and update referenced symbols (strategies, vaults) to the new
collection name (e.g., phoenixPairs) and their usages (index-based accesses)
accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e4227f9c-b1ed-4697-a555-0eb0e7b97471

📥 Commits

Reviewing files that changed from the base of the PR and between dac18f4 and 8ae89f2.

📒 Files selected for processing (1)
  • projects/phoenix-protocol/index.js

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