Skip to content

Refining the Leaderboard Calculation#1973

Merged
Goader merged 7 commits intomainfrom
task/refine-referrerracestate
Apr 22, 2026
Merged

Refining the Leaderboard Calculation#1973
Goader merged 7 commits intomainfrom
task/refine-referrerracestate

Conversation

@Goader
Copy link
Copy Markdown
Member

@Goader Goader commented Apr 21, 2026

Refining the Leaderboard Calculation

closes: #1901

Summary

  • Added new currency helpers to ensnode-sdk
  • Refined the whole leaderboard building to use PriceXXX objects
  • Added another baseContribution helper to ens-referrals

Why


Testing

  • Automated CI and manual validation
  • Randomized 200 different leaderboards and verified they are identical to the previous implementation

Notes for Reviewer (Optional)

  • Renamed wasQualified to hasQualified (as opposed to the suggestion in Refine ReferrerRaceState #1901), because it does check the disqualification status, and therefore represents the qualification as we understand it on the API level
  • Applying PriceXXX suggestions in Refine ReferrerRaceState #1901 would make the implementation a little bit of a mess, since some objects would be PriceXXX objects, while the others wouldn't be. I remade it to fully work with PriceXXX objects to keep everything consistent and easy to read (had to introduce a few helpers)

Pre-Review Checklist (Blocking)

  • This PR does not introduce significant changes and is low-risk to review quickly.
  • Relevant changesets are included (or are not required)

@Goader Goader self-assigned this Apr 21, 2026
Copilot AI review requested due to automatic review settings April 21, 2026 15:50
@Goader Goader requested a review from a team as a code owner April 21, 2026 15:50
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 21, 2026

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

Project Deployment Actions Updated (UTC)
admin.ensnode.io Ready Ready Preview, Comment Apr 22, 2026 1:34pm
ensnode.io Ready Ready Preview, Comment Apr 22, 2026 1:34pm
ensrainbow.io Ready Ready Preview, Comment Apr 22, 2026 1:34pm

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 21, 2026

🦋 Changeset detected

Latest commit: 2eb1a84

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

This PR includes changesets to release 23 packages
Name Type
@ensnode/ensnode-sdk Major
@namehash/ens-referrals Major
ensadmin Major
ensapi Major
ensindexer Major
ensrainbow Major
fallback-ensapi Major
@ensnode/ensdb-sdk Major
@ensnode/ensnode-react Major
@ensnode/ensrainbow-sdk Major
@ensnode/integration-test-env Patch
@namehash/namehash-ui Major
@docs/ensnode Major
@docs/ensrainbow Major
enssdk Major
enscli Major
enskit Major
ensskills Major
@ensnode/datasources Major
@ensnode/ponder-sdk Major
@ensnode/ponder-subgraph Major
@ensnode/shared-configs Major
@ensnode/enskit-react-example 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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 2026

Warning

Rate limit exceeded

@Goader has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 48 minutes and 9 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 48 minutes and 9 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e801dbb1-3399-40f5-b75c-e487c5627dea

📥 Commits

Reviewing files that changed from the base of the PR and between e1c5697 and 2eb1a84.

📒 Files selected for processing (1)
  • .changeset/tidy-cobras-race.md
📝 Walkthrough

Walkthrough

The changes refactor the rev-share-cap race algorithm to use Price value objects (PriceEth, PriceUsdc) instead of raw bigints for improved type safety and clarity. Internal state fields are renamed for consistency, a new calcBaseRevenueContribution helper extracts common duration-based calculations, and three new currency utility functions are added to the SDK.

Changes

Cohort / File(s) Summary
Release Documentation
.changeset/quick-signals-align.md, .changeset/tidy-cobras-race.md
Added changeset metadata for minor and patch releases documenting new price utility functions and rev-share-cap algorithm refinements.
Rev-Share-Cap Core Logic
packages/ens-referrals/src/award-models/rev-share-cap/leaderboard.ts, packages/ens-referrals/src/award-models/rev-share-cap/metrics.ts, packages/ens-referrals/src/award-models/rev-share-cap/rules.ts
Refactored algorithm to use PriceEth/PriceUsdc objects throughout instead of raw bigints. Renamed totalRevenueContributionAmounttotalRevenueContribution, cappedAwardAmountcappedAward, wasQualifiedhasQualified. Extracted repeated duration-to-revenue calculation into calcBaseRevenueContribution helper. Updated leaderboard ranking and downstream metric building to work with Price objects.
SDK Currency Utilities
packages/ensnode-sdk/src/shared/currencies.ts, packages/ensnode-sdk/src/shared/currencies.test.ts
Added three new exported utility functions: subtractPrice (enforces same-currency, throws on negative results), minPrice and maxPrice (select minimum/maximum from same-currency price lists). Includes comprehensive test coverage for all three utilities.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

javascript

Poem

🐰 Prices dance in types so bright,
No more bigints in the night!
Subtraction, min, and max align,
Revenue flows in measured design,
Clarity earned, the race runs fine!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Refining the Leaderboard Calculation' is partially related to the changeset, referring to a real aspect of the changes (leaderboard refactoring) but doesn't capture key changes like adding currency helpers or the ReferrerRaceState refinements.
Description check ✅ Passed The PR description covers all required template sections: Summary, Why, Testing, Notes for Reviewer, and Pre-Review Checklist. All sections are completed with relevant information.
Linked Issues check ✅ Passed The PR partially addresses issue #1901: totalRevenueContributionAmount and cappedAwardAmount were renamed with PriceEth/PriceUsdc types. However, wasQualified was renamed to hasQualified rather than achievedMinBaseRevenueContribution as suggested.
Out of Scope Changes check ✅ Passed All changes are directly related to #1901 objectives: renaming fields, converting types to PriceXXX objects, introducing currency helpers, and refactoring leaderboard logic. No out-of-scope changes detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/refine-referrerracestate

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 and usage tips.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 21, 2026

Greptile Summary

This PR refines the leaderboard calculation for the rev-share-cap award model by migrating from raw bigint fields to typed PriceEth/PriceUsdc objects throughout the race state and by extracting the repeated baseAnnualRevenueContribution × (duration / 1 year) formula into a shared computeBaseRevenueContribution helper. Three new variadic helpers — subtractPrices, minPrices, maxPrices — are added to ensnode-sdk to support end-to-end Price-object arithmetic.

Confidence Score: 5/5

Safe to merge — all changes are a well-typed refactor with no semantic differences from the prior implementation.

No P0 or P1 issues found. The migration from raw bigints to Price objects is consistent end-to-end, currency runtime guards are correct, the non-negativity invariant in subtractPrices is enforced, and the race algorithm's logic is preserved exactly. Tests cover the new helpers' happy paths and all throwing conditions.

No files require special attention.

Important Files Changed

Filename Overview
packages/ensnode-sdk/src/shared/currencies.ts Adds subtractPrices, minPrices, and maxPrices helpers with correct currency validation, bigint arithmetic, and non-negativity enforcement for subtract.
packages/ensnode-sdk/src/shared/currencies.test.ts Adds unit tests for the three new helpers, covering happy paths, tie-breaking, and currency-mismatch error cases.
packages/ens-referrals/src/award-models/rev-share-cap/leaderboard.ts Race state fields migrated from bigint to PriceEth/PriceUsdc; awardPoolRemaining is now a typed PriceUsdc; all arithmetic uses the new Price helpers; logic is semantically unchanged.
packages/ens-referrals/src/award-models/rev-share-cap/rules.ts Extracts computeBaseRevenueContribution as a reusable domain helper; no logic changes to existing rule validation or qualification check.
packages/ens-referrals/src/award-models/rev-share-cap/metrics.ts Adopts computeBaseRevenueContribution from rules.ts; priceEth(0n) used for zero-state metrics; no functional changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[sortedEvents] --> B[for each event]
    B --> C{referrer state exists?}
    C -- No --> D[init state\ntotalRevenueContribution: PriceEth 0\nhasQualified: false\ncappedAward: PriceUsdc 0]
    D --> E
    C -- Yes --> E[addPrices totalRevenueContribution\n+ event.incrementalRevenueContribution]
    E --> F[computeBaseRevenueContribution\nrules x totalIncrementalDuration]
    F --> G{isReferrerQualified?}
    G -- No --> B
    G -- Yes, first time --> H[accumulatedUncappedAward =\nscalePrice totalBaseRevenue\nx maxBaseRevenueShare]
    H --> I[incrementalCappedAward =\nminPrices uncapped, awardPoolRemaining]
    I --> J[cappedAward += incrementalCappedAward\nawardPoolRemaining -= incrementalCappedAward\nhasQualified = true]
    J --> B
    G -- Yes, already qualified --> K[incrementalBaseRevenue =\ncomputeBaseRevenueContribution\nevent.incrementalDuration]
    K --> L[incrementalUncappedAward =\nscalePrice incremental x maxBaseRevenueShare]
    L --> M[incrementalCappedAward =\nminPrices uncapped, awardPoolRemaining]
    M --> N[cappedAward += incrementalCappedAward\nawardPoolRemaining -= incrementalCappedAward]
    N --> B
    B --> O[sort by cappedAward desc\nthen duration desc\nthen address desc]
    O --> P[build AwardedReferrerMetrics for each]
    P --> Q[buildAggregatedMetrics\nwith awardPoolRemaining]
    Q --> R[ReferrerLeaderboardRevShareCap]
Loading

Reviews (2): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors the rev-share-cap leaderboard/race algorithm in ens-referrals to operate on PriceEth/PriceUsdc objects end-to-end (instead of mixing bigint amounts and Price wrappers), and extends @ensnode/ensnode-sdk with additional price arithmetic helpers to support that.

Changes:

  • Add subtractPrices, minPrices, and maxPrices helpers to @ensnode/ensnode-sdk shared currencies utilities (with same-currency checks; subtractPrices disallows negative results).
  • Extract computeBaseRevenueContribution(rules, duration) helper in ens-referrals and apply it across rev-share-cap metrics + leaderboard race processing.
  • Rename internal race state fields (totalRevenueContributionAmounttotalRevenueContribution, cappedAwardAmountcappedAward, wasQualifiedhasQualified) and update race loop to use Price objects.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/ensnode-sdk/src/shared/currencies.ts Adds subtractPrices, minPrices, maxPrices helpers for Price arithmetic/comparison.
packages/ensnode-sdk/src/shared/currencies.test.ts Adds unit tests covering the new currency helpers (incl. mismatch-currency and negative-subtraction cases).
packages/ens-referrals/src/award-models/rev-share-cap/rules.ts Adds computeBaseRevenueContribution and updates imports/constants usage.
packages/ens-referrals/src/award-models/rev-share-cap/metrics.ts Switches base revenue contribution computation/validation to the shared helper.
packages/ens-referrals/src/award-models/rev-share-cap/leaderboard.ts Rewrites race state + award pool logic to use PriceEth/PriceUsdc throughout.
.changeset/tidy-cobras-race.md Changeset for @namehash/ens-referrals patch release describing internal refactor.
.changeset/quick-signals-align.md Changeset for @ensnode/ensnode-sdk minor release adding new helpers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/ens-referrals/src/award-models/rev-share-cap/rules.ts Outdated
@vercel vercel Bot temporarily deployed to Preview – ensrainbow.io April 21, 2026 16:02 Inactive
@vercel vercel Bot temporarily deployed to Preview – admin.ensnode.io April 21, 2026 16:02 Inactive
@vercel vercel Bot temporarily deployed to Preview – ensnode.io April 21, 2026 16:02 Inactive
Copilot AI review requested due to automatic review settings April 21, 2026 16:05
@vercel vercel Bot temporarily deployed to Preview – admin.ensnode.io April 21, 2026 16:05 Inactive
@vercel vercel Bot temporarily deployed to Preview – ensrainbow.io April 21, 2026 16:05 Inactive
@vercel vercel Bot temporarily deployed to Preview – ensnode.io April 21, 2026 16:05 Inactive
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refines the rev-share-cap leaderboard “race” calculation in ens-referrals to operate on typed PriceXXX objects end-to-end (instead of raw bigint amounts), and adds supporting currency helpers to @ensnode/ensnode-sdk. It also extracts the repeated base revenue contribution proration formula into a shared domain helper to keep the logic consistent across leaderboard + metrics.

Changes:

  • Add subtractPrices, minPrices, and maxPrices helpers to @ensnode/ensnode-sdk shared/currencies.
  • Refactor rev-share-cap leaderboard race state fields to be typed PriceEth/PriceUsdc and update the loop to use price helpers for arithmetic.
  • Introduce and apply computeBaseRevenueContribution(rules, duration) across rev-share-cap codepaths.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/ensnode-sdk/src/shared/currencies.ts Adds new Price arithmetic/comparison helpers with same-currency enforcement and non-negative subtraction.
packages/ensnode-sdk/src/shared/currencies.test.ts Adds unit tests covering new helpers (correctness + error cases).
packages/ens-referrals/src/award-models/rev-share-cap/rules.ts Adds exported computeBaseRevenueContribution helper for prorated base contribution computation.
packages/ens-referrals/src/award-models/rev-share-cap/metrics.ts Reuses computeBaseRevenueContribution to build/validate total base revenue contribution invariants.
packages/ens-referrals/src/award-models/rev-share-cap/leaderboard.ts Refactors race state and award-pool accounting to use Price helpers consistently.
.changeset/tidy-cobras-race.md Changeset for @namehash/ens-referrals patch release describing the refactor.
.changeset/quick-signals-align.md Changeset for @ensnode/ensnode-sdk minor release adding the new helpers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lightwalker-eth
Copy link
Copy Markdown
Member

@greptile

Copy link
Copy Markdown
Member

@lightwalker-eth lightwalker-eth left a comment

Choose a reason for hiding this comment

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

@Goader Nice work 👍 Shared a few small suggestions please take the lead to merge when ready 👍

* such value in argument order.
* @throws if not all prices have the same currency.
*/
export function maxPrices<const PriceType extends Price = Price>(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
export function maxPrices<const PriceType extends Price = Price>(
export function maxPrice<const PriceType extends Price = Price>(

* such value in argument order.
* @throws if not all prices have the same currency.
*/
export function minPrices<const PriceType extends Price = Price>(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
export function minPrices<const PriceType extends Price = Price>(
export function minPrice<const PriceType extends Price = Price>(

* @throws if not all prices have the same currency.
* @throws if the result would be negative ({@link CurrencyAmount} must be non-negative).
*/
export function subtractPrices<const PriceType extends Price = Price>(
Copy link
Copy Markdown
Member

@lightwalker-eth lightwalker-eth Apr 21, 2026

Choose a reason for hiding this comment

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

What do you think about changing this to subtractPrice that always takes exactly two prices as input (price A and price B) where it then returns A - B?

Goal: Make it easier to think about what this operation does, even if it might not be quite as efficient when subtracting a lot of prices at once.

Comment on lines +199 to +207
/**
* Compute the base revenue contribution accrued over a given duration under
* rev-share-cap rules: `rules.baseAnnualRevenueContribution × (duration / 1 year)`.
*
* Uses exact integer bigint arithmetic (single floor division) so the result
* matches the aggregate for the same duration — avoids per-event truncation
* that would compound into a smaller sum than the aggregated value.
*/
export function computeBaseRevenueContribution(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
/**
* Compute the base revenue contribution accrued over a given duration under
* rev-share-cap rules: `rules.baseAnnualRevenueContribution × (duration / 1 year)`.
*
* Uses exact integer bigint arithmetic (single floor division) so the result
* matches the aggregate for the same duration avoids per-event truncation
* that would compound into a smaller sum than the aggregated value.
*/
export function computeBaseRevenueContribution(
/**
* Calculate the base revenue contribution accrued over a given duration under
* rev-share-cap rules: `rules.baseAnnualRevenueContribution × (duration / 1 year)`.
*
* Uses exact integer bigint arithmetic (single floor division) so the result
* matches the aggregate for the same duration avoids per-event truncation
* that would compound into a smaller sum than the aggregated value.
*/
export function calcBaseRevenueContribution(

Goal: There's a bunch of functions in the ENSAwards site where we use this "calc..." prefix. Seems nice to continue that idea here.

* contribution met AND not admin-disqualified), and stays true thereafter.
*/
hasQualified: boolean;
/** Amount actually claimed from the award pool (the capped award). */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
/** Amount actually claimed from the award pool (the capped award). */
/** Amount tentatively claimed from the award pool (capped by the available award pool). */

Comment thread .changeset/quick-signals-align.md Outdated
"@ensnode/ensnode-sdk": minor
---

Add `subtractPrices`, `minPrices`, and `maxPrices` helpers to `@ensnode/ensnode-sdk` (variadic, parallel to the existing `addPrices`; throw on mismatched currencies; `subtractPrices` additionally throws if the result would be negative).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please see related feedback which may rename some of these

let awardPoolRemaining: PriceUsdc = rules.awardPool;

for (const event of sortedEvents) {
const referrer = event.referrer;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

To help make the code here more self-documenting, suggest the following:

  1. Rename referrer to referrerId.
  2. Rename state to referrerState

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.changeset/tidy-cobras-race.md:
- Line 5: The changeset text references a non-existent helper name
computeBaseRevenueContribution; update the changeset to reference the actual
exported helper calcBaseRevenueContribution (or alternatively rename the export
in rules.ts to computeBaseRevenueContribution) so the docs and release notes
match the code; ensure you also mention the renamed ReferrerRaceState fields
(totalRevenueContribution → totalRevenueContribution, cappedAward → cappedAward,
wasQualified → hasQualified) only if the changeset intended to describe those
exact symbol names, otherwise keep the helper name consistent with the exported
function calcBaseRevenueContribution.

In `@packages/ensnode-sdk/src/shared/currencies.ts`:
- Around line 183-249: DRY up repeated same-currency checks by adding a small
helper (e.g., assertSameCurrency or ensureSameCurrency) that accepts a variadic
list of Price (or PriceType) values and throws the existing "All prices must
have the same currency..." error when any differ; then replace the duplicate
checks in subtractPrice, minPrice, and maxPrice (and optionally addPrices) to
call this new helper (use firstPrice as the reference inside the helper and keep
current error text/behavior intact).
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 73f7d1ef-f9c3-4796-abb6-0a409a3b88bb

📥 Commits

Reviewing files that changed from the base of the PR and between d9ab6b0 and e1c5697.

📒 Files selected for processing (7)
  • .changeset/quick-signals-align.md
  • .changeset/tidy-cobras-race.md
  • packages/ens-referrals/src/award-models/rev-share-cap/leaderboard.ts
  • packages/ens-referrals/src/award-models/rev-share-cap/metrics.ts
  • packages/ens-referrals/src/award-models/rev-share-cap/rules.ts
  • packages/ensnode-sdk/src/shared/currencies.test.ts
  • packages/ensnode-sdk/src/shared/currencies.ts

Comment thread .changeset/tidy-cobras-race.md Outdated
Comment thread packages/ensnode-sdk/src/shared/currencies.ts
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refines the rev-share-cap leaderboard “race” calculation by converting internal mutable state to use typed PriceEth/PriceUsdc objects end-to-end, and introduces shared currency helpers in @ensnode/ensnode-sdk to make arithmetic/comparisons safer and more self-documenting.

Changes:

  • Add subtractPrice, minPrice, and maxPrice helpers to @ensnode/ensnode-sdk (with tests).
  • Refactor the rev-share-cap leaderboard race state to store Price objects instead of raw bigint amounts, and update the loop logic accordingly.
  • Extract the repeated prorated base revenue contribution formula into calcBaseRevenueContribution(...) and reuse it across rev-share-cap modules.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/ensnode-sdk/src/shared/currencies.ts Adds subtractPrice, minPrice, maxPrice helpers with same-currency validation and non-negative subtraction.
packages/ensnode-sdk/src/shared/currencies.test.ts Adds unit tests covering success paths and error cases for the new helpers.
packages/ens-referrals/src/award-models/rev-share-cap/rules.ts Introduces calcBaseRevenueContribution helper using single-division bigint arithmetic for prorating base annual contribution.
packages/ens-referrals/src/award-models/rev-share-cap/metrics.ts Reuses calcBaseRevenueContribution and updates invariants/validation accordingly.
packages/ens-referrals/src/award-models/rev-share-cap/leaderboard.ts Refactors the sequential race state/loop to use PriceEth/PriceUsdc and the new currency helpers.
.changeset/tidy-cobras-race.md Changeset for @namehash/ens-referrals describing the internal leaderboard refactor + new helper adoption.
.changeset/quick-signals-align.md Changeset for @ensnode/ensnode-sdk documenting the new currency helpers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Refine ReferrerRaceState

3 participants