fix(vesting): add admin auth guard and aggregate getter functions (#359, #360) - #421
Merged
zachyo merged 2 commits intoAug 3, 2026
Merged
Conversation
…ropad#359, soropad#360) - Add admin.require_auth() as first executable line in initialize() - Add total_vested, total_released, total_releasable, get_all_schedules, release_all - Replace N+1 frontend pattern with get_all_schedules (single contract call) - Add Release All button in ClaimVesting when multiple schedules exist - 44 tests pass, formatting clean
|
@Amas-01 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! 🚀 |
Contributor
|
Hi @Amas-01 , kindly fix conflicts, clear out test json and fix lib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #359
Closes #360
Fixes two security/usability defects in the soropad vesting contract:
admin.require_auth()guard to theinitialize()function (missing auth check)release_allto eliminate N+1 patternChanges
Contract (contracts/vesting/src/lib.rs)
admin.require_auth()as the first executable statement ininitialize()before any storage accesstotal_vested(recipient)— sums total vested across all schedulestotal_released(recipient)— sums total released across all schedulestotal_releasable(recipient)— sums currently releasable across all schedulesget_all_schedules(recipient)— returnsVec<Schedule>in a single contract callrelease_all(recipient)— releases all unlocked tokens across all schedules in one auth+batched-transferrelease_allusesrecipient.require_auth()and singletoken_client.transfer()callFrontend
fetchAllVestingSchedules(public export) andbuildReleaseAllTxfetchAllVestingSchedules(public export)fetchAllVestingSchedulescallback and exportget_all_schedulescall;added "Release All" button when multiple schedules exist
fetchAllVestingSchedules; keptfetchVestingScheduleCountforbackward compat
Testing
cargo test— 44/44 passcargo fmt --all -- --check— clean (vesting contract)tsc --noEmit— passesnext lint— no new warnings