Skip to content

feat(contract): add setup_application_milestones function#381

Merged
Akshola00 merged 2 commits intoWeb3Novalabs:mainfrom
utilityjnr:utility
Apr 27, 2026
Merged

feat(contract): add setup_application_milestones function#381
Akshola00 merged 2 commits intoWeb3Novalabs:mainfrom
utilityjnr:utility

Conversation

@utilityjnr
Copy link
Copy Markdown
Contributor

Summary

Adds setup_application_milestones to the Soroban contract, allowing sponsors or trusted schools to allocate pool funds into time-based milestones for a student's graduation journey.

Changes

Introduced Milestone contracttype struct (amount: u128, unlock_time: u64)
Introduced DataKey enum for type-safe persistent storage
Implemented setup_application_milestones(env, pool_id, student, milestones) with full invariant enforcement
Added get_milestones read accessor
Added 9 tests covering all happy-path and revert scenarios
Invariants enforced

Pool must exist and be open
Pool creator (validator) must authorise the call via require_auth()
Milestones array must be non-empty
Sum of milestone amounts must equal the pool goal exactly
Cannot overwrite an already-active milestone schedule for the same student
Testing

All 15 tests pass (6 existing + 9 new). Build and formatter clean.

closes #327

@Akshola00 Akshola00 merged commit a1d1dd9 into Web3Novalabs:main Apr 27, 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.

[Milestones] Implement 'create_milestones' application extension

2 participants