Skip to content

Add Tirelire fees adapter (Robinhood Chain)#8386

Merged
bheluga merged 2 commits into
DefiLlama:masterfrom
admsk2:add-tirelire
Jul 24, 2026
Merged

Add Tirelire fees adapter (Robinhood Chain)#8386
bheluga merged 2 commits into
DefiLlama:masterfrom
admsk2:add-tirelire

Conversation

@admsk2

@admsk2 admsk2 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

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/fees1 are the total Uniswap V3 trading fees the position collected; the protocol treasury takes fees / fee (both vaults run fee = 10 → a 10% performance fee; the divisor is read per-event, not hardcoded).

  • Fees = Σ (fees0 + fees1) — all trading fees collected
  • Revenue / ProtocolRevenue = Σ (fees0/fee + fees1/fee) — the 10% treasury cut

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

$ npm test fees tirelire
ROBINHOOD 👇
Daily fees: 14.00
Daily revenue: 1.41
Daily protocol revenue: 1.41

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>
@coderabbitai

coderabbitai Bot commented Jul 24, 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c39a0e8f-a961-4193-822f-234ebbe796b7

📥 Commits

Reviewing files that changed from the base of the PR and between 0029958 and 5542955.

📒 Files selected for processing (1)
  • fees/tirelire.ts

Summary by CodeRabbit

  • New Features
    • Added fee and protocol revenue tracking for Tirelire on Robinhood Chain.
    • Reports daily trading fees, protocol revenue, and revenue methodology based on on-chain activity.
    • Tracking begins July 22, 2026.

Walkthrough

Adds 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.

Changes

Tirelire fee reporting

Layer / File(s) Summary
ZeroBurn fee aggregation
fees/tirelire.ts
Documents the fee mechanics, targets two Hypervisors, retrieves token and ZeroBurn event data, and computes daily fees, protocol revenue, and supply-side revenue.
Robinhood adapter registration
fees/tirelire.ts
Adds methodology descriptions and exports the version 2 SimpleAdapter with Robinhood configuration, start date, and fetch wiring.

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
Loading

Possibly related PRs

Suggested labels: fees, new-adapter, methodology

🚥 Pre-merge checks | ✅ 12 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title is relevant, but it does not match the required [type] protocol-name - description format. Rewrite it as [add] Tirelire - fees adapter for Robinhood Chain or another title in the required format.
Description check ⚠️ Warning The description covers core metadata and methodology, but it omits many required new-listing template fields. Fill the remaining template sections, including logo, current TVL, treasury, token info, proof/implementation details, forkedFrom, Github org/user, and referral program.
Efficiency And Error Handling ⚠️ Warning fetch loops over HYPERVISORS and makes per-target api.call token lookups instead of batching them with api.multiCall. Batch token0/token1 reads across all hypervisors with api.multiCall (or equivalent pooling) so the adapter avoids per-target single calls.
✅ Passed checks (12 passed)
Check name Status Explanation
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.
Breakdown Methodology Check ✅ Passed All .add() labels in fees/tirelire.ts are covered by breakdownMethodology, and the adapter includes breakdownMethodology.
Income Statement Compliance ✅ Passed dailyFees totals all collected fees, dailyRevenue is the protocol cut, and dailySupplySideRevenue is the LP remainder; the per-event math preserves fees = revenue + supply-side.
Version 2 Required ✅ Passed fees/tirelire.ts is a new adapter and exports SimpleAdapter with version: 2; no v1 or external-aggregate exception applies.
Pullhourly Required For Version 2 ✅ Passed fees/tirelire.ts is version 2 and explicitly sets pullHourly: true at line 100.
Dune Adapters Are Version 1 ✅ Passed tirelire.ts uses on-chain logs only; no Dune helpers or query calls, so the v1-only rule doesn’t apply.
Income Statement Balance ✅ Passed PASS: tirelire.ts computes dailyRevenue=fees/divisor and dailySupplySideRevenue=fees-fees/divisor, so dailyFees = revenue + supply-side revenue.
Fetchoptions Usage ✅ Passed fees/tirelire.ts uses fetch(options: FetchOptions), has no timestamp return, and does not derive windows from raw timestamps or startOfDay.
Adapter Shape ✅ Passed Tirelire uses a single-chain adapter with chains:[CHAIN.ROBINHOOD] and one start date, not a per-chain adapter/config split.
Methodology Keys ✅ Passed The methodology object uses display-name keys: Fees, Revenue, ProtocolRevenue, and SupplySideRevenue, not daily* field names.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

The tirelire.ts adapter exports:

> adapters@1.0.0 test
> ts-node --transpile-only cli/testAdapter.ts fees tirelire.ts

🦙 Running TIRELIRE.TS adapter 🦙
---------------------------------------------------
Start Date:	Thu, 23 Jul 2026 12:01:48 GMT
End Date:	Fri, 24 Jul 2026 12:01:48 GMT
---------------------------------------------------

ROBINHOOD 👇
Backfill start time: 22/7/2026
Daily fees: 14.00
Daily revenue: 1.41
Daily protocol revenue: 1.41
End timestamp: 1784894507 (2026-07-24T12:01:47.000Z)




FEES BREAKDOWN 👇

coderabbitai[bot]
coderabbitai Bot previously requested changes Jul 24, 2026

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

📥 Commits

Reviewing files that changed from the base of the PR and between a70acc3 and 0029958.

📒 Files selected for processing (1)
  • fees/tirelire.ts

Comment thread fees/tirelire.ts
Comment thread fees/tirelire.ts
Comment on lines +43 to +49
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 });

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.

🚀 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

Comment thread fees/tirelire.ts Outdated
Comment on lines +51 to +59
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);

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.

🗄️ 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.

Comment thread fees/tirelire.ts Outdated
Comment on lines +70 to +80
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.",
},

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.

🗄️ 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 || true

Repository: 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 || true

Repository: 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)
PY

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

@github-actions

Copy link
Copy Markdown

The tirelire.ts adapter exports:

> adapters@1.0.0 test
> ts-node --transpile-only cli/testAdapter.ts fees tirelire.ts

🦙 Running TIRELIRE.TS adapter 🦙
---------------------------------------------------
Start Date:	Thu, 23 Jul 2026 15:00:00 GMT
End Date:	Fri, 24 Jul 2026 15:00:00 GMT
---------------------------------------------------

 (1/24) start: 3 PM - 23/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
 (2/24) start: 4 PM - 23/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
 (3/24) start: 5 PM - 23/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
 (4/24) start: 6 PM - 23/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
 (5/24) start: 7 PM - 23/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
 (6/24) start: 8 PM - 23/07    |  fees - 14.00 | revenue - 1.41 | protocol revenue - 1.41 | supply side revenue - 13.00
 (7/24) start: 9 PM - 23/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
 (8/24) start: 10 PM - 23/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
 (9/24) start: 11 PM - 23/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
(10/24) start: 12 AM - 24/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
(11/24) start: 1 AM - 24/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
(12/24) start: 2 AM - 24/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
(13/24) start: 3 AM - 24/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
(14/24) start: 4 AM - 24/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
(15/24) start: 5 AM - 24/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
(16/24) start: 6 AM - 24/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
(17/24) start: 7 AM - 24/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
(18/24) start: 8 AM - 24/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
(19/24) start: 9 AM - 24/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
(20/24) start: 10 AM - 24/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
(21/24) start: 11 AM - 24/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
(22/24) start: 12 PM - 24/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
(23/24) start: 1 PM - 24/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00
(24/24) start: 2 PM - 24/07    |  fees - 0.00 | revenue - 0.00 | protocol revenue - 0.00 | supply side revenue - 0.00

====== TOTAL DAILY AGGREGATED (sum of slots per chain) ======

ROBINHOOD 👇
End timestamp: 1784905199 (2026-07-24T14:59:59.000Z)
Daily fees: 14.00
Daily revenue: 1.41
Daily protocol revenue: 1.41
Daily supply side revenue: 13.00




FEES BREAKDOWN 👇

label                       | Daily fees | Daily supply side revenue | Daily revenue
---                         | ---        | ---                       | ---          
Token Swap Fees             | 14         |                           |              
Token Swap Fees to LPs      |            | 13                        |              
Token Swap Fees to Protocol |            |                           | 1.41         

@bheluga
bheluga merged commit 8253f95 into DefiLlama:master Jul 24, 2026
3 checks passed
@bheluga

bheluga commented Jul 24, 2026

Copy link
Copy Markdown
Member

@admsk2 thanks for the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants