Skip to content

Drip system#22

Closed
mzhakun wants to merge 13 commits intomainfrom
drip-system
Closed

Drip system#22
mzhakun wants to merge 13 commits intomainfrom
drip-system

Conversation

@mzhakun
Copy link
Collaborator

@mzhakun mzhakun commented Mar 18, 2026

Linear Fee Drip System (resolves M-01, L-02)

  • Linear fee drip — exit fees are no longer added to totalPooledRnbw instantly. They accumulate in undistributedFees and drip linearly into the pool over dripDuration (default 7 days), producing a smooth exchange rate curve
  • _syncPool() settles accrued drip before every state-changing operation
  • _effectivePooledRnbw() view helper ensures frontend shows accurate exchange rate including pending drip
  • Overlapping drips are combined: remaining undistributed fees + new fee, fresh drip window
  • setDripDuration() admin function with bounds checking, syncs and recalculates active drip mid-stream
  • emergencyWithdraw and residual sweep account for undistributedFees
  • Interface updated with DripDurationTooLow, DripDurationTooHigh errors and setDripDuration() declaration

mzhakun added 13 commits March 16, 2026 01:28
Replace instant exit fee distribution with linear drip over configurable
dripDuration (default 7 days, bounds 7-60 days). Exit fees accumulate in
undistributedFees and drip into totalPooledRnbw via _syncPool(), called
before every state-changing operation. View functions use
_effectivePooledRnbw() to reflect pending drip without mutating state.

Resolves whale self-absorption (M-01) and APY manipulation (L-02).
Add 12 drip-specific tests covering linear distribution, overlapping
fees, view function accuracy, residual sweep, self-absorption prevention,
and configurable duration. Update 6 existing tests for delayed fee
settlement. Add RNBWStakingHarness for internal _syncPool access.
Update invariant tests to include undistributedFees in accounting.
@mzhakun mzhakun closed this Mar 18, 2026
@mzhakun mzhakun deleted the drip-system branch March 18, 2026 05:29
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