Skip to content

feat(voting): optimize rewards from current incentives - #27

Draft
WilliamPyke wants to merge 2 commits into
mainfrom
codex/reward-optimizer
Draft

feat(voting): optimize rewards from current incentives#27
WilliamPyke wants to merge 2 commits into
mainfrom
codex/reward-optimizer

Conversation

@WilliamPyke

Copy link
Copy Markdown
Collaborator

Summary

  • add a shared bigint reward optimizer that allocates one 0.01%-precision ballot across eligible selected veNFTs while accounting for vote dilution
  • add preview, gauge exclusion, configurable gauge caps, projected epoch rewards, and blended APY to veMEZO boost and veBTC validator voting
  • preserve explicit ballot application and validator Equal Vote behavior while excluding unpriced incentives and beneficiary MEZO rewards
  • improve precise USD valuation for very small token prices and add optimizer regression coverage

Why

Gauge voters currently have to compare incentive pools and dilution manually. This gives them a current-epoch recommendation designed to increase external incentive rewards per veMEZO or veBTC without silently changing their ballot.

User impact

Users can preview an optimized allocation, exclude gauges, adjust the maximum number of gauges, and explicitly apply the result. The same allocation is used for every eligible selected NFT, and prior replaceable votes are included in the projection.

Validation

  • pnpm --filter @repo/webapp lint
  • pnpm --filter @repo/webapp typecheck
  • pnpm --filter @repo/webapp test
  • pnpm --filter @repo/webapp build
  • pnpm typecheck

Notes

Workspace-wide lint still reports an unrelated existing line-ending formatting issue in apps/developer-platform/src/styles/globals.css; webapp lint passes.

@netlify

netlify Bot commented Jul 28, 2026

Copy link
Copy Markdown

Deploy Preview for matchb0x ready!

Name Link
🔨 Latest commit ad8a01c
🔍 Latest deploy log https://app.netlify.com/projects/matchb0x/deploys/6a6acd8e162dec00088baca1
😎 Deploy Preview https://deploy-preview-27--matchb0x.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jul 28, 2026

Copy link
Copy Markdown

Deploy Preview for matchboxdeveloper ready!

Name Link
🔨 Latest commit ad8a01c
🔍 Latest deploy log https://app.netlify.com/projects/matchboxdeveloper/deploys/6a6acd8e0bbd1d000810e15c
😎 Deploy Preview https://deploy-preview-27--matchboxdeveloper.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 28, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
matchbox ad8a01c Jul 30 2026, 04:10 AM

Maximizing pro-rata incentive capture under a fixed vote budget equalizes
marginal returns across gauges, which has an exact solution. We were
approximating it with a 10,000-step greedy walk wrapped in a heuristic
search over candidate gauge subsets, which cost ~170ms of blocked main
thread per click and still landed up to 1.74% below the optimum. Solving
the water-fill directly is exact, runs in under a millisecond, and makes
the gauge cap unnecessary: concentration now falls out of the math, since
a diluting vote stops paying before the candidate list runs out.

Two modelling fixes come with it. A gauge nobody has voted for yet looked
like free money -- one basis point captured the whole pool -- so
projections were wildly optimistic and ballots filled with dust. Competing
weight is now floored at one basis point of the voter's own power, the
finest vote a ballot can express. Separately, the annualized return
truncated its principal to micro-USD before dividing, reporting no APY at
all for small positions.

Basis points are assigned by largest remainder so the ballot always totals
exactly 100%. The old greedy also never terminated early, dumping
thousands of leftover basis points on whichever gauge won a tie-break once
every marginal return had reached zero.

The panel collapses to a single Optimize button that writes straight to
the ballot. The max-gauge input, the per-gauge exclusions, and the
preview-then-apply two-step were all surfacing knobs on an approximation
that no longer exists.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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