active-users: add protocols via allium - #8533
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdded shared Allium-based user metrics for DEX, lending, Hyperliquid, and token-transfer activity. Added protocol configurations and registered the adapters for active-user reporting. New-user reporting remains connected to the existing sources. ChangesAllium user metrics exports
Estimated code review effort: 3 (Moderate) | ~30 minutes Sequence Diagram(s)sequenceDiagram
participant ActiveUserProtocols
participant AlliumUserAdapter
participant Allium
ActiveUserProtocols->>AlliumUserAdapter: request configured user metrics
AlliumUserAdapter->>Allium: query grouped activity or transfers
Allium-->>AlliumUserAdapter: return activity rows
AlliumUserAdapter-->>ActiveUserProtocols: return wallet and transaction counts
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 11 | ❌ 4❌ Failed checks (4 warnings)
✅ Passed checks (11 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 |
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 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 `@active-users/pharaoh-exchange.ts`:
- Around line 6-9: Update the single-chain configuration in pharaoh-exchange by
replacing the chains object with the array form containing CHAIN.AVAX, while
retaining the existing top-level start date.
In `@helpers/alliumUsers.ts`:
- Around line 75-79: Add breakdownMethodology metadata to the returned adapter
alongside methodology, covering both exported dimensions ActiveUsers and
TransactionsCount. Use the repository’s exact display labels and preserve the
existing methodology entries.
- Line 16: Add JSDoc comments to the exported helpers alliumToLlamaChain and
alliumDexUsersExport. Document chain normalization, the accepted forms of the
chains input, and the behavior when chains includes CHAIN.CHAIN_GLOBAL, using
the existing exported types and symbols.
- Around line 19-21: Define a typed DexUserRow shape and replace every any usage
in this helper: type inflight as Record<string, Promise<DexUserRow>>, make
getDexUserRows return the corresponding typed promise/result, and type the
rows.find callback parameter as DexUserRow while preserving the existing
behavior.
- Around line 47-52: Update fetch around getDexUserRows so an empty successful
result returns zero dailyActiveUsers and dailyTransactionsCount instead of
throwing. Preserve propagation of actual query failures and retain the existing
missing-project fallback for non-empty results.
- Around line 35-36: Update the inflight cache handling around queryAllium so a
rejected promise is removed from inflight[query] before the rejection
propagates. Keep successful promises cached for reuse, and ensure cleanup only
removes the entry associated with the failed request so a newer retry is not
deleted.
- Around line 69-73: Update the adapter metadata returned by the Allium users
adapter to use version 2 and set pullHourly to true, while preserving the
existing fetch and adapter chain configuration.
🪄 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: d81de35f-269e-47f9-a4e0-a678cc7bbe12
📒 Files selected for processing (19)
active-users/alphaq.tsactive-users/aquifer.tsactive-users/bisonfi.tsactive-users/curve-dex.tsactive-users/fluid-dex.tsactive-users/goonfi.tsactive-users/humidifi.tsactive-users/manifest-trade.tsactive-users/meteora.tsactive-users/orca-dex.tsactive-users/pharaoh-exchange.tsactive-users/project-x.tsactive-users/pumpswap.tsactive-users/raydium-amm.tsactive-users/scorch.tsactive-users/solfi.tsactive-users/sun.tsactive-users/tessera-v.tshelpers/alliumUsers.ts
| manta_pacific: CHAIN.MANTA, | ||
| }; | ||
|
|
||
| export const alliumToLlamaChain = (chain: string) => ALLIUM_TO_LLAMA[chain] ?? chain; |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Add JSDoc to the exported helper API.
alliumToLlamaChain and alliumDexUsersExport are public exports. Document the chain normalization, the accepted chains forms, and the CHAIN.CHAIN_GLOBAL behavior.
As per path instructions, public helper functions must include JSDoc comments.
Also applies to: 42-46
🤖 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 `@helpers/alliumUsers.ts` at line 16, Add JSDoc comments to the exported
helpers alliumToLlamaChain and alliumDexUsersExport. Document chain
normalization, the accepted forms of the chains input, and the behavior when
chains includes CHAIN.CHAIN_GLOBAL, using the existing exported types and
symbols.
Source: Path instructions
| methodology: { | ||
| ActiveUsers: "Unique wallets that swapped on the protocol that day. Counted per chain, plus an all-chains total that counts a wallet trading on several chains only once.", | ||
| TransactionsCount: "Number of transactions containing at least one swap on the protocol.", | ||
| }, | ||
| }; |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Add breakdownMethodology metadata.
The returned adapter defines methodology but omits breakdownMethodology. Add entries for both exported dimensions using the repository's exact display labels.
As per coding guidelines, every export must include both methodology and breakdownMethodology.
🤖 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 `@helpers/alliumUsers.ts` around lines 75 - 79, Add breakdownMethodology
metadata to the returned adapter alongside methodology, covering both exported
dimensions ActiveUsers and TransactionsCount. Use the repository’s exact display
labels and preserve the existing methodology entries.
Source: Coding guidelines
yeah makes more sense, thanks |
There was a problem hiding this comment.
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 `@users/utils/alliumUsers.ts`:
- Around line 25-35: Bound the successful-query cache in runOnce so resolved
entries in inflight are evicted after the relevant batch completes, or replace
it with an equivalent bounded cache. Preserve the existing catch handler that
deletes failed requests immediately, and ensure repeated calls still share an
in-flight query while it remains cached.
🪄 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: 0bf7bba6-0a5b-45c1-852a-a883221d5502
📒 Files selected for processing (3)
users/lendingUsers.tsusers/list.tsusers/utils/alliumUsers.ts
There was a problem hiding this comment.
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 `@users/utils/alliumUsers.ts`:
- Around line 39-47: Update the inflight caching logic around queryAllium so
pending promises remain in a separate non-evictable map, while
MAX_CACHED_WINDOWS eviction applies only to settled results. Ensure
failed-request cleanup cannot delete a newer promise for the same query key, and
add coverage using more than eight deferred queries followed by a late failure.
🪄 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: b0efa9a8-433c-431f-b2a9-0b09d1f804c3
📒 Files selected for processing (1)
users/utils/alliumUsers.ts
| const run = queryAllium(query).catch((e: any) => { | ||
| inflight.delete(query); | ||
| throw e; | ||
| }); | ||
| inflight.set(query, run); | ||
|
|
||
| while (inflight.size > MAX_CACHED_WINDOWS) { | ||
| inflight.delete(inflight.keys().next().value as string); | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Do not evict pending queries from inflight.
inflight stores both pending and completed promises. The eviction loop can remove a pending query. A later adapter can then start a second queryAllium call for the same window. If the first call fails, its cleanup can delete the newer promise because cleanup uses only the query key.
Keep pending promises in a separate non-evictable map. Apply MAX_CACHED_WINDOWS only to settled results. Add a test with more than eight deferred queries and a late failure.
🤖 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 `@users/utils/alliumUsers.ts` around lines 39 - 47, Update the inflight caching
logic around queryAllium so pending promises remain in a separate non-evictable
map, while MAX_CACHED_WINDOWS eviction applies only to settled results. Ensure
failed-request cleanup cannot delete a newer promise for the same query key, and
add coverage using more than eight deferred queries followed by a late failure.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@users/utils/alliumUsers.ts`:
- Around line 145-160: Update the query construction around tokenConfigs and the
WHERE clause so exit-address checks preserve each configuration’s token-to-exit
mapping. Generate per-token conditions that require LOWER(token_address) to
match the token and LOWER(to_address) to match one of that token’s
exitAddresses, while keeping the zero-address from_address mint condition
separate.
- Around line 165-170: Update alliumTokenUsersExport to use the shared-chain
adapter form by changing the chain-keyed chains object to an array containing
config.chain, while retaining the existing single start: config.start value.
🪄 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: 1b1e4a9f-c92b-4006-ae2e-cec84b9e3079
📒 Files selected for processing (4)
users/hyperliquidUsers.tsusers/list.tsusers/tokenUsers.tsusers/utils/alliumUsers.ts
| export function alliumTokenUsersExport(config: TokenUsersConfig): SimpleAdapter { | ||
| tokenConfigs.push(config); | ||
| return buildUsersAdapter({ | ||
| project: config.token.toLowerCase(), | ||
| chains: { [config.chain]: config.start }, | ||
| start: config.start, |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Use the shared-chain adapter form.
Each token adapter has one chain and one shared start. Replace the chain-keyed object with chains: [config.chain]. The current object form is reserved for adapters with different chain starts.
Proposed change
- chains: { [config.chain]: config.start },
+ chains: [config.chain],As per coding guidelines, use a shared chains array and single start when all chains share the same start.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| export function alliumTokenUsersExport(config: TokenUsersConfig): SimpleAdapter { | |
| tokenConfigs.push(config); | |
| return buildUsersAdapter({ | |
| project: config.token.toLowerCase(), | |
| chains: { [config.chain]: config.start }, | |
| start: config.start, | |
| export function alliumTokenUsersExport(config: TokenUsersConfig): SimpleAdapter { | |
| tokenConfigs.push(config); | |
| return buildUsersAdapter({ | |
| project: config.token.toLowerCase(), | |
| chains: [config.chain], | |
| start: config.start, |
🤖 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 `@users/utils/alliumUsers.ts` around lines 165 - 170, Update
alliumTokenUsersExport to use the shared-chain adapter form by changing the
chain-keyed chains object to an array containing config.chain, while retaining
the existing single start: config.start value.
Source: Coding guidelines
| chain: CHAIN.ETHEREUM, | ||
| token: "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84", // stETH | ||
| // The protocol burns stETH on finalisation, so the exit is the queue transfer. | ||
| exitAddresses: ["0x889edC2eDab5f40e902b864aD4d7AdE8E412F9B1"], // unstETH withdrawal queue |
There was a problem hiding this comment.
hmm, this excludes stake, wrap and unwraps?
There was a problem hiding this comment.
wrap/unwrap is neither entry nor exit so i deliberately excluded them
Adds
dailyActiveUsersanddailyTransactionsCountfor 111 protocols using Allium’s curated cross-chain tables, plus one Dune adapter for Compound V3.What's added
crosschain.dex.tradescrosschain.lending.*lending.supply/lending.borrowhyperliquid.dex.tradescrosschain.assets.transfersMethodology
DEXs: unique
transaction_from_address; transactions = distincttransaction_hash.Lending: unique addresses across deposits, withdrawals, borrows, and repayments. Liquidations excluded.
Hyperliquid: both maker and taker counted; HIP-3 third-party markets excluded.
Token-shaped: users identified via token minting and transfers to configured burn/exit addresses.
transaction_from_addressis used instead of router/pool-oriented fields such assender_addressordepositor.The existing Uniswap and PancakeSwap router-based active-user adapters are intentionally replaced by the Allium implementations for broader chain coverage.