Skip to content

feat: Implement Dynamic Clawback Pro-Rata Recalculation#255

Merged
JerryIdoko merged 3 commits into
mainfrom
feat/dynamic-clawback-prorata
Apr 23, 2026
Merged

feat: Implement Dynamic Clawback Pro-Rata Recalculation#255
JerryIdoko merged 3 commits into
mainfrom
feat/dynamic-clawback-prorata

Conversation

@BarryArinze

Copy link
Copy Markdown
Collaborator

🧩 Overview

This PR introduces dynamic pro-rata recalculation for partially clawed back vesting schedules.

Previously, if the DAO clawed back a portion of an allocation mid-stream, the remaining tokens could vest at the old emission rate, causing the schedule to end earlier than originally intended.

With this update, the contract recalculates the ongoing emission rate based on:

  • remaining unvested tokens after clawback
  • remaining time until the original vesting end date

This ensures the vesting schedule still completes on its designated end date.

⚙️ Key Features

  • Supports partial clawbacks without shortening vesting duration
  • Recomputes emission rate dynamically after clawback
  • Preserves original vesting end timestamp
  • Maintains already vested / already claimed balances
  • Works across linear vesting schedules

🏗️ Calculation Logic

At clawback time:

  1. Determine already vested amount
  2. Determine remaining unvested amount
  3. Subtract clawback amount from remaining tokens
  4. Compute remaining vesting duration
  5. Set new emission rate:

new_rate = adjusted_remaining_tokens / remaining_time

Future claims use the updated rate while honoring the original schedule end.

📐 Example

Original Schedule:

  • 1,000 tokens over 10 months
  • 100 tokens/month

After 4 months:

  • 400 vested
  • 600 remaining

DAO claws back 300 tokens.

Updated schedule:

  • 300 tokens remain
  • 6 months left
  • New rate = 50/month

Schedule still ends at month 10.

🔐 Safety Considerations

  • Cannot claw back already vested tokens
  • Cannot reduce balance below claimed amount
  • Rounding handled safely for final claim
  • Access restricted to authorized DAO/admin controls

🧪 Testing

Added tests for:

  • Partial clawback mid-schedule
  • Multiple clawbacks over time
  • Full remaining clawback
  • Final claim rounding correctness
  • Original end date preserved
  • Claims before and after recalculation

🚀 Impact

  • Fairer token recovery mechanics
  • Prevents unintended accelerated vesting
  • Better treasury control for DAOs
  • Stronger financial accuracy for long-term allocations

🔗 Related Issue

Closes #198

🏷️ Labels

math, edge-case, finance

@drips-wave

drips-wave Bot commented Apr 22, 2026

Copy link
Copy Markdown

@BarryArinze 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! 🚀

Learn more about application limits

@JerryIdoko JerryIdoko merged commit 89ba893 into main Apr 23, 2026
1 check failed
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.

Implement Dynamic Clawback Pro-Rata Recalculation

2 participants