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;
/// 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);

@ -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));

Loading…
Cancel
Save