Skip to content

feat:Issue 866 add coverage badge#994

Open
Happybello365 wants to merge 123 commits into
StellarCheckMate:mainfrom
Happybello365:issue-866-add-coverage-badge
Open

feat:Issue 866 add coverage badge#994
Happybello365 wants to merge 123 commits into
StellarCheckMate:mainfrom
Happybello365:issue-866-add-coverage-badge

Conversation

@Happybello365

Copy link
Copy Markdown

Summary

Provide a short description of the change and the problem it fixes.

Related Issue

Link the issue number or task this PR addresses.

What changed

  • Contracts:
  • Tests:
  • Docs:
  • Events / API / storage:

Verification

  • What did you run to verify this change?
    • cargo test -p escrow
    • cargo test -p oracle
    • cargo fmt
    • cargo clippy

Checklist

  • I added or updated tests covering this change.
  • I updated documentation or confirmed no docs update is needed.
  • I confirmed any event/API/storage changes are documented and backward-compatible.
  • I manually verified the contract or CLI behavior where applicable.
  • I linked this PR to the related issue.
  • I included notes on any TTL or storage assumptions affecting contract state.

Notes

Add any additional details, risks, or follow-up tasks here.
closes #866

HuiNeng6 and others added 30 commits March 25, 2026 14:28
- Add AllowedToken(Address) to DataKey enum
- Add TokenNotAllowed and TokenAlreadyAllowed errors
- Implement add_allowed_token() and remove_allowed_token() admin functions
- Add is_token_allowed() query function
- Validate token in create_match() against allowlist
- Add comprehensive tests for token allowlist functionality

Fixes StellarCheckMate#52
- Added client.add_allowed_token(&token_addr) in setup() function
- This fixes CI failures where tests failed because create_match
  now requires tokens to be in the allowlist (PR StellarCheckMate#89)
…rCheckMate#52)

- Add DataKey::AllowedToken(Address) variant to DataKey enum
- Add Error::TokenNotAllowed = 11 to the Error enum
- Add admin functions: add_allowed_token, remove_allowed_token, is_allowed_token
- Reject create_match if the token is not on the admin-managed allowlist
- Update setup() helper to register the test token as allowed
- Add 6 new tests covering allowed/disallowed token scenarios and
  non-admin access control for allowlist management
…e#65)

- test_player1_cannot_deposit_twice: player1 deposits successfully then
  calls deposit again, asserts Error::AlreadyFunded
- test_player2_cannot_deposit_twice: same coverage for player2
…leted instead of InvalidState

- errors.rs: add MatchCancelled=11, MatchCompleted=12 (HEAD) merged with
  MatchNotExpired=13, InvalidGameId=14 (origin/main) — all sequential
- deposit() already had explicit guards for Cancelled and Completed states;
  merge conflict resolved keeping those checks intact
- tests: add test_deposit_into_cancelled_match_returns_match_cancelled and
  test_deposit_into_completed_match_returns_match_completed
- update two stale origin/main assertions that expected InvalidState to now
  correctly expect MatchCancelled / MatchCompleted

All 52 tests pass.
…submit_result

Replace unchecked multiplication with checked_mul(2).ok_or(Error::Overflow)?
to safely handle stake amounts near i128::MAX / 2.
Add test to verify Overflow error is returned for large stake amounts.
…stake (StellarCheckMate#169)

- Replace  with  in submit_result
- Add test_create_match_with_max_stake_amount: verifies create_match succeeds with i128::MAX
  and submit_result returns Error::Overflow when pot calculation overflows
… submit_result

Closes StellarCheckMate#144

The existing test_ttl_extended_on_submit_result covered Winner::Player2.
Added two explicit tests to cover the remaining paths:
- test_ttl_extended_on_submit_result_player1_wins
- test_ttl_extended_on_submit_result_draw

All three Winner variants now have dedicated TTL extension assertions.
yahia008 and others added 29 commits March 28, 2026 15:15
…test/unpause-restores-create-match

test: verify unpause restores create_match functionality
…test

feat: oracle.get_result on non-existent match_id should return Result…
feat: implement player match indexing and get_player_matches getter
…it-result-pot-overflow

Fix StellarCheckMate#170: use checked_mul to prevent pot overflow in submit_result
…-169-overflow-guard-max-stake

feat: add overflow guard for pot calculation and test with i128::MAX …
…-174-is-initialized

feat: add is_initialized() helper and test (StellarCheckMate#174)
…-137-state-transition-pending-active

test: explicitly assert Pending -> Active state transition (StellarCheckMate#137)
…e-181-test-oracle-submit_result

feat: Add Test: oracle submit_result is blocked when oracle contract …
…e-187-match-never-existed

feat: distinguish MatchNotFound vs MatchStorageExpired
…ow-state-test

feat(testing): add escrow state transition tests for all winner variants
…yer1-balance

feat: add player1 balance test
…cle-get-admin

fix(StellarCheckMate#135): add get_admin getter to oracle contract and test
…me-id-mismatch

fix: validate game_id against escrow match in oracle submit_result
…ame-player-match

fix: reject create_match when player1 == player2
…tended-on-submit-result

tests: extend TTL coverage on submit_result for Player2Wins and Draw
…ntract-token-balance-zero-after-winner-payout

fix: resolve contract token balance zero after winner payout
@famvilianity-eng

Copy link
Copy Markdown
Contributor

please resolve conflict

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.

Add coverage badge to README.md