Add Tirelire fees adapter (Robinhood Chain)#8386
Conversation
Verbatim Gamma Hypervisor ALM on Robinhood Chain (chainId 4663). Fees/revenue read on-chain from ZeroBurn events; treasury cut = fees/fee (10%). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Summary by CodeRabbit
WalkthroughAdds a Robinhood Chain Tirelire fee adapter that reads ZeroBurn events from two Hypervisors, aggregates trading fees and protocol revenue, and exports a version 2 SimpleAdapter beginning July 22, 2026. ChangesTirelire fee reporting
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant SimpleAdapter
participant fetch
participant Hypervisors
participant RobinhoodLogs
SimpleAdapter->>fetch: provide adapter options
fetch->>Hypervisors: read token0 and token1
fetch->>RobinhoodLogs: retrieve ZeroBurn events
RobinhoodLogs-->>fetch: return fee, fees0, fees1
fetch-->>SimpleAdapter: return dailyFees and dailyProtocolRevenue
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 12 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (12 passed)
✨ Finishing Touches✨ Simplify code
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 |
|
The tirelire.ts adapter exports: |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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 `@fees/tirelire.ts`:
- Around line 51-59: Update the divisor calculation in the daily revenue
processing block to parse log.fee directly with BigInt instead of defaulting
through Number(log.fee) || 1. Require the parsed divisor to be positive, and
explicitly handle invalid or non-positive event data by following the
surrounding event-processing error handling rather than adding revenue.
- Around line 43-49: Replace the per-target reads in the HYPERVISORS loop with
one api.multiCall for token0/token1 lookups, preserving each hypervisor’s token
mapping, and replace per-target getLogs calls with a single getLogs request
using targets: HYPERVISORS and flatten: false. Update subsequent processing to
consume the batched results while retaining the existing target associations.
- Around line 39-67: Update the fetch function to create and populate
dailySupplySideRevenue with the non-treasury portion of each fee, calculated as
fees minus the treasury amount in dailyRevenue for both tokens. Return it
alongside dailyFees and dailyRevenue so the invariant dailyFees = dailyRevenue +
dailySupplySideRevenue holds, without aliasing dailyProtocolRevenue to
dailyRevenue.
- Around line 70-80: Update the SimpleAdapter configuration to set pullHourly:
true and add SupplySideRevenue as zero in the methodology. Add matching
breakdownMethodology entries for every revenue breakdown label used by the
adapter’s per-target add() calls, including the collected revenue components.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 64469b53-68f6-42a0-87da-e130b577a42b
📒 Files selected for processing (1)
fees/tirelire.ts
| for (const target of HYPERVISORS) { | ||
| const [token0, token1] = await Promise.all([ | ||
| options.api.call({ abi: "address:token0", target }), | ||
| options.api.call({ abi: "address:token1", target }), | ||
| ]); | ||
|
|
||
| const logs = await options.getLogs({ target, eventAbi: ZERO_BURN }); |
There was a problem hiding this comment.
🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win
Batch the Hypervisor reads and log query.
Use api.multiCall for token lookups and one getLogs({ targets: HYPERVISORS, ... }) call with flatten: false, preserving each target’s token mapping. This reduces repeated calls and follows the adapter guidelines.
🤖 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 `@fees/tirelire.ts` around lines 43 - 49, Replace the per-target reads in the
HYPERVISORS loop with one api.multiCall for token0/token1 lookups, preserving
each hypervisor’s token mapping, and replace per-target getLogs calls with a
single getLogs request using targets: HYPERVISORS and flatten: false. Update
subsequent processing to consume the batched results while retaining the
existing target associations.
Sources: Coding guidelines, Path instructions
| const fees0 = BigInt(log.fees0); | ||
| const fees1 = BigInt(log.fees1); | ||
| const divisor = BigInt(Number(log.fee) || 1); | ||
|
|
||
| dailyFees.add(token0, fees0); | ||
| dailyFees.add(token1, fees1); | ||
| // Integer division mirrors the contract's SafeMath `.div(fee)` cut. | ||
| dailyRevenue.add(token0, fees0 / divisor); | ||
| dailyRevenue.add(token1, fees1 / divisor); |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Do not silently default an invalid fee divisor to 1.
Number(log.fee) || 1 turns zero, missing, or malformed event data into a divisor of one, materially inflating dailyRevenue. Parse the value directly as BigInt, require it to be positive, and handle invalid events explicitly.
🤖 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 `@fees/tirelire.ts` around lines 51 - 59, Update the divisor calculation in the
daily revenue processing block to parse log.fee directly with BigInt instead of
defaulting through Number(log.fee) || 1. Require the parsed divisor to be
positive, and explicitly handle invalid or non-positive event data by following
the surrounding event-processing error handling rather than adding revenue.
| const adapter: SimpleAdapter = { | ||
| version: 2, | ||
| fetch, | ||
| adapter: { | ||
| [CHAIN.ROBINHOOD]: { start: "2026-07-22" }, // flagship deploy date | ||
| }, | ||
| methodology: { | ||
| Fees: "All Uniswap V3 trading fees collected by the positions each Tirelire Hypervisor manages, summed on-chain from ZeroBurn events.", | ||
| Revenue: "The 10% performance fee taken from collected trading fees and sent to the protocol treasury (fees / fee, with the divisor read from each ZeroBurn event).", | ||
| ProtocolRevenue: "Same as Revenue — the 10% performance fee retained by the protocol treasury.", | ||
| }, |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== locate file =="
fd -a 'tirelire\.ts$' . || true
echo "== file outline =="
ast-grep outline fees/tirelire.ts --view expanded || true
echo "== relevant file sections =="
wc -l fees/tirelire.ts
sed -n '1,180p' fees/tirelire.ts
echo "== search Tirelire/Hypervisor references in fees =="
rg -n "tirelire|Tirelire|Hypervisor|ZeroBurn|pullHourly|breakdownMethodology|dailySupplySideRevenue|dailyProtocolRevenue|dailyHoldersRevenue" fees || trueRepository: DefiLlama/dimension-adapters
Length of output: 50385
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== tirelire file size and key occurrences =="
wc -l fees/tireلیل.ts fees/tirelire.ts 2>/dev/null || true
rg -n "pullHourly|breakdownMethodology|dailySupplySideRevenue|dailyProtocolRevenue|dailyHoldersRevenue|Univ3|Hypervisor|ZeroBurn|version: 2|SimpleAdapter|adapter:" fees/tirelire.ts || true
echo "== focused tirelire.ts lines =="
if [ -f fees/tirelire.ts ]; then
nl -ba fees/tirelire.ts | sed -n '1,220p'
fi
echo "== nearby files named tirelire =="
fd -a 'tirelire|Tirelire|tire' fees . -d 4 || true
echo "== targeted Tirelire symbols across repository =="
rg -n "\bTirelire\b|\btirelire\b|ROBINHOOD|Hypervisor|ZeroBurn" . --glob '!node_modules/**' --glob '!dist/**' | head -n 200 || trueRepository: DefiLlama/dimension-adapters
Length of output: 1195
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== focused tirelire.ts lines =="
sed -n '1,110p' fees/tirelire.ts
echo "== adapter export summary =="
python3 - <<'PY'
from pathlib import Path
p = Path('fees/tirelire.ts')
text = p.read_text()
for term in ['version:', 'pullHourly', 'breakdownMethodology', 'dailySupplySideRevenue', 'dailyHoldersRevenue', 'dailyProtocolRevenue']:
print(f'{term}:', term in text)
PYRepository: DefiLlama/dimension-adapters
Length of output: 3870
Add pullHourly: true and expose the collected revenue breakdown.
This v2 on-chain log adapter needs explicit hourly data retrieval. Add SupplySideRevenue that is zero because Tirelire does not expose LP distribution in the ZeroBurn events; each label used in the breakdown must also have a matching breakdownMethodology entry because this adapter uses per-target add() labels.
🤖 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 `@fees/tirelire.ts` around lines 70 - 80, Update the SimpleAdapter
configuration to set pullHourly: true and add SupplySideRevenue as zero in the
methodology. Add matching breakdownMethodology entries for every revenue
breakdown label used by the adapter’s per-target add() calls, including the
collected revenue components.
Sources: Coding guidelines, Path instructions
|
The tirelire.ts adapter exports: |
|
@admsk2 thanks for the PR |
Tirelire fees & revenue adapter (Robinhood Chain)
Adds a fees adapter for Tirelire, an automated Uniswap V3 liquidity manager (ALM) on Robinhood Chain (Arbitrum Orbit L2, chainId 4663 — slug
robinhood). Tirelire deploys the audited Gamma Hypervisor verbatim (config-only) and manages Uniswap V3 positions, auto-compounding trading fees.Listing metadata
Methodology
Read fully on-chain from each Hypervisor's
ZeroBurn(uint8 fee, uint256 fees0, uint256 fees1)event.fees0/fees1are the total Uniswap V3 trading fees the position collected; the protocol treasury takesfees / fee(both vaults runfee = 10→ a 10% performance fee; the divisor is read per-event, not hardcoded).The canonical Gamma fees adapter (
fees/gamma.ts) pulls from Gamma's own API, which does not include this independent deployment — hence the on-chain event approach.Vaults:
0xb9F974d19425d93B3a9dC80c8f0d3aE428Cbb2B2— Tirelire USDG-WETH (0.05%)0xcFefe9Ee6B45587939debB869394190432e72258— Tirelire USDG-NVDA (0.05%)Test