require mayhem set by operator to send bomb

master
lza_menace 1 year ago
parent 76f0a291e2
commit 020391264b

@ -78,6 +78,8 @@ contract Main is Owned {
uint256 public unaboomerPrice = 0.01 ether; uint256 public unaboomerPrice = 0.01 ether;
/// Price of the Mailbomb ERC-1155 token /// Price of the Mailbomb ERC-1155 token
uint256 public bombPrice = 0.0025 ether; uint256 public bombPrice = 0.0025 ether;
/// If mail bombs can be sent by players
bool public mayhem;
/// Unaboomer contract /// Unaboomer contract
Unaboomer public unaboomer; Unaboomer public unaboomer;
/// Mailbomb contract /// Mailbomb contract
@ -127,6 +129,11 @@ contract Main is Owned {
mailbomb = Mailbomb(_address); mailbomb = Mailbomb(_address);
} }
/// Toggle mayhem switch to enable mail bomb sending
function toggleMayhem() external onlyOwner {
mayhem = !mayhem;
}
// ========================================================================= // =========================================================================
// Modifiers // 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 /// @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) /// @param _amount Amount of bombs to send to kill Unaboomers (dead pfps)
function sendBombs(uint256 _amount) external missionNotCompleted { 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 // Ensure _amount will not exceed wallet balance of bombs, Unaboomer supply, and active Unaboomers
uint256 supply = unaboomersRadicalized(); uint256 supply = unaboomersRadicalized();
uint256 bal = bombBalance(msg.sender); uint256 bal = bombBalance(msg.sender);

@ -47,6 +47,7 @@ contract UnaboomerTest is Test {
// ensure killing increments leaderboard // ensure killing increments leaderboard
function testLeaderboard() public { function testLeaderboard() public {
uint256 amt = 20; uint256 amt = 20;
main.toggleMayhem();
hoax(victim); hoax(victim);
main.radicalizeBoomers{value: unaboomerPrice * amt}(amt); main.radicalizeBoomers{value: unaboomerPrice * amt}(amt);
startHoax(killer); startHoax(killer);
@ -63,17 +64,18 @@ contract UnaboomerTest is Test {
// ensure killing toggles URI // ensure killing toggles URI
function testURIToggling() public { function testURIToggling() public {
boomr.setAliveURI('ipfs://alive/'); boomr.setBaseURI('ipfs://base/');
boomr.setDeadURI('ipfs://dead/'); main.toggleMayhem();
startHoax(victim); startHoax(victim);
main.radicalizeBoomers{value: unaboomerPrice}(1); main.radicalizeBoomers{value: unaboomerPrice}(1);
assertEq(boomr.tokenURI(1), 'ipfs://alive/1.json'); assertEq(boomr.tokenURI(1), 'ipfs://base/1.json');
main.sendBombs(1); main.sendBombs(1);
assertEq(boomr.tokenURI(1), 'ipfs://dead/1.json'); assertEq(boomr.tokenURI(1), 'ipfs://base/dead.json');
} }
// ensure sending bombs burns bombs // ensure sending bombs burns bombs
function testBombBurning() public { function testBombBurning() public {
main.toggleMayhem();
hoax(victim); hoax(victim);
main.radicalizeBoomers{value: unaboomerPrice * 20}(20); main.radicalizeBoomers{value: unaboomerPrice * 20}(20);
startHoax(killer); startHoax(killer);
@ -87,6 +89,7 @@ contract UnaboomerTest is Test {
// ensure sending bombs doesn't bork // ensure sending bombs doesn't bork
function testSendBombErrors() public { function testSendBombErrors() public {
main.toggleMayhem();
hoax(address(1)); hoax(address(1));
main.radicalizeBoomers{value: unaboomerPrice * 20}(20); main.radicalizeBoomers{value: unaboomerPrice * 20}(20);
hoax(address(2)); hoax(address(2));

Loading…
Cancel
Save