Skip to content

Fix pool performance metrics display#148

Open
autochamchikim-pixel wants to merge 1 commit into
capofficial:mainfrom
autochamchikim-pixel:fix-pool-metrics-issue-6
Open

Fix pool performance metrics display#148
autochamchikim-pixel wants to merge 1 commit into
capofficial:mainfrom
autochamchikim-pixel:fix-pool-metrics-issue-6

Conversation

@autochamchikim-pixel
Copy link
Copy Markdown

Summary

  • Replaces the hard-coded 30%+ pool performance display with a derived performance value per asset.
  • Keeps fee APY derived from the documented monthly fee assumptions, but centralizes the fee constants and guards non-numeric/zero balances.
  • Adds USD sub-values for trader UP/L and buffer balances so the table no longer mixes raw asset units with unexplained metrics.

Root cause

The pool table had one dynamic yield column and one static placeholder: 30%+ was rendered for every asset regardless of pool balance or global trader UP/L. That made the displayed pool performance nonsensical and unable to react to the actual pool state shown in the adjacent columns.

Reproduction / failing case

Open the Pool page with any non-zero pool balance and a non-zero global UP/L. Before this change, the pool performance column still displayed 30%+ for both ETH and USDC, so the value did not change when the pool balance or trader UP/L changed.

Changed files / scope

  • src/components/pool/Pools.svelte only.
  • No route, contract, wallet, or store changes.

Implementation notes

  • MONTHLY_FEES keeps the existing fee assumptions: ~95 ETH/month and ~100,000 USDC/month.
  • feeAPY is recomputed for each supported pool asset and falls back to 0 when data is missing.
  • Pool performance is displayed as feeAPY - traderUPL / poolBalance * 100, because positive trader UP/L is owed by the pool and reduces pool-side performance.
  • Missing/zero balances render - rather than NaN%/Infinity%.

Validation

  • NODE_OPTIONS=--max-old-space-size=2048 npm run build
    • Build completed and created build/bundle.dd73831.js.
    • Existing Svelte/Rollup warnings are still present and are unrelated to this one-file pool table change.

Edge cases covered

  • Zero or missing pool balance.
  • Missing/non-numeric fee, UP/L, or balance values.
  • Assets without a monthly fee constant.
  • Positive and negative trader UP/L values.

Risk / compatibility

Low risk: this is a display-only change inside the Pool table. It preserves the existing monthly fee assumptions and does not modify state, transactions, stores, or contract calls.

Acceptance checklist

  • Pool performance is no longer a hard-coded placeholder.
  • Metrics are derived from the same per-asset pool state shown in the table.
  • Invalid arithmetic is guarded so users do not see NaN% or Infinity%.
  • Minimal one-file change with a successful targeted production build.

Closes #6

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.

Pool metrics are wrong / weird

1 participant