Skip to content

feat: liquidity hub analytics - #5813

Open
cuzz-venus wants to merge 1 commit into
mainfrom
feat/liquidity-hub-analytics
Open

cuzz-venus wants to merge 1 commit into
mainfrom
feat/liquidity-hub-analytics

Conversation

@cuzz-venus

@cuzz-venus cuzz-venus commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Jira ticket(s)

VPD-1740

Changes

  • add event tracking

@changeset-bot

changeset-bot Bot commented Sep 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 40b72d1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@venusprotocol/evm Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Sep 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
dapp-preview Ready Ready Preview Sep 14, 2026 3:34pm UTC
dapp-testnet Ready Ready Preview Sep 14, 2026 3:34pm UTC
venus.io Ready Ready Preview Sep 14, 2026 3:34pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 14, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds Liquidity Hub analytics across navigation, hub selection, amount entry, transaction submission, confirmation, and dashboard entry points. It also enriches page-view events with pathname data and extends typed analytics payloads.

  • Tracks wallet and Core Pool supplies, withdrawals, rejections, signatures, and confirmations.
  • Tracks Liquidity Hub navigation and selection across the navbar, dashboard, and hub table.
  • Adds focused analytics assertions to the affected tests.
  • Two analytics correctness concerns remain around withdrawal classification and delayed event ordering.

Confidence Score: 4/5

The PR appears safe to merge from a runtime perspective, but the two non-blocking analytics correctness issues should be addressed to avoid misleading Liquidity Hub reporting.

Transaction behavior remains intact, but fallback withdrawals can be classified incorrectly and debounced amount events can arrive after later funnel stages.

Files Needing Attention: apps/evm/src/clients/api/mutations/useWithdrawFromLiquidityHub/index.ts; apps/evm/src/containers/LiquidityHubForm/SupplyTabs/SupplyWithWalletForm/index.tsx

Important Files Changed

Filename Overview
apps/evm/src/clients/api/mutations/useWithdrawFromLiquidityHub/index.ts Adds confirmed-withdrawal analytics, but classifies fallback partial withdrawals as full exits.
apps/evm/src/clients/api/mutations/useMigrateCoreSupplyToLiquidityHub/index.ts Adds confirmed migration analytics and a required underlying-amount input.
apps/evm/src/containers/LiquidityHubForm/SupplyTabs/SupplyWithWalletForm/index.tsx Adds amount-entry and transaction-lifecycle analytics, with delayed amount events that can arrive out of order.
apps/evm/src/containers/LiquidityHubForm/SupplyTabs/SupplyWithCollateralForm/index.tsx Adds funding-source-aware analytics to Core Pool migration and amount selection.
apps/evm/src/containers/LiquidityHubForm/WithdrawForm/index.tsx Adds withdrawal funnel analytics and amount-selection tracking.
apps/evm/src/pages/LiquidityHubs/LiquidityHubTable/index.tsx Tracks hub selection through both row navigation and modal controls while preserving propagation behavior.
apps/evm/src/libs/analytics/useAnalytics/types.ts Extends typed event contracts for Liquidity Hub navigation, selection, and funding sources.

Reviews (1): Last reviewed commit: "feat: support liquidity hub analytics" | Re-trigger Greptile

token: input.liquidityHub.vhToken.underlyingToken,
value: input.amountMantissa,
}).toNumber(),
withdrewFullSupply: input.withdrawFullSupply === true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Partial Withdrawals Look Full

When a full withdrawal is requested but the hub cannot redeem the complete vhToken balance, the transaction falls back to a partial withdraw call. This event still sets withdrewFullSupply to true from the original request, so analytics incorrectly records the partial withdrawal as a full exit.

Knowledge Base Used: Liquidity hub operations

Comment on lines +112 to +121
captureAnalyticEvent(
'supply_amount_set',
{
...getAnalyticData(amountTokens),
maxSelected,
},
{
debounced: true,
},
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Amount Events Arrive Late

The amount event is delayed by 900 ms, while submission immediately records the initiated and signed events and may then close the modal without flushing or cancelling the pending callback. If a user enters an amount and submits within that window, supply_amount_set can be recorded after the later funnel stages, making analytics ordering depend on transaction latency. The collateral-supply and withdrawal forms use the same pattern.

Knowledge Base Used:

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for ./apps/evm

Status Category Percentage Covered / Total
🔵 Lines 81.51% 53842 / 66055
🔵 Statements 81.51% 53842 / 66055
🔵 Functions 75.31% 1666 / 2212
🔵 Branches 86.26% 8008 / 9283
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/evm/src/clients/api/mutations/useMigrateCoreSupplyToLiquidityHub/index.ts 100% 100% 100% 100%
apps/evm/src/clients/api/mutations/useSupplyToLiquidityHub/index.ts 100% 100% 100% 100%
apps/evm/src/clients/api/mutations/useWithdrawFromLiquidityHub/index.ts 95.19% 91.66% 100% 95.19% 41-45
apps/evm/src/containers/Layout/NavBar/MenuItem/index.tsx 88.77% 76.19% 42.85% 88.77% 70-72, 87-93, 124-126, 132
apps/evm/src/containers/Layout/NavBar/useMenuItems/index.tsx 96.68% 90.9% 100% 96.68% 87-91
apps/evm/src/containers/LiquidityHubForm/Form/index.tsx 97.72% 96.96% 75% 97.72% 138-141
apps/evm/src/containers/LiquidityHubForm/SupplyTabs/SupplyWithCollateralForm/index.tsx 97.79% 94.11% 100% 97.79% 187-191
apps/evm/src/containers/LiquidityHubForm/SupplyTabs/SupplyWithWalletForm/index.tsx 98.74% 90% 100% 98.74% 109-110
apps/evm/src/containers/LiquidityHubForm/WithdrawForm/index.tsx 97.63% 85% 100% 97.63% 55-56, 86
apps/evm/src/libs/analytics/AnalyticProvider/RouteChangeTracker/index.tsx 28.57% 100% 0% 28.57% 6-17
apps/evm/src/pages/Dashboard/Hubs/index.tsx 100% 80% 100% 100%
apps/evm/src/pages/Dashboard/Hubs/LiquidityHubCard/index.tsx 100% 76.92% 75% 100%
apps/evm/src/pages/Dashboard/Placeholder/index.tsx 100% 50% 100% 100%
apps/evm/src/pages/Dashboard/PositionCardsTab/index.tsx 100% 100% 100% 100%
apps/evm/src/pages/Dashboard/PreviewCard/index.tsx 100% 100% 100% 100%
apps/evm/src/pages/LiquidityHubs/LiquidityHubTable/index.tsx 84.06% 70.58% 68.75% 84.06% 55-60, 69-70, 72-73, 78, 95, 134-146, 168, 222-225
Generated in workflow #14240 for commit 40b72d1 by the Vitest Coverage Report Action

Instrument the Liquidity Hub funnel defined in the New Event Taxonomy:
hub_navigation, hub_selected, the supply funnel (amount_set, initiated,
rejected, signed, Tokens supplied) and the withdrawal funnel, all tagged
with poolName liquidity_hub. Supplies also carry fundingSource to
separate new capital from Core pool collateral being reallocated.

Also send $pathname alongside $pageview so Hub list views can be
isolated in PostHog.
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