Repository navigation
feat(rewards): dynamic campaign reward pool rebalancing - #1396
Merged
joelpeace48-cell merged 2 commits intoSep 25, 2026
Merged
joelpeace48-cell merged 2 commits into
joelpeace48-cell merged 2 commits into
Conversation
rebalance_campaign_pool (admin) moves unspent supply-cap headroom from one capped campaign to another, never touching issued rewards, and emits a poolrbal event. campaign_unspent_supply exposes cap - issued. Refs FinesseStudioLab#1186 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conservation of the combined pool, issued rewards cannot move, zero / same / uncapped campaigns, non-admin, and destination cap overflow. Closes FinesseStudioLab#1186 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@presidojay1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
joelpeace48-cell
merged commit Sep 25, 2026
351b59d
into
FinesseStudioLab:main
8 of 24 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds dynamic reward pool rebalancing to the rewards contract. An admin can move unspent rewards from an underperforming campaign track to a high-demand one in the same suite.
It builds on the existing per-campaign supply cap from #903 (
CAMPAIGN_CAP/CAMPAIGN_ISSUED). A campaign's reward pool is its cap, and the unspent part iscap - issued. Rebalancing moves that unspent headroom between campaigns.Changes (
contracts/rewards/src/lib.rs)rebalance_campaign_pool(admin, from_campaign, to_campaign, amount)require_admin.from_campaign's cap byamountand raisesto_campaign's cap by the same amount. The combined pool is unchanged, and rewards that were already issued are never touched.ZeroAmount:amount == 0.InvalidSupplyCap:from == to, or either campaign is uncapped (cap0means unlimited, so there is no fixed pool to move).CampaignSupplyCapExceeded:amountis more than the source's unspent pool, so issued rewards can't be moved.Overflow: the destination cap would overflowu64(checked_add).set_campaign_supply_capdoes.(poolrbal, from, to)→(amount, new_from_cap, new_to_cap)so indexers can follow reallocations.campaign_unspent_supply(campaign_id) -> u64cap - issued, or0for uncapped campaigns.Like
set_campaign_supply_cap, rebalancing is an admin config change and is not blocked by pause.Tests (
contracts/rewards/src/pool_rebalance_test.rs)Closes #1186
Closes #1187
Closes #1188
Closes #1189