From 020391264bbc91c4e1955e17fc36d3afa33d520a Mon Sep 17 00:00:00 2001 From: lza_menace Date: Tue, 24 Jan 2023 13:02:34 -0800 Subject: [PATCH] require mayhem set by operator to send bomb --- src/Main.sol | 9 +++++++++ test/Unaboomer.t.sol | 11 +++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Main.sol b/src/Main.sol index 9abb062..f745b52 100644 --- a/src/Main.sol +++ b/src/Main.sol @@ -78,6 +78,8 @@ contract Main is Owned { uint256 public unaboomerPrice = 0.01 ether; /// Price of the Mailbomb ERC-1155 token uint256 public bombPrice = 0.0025 ether; + /// If mail bombs can be sent by players + bool public mayhem; /// Unaboomer contract Unaboomer public unaboomer; /// Mailbomb contract @@ -127,6 +129,11 @@ contract Main is Owned { mailbomb = Mailbomb(_address); } + /// Toggle mayhem switch to enable mail bomb sending + function toggleMayhem() external onlyOwner { + mayhem = !mayhem; + } + // ========================================================================= // Modifiers // ========================================================================= @@ -234,6 +241,8 @@ contract Main is Owned { /// @dev The likelihood of killing a boomer decreases as time goes on - i.e. more duds /// @param _amount Amount of bombs to send to kill Unaboomers (dead pfps) function sendBombs(uint256 _amount) external missionNotCompleted { + // Require mayhem is set (allow time to mint and trade) + require(mayhem, "not ready for mayhem"); // Ensure _amount will not exceed wallet balance of bombs, Unaboomer supply, and active Unaboomers uint256 supply = unaboomersRadicalized(); uint256 bal = bombBalance(msg.sender); diff --git a/test/Unaboomer.t.sol b/test/Unaboomer.t.sol index 3470636..cfc0379 100644 --- a/test/Unaboomer.t.sol +++ b/test/Unaboomer.t.sol @@ -47,6 +47,7 @@ contract UnaboomerTest is Test { // ensure killing increments leaderboard function testLeaderboard() public { uint256 amt = 20; + main.toggleMayhem(); hoax(victim); main.radicalizeBoomers{value: unaboomerPrice * amt}(amt); startHoax(killer); @@ -63,17 +64,18 @@ contract UnaboomerTest is Test { // ensure killing toggles URI function testURIToggling() public { - boomr.setAliveURI('ipfs://alive/'); - boomr.setDeadURI('ipfs://dead/'); + boomr.setBaseURI('ipfs://base/'); + main.toggleMayhem(); startHoax(victim); main.radicalizeBoomers{value: unaboomerPrice}(1); - assertEq(boomr.tokenURI(1), 'ipfs://alive/1.json'); + assertEq(boomr.tokenURI(1), 'ipfs://base/1.json'); main.sendBombs(1); - assertEq(boomr.tokenURI(1), 'ipfs://dead/1.json'); + assertEq(boomr.tokenURI(1), 'ipfs://base/dead.json'); } // ensure sending bombs burns bombs function testBombBurning() public { + main.toggleMayhem(); hoax(victim); main.radicalizeBoomers{value: unaboomerPrice * 20}(20); startHoax(killer); @@ -87,6 +89,7 @@ contract UnaboomerTest is Test { // ensure sending bombs doesn't bork function testSendBombErrors() public { + main.toggleMayhem(); hoax(address(1)); main.radicalizeBoomers{value: unaboomerPrice * 20}(20); hoax(address(2));