Skip to content

Commit

Permalink
harden against beast mint errors (#362)
Browse files Browse the repository at this point in the history
- Adds check to ensure LS is minter before attempting to mint
  • Loading branch information
loothero authored Sep 23, 2023
1 parent c35e455 commit ceca8fd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions contracts/game/src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,9 @@ mod Game {
beast.id, beast.combat_spec.specials.special2, beast.combat_spec.specials.special3
);

if !is_beast_minted {
let beasts_minter = collectible_beasts_contract.getMinter();

if !is_beast_minted && beasts_minter == starknet::get_contract_address() {
collectible_beasts_contract
.mint(
get_caller_address(),
Expand Down Expand Up @@ -3040,6 +3042,7 @@ mod Game {
fn mint(
ref self: T, to: ContractAddress, beast: u8, prefix: u8, suffix: u8, level: felt252
);
fn isMinted(ref self: T, beast: u8, prefix: u8, suffix: u8) -> bool;
fn isMinted(self: @T, beast: u8, prefix: u8, suffix: u8) -> bool;
fn getMinter(self: @T) -> ContractAddress;
}
}

1 comment on commit ceca8fd

@vercel
Copy link

@vercel vercel bot commented on ceca8fd Sep 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.