Description
Straight-line vesting is a single curve. Tokenized revenue-share offerings often need step (monthly bucket) or exponential back-loaded schedules. Add a VestingCurve enum and route vested_amount_at through a curve evaluator while keeping linear as default.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
Revora-Contracts/src/vesting.rs
- Curve evaluation must use only i128 fixed-point math, no floats
Suggested execution
- Fork the repo and create a branch
git checkout -b feat/vesting-curves
- Implement changes
- Define
VestingCurve { Linear, Step { period_secs: u64 }, Exponential { k_num: u32, k_den: u32 } }
- Add
evaluate_curve(curve, elapsed, total) helper with checked arithmetic
- Persist curve into
VestingSchedule and migrate existing schedules to Linear
- Validate security and correctness assumptions
Test and commit
- Run tests
- Cover edge cases
- Exponential with k_den=0 must fail with
InvalidCurveParameters
- Include test output and security notes
Example commit message
feat: add Step and Exponential vesting curves
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
Straight-line vesting is a single curve. Tokenized revenue-share offerings often need step (monthly bucket) or exponential back-loaded schedules. Add a
VestingCurveenum and routevested_amount_atthrough a curve evaluator while keeping linear as default.Requirements and context
Revora-Contracts/src/vesting.rsSuggested execution
git checkout -b feat/vesting-curvesVestingCurve { Linear, Step { period_secs: u64 }, Exponential { k_num: u32, k_den: u32 } }evaluate_curve(curve, elapsed, total)helper with checked arithmeticVestingScheduleand migrate existing schedules toLinearTest and commit
cargo test --allInvalidCurveParametersExample commit message
feat: add Step and Exponential vesting curvesGuidelines