feat: add Brix wiTRY yield adapter#2680
Conversation
Adds a yield adapter for wiTRY, the yield-bearing staking wrapper for
Brix's iTRY (a TRY-pegged stablecoin backed by Turkish money market
funds).
APY is computed entirely on-chain, anchored to actual yield-distribution
events rather than fixed-window block sampling:
1. Collect RewardsReceived events from the wiTRY vault (last 21d)
2. end_event = latest distribution
start_event = latest event with ts <= end_event.ts - 7d
3. Sample convertToAssets at (event.ts + getVestingPeriod()) so each
anchor event's distribution is fully reflected — vesting-aware
4. elapsedDays dynamic (typically 7-9)
5. APY = (rateEnd / rateStart) ^ (365 / elapsedDays) - 1
This is robust to multi-day distribution gaps (Turkish public holidays,
weekends) — both anchors freeze symmetrically when no new distribution
arrives, so the displayed APY stays flat through dry periods and the
catch-up distribution at the end of a gap is absorbed without a spike.
The 10% performance fee is deducted by YieldForwarder before yield is
streamed into the wiTRY vault, so convertToAssets growth already
reflects net yield — no fee multiplier needed.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Error while running brix adapter: Test Suites: 1 failed, 1 total |
CI failure is the expected slug-dependency, not an adapter issueThe one failing test is the prerequisite mentioned in the PR description: ``` This fails because the project slug `brix` does not yet exist in DefiLlama's protocol list — it gets created when the parallel TVL adapter PR (DefiLlama-Adapters#19280) merges. Once that lands, this CI will pass on a re-run. Adapter itself: passing all other checks``` Sample pool produced: `tvlUsd: 0` is also expected and depends on the parallel price adapter PR (defillama-server#12004) landing. Happy to coordinate merge order — TVL first → this re-runs green → Price unlocks USD value. |
Summary
Adds a yield adapter for wiTRY, the yield-bearing staking wrapper for Brix's iTRY (a TRY-pegged stablecoin backed by Turkish money market funds).
APY methodology — distribution-anchored
Instead of sampling
convertToAssets(1e18)at fixed "now" and "exactly 7 days ago" timestamps, both endpoints are anchored to actual on-chainRewardsReceivedevents emitted by the wiTRY vault every time yield is streamed in. This is robust to multi-day distribution gaps (Turkish public holidays, weekends, religious holidays) that would otherwise produce large false dips and spikes if a fixednow − 7dblock were used.Why vesting-aware sampling. wiTRY uses an Ethena V2-style vesting pattern where `totalAssets()` subtracts the unvested portion of the latest distribution. Reading `convertToAssets` at the distribution event's own block returns the pre-distribution rate — the new amount has been added to `vestingAmount` but is 0% unlocked. Sampling at `event.ts + getVestingPeriod()` (currently 3600s, read live from the contract — admin-mutable) ensures each anchor event's distribution is fully reflected.
Why robust to holidays. When no distribution arrives, both `end_event` and `start_event` stay frozen → APY stays flat. The catch-up distribution at the end of a gap shifts both anchors symmetrically (start_event also moves) → no spike. This was the key concern for a Turkish-yield protocol with frequent multi-day banking-holiday gaps.
No fee multiplier needed. The 10% performance fee is deducted by `YieldForwarder` before yield is streamed into the wiTRY vault, so `convertToAssets` growth already reflects net yield to wiTRY holders.
Pool
Verified mainnet run
{ "pool": "0xe346c29b5b60ef870b9724c57ccfbbc631e47dee-ethereum", "chain": "Ethereum", "project": "brix", "symbol": "wiTRY", "tvlUsd": 0, "apyBase": 43.61888605833464, "underlyingTokens": ["0xb492B4aFD9658093694CF9452D5C272e8230F3B0"], "poolMeta": "APY · distribution-anchored 7d", "url": "https://app.brix.money" }`tvlUsd: 0` is expected and depends on the parallel price adapter PR landing in `DefiLlama/defillama-server`.
Prerequisites
Project info
Allow edits by maintainers: ✅