Skip to content

fix(vesting): add admin auth guard and aggregate getter functions (#359, #360) - #421

Merged
zachyo merged 2 commits into
soropad:masterfrom
Amas-01:fix/vesting-auth-and-aggregates-359-360
Aug 3, 2026
Merged

fix(vesting): add admin auth guard and aggregate getter functions (#359, #360)#421
zachyo merged 2 commits into
soropad:masterfrom
Amas-01:fix/vesting-auth-and-aggregates-359-360

Conversation

@Amas-01

@Amas-01 Amas-01 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #359
Closes #360

Fixes two security/usability defects in the soropad vesting contract:

Changes

Contract (contracts/vesting/src/lib.rs)

  • Added admin.require_auth() as the first executable statement in initialize() before any storage access
  • Added 5 new contract functions:
    • total_vested(recipient) — sums total vested across all schedules
    • total_released(recipient) — sums total released across all schedules
    • total_releasable(recipient) — sums currently releasable across all schedules
    • get_all_schedules(recipient) — returns Vec<Schedule> in a single contract call
    • release_all(recipient) — releases all unlocked tokens across all schedules in one auth+batched-transfer
  • release_all uses recipient.require_auth() and single token_client.transfer() call
  • All 44 tests pass (4 new + 40 existing), test snapshots updated

Frontend

  • lib/vesting.ts — Added fetchAllVestingSchedules (public export) and buildReleaseAllTx
  • lib/stellar.ts — Added fetchAllVestingSchedules (public export)
  • hooks/useSoroban.ts — Added fetchAllVestingSchedules callback and export
  • ClaimVesting.tsx — Replaced N+1 pattern (fetchScheduleCount + loop) with single get_all_schedules call;
    added "Release All" button when multiple schedules exist
  • PersonalDashboard.tsx — Same N+1 fix using fetchAllVestingSchedules; kept fetchVestingScheduleCount for
    backward compat

Testing

  • cargo test — 44/44 pass
  • cargo fmt --all -- --check — clean (vesting contract)
  • tsc --noEmit — passes
  • next lint — no new warnings

…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
@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

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

Learn more about application limits

@zachyo

zachyo commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Hi @Amas-01 , kindly fix conflicts, clear out test json and fix lib

@zachyo
zachyo merged commit 001f2b0 into soropad:master Aug 3, 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.

Vesting: no aggregate getters, so index: None silently touches only the newest schedule Vesting: initialize has no require_auth

2 participants