Skip to content

feat: Add Peer/ZKP2P yield adapter#2799

Open
richardliang wants to merge 4 commits into
DefiLlama:masterfrom
richardliang:agent/peer-yield-adapter
Open

feat: Add Peer/ZKP2P yield adapter#2799
richardliang wants to merge 4 commits into
DefiLlama:masterfrom
richardliang:agent/peer-yield-adapter

Conversation

@richardliang

@richardliang richardliang commented Jul 9, 2026

Copy link
Copy Markdown

Summary

Adds a Peer yield adapter for Base USDC seller liquidity.

The adapter returns platform-level pools for current Peer Earn-supported rails:

  • Venmo
  • Wise
  • current Zelle (0xf752c7d19698ecb0bb8988abf9b9a53a4c3657f3bc8850a6fb59fdf3e3ce8cd3)
  • Revolut
  • PayPal
  • Chime
  • Cash App
  • Monzo

Legacy Zelle method hashes, N26, Mercado Pago, and Luxon are intentionally excluded from the yield pools.

Methodology

  • Uses Base RPC/on-chain reads only.
  • Reads current USDC liquidity from EscrowV2 using depositCounter() and getDeposit().
  • Checks active platform/currency routes with getDepositPaymentMethods(), getDepositPaymentMethodActive(), getDepositCurrencies(), and getEffectiveRate().
  • Limits priced yield routes to Peer Earn's USD/EUR/GBP set.
  • Computes fee APY from a 24h window of IntentFulfilled events that have matching EscrowV2.FundsUnlockedAndTransferred events.
  • Includes manual fills.
  • Computes each platform APY as:
weighted positive spread * (24h platform volume / platform-serviceable liquidity) * 365

Platform pools combine currencies inside the same platform. Liquidity is platform-serviceable liquidity, so it is not intended to be summed across Peer pools.

Sample Data

Latest on-chain smoke sample, UTC 2026-07-09 22:02:39:

Platform TVL 24h volume Fills Weighted spread APY
Cash App $18,674.88 $1,405.00 17 5.0220% 137.9090%
Revolut $25,283.43 $9,015.24 44 0.6400% 83.2999%
Venmo $72,392.51 $5,415.43 18 1.3535% 36.9576%
Wise $43,671.92 $5,950.12 26 0.6961% 34.6159%
PayPal $24,311.94 $646.66 5 3.2690% 31.7374%
Zelle $29,461.64 $1,249.42 3 0.2392% 3.7023%
Chime $21,616.67 $600.00 1 0.0000% 0.0000%
Monzo $1,423.67 $0.00 0 0.0000% 0.0000%

Historical APY smoke samples:

Platform Now 6h ago 24h ago 48h ago
Cash App 137.91% 130.49% 139.89% 88.25%
Revolut 83.30% 43.42% 22.28% 47.41%
Venmo 36.96% 45.08% 34.24% 88.95%
Wise 34.62% 29.21% 75.44% 139.86%
PayPal 31.74% 39.62% 13.10% 82.22%
Zelle 3.70% 0.00% 5.63% 9.47%

Validation

node --check peer/index.js
npm run test --adapter=peer -- --runInBand

The DefiLlama adapter harness passes and currently returns 8 pools. Monzo is below DefiLlama's $10k display threshold.

Summary by CodeRabbit

  • New Features
    • Added Peer protocol tracking on Base.
    • Introduced per-payment-platform realized USDC APY derived from on-chain escrow/orchestrator activity.
    • Added per-platform liquidity (TVL), volume (USD), and fill counts computed over a recent lookback window.
    • Added support for USD, EUR, and GBP payment routes with market-rate normalization.
    • Included pool metadata, token details, and direct links to the Peer application.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dbb0a2aa-c438-44f5-ab29-be53c3b7fd3a

📥 Commits

Reviewing files that changed from the base of the PR and between 0170677 and b9a361b.

📒 Files selected for processing (1)
  • src/adaptors/peer/index.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/adaptors/peer/index.js

📝 Walkthrough

Walkthrough

Adds a Peer adaptor that reads Base escrow liquidity, oracle rates, and intent events to calculate per-platform USDC APY and export the resulting pools.

Changes

Peer APY calculation

Layer / File(s) Summary
Contracts, currency metadata, and query utilities
src/adaptors/peer/index.js
Defines Base contract constants, ABIs, supported fiat currencies, platform mappings, decoding helpers, and chunked RPC queries.
Liquidity and market-rate discovery
src/adaptors/peer/index.js
Reads eligible escrow deposits and payment routes, aggregates platform TVL, and normalizes EUR/GBP oracle rates.
Window statistics and APY output
src/adaptors/peer/index.js
Correlates intent events with transferred amounts, calculates realized spread and volume, derives APY, and exports adaptor metadata.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested reviewers: 0xkr3p

Sequence Diagram(s)

sequenceDiagram
  participant Apy
  participant Liquidity
  participant Rates
  participant Stats
  participant BaseContracts
  Apy->>Liquidity: read escrow deposits and routes
  Liquidity->>BaseContracts: query deposit and payment data
  Apy->>Rates: read currency market rates
  Rates->>BaseContracts: query oracle rounds
  Apy->>Stats: process intent outcomes
  Stats->>BaseContracts: query intent and transfer events
  Liquidity-->>Apy: return platform TVL
  Stats-->>Apy: return volume and weighted spread
  Apy-->>Apy: derive APY pool results
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a new Peer/ZKP2P yield adapter.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

The peer adapter exports pools:

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

Nb of pools: 8
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────────┬────────┬─────────┬────────┬──────────────┬────────────────────┬──────────────────────────────────────────────────┬───────┬────────────────────────────────────────────────────────┬─────────────────────────┐
│ (index) │ pool                                                      │ chain  │ project │ symbol │ tvlUsd       │ apyBase            │ underlyingTokens                                 │ token │ poolMeta                                               │ url                     │
├─────────┼───────────────────────────────────────────────────────────┼────────┼─────────┼────────┼──────────────┼────────────────────┼──────────────────────────────────────────────────┼───────┼────────────────────────────────────────────────────────┼─────────────────────────┤
│ 0       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-venmo'   │ 'Base' │ 'peer'  │ 'USDC' │ 72371.512881 │ 37.977040378731196 │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Venmo (USD) seller liquidity (24h fee APR)'           │ 'https://www.peer.xyz/' │
│ 1       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-wise'    │ 'Base' │ 'peer'  │ 'USDC' │ 43671.920987 │ 34.391419155160754 │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Wise (USD/EUR/GBP) seller liquidity (24h fee APR)'    │ 'https://www.peer.xyz/' │
│ 2       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-zelle'   │ 'Base' │ 'peer'  │ 'USDC' │ 29461.642234 │ 3.7023131020212254 │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Zelle (USD) seller liquidity (24h fee APR)'           │ 'https://www.peer.xyz/' │
│ 3       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-revolut' │ 'Base' │ 'peer'  │ 'USDC' │ 25283.426354 │ 82.33441489051636  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Revolut (USD/EUR/GBP) seller liquidity (24h fee APR)' │ 'https://www.peer.xyz/' │
│ 4       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-paypal'  │ 'Base' │ 'peer'  │ 'USDC' │ 24311.944284 │ 31.737409429682966 │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'PayPal (USD/EUR/GBP) seller liquidity (24h fee APR)'  │ 'https://www.peer.xyz/' │
│ 5       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-chime'   │ 'Base' │ 'peer'  │ 'USDC' │ 21616.670409 │ 0                  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Chime (USD) seller liquidity (24h fee APR)'           │ 'https://www.peer.xyz/' │
│ 6       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-cashapp' │ 'Base' │ 'peer'  │ 'USDC' │ 18653.877682 │ 138.06424325312832 │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Cash App (USD) seller liquidity (24h fee APR)'        │ 'https://www.peer.xyz/' │
│ 7       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-monzo'   │ 'Base' │ 'peer'  │ 'USDC' │ 1423.668022  │ 0                  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Monzo (GBP) seller liquidity (24h fee APR)'           │ 'https://www.peer.xyz/' │
└─────────┴───────────────────────────────────────────────────────────┴────────┴─────────┴────────┴──────────────┴────────────────────┴──────────────────────────────────────────────────┴───────┴────────────────────────────────────────────────────────┴─────────────────────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

@richardliang richardliang changed the title Add Peer yield adapter feat: Add Peer yield adapter Jul 9, 2026
@richardliang richardliang changed the title feat: Add Peer yield adapter feat: Add Peer/ZKP2P yield adapter Jul 9, 2026
@richardliang
richardliang marked this pull request as ready for review July 9, 2026 22:12

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/adaptors/peer/index.js (1)

261-284: 🚀 Performance & Scalability | 🔵 Trivial

fetchPlatformLiquidity rescans every historical deposit on each run.

fetchDepositIds enumerates 0..depositCounter and getDeposit is multicalled for the entire set before closed/zero-liquidity deposits are filtered out. This cost grows unbounded with the protocol's lifetime deposit count (not just active liquidity), so each apy() invocation gets progressively heavier. Consider bounding the scan (e.g., an on-chain active-deposit enumerator, an off-chain index, or a lower deposit-id watermark) as the protocol scales.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/adaptors/peer/index.js` around lines 261 - 284, `fetchPlatformLiquidity`
is scanning the full historical deposit range on every `apy()` run via
`fetchDepositIds`, which makes the work grow with total deposits rather than
active ones. Update `fetchDepositIds` and the `getDeposit` call path to avoid
enumerating all IDs each time, using a bounded source such as an on-chain
active-deposit enumerator, an off-chain index, or a stored lower watermark so
only new or relevant deposit IDs are queried.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/adaptors/peer/index.js`:
- Around line 424-442: The oracle read in the feed loop is missing a freshness
check, so stale completed rounds can still be used. Update the `for` loop in the
peer adaptor to also read `updatedAt` from `entry.output` and skip the feed when
it is older than the feed’s expected heartbeat. Use the existing `tupleField`,
`asBigNumber`, and `config` data in this block to compare the timestamp against
the allowed staleness before assigning `rates[code]`.

---

Nitpick comments:
In `@src/adaptors/peer/index.js`:
- Around line 261-284: `fetchPlatformLiquidity` is scanning the full historical
deposit range on every `apy()` run via `fetchDepositIds`, which makes the work
grow with total deposits rather than active ones. Update `fetchDepositIds` and
the `getDeposit` call path to avoid enumerating all IDs each time, using a
bounded source such as an on-chain active-deposit enumerator, an off-chain
index, or a stored lower watermark so only new or relevant deposit IDs are
queried.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9bbb0bb0-5ae2-4564-b994-0eed0a0f1b45

📥 Commits

Reviewing files that changed from the base of the PR and between e1d36f7 and 53d60c2.

📒 Files selected for processing (1)
  • src/adaptors/peer/index.js

Comment thread src/adaptors/peer/index.js
@github-actions

Copy link
Copy Markdown

The peer adapter exports pools:

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

Nb of pools: 8
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────────┬────────┬─────────┬────────┬──────────────┬────────────────────┬──────────────────────────────────────────────────┬───────┬────────────────────────────────────────────────────────┬─────────────────────────┐
│ (index) │ pool                                                      │ chain  │ project │ symbol │ tvlUsd       │ apyBase            │ underlyingTokens                                 │ token │ poolMeta                                               │ url                     │
├─────────┼───────────────────────────────────────────────────────────┼────────┼─────────┼────────┼──────────────┼────────────────────┼──────────────────────────────────────────────────┼───────┼────────────────────────────────────────────────────────┼─────────────────────────┤
│ 0       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-venmo'   │ 'Base' │ 'peer'  │ 'USDC' │ 72253.927777 │ 44.12454431989046  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Venmo (USD) seller liquidity (24h fee APR)'           │ 'https://www.peer.xyz/' │
│ 1       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-wise'    │ 'Base' │ 'peer'  │ 'USDC' │ 41103.256081 │ 41.98374051437643  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Wise (USD/EUR/GBP) seller liquidity (24h fee APR)'    │ 'https://www.peer.xyz/' │
│ 2       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-revolut' │ 'Base' │ 'peer'  │ 'USDC' │ 29249.789359 │ 69.54039611534247  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Revolut (USD/EUR/GBP) seller liquidity (24h fee APR)' │ 'https://www.peer.xyz/' │
│ 3       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-zelle'   │ 'Base' │ 'peer'  │ 'USDC' │ 27797.945091 │ 3.923895226532956  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Zelle (USD) seller liquidity (24h fee APR)'           │ 'https://www.peer.xyz/' │
│ 4       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-cashapp' │ 'Base' │ 'peer'  │ 'USDC' │ 24207.732325 │ 54.65218201082581  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Cash App (USD) seller liquidity (24h fee APR)'        │ 'https://www.peer.xyz/' │
│ 5       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-paypal'  │ 'Base' │ 'peer'  │ 'USDC' │ 22105.330185 │ 60.916969406111996 │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'PayPal (USD/EUR/GBP) seller liquidity (24h fee APR)'  │ 'https://www.peer.xyz/' │
│ 6       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-chime'   │ 'Base' │ 'peer'  │ 'USDC' │ 19637.228624 │ 0                  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Chime (USD) seller liquidity (24h fee APR)'           │ 'https://www.peer.xyz/' │
│ 7       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-monzo'   │ 'Base' │ 'peer'  │ 'USDC' │ 778.615038   │ 0                  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Monzo (GBP) seller liquidity (24h fee APR)'           │ 'https://www.peer.xyz/' │
└─────────┴───────────────────────────────────────────────────────────┴────────┴─────────┴────────┴──────────────┴────────────────────┴──────────────────────────────────────────────────┴───────┴────────────────────────────────────────────────────────┴─────────────────────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

Comment thread src/adaptors/peer/index.js Outdated
apyBase,
underlyingTokens: [BASE_USDC],
token: null,
poolMeta: `${liquidity.platform.label} (${currencyMeta}) seller liquidity (24h fee APR)`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

reduce pool meta, too long.. should be a few words max

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in 01706776: poolMeta is now only the payment platform label (Venmo, Cash App, etc.), so it is a few words at most.

Comment thread src/adaptors/peer/index.js Outdated
underlyingTokens: [BASE_USDC],
token: null,
poolMeta: `${liquidity.platform.label} (${currencyMeta}) seller liquidity (24h fee APR)`,
url: 'https://www.peer.xyz/',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

add specific pool url

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in 01706776: each pool now links directly to https://app.peer.xyz/liquidity instead of the project homepage. The URL was verified to return HTTP 200.

Comment thread src/adaptors/peer/index.js Outdated
@@ -0,0 +1,635 @@
const sdk = require('@defillama/sdk');
const { ethers } = require('ethers');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ethers isn't needed we can replace BigNumber with native BigInt, formatUnits with Number(x)/10**dec, and utils.id('USD'/'EUR'/'GBP') with the three precomputed keccak constants; that drops the direct ethers import

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Addressed in 01706776: removed the direct ethers import, replaced BigNumber operations with native BigInt, replaced formatUnits with numeric decimal scaling, and precomputed the USD/EUR/GBP keccak hashes.

@0xkr3p 0xkr3p left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hi @richardliang, thanks for the PR. Can you check the TVL is not being double counted or overstated? pls also use defillama price api helper for usdc

@github-actions

Copy link
Copy Markdown

The peer adapter exports pools:

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

Nb of pools: 8
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────────┬────────┬─────────┬────────┬────────────────────┬────────────────────┬──────────────────────────────────────────────────┬───────┬────────────┬──────────────────────────────────┐
│ (index) │ pool                                                      │ chain  │ project │ symbol │ tvlUsd             │ apyBase            │ underlyingTokens                                 │ token │ poolMeta   │ url                              │
├─────────┼───────────────────────────────────────────────────────────┼────────┼─────────┼────────┼────────────────────┼────────────────────┼──────────────────────────────────────────────────┼───────┼────────────┼──────────────────────────────────┤
│ 0       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-venmo'   │ 'Base' │ 'peer'  │ 'USDC' │ 46206.78295273025  │ 107.06795346762506 │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Venmo'    │ 'https://app.peer.xyz/liquidity' │
│ 1       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-wise'    │ 'Base' │ 'peer'  │ 'USDC' │ 31241.604365279043 │ 45.4698050214556   │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Wise'     │ 'https://app.peer.xyz/liquidity' │
│ 2       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-zelle'   │ 'Base' │ 'peer'  │ 'USDC' │ 18199.670997936835 │ 0                  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Zelle'    │ 'https://app.peer.xyz/liquidity' │
│ 3       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-revolut' │ 'Base' │ 'peer'  │ 'USDC' │ 15336.93808991995  │ 88.38241974140054  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Revolut'  │ 'https://app.peer.xyz/liquidity' │
│ 4       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-cashapp' │ 'Base' │ 'peer'  │ 'USDC' │ 14557.2586392389   │ 89.57232735547291  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Cash App' │ 'https://app.peer.xyz/liquidity' │
│ 5       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-paypal'  │ 'Base' │ 'peer'  │ 'USDC' │ 10999.234226232205 │ 175.5408243294948  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'PayPal'   │ 'https://app.peer.xyz/liquidity' │
│ 6       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-chime'   │ 'Base' │ 'peer'  │ 'USDC' │ 8543.918118906397  │ 0                  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Chime'    │ 'https://app.peer.xyz/liquidity' │
│ 7       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-monzo'   │ 'Base' │ 'peer'  │ 'USDC' │ 82.76572764887659  │ 0                  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Monzo'    │ 'https://app.peer.xyz/liquidity' │
└─────────┴───────────────────────────────────────────────────────────┴────────┴─────────┴────────┴────────────────────┴────────────────────┴──────────────────────────────────────────────────┴───────┴────────────┴──────────────────────────────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

@richardliang

Copy link
Copy Markdown
Author

@0xkr3p Addressed the TVL accounting and USDC pricing points in 01706776.

  • Shared TVL: each deposit's remainingDeposits + outstandingIntentAmount is now assigned exactly once across its unique eligible platform pools. Any indivisible base-unit remainder is distributed deterministically, so deposits supporting several payment methods no longer inflate aggregate TVL.
  • USDC pricing: the adapter now uses utils.getPrices([BASE_USDC], 'base') and applies that DefiLlama price to both TVL and 24h volume.
  • APY remains positive spread × (24h platform volume / allocated platform TVL) × 365 × 100. Splitting shared TVL changes the platform denominator, but does not change its fee numerator.

I also ran fixed-block before/after smoke snapshots on three reproducibly sampled dates (seed 2799):

UTC snapshot Base block TVL before TVL after TVL reduction TVL-weighted APY before TVL-weighted APY after Annual fee before Annual fee after Fee delta
2026-07-05 12:00 48,231,726 $163,582.56 $115,222.01 29.56% 110.75% 157.21% $181,169.98 $181,136.28 -0.0186%
2026-07-07 12:00 48,318,126 $182,294.05 $119,728.56 34.32% 69.33% 105.54% $126,390.65 $126,367.15 -0.0186%
2026-07-10 12:00 48,447,726 $234,790.67 $151,479.37 35.48% 39.11% 60.62% $91,837.05 $91,819.96 -0.0186%

Annual fee is sum(tvlUsd × apyBase / 100). Each pair used the same pinned Base block and historical clock. The small, consistent -0.0186% fee delta is the DefiLlama current USDC price used by this non-timetravel adapter ($0.999814) versus the previous implicit $1; apart from that price conversion, fee dollars are conserved.

Validation: 53/53 adapter tests passed locally, and both the GitHub Test_Change and CodeRabbit checks are green.

@0xkr3p

0xkr3p commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@richardliang thanks for the fast changes, the APY figures look relatively high, we tend to show lower bounds of what a user will receive. I'm thinking we could compute apy over 7d or 30d to give a more realistic view on what apy figures could be achieved.

@richardliang

Copy link
Copy Markdown
Author

@0xkr3p Addressed in b9a361b: the adapter now computes fee APY over 7 days and annualizes by 365 / 7, while retaining the extra five-day signal lookup needed to join early-window fulfillments.

I compared 7d and 30d using identical fixed Base blocks, allocated TVL, spread logic, and USDC pricing:

UTC snapshot Base block 7d TVL-weighted APY 30d TVL-weighted APY
2026-06-11 12:00 47,194,926 398.62% 257.98%
2026-06-28 12:00 47,929,326 134.43% 148.68%
2026-07-14 12:00 48,620,526 68.42% 112.68%
2026-07-17 02:11 48,732,454 85.64% 117.07%

We selected 7d because it produced the lower aggregate figure in three of four samples and, at the latest block, was lower for seven of eight platform pools. It also reduces the mismatch from dividing a long period of historical fees by only the current allocated TVL. For example, Monzo had about $77 of current TVL: its 7d APY was 165.32%, while 30d produced 2,014.11% because it included fees earned before liquidity fell to its current level. Seven days still smooths one-day volatility without carrying as much stale liquidity history as 30 days.

Validation: the live Peer adapter suite passes 53/53 tests and exports all eight pools.

@github-actions

Copy link
Copy Markdown

The peer adapter exports pools:

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

Nb of pools: 8
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────────┬────────┬─────────┬────────┬────────────────────┬────────────────────┬──────────────────────────────────────────────────┬───────┬────────────┬──────────────────────────────────┐
│ (index) │ pool                                                      │ chain  │ project │ symbol │ tvlUsd             │ apyBase            │ underlyingTokens                                 │ token │ poolMeta   │ url                              │
├─────────┼───────────────────────────────────────────────────────────┼────────┼─────────┼────────┼────────────────────┼────────────────────┼──────────────────────────────────────────────────┼───────┼────────────┼──────────────────────────────────┤
│ 0       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-venmo'   │ 'Base' │ 'peer'  │ 'USDC' │ 50602.418297696575 │ 117.30323498202529 │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Venmo'    │ 'https://app.peer.xyz/liquidity' │
│ 1       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-wise'    │ 'Base' │ 'peer'  │ 'USDC' │ 29700.471983786843 │ 67.0912043498785   │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Wise'     │ 'https://app.peer.xyz/liquidity' │
│ 2       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-cashapp' │ 'Base' │ 'peer'  │ 'USDC' │ 18082.300395343    │ 82.76701621464227  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Cash App' │ 'https://app.peer.xyz/liquidity' │
│ 3       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-zelle'   │ 'Base' │ 'peer'  │ 'USDC' │ 12656.715148905554 │ 21.249451981026333 │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Zelle'    │ 'https://app.peer.xyz/liquidity' │
│ 4       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-revolut' │ 'Base' │ 'peer'  │ 'USDC' │ 12533.943416280468 │ 129.79002045137952 │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Revolut'  │ 'https://app.peer.xyz/liquidity' │
│ 5       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-chime'   │ 'Base' │ 'peer'  │ 'USDC' │ 11986.256912759638 │ 10.699010730767261 │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Chime'    │ 'https://app.peer.xyz/liquidity' │
│ 6       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-paypal'  │ 'Base' │ 'peer'  │ 'USDC' │ 11607.234363886733 │ 92.25531340866279  │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'PayPal'   │ 'https://app.peer.xyz/liquidity' │
│ 7       │ '0x777777779d229cdf3110e9de47943791c26300ef-base-monzo'   │ 'Base' │ 'peer'  │ 'USDC' │ 76.6020483095151   │ 165.31947847126526 │ [ '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ] │ null  │ 'Monzo'    │ 'https://app.peer.xyz/liquidity' │
└─────────┴───────────────────────────────────────────────────────────┴────────┴─────────┴────────┴────────────────────┴────────────────────┴──────────────────────────────────────────────────┴───────┴────────────┴──────────────────────────────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

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