Skip to content

Add BrownFi CLAMM (Hemi) yield adapter - #3118

Open
pumafi300 wants to merge 1 commit into
DefiLlama:masterfrom
pumafi300:brownfi-hemi
Open

pumafi300 wants to merge 1 commit into
DefiLlama:masterfrom
pumafi300:brownfi-hemi

Conversation

@pumafi300

@pumafi300 pumafi300 commented Oct 27, 2026 •

Copy link
Copy Markdown

Adds a yield adapter for BrownFi CLAMM on Hemi (chain id 43111), project slug brownfi-clamm (protocolId 8430).

How it works (no API keys)

  • Pools: discovered on-chain from the BrownFi factory's pool-creation events via the public Hemi RPC, so new pools are picked up automatically. Pools under $100 TVL are skipped.
  • TVL: pool token balances priced via coins.llama.fi (with a fallback that prices a missing token off a liquid BrownFi pool).
  • apyBase: last 24h of swaps using the exact fee paid per swap, annualized. BrownFi pools send 90% of swap fees to the protocol (communityFee = 900/1000), so only the 10% LP share is counted, which is why base APY is small.
  • apyReward / rewardTokens: live Merkl campaigns for BrownFi on Hemi (rewards in USDC.e). Incentivized pools set url to their Merkl opportunity page; others link to the BrownFi pool page.
  • poolMeta: each pool's current dynamic fee.

Shared Merkl changes

  • src/adaptors/merkl/config.js: adds 43111: 'hemi' so Merkl rewards on Hemi are recognized.
  • src/adaptors/merkl/index.js: adds brownfi to the exclusion list (same as Satsuma/Sushi) so BrownFi campaigns aren't listed twice. The only other live Merkl campaigns on Hemi are Sushi's, which are already excluded.

Checks

  • npm run test --adapter=brownfi-clamm: 54/54 passing, 7 pools.
  • Total TVL ≈ $670.8K vs DefiLlama's BrownFi CLAMM TVL ≈ $670.55K; per-pool TVL and 24h volume match GeckoTerminal within ~1%; implied LP fees match DefiLlama's fees dashboard (~10% of total fees); reward APRs match Merkl.

Summary by CodeRabbit

  • New Features
    • Added BrownFi CLAMM pool data, including token pricing, TVL, 24-hour trading volume, LP fee APY, and Merkl reward APY.
    • Added support for Hemi network reward data and links BrownFi pools to matching live Merkl opportunities when available.
  • Bug Fixes
    • BrownFi pools are excluded from Merkl’s general protocol listings unless specifically whitelisted.

Algebra Integral pools discovered from factory Pool events; TVL from pool
balances priced via coins.llama.fi; apyBase from 24h Swap/SwapFee logs net of
the 90% community fee; Merkl rewards via addMerklRewardApy (adds Hemi 43111
to merkl networks). Pools with Merkl incentives link to their Merkl
opportunity page; brownfi is added to the Merkl adapter blacklist so those
campaigns are not listed twice.
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 60a12c4c-8967-4a89-9a67-fe1ea0b73777
Commits

Reviewing files that changed from the base of the PR and between af7548a and a87e74c.

Files selected for processing: 3
  • src/adaptors/brownfi-clamm/index.js
  • src/adaptors/merkl/config.js
  • src/adaptors/merkl/index.js

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

This PR adds a BrownFi CLAMM adaptor for Hemi. It reads pool and swap data, derives token prices, and reports TVL, volume, and fee APY. It adds Merkl reward integration and updates Merkl's Hemi network mapping and BrownFi protocol blacklist.

Changes: BrownFi CLAMM on Hemi

Layer / File(s) Summary
Read Hemi pool and swap data
src/adaptors/brownfi-clamm/index.js
The adaptor reads factory-created pools, pool state, token metadata, balances, and swap logs from the Hemi RPC.
Calculate token prices and swap metrics
src/adaptors/brownfi-clamm/index.js
The adaptor fetches token prices and derives prices for unpriced tokens from qualifying pool anchors. It calculates 24-hour volume and LP fees using the observed block interval.
Build adaptor output with Merkl rewards
src/adaptors/brownfi-clamm/index.js, src/adaptors/merkl/config.js, src/adaptors/merkl/index.js
The adaptor calculates TVL and APY, filters pools, and adds Merkl reward data and matching opportunity URLs. Merkl maps chain 43111 to Hemi and adds brownfi to its protocol blacklist.

Priority: Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant BrownFi as BrownFi CLAMM adaptor
  participant RPC as Hemi public RPC
  participant Prices as coins.llama.fi
  participant Merkl as Merkl opportunities
  BrownFi->>RPC: Read pool state and swap logs
  BrownFi->>Prices: Fetch token prices
  BrownFi->>Merkl: Fetch live matching opportunities
  BrownFi->>BrownFi: Emit filtered pools with TVL and APY data
Loading

Suggested reviewers: 0xkr3p

Merge Risk: Minimal · up to a87e7

No confirmed issue remains that should prevent merging after normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding a BrownFi CLAMM yield adapter for Hemi.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi…
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.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 3 files.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

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