Skip to content

feat(rewards): accrue protocol fee rewards with view, event, and boundary tests - #443

Merged
mikewheeleer merged 1 commit into
StableRoute-Org:mainfrom
Baskarayelu:feature/rewards-419-421-model
Jul 30, 2026
Merged

feat(rewards): accrue protocol fee rewards with view, event, and boundary tests#443
mikewheeleer merged 1 commit into
StableRoute-Org:mainfrom
Baskarayelu:feature/rewards-419-421-model

Conversation

@Baskarayelu

Copy link
Copy Markdown
Contributor

Summary

The router had no rewards concept — closest existing state is the fee collected per route (compute_route_fee) that's ultimately owed to FeeRecipient. Issues #419-#421 each describe a slice of a rewards model (a view, an event, boundary tests) that presuppose the underlying accrual exists, so this is the minimal accrual this repo's fee model naturally supports, built in one PR since #419's view and #420's event are two sides of the same state:

Tests (#421)

Default-zero, accumulation across multiple routes, zero-fee route is a no-op (no write, no event), event payload carries the correct (fee, running_total), and the over-limit boundary: seeding the counter near i128::MAX and confirming a further accrual saturates instead of panicking.

Test output

Same pre-existing main-at-HEAD build breakage as prior PRs in this batch (103 unrelated errors, reproducible via git stash). Confirmed this change adds zero additional errors.

Closes #419
Closes #420
Closes #421

…dary tests

Adds a minimal rewards-accrual model: every fee-bearing compute_route_fee
call adds its fee to a protocol-wide RewardsAccrued counter (saturating,
owed to FeeRecipient once distributed), exposed via get_rewards_accrued
and a rwd_accr event carrying (fee, running_total). Zero-fee routes are
not a state change and neither write nor emit.

Closes StableRoute-Org#419
Closes StableRoute-Org#420
Closes StableRoute-Org#421
@mikewheeleer
mikewheeleer merged commit 6f0b564 into StableRoute-Org:main Jul 30, 2026
0 of 2 checks passed
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.

Add boundary tests for the rewards logic Emit a dedicated event when rewards state changes Add a read-only view exposing the current rewards state

2 participants