Skip to content

fix: update token distribution - #5778

Merged
therealemjy merged 1 commit into
mainfrom
fix/rewards-apys
Aug 19, 2026
Merged

fix: update token distribution#5778
therealemjy merged 1 commit into
mainfrom
fix/rewards-apys

Conversation

@therealemjy

Copy link
Copy Markdown
Contributor

Changes

  • read token distribution APYs from supplyApyRatio and borrowApyRatio properties

@therealemjy
therealemjy requested a review from cuzz-venus August 14, 2026 09:29
@changeset-bot

changeset-bot Bot commented Aug 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ce9ddf5

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 Patch

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 Aug 14, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
dapp-preview Ready Ready Preview Aug 14, 2026 2:51pm
dapp-testnet Ready Ready Preview Aug 14, 2026 2:51pm
venus.io Ready Ready Preview Aug 14, 2026 2:51pm

Request Review

@greptile-apps

greptile-apps Bot commented Aug 14, 2026

Copy link
Copy Markdown

Greptile Summary

The PR updates reward-distribution formatting to consume supply and borrow APY ratios supplied by the API instead of calculating APYs from market balances.

  • Converts API APY ratios into percentage values.
  • Removes obsolete balance and token-price inputs from the distribution formatter.
  • Updates reward-distributor types, tests, and pool snapshots.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/evm/src/utilities/formatApiRewardDistributors/index.ts Reads API-provided supply and borrow APY ratios and forwards converted percentages into token distributions.
apps/evm/src/clients/api/queries/useGetPools/useGetPoolsQuery/getPools/formatOutput/formatDistributions/index.ts Removes the obsolete balance and token-price inputs, resolving the previously reported formatter input mismatch.
apps/evm/src/types/index.ts Adds the API ratio fields and normalized percentage fields required by the updated reward-distribution contract.
apps/evm/src/utilities/convertRatioToPercentage/index.ts Adds a focused helper that converts decimal APY ratios into BigNumber percentage values.

Reviews (2): Last reviewed commit: "fix: read token distribution APYs from s..." | Re-trigger Greptile

Comment on lines 6 to 10
export interface FormatApiRewardDistributorsInput {
apiRewardDistributors: ApiRewardDistributor[];
tokens: Token[];
supplyBalanceDollars: BigNumber;
borrowBalanceDollars: BigNumber;
blocksPerDay?: number;
currentBlockNumber?: bigint;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Formatter input contract breaks caller

When TypeScript checks the production pool-formatting path, formatDistributions still passes supplyBalanceDollars and borrowBalanceDollars even though this changed interface no longer accepts them, causing excess-property errors that prevent the application typecheck and build from succeeding.

Context Used: AGENTS.md (source)

@cuzz-venus cuzz-venus 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.

LGTM

@cuzz-venus cuzz-venus 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.

LGTM

@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for ./apps/evm

Status Category Percentage Covered / Total
🔵 Lines 80.77% 51979 / 64352
🔵 Statements 80.77% 51979 / 64352
🔵 Functions 74.56% 1595 / 2139
🔵 Branches 86% 7644 / 8888
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/evm/src/clients/api/queries/useGetPools/useGetPoolsQuery/getPools/formatOutput/index.ts 94.73% 86.66% 100% 94.73% 81-82, 94-95, 116-121, 126-131
apps/evm/src/clients/api/queries/useGetPools/useGetPoolsQuery/getPools/formatOutput/formatDistributions/index.ts 93.33% 42.85% 100% 93.33% 68-69, 74-75
apps/evm/src/types/index.ts 100% 100% 100% 100%
apps/evm/src/utilities/convertRatioToPercentage/index.ts 100% 100% 100% 100%
apps/evm/src/utilities/formatApiRewardDistributors/index.ts 100% 100% 100% 100%
apps/evm/src/utilities/formatApiRewardDistributors/formatRewardTokenDistribution/index.ts 100% 100% 100% 100%
apps/evm/src/utilities/formatApiRewardDistributors/formatRewardTokenDistribution/formatRewardDistribution/index.ts 100% 100% 100% 100%
Generated in workflow #14147 for commit ce9ddf5 by the Vitest Coverage Report Action

@gleiser-oliveira

Copy link
Copy Markdown
Contributor

@therealemjy I think this can be closed, the current API should be compatible with the live code and #5757

@therealemjy therealemjy reopened this Aug 19, 2026
@therealemjy
therealemjy merged commit 1315a83 into main Aug 19, 2026
7 checks passed
@therealemjy
therealemjy deleted the fix/rewards-apys branch August 19, 2026 06:57
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.

3 participants