Skip to content

Commit

Permalink
Scarb fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
b-j-roberts committed Jan 18, 2025
1 parent 6b701dd commit b448e66
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions onchain/src/multi_canvas.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -400,15 +400,18 @@ pub mod MultiCanvas {
self.awards_enabled.write(false);
}

fn award_user(
ref self: ContractState, canvas_id: u32, user: ContractAddress, amount: u32
) {
fn award_user(ref self: ContractState, canvas_id: u32, user: ContractAddress, amount: u32) {
if !self.awards_enabled.read() {
return;
}
let caller = get_caller_address();
assert(caller == self.hosts.read(canvas_id) || caller == self.game_master.read(), 'Only hosts can award');
self.extra_pixels.write((canvas_id, user), self.extra_pixels.read((canvas_id, user)) + amount);
assert(
caller == self.hosts.read(canvas_id) || caller == self.game_master.read(),
'Only hosts can award'
);
self
.extra_pixels
.write((canvas_id, user), self.extra_pixels.read((canvas_id, user)) + amount);
self.emit(CanvasHostAwardedUser { canvas_id, user, amount });
}

Expand Down

0 comments on commit b448e66

Please sign in to comment.