Skip to content

Comments

Add LazyUSD yield adapter#2267

Merged
slasher125 merged 9 commits intoDefiLlama:masterfrom
sirmoremoney:add-lazyusd
Jan 17, 2026
Merged

Add LazyUSD yield adapter#2267
slasher125 merged 9 commits intoDefiLlama:masterfrom
sirmoremoney:add-lazyusd

Conversation

@sirmoremoney
Copy link

@sirmoremoney sirmoremoney commented Jan 14, 2026

Summary

Test output

Nb of pools: 1

Sample pools: [
  {
    pool: '0xd53b68fb4eb907c3c1e348cd7d7bede34f763805-ethereum',
    chain: 'Ethereum',
    project: 'lazyusd',
    symbol: 'USDC',
    tvlUsd: 500661.494622,
    apyBase: 19.55,
    underlyingTokens: [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ],
    url: 'https://getlazy.xyz'
  }
]

Test plan

  • Ran npm run test --adapter=lazyusd - all relevant tests pass
  • Pending: TVL adapter merge (PR #17673) for protocol slug validation

Summary by CodeRabbit

  • New Features
    • Added Lazy protocol adapter on Ethereum with liquidity pool metrics, including 1-day and 7-day APY calculations, total value locked (TVL), and underlying token information.

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

Onome Okajevo added 3 commits January 13, 2026 22:04
LazyUSD is a delta-neutral yield vault on Ethereum that deploys USDC
across lending protocols, DEXs, and derivatives platforms to generate
sustainable yields while maintaining full USDC backing.

The adapter calculates APY based on share price changes over a 7-day
window, falling back to accumulated yield for new vaults.
- Use vault deploy block to calculate available history
- Try 7-day window first, fall back to 1-day if vault is newer
- Remove hardcoded daysLive that would become stale
- Corrected VAULT_DEPLOY_BLOCK from 21763550 to 24181000 (Jan 7, 2026)
- Use ethers.js directly instead of SDK for more reliable ABI parsing
- Calculate APY using 7-day window (falls back to 1-day for new vaults)
@coderabbitai
Copy link

coderabbitai bot commented Jan 14, 2026

📝 Walkthrough

Walkthrough

A new adapter module is introduced at src/adaptors/lazy/index.js that computes APY metrics for the Lazy liquidity pool on Ethereum. It fetches current and historical share prices from the Vault contract, calculates 1-day and 7-day APY values, and returns formatted pool data.

Changes

Cohort / File(s) Summary
New Lazy Adapter
src/adaptors/lazy/index.js
New adapter module for Lazy project on Ethereum. Implements APY calculation from price changes (capped at 100%, floor at 0%). Fetches current sharePrice and totalAssets from Vault contract, computes 1-day and 7-day APY by querying historical prices at blocks from 1 and 7 days ago. Aggregates results with pool metadata (tvlUsd, underlyingTokens, url). Handles errors gracefully by logging and returning empty array. Exports timetravel flag, apy function, and url property.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A Lazy adapter hops into place,
APY calculations run at a steady pace,
Vault prices tracked through time,
Returns data, looking quite fine!
✨ Historical blocks and daily fees,
The Ethereum pools put minds at ease! 📊

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add LazyUSD yield adapter' directly and clearly summarizes the main change: introducing a new yield adapter module for LazyUSD, which aligns with the PR objectives and the new file added.
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

Error while running lazyusd adapter:

Test Suites: 1 failed, 1 total
Tests: 1 failed, 9 passed, 10 total
Snapshots: 0 total
Time: 0.301 s
Ran all test suites.

Nb of pools: 1
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬───────────┬────────┬───────────────┬────────────────────┬──────────────────────────────────────────────────┬───────────────────────┐
│ (index) │ pool                                                  │ chain      │ project   │ symbol │ tvlUsd        │ apyBase            │ underlyingTokens                                 │ url                   │
├─────────┼───────────────────────────────────────────────────────┼────────────┼───────────┼────────┼───────────────┼────────────────────┼──────────────────────────────────────────────────┼───────────────────────┤
│ 0       │ '0xd53b68fb4eb907c3c1e348cd7d7bede34f763805-ethereum' │ 'Ethereum' │ 'lazyusd' │ 'USDC' │ 500661.494622 │ 19.552464046207987 │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 'https://getlazy.xyz' │
└─────────┴───────────────────────────────────────────────────────┴────────────┴───────────┴────────┴───────────────┴────────────────────┴──────────────────────────────────────────────────┴───────────────────────┘
}

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: 3

🤖 Fix all issues with AI agents
In `@src/adaptors/lazyusd/index.js`:
- Around line 33-35: The calculation for apyBase uses historicalSharePrice (from
await vault.sharePrice({ blockTag: historicalBlock })) without guarding against
zero, which can yield Infinity/NaN; before computing priceChange and apyBase,
check that historicalSharePrice is a positive non-zero number and if it's zero
or falsy either set apyBase to 0 (or skip the APY calculation) and optionally
log/mark the vault as uninitialized — update the block that assigns
historicalSharePrice, computes priceChange, and sets apyBase to perform this
validation and handle the zero-case safely.
- Around line 4-6: The VAULT_DEPLOY_BLOCK constant is incorrect (24181000 is
non-existent); locate the actual deployment block for the VAULT address
(0xd53B68fB4eb907c3c1E348CD7d7bEDE34f763805) by checking the contract creation
transaction on Etherscan or by querying the creation tx receipt via web3/ethers
to get its blockNumber, then update VAULT_DEPLOY_BLOCK to that integer value in
the file (ensure you modify the VAULT_DEPLOY_BLOCK constant alongside the
existing VAULT and USDC constants).
🧹 Nitpick comments (2)
src/adaptors/lazyusd/index.js (2)

1-1: Unused import: sdk is never used.

The @defillama/sdk import is declared but not referenced anywhere in this file. Remove it to avoid confusion.

Suggested fix
-const sdk = require('@defillama/sdk');
 const { ethers } = require('ethers');

18-18: blocksPerDay is an approximation.

The value 7200 assumes exactly 12-second block times. Post-merge Ethereum averages ~12.05s, which introduces minor drift over 7 days (~0.4%). This is acceptable for APY estimates but worth noting.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e95933c and 5156c75.

📒 Files selected for processing (1)
  • src/adaptors/lazyusd/index.js
🔇 Additional comments (3)
src/adaptors/lazyusd/index.js (3)

8-11: LGTM!

The human-readable ABI format is appropriate for ethers.js, and the function signatures match standard vault interfaces.


27-36: Edge case: vault less than 1 day old still returns apyBase = 0.

If the vault is less than 1 day old, the fallback on line 28 sets historicalBlock = latestBlock - blocksPerDay, which may still be less than VAULT_DEPLOY_BLOCK. The condition on line 32 will then be false, leaving apyBase = 0. This is likely acceptable behavior for new vaults, but worth confirming this is intentional.


50-54: LGTM!

The export structure follows the standard DefiLlama yield adapter pattern with timetravel, apy, and url properties.

@llamatester
Copy link

Error while running lazyusd adapter:

Test Suites: 1 failed, 1 total
Tests: 1 failed, 9 passed, 10 total
Snapshots: 0 total
Time: 0.272 s
Ran all test suites.

Nb of pools: 1
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬───────────┬────────┬───────────────┬─────────┬──────────────────────────────────────────────────┬───────────────────────┐
│ (index) │ pool                                                  │ chain      │ project   │ symbol │ tvlUsd        │ apyBase │ underlyingTokens                                 │ url                   │
├─────────┼───────────────────────────────────────────────────────┼────────────┼───────────┼────────┼───────────────┼─────────┼──────────────────────────────────────────────────┼───────────────────────┤
│ 0       │ '0xd53b68fb4eb907c3c1e348cd7d7bede34f763805-ethereum' │ 'Ethereum' │ 'lazyusd' │ 'USDC' │ 510661.494622 │ 0       │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 'https://getlazy.xyz' │
└─────────┴───────────────────────────────────────────────────────┴────────────┴───────────┴────────┴───────────────┴─────────┴──────────────────────────────────────────────────┴───────────────────────┘
}

@llamatester
Copy link

Error while running lazyusd adapter:

Test Suites: 1 failed, 1 total
Tests: 1 failed, 9 passed, 10 total
Snapshots: 0 total
Time: 0.297 s
Ran all test suites.

Nb of pools: 1
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬───────────┬────────┬───────────────┬────────────────────┬──────────────────────────────────────────────────┬───────────────────────┐
│ (index) │ pool                                                  │ chain      │ project   │ symbol │ tvlUsd        │ apyBase            │ underlyingTokens                                 │ url                   │
├─────────┼───────────────────────────────────────────────────────┼────────────┼───────────┼────────┼───────────────┼────────────────────┼──────────────────────────────────────────────────┼───────────────────────┤
│ 0       │ '0xd53b68fb4eb907c3c1e348cd7d7bede34f763805-ethereum' │ 'Ethereum' │ 'lazyusd' │ 'USDC' │ 510661.494622 │ 19.552464046207987 │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 'https://getlazy.xyz' │
└─────────┴───────────────────────────────────────────────────────┴────────────┴───────────┴────────┴───────────────┴────────────────────┴──────────────────────────────────────────────────┴───────────────────────┘
}

- Remove fallback to 1-day calculation
- Return 0 APY if vault is less than 7 days old
- Add guard against division by zero
- Cap APY at 100% to filter data outliers
- Simpler, more predictable calculation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@llamatester
Copy link

Error while running lazyusd adapter:

Test Suites: 1 failed, 1 total
Tests: 1 failed, 9 passed, 10 total
Snapshots: 0 total
Time: 0.276 s
Ran all test suites.

Nb of pools: 1
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬───────────┬────────┬───────────────┬─────────┬──────────────────────────────────────────────────┬───────────────────────┐
│ (index) │ pool                                                  │ chain      │ project   │ symbol │ tvlUsd        │ apyBase │ underlyingTokens                                 │ url                   │
├─────────┼───────────────────────────────────────────────────────┼────────────┼───────────┼────────┼───────────────┼─────────┼──────────────────────────────────────────────────┼───────────────────────┤
│ 0       │ '0xd53b68fb4eb907c3c1e348cd7d7bede34f763805-ethereum' │ 'Ethereum' │ 'lazyusd' │ 'USDC' │ 510661.494622 │ 0       │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 'https://getlazy.xyz' │
└─────────┴───────────────────────────────────────────────────────┴────────────┴───────────┴────────┴───────────────┴─────────┴──────────────────────────────────────────────────┴───────────────────────┘
}

@llamatester
Copy link

Error while running lazyusd adapter:

Test Suites: 1 failed, 1 total
Tests: 1 failed, 9 passed, 10 total
Snapshots: 0 total
Time: 0.302 s
Ran all test suites.

Nb of pools: 1
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬───────────┬────────┬───────────────┬────────────────────┬──────────────────────────────────────────────────┬───────────────────────┐
│ (index) │ pool                                                  │ chain      │ project   │ symbol │ tvlUsd        │ apyBase            │ underlyingTokens                                 │ url                   │
├─────────┼───────────────────────────────────────────────────────┼────────────┼───────────┼────────┼───────────────┼────────────────────┼──────────────────────────────────────────────────┼───────────────────────┤
│ 0       │ '0xd53b68fb4eb907c3c1e348cd7d7bede34f763805-ethereum' │ 'Ethereum' │ 'lazyusd' │ 'USDC' │ 550820.713731 │ 7.1748571428573715 │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 'https://getlazy.xyz' │
└─────────┴───────────────────────────────────────────────────────┴────────────┴───────────┴────────┴───────────────┴────────────────────┴──────────────────────────────────────────────────┴───────────────────────┘
}

Following best practices from other vault-style adapters (Sandclock, Beraborrow),
providing both metrics gives users better insight into yield stability.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@llamatester
Copy link

Error while running lazyusd adapter:

Test Suites: 1 failed, 1 total
Tests: 1 failed, 9 passed, 10 total
Snapshots: 0 total
Time: 0.29 s
Ran all test suites.

Nb of pools: 1
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬───────────┬────────┬───────────────┬───────────────────┬──────────────────────────────────────────────────┬───────────────────────┬────────────────────┐
│ (index) │ pool                                                  │ chain      │ project   │ symbol │ tvlUsd        │ apyBase           │ underlyingTokens                                 │ url                   │ apyBase7d          │
├─────────┼───────────────────────────────────────────────────────┼────────────┼───────────┼────────┼───────────────┼───────────────────┼──────────────────────────────────────────────────┼───────────────────────┼────────────────────┤
│ 0       │ '0xd53b68fb4eb907c3c1e348cd7d7bede34f763805-ethereum' │ 'Ethereum' │ 'lazyusd' │ 'USDC' │ 550820.713731 │ 9.114736806359087 │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 'https://getlazy.xyz' │ 7.1748571428573715 │
└─────────┴───────────────────────────────────────────────────────┴────────────┴───────────┴────────┴───────────────┴───────────────────┴──────────────────────────────────────────────────┴───────────────────────┴────────────────────┘
}

@llamatester
Copy link

The lazy adapter exports pools:

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

Nb of pools: 1
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬─────────┬────────┬───────────────┬────────────────────┬──────────────────────────────────────────────────┬───────────────────────┬──────────────────┐
│ (index) │ pool                                                  │ chain      │ project │ symbol │ tvlUsd        │ apyBase            │ underlyingTokens                                 │ url                   │ apyBase7d        │
├─────────┼───────────────────────────────────────────────────────┼────────────┼─────────┼────────┼───────────────┼────────────────────┼──────────────────────────────────────────────────┼───────────────────────┼──────────────────┤
│ 0       │ '0xd53b68fb4eb907c3c1e348cd7d7bede34f763805-ethereum' │ 'Ethereum' │ 'lazy'  │ 'USDC' │ 551020.713731 │ 10.606904898860673 │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 'https://getlazy.xyz' │ 8.69221428571473 │
└─────────┴───────────────────────────────────────────────────────┴────────────┴─────────┴────────┴───────────────┴────────────────────┴──────────────────────────────────────────────────┴───────────────────────┴──────────────────┘

@slasher125
Copy link
Collaborator

@sirmoremoney
pls remove the changes in the package files

@llamatester
Copy link

The lazy adapter exports pools:

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

Nb of pools: 1
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬─────────┬────────┬───────────────┬────────────────────┬──────────────────────────────────────────────────┬───────────────────────┬───────────────────┐
│ (index) │ pool                                                  │ chain      │ project │ symbol │ tvlUsd        │ apyBase            │ underlyingTokens                                 │ url                   │ apyBase7d         │
├─────────┼───────────────────────────────────────────────────────┼────────────┼─────────┼────────┼───────────────┼────────────────────┼──────────────────────────────────────────────────┼───────────────────────┼───────────────────┤
│ 0       │ '0xd53b68fb4eb907c3c1e348cd7d7bede34f763805-ethereum' │ 'Ethereum' │ 'lazy'  │ 'USDC' │ 551020.713731 │ 10.606904898860673 │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 'https://getlazy.xyz' │ 8.143859180500662 │
└─────────┴───────────────────────────────────────────────────────┴────────────┴─────────┴────────┴───────────────┴────────────────────┴──────────────────────────────────────────────────┴───────────────────────┴───────────────────┘

@sirmoremoney
Copy link
Author

@sirmoremoney pls remove the changes in the package files
Done. Let me know if there is anything else. Thanks

@slasher125 slasher125 merged commit 17811c9 into DefiLlama:master Jan 17, 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.

3 participants