Implemented split and added comprehensive test#204
Merged
Birdmannn merged 8 commits intoPrometheus-A:v1from Oct 9, 2025
truthixify:fix-95
Merged
Implemented split and added comprehensive test#204Birdmannn merged 8 commits intoPrometheus-A:v1from truthixify:fix-95
Birdmannn merged 8 commits intoPrometheus-A:v1from
truthixify:fix-95
Conversation
Birdmannn
reviewed
Oct 9, 2025
Collaborator
Birdmannn
left a comment
There was a problem hiding this comment.
Nice job @truthixify 🫡🎉🔥💯. I'll take this PR adjustments from here. You've done very well
| break; | ||
| } | ||
| }; | ||
| assert(found, 'Winner not in game'); |
| let mut player: Player = world.read_model(player_addr); | ||
|
|
||
| let mut share = share_per_player; | ||
| // Give remainder to first player |
Collaborator
There was a problem hiding this comment.
Catch ✅ Nice job on the remainder
| } | ||
|
|
||
| /// Split pot evenly among multiple winners | ||
| fn _split_pot_among_winners( |
Collaborator
There was a problem hiding this comment.
this function and _split_pot_among_eligible are identical. So it's only normal that one must go. Then it's to put in the last argument to the function appropriately.
|
|
||
| let mut winner: Player = world.read_model(*winner_addr); | ||
| winner.chips += pot_amount; | ||
| world.write_model(@winner); |
Collaborator
There was a problem hiding this comment.
just updating the chips field of the Player can be done with
let winner_chips = world.read_member(Model::<Player>::ptr_from_keys(winner_adr), selector!("chips"));
world.write_member(Model::<Player>::ptr_from_keys(winner_adr), selector!("chips"), winner_chips + pot_amount);
Comment on lines
+1791
to
+1803
| fn _update_player_chips_and_emit( | ||
| ref self: ContractState, | ||
| player_addr: ContractAddress, | ||
| amount: u256, | ||
| game_id: u64, | ||
| pot_index: u32, | ||
| total_pot: u256, | ||
| ) { | ||
| let mut _world = self.world_default(); | ||
| let mut player: Player = _world.read_model(player_addr); | ||
| player.chips += amount; | ||
| _world.write_model(@player); | ||
| } |
Collaborator
There was a problem hiding this comment.
game_id, pot_index, and total_pot are never used.
That said, I could swear I saw this logic standalone somewhere else in another function... 🙂
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.
Implemented split and added comprehensive test
Related issues
Closes #95
Changes Made
_split_pots_with_kickers_internal()function handling all scenarioscompare_hands()for tie-breakingCasinoFundsmodel tracks house collectionsPotSplitandCasinoCollectionevents for transparencyPOT_SPLITTING_DOCUMENTATION.mdHow to Test
Screenshots (if applicable)
Checklist