Skip to content

Conversation

@ayomideadeniran
Copy link

This PR fixes compilation warnings in the treasury.rs contract and completes unit test coverage for the distribute_leaderboard function by adding proper admin authentication tests.


Changes

contracts/contracts/boxmeout/src/treasury.rs

  • Prefixed unused variables with _ to silence compiler warnings in the following functions:

    • distribute_creator_rewards
    • get_treasury_balance
    • get_treasury_stats
    • emergency_withdraw
    • set_fee_distribution
    • set_reward_multiplier
    • get_treasury_report

contracts/contracts/boxmeout/src/test_treasury.rs

  • Implemented test_distribute_leaderboard_not_admin to ensure distribute_leaderboard correctly enforces admin-only access.
  • Added required imports (MockAuth, MockAuthInvoke) to support authentication testing.
  • Verified the function panics with
    HostError: Error(Auth, InvalidAction) when called by a non-admin.

Cleanup

  • Removed temporary build/test artifacts:

    • test_output*.txt
    • build_error.log
    • check_output.txt
  • Added missing test snapshots for:

    • test_treasury
    • oracle_test

Verification

  • Ran cargo check — compilation errors and warnings resolved.
  • Ran cargo test — all tests pass, including new admin authorization coverage.

Checklist

  • Code compiles without warnings
  • Unit tests pass
  • Integration tests pass
  • Temporary files removed

close issue #17

@ayomideadeniran
Copy link
Author

ayomideadeniran commented Jan 25, 2026

@GoSTEAN Kindly review this PR . Thank you.

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.

1 participant