Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
Fixing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
RecrafterH committed Jul 3, 2024
1 parent 3c16d04 commit 9f5208c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pallets/game/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ pub mod pallet {
/// A user has received points.
PointsReceived { receiver: AccountIdOf<T>, amount: u32 },
/// A game has started.
GameStarted { player: AccountIdOf<T>, game_id: u32, ending_block: BlockNumberFor<T>, property_id: u32 },
GameStarted { player: AccountIdOf<T>, game_id: u32, ending_block: BlockNumberFor<T> },
/// An answer has been submitted.
AnswerSubmitted { player: AccountIdOf<T>, game_id: u32, guess: u32 },
/// The result has been checked.
Expand Down Expand Up @@ -497,14 +497,14 @@ pub mod pallet {
let random_number = u32_value as usize % game_properties.len();
let property = game_properties[random_number].clone();
let game_datas =
GameData { difficulty: game_type, player: signer.clone(), property: property.clone(), guess: None };
GameData { difficulty: game_type, player: signer.clone(), property: property, guess: None };
game_properties.retain(|property| property.id as usize != random_number);
GameProperties::<T>::put(game_properties);
GameInfo::<T>::insert(game_id, game_datas);
let next_game_id = game_id.checked_add(1).ok_or(Error::<T>::ArithmeticOverflow)?;
GameId::<T>::put(next_game_id);
// Submit the encrypted property data and delete the price
Self::deposit_event(Event::<T>::GameStarted { player: signer, game_id, ending_block: expiry_block, property_id: property.id });
Self::deposit_event(Event::<T>::GameStarted { player: signer, game_id, ending_block: expiry_block });
Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion pallets/game/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ fn handle_offer_accept_works() {
crate::DifficultyLevel::Player,
));
System::assert_last_event(
Event::GameStarted { player: [0; 32].into(), game_id: 6, ending_block: 9, property_id: 147229391 }.into(),
Event::GameStarted { player: [0; 32].into(), game_id: 6, ending_block: 9 }.into(),
);
run_to_block(20);
assert_eq!(GameModule::users::<AccountId>([0; 32].into()).unwrap().nfts.xorange, 3);
Expand Down

0 comments on commit 9f5208c

Please sign in to comment.