Skip to content

feat: emit RatioUpdatedEvent in set_ratio + add unit tests (Closes #11, Closes #12) - #57

Open
ZacLou wants to merge 3 commits into
StellarRoute:mainfrom
ZacLou:feat/issue-12-11-ratio-event-tests
Open

feat: emit RatioUpdatedEvent in set_ratio + add unit tests (Closes #11, Closes #12)#57
ZacLou wants to merge 3 commits into
StellarRoute:mainfrom
ZacLou:feat/issue-12-11-ratio-event-tests

Conversation

@ZacLou

@ZacLou ZacLou commented Aug 27, 2026

Copy link
Copy Markdown

Closes #11, Closes #12

Changes

#12 - Emit RatioUpdatedEvent from set_ratio

  • Added RatioUpdatedEvent struct to events.rs with program_id and reward_per_point fields
  • Emit the event in set_ratio() after updating the ratio in storage

#11 - Add unit tests for set_ratio and withdraw_remaining

  • set_ratio_updates_reward_per_point: verifies successful ratio update
  • set_ratio_rejects_zero: verifies validation rejects 0
  • set_ratio_rejects_negative: verifies validation rejects negative values
  • set_ratio_rejects_non_maintainer: verifies auth check
  • withdraw_remaining_fails_when_active: verifies program-paused guard
  • withdraw_remaining_rejects_non_maintainer: verifies auth check

Total: 6 new tests covering both happy paths and error conditions.

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.

[contracts] Emit RatioUpdated event from set_ratio [contracts] Add unit tests for set_ratio and withdraw_remaining

1 participant