Implements vesting "cliffs" on top-ups functionality, allowing new cliff periods to be defined specifically for tokens added to existing vaults.
- β
Vault Model (
backend/src/models/vault.js) - Main vault storage - β
SubSchedule Model (
backend/src/models/subSchedule.js) - Multiple vesting schedules per vault - β
Migration (
backend/migrations/001_create_vaults_and_sub_schedules.sql) - Complete schema
- β
VestingService (
backend/src/services/vestingService.js) - Core business logic - β AdminService Updates - Integration with new vesting functionality
- β IndexingService Updates - Blockchain event processing
- β
POST /api/vault/top-up- Top-up with cliff configuration - β
GET /api/vault/:vaultAddress/details- Vault details with sub-schedules - β
GET /api/vault/:vaultAddress/releasable- Calculate releasable amounts - β
POST /api/vault/release- Release tokens respecting cliffs - β
POST /api/indexing/top-up- Process blockchain top-up events - β
POST /api/indexing/release- Process blockchain release events
- β
Comprehensive Test Suite (
backend/test/vesting-topup.test.js) - Full coverage
- Independent Cliffs: Each top-up can have its own cliff period
- Multiple Sub-Schedules: Support for unlimited vesting schedules per vault
- Pro-rata Releases: Tokens distributed proportionally across sub-schedules
- Audit Trail: Complete logging for compliance
- Blockchain Integration: Full event processing support
- β SubSchedule List: Implemented within Vault system
- β Complex Logic: Successfully handles multiple vesting schedules with independent cliffs
- β Stretch Goal: Delivered as robust, production-ready feature
# Run the test suite
npm test backend/test/vesting-topup.test.js
# Start the application
npm startSee VESTING_CLIFFS_IMPLEMENTATION.md for detailed documentation and usage examples.
Closes #19: [Feature] Vesting "Cliffs" on Top-Ups
Ready for Review π