Skip to content

Add Tori Finance yields (strUSD)#2761

Open
tori-sam wants to merge 1 commit into
DefiLlama:masterfrom
tori-sam:tori-yields-adapter
Open

Add Tori Finance yields (strUSD)#2761
tori-sam wants to merge 1 commit into
DefiLlama:masterfrom
tori-sam:tori-yields-adapter

Conversation

@tori-sam

@tori-sam tori-sam commented Jun 26, 2026

Copy link
Copy Markdown

Adds the Tori-native yield pool strUSD (Staked trUSD) to the existing "Tori Finance" protocol (slug tori-finance, protocolId 8063).

strUSD is an ERC-4626 with: 8h reward vesting, a RewardsReceived(uint256) event, and a 7 day unstaking cooldown. APY is computed fully on-chain with no external API, similar to Ethena's sUSDe adapter:

  • apyBase: latest RewardsReceived amount annualized over the 8h cadence (3 per day) and compounded weekly.
  • apyBase7d: ERC-4626 share-price (convertToAssets) growth over a 7 day window.
  • pricePerShare and isIntrinsicSource are included.

TVL is read on-chain from totalAssets (the trUSD backing, valued 1:1 to USD), currently about $20M.

Note: during the current fee-waived pre-deposit phase, before transferInRewards has run, apyBase reads 0. It populates automatically once reward streaming begins (the on-chain vesting state confirms no distribution has occurred yet).

Local test: npm run test --adapter=tori-finance passes 14/14.

Summary by CodeRabbit

  • New Features

    • Added support for tracking Tori Finance’s strUSD vault on Ethereum.
    • Displays vault TVL and estimated APY based on on-chain activity.
    • Includes a 7-day yield trend check for better accuracy.
    • Provides protocol metadata and a direct link to the Tori Finance app.
  • Bug Fixes

    • Improves APY handling by safely returning zero when reward data is unavailable or calls fail.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@tori-sam, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 34 minutes and 51 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 887ee57d-510c-4d37-95d0-ff5c555d7952

📥 Commits

Reviewing files that changed from the base of the PR and between e2ba491 and c4ff9ee.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • src/adaptors/tori-finance/index.js
📝 Walkthrough

Walkthrough

Adds a new Tori Finance yield-server adapter for the strUSD ERC-4626 vault. It computes TVL from totalAssets(), APY from recent RewardsReceived events plus a 7-day share-price check, and exports the adapter metadata and single pool response.

Changes

Tori Finance adapter

Layer / File(s) Summary
Adapter logic and export
src/adaptors/tori-finance/index.js
Defines the strUSD pool payload, on-chain TVL and APY helpers, reward-event annualization, 7-day share-price growth check, and module exports for protocol 8063.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • 0xkr3p

Poem

A bunny hopped through Tori's vault at dawn,
Counting reward hops till the APY was drawn.
strUSD shimmered bright, both steady and neat,
With one tiny hop, the pool found its beat.
🐇🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding a Tori Finance yield adapter for strUSD.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ 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.

@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

🤖 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/tori-finance/index.js`:
- Around line 55-64: The 7-day APY lookup in sharePriceApy can point before
deployment and cause convertToAssets to fail for the pool’s first week; update
sharePriceApy to clamp the historical timestamp/block to LAUNCH_TS before
calling blockForTs/call, and compute the annualization using the actual elapsed
time between nowTs and the clamped start instead of returning 0 from the blanket
fallback. Use the sharePriceApy helper and the related apyBase7d path to locate
the fix.
🪄 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: 628ec31d-77be-4205-8496-214a1a0eae18

📥 Commits

Reviewing files that changed from the base of the PR and between d8ed6b6 and e2ba491.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • src/adaptors/tori-finance/index.js

Comment thread src/adaptors/tori-finance/index.js Outdated
@tori-sam tori-sam force-pushed the tori-yields-adapter branch from e2ba491 to c4ff9ee Compare June 26, 2026 12:46
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.

1 participant