From 6675ff38cc5b258e99d20ba8702f5635a6ffadb3 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Tue, 3 Jan 2023 11:23:30 -0800 Subject: [PATCH] minor adjusts --- src/Main.sol | 5 +++-- test/Unaboomer.t.sol | 2 +- testing.sh | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Main.sol b/src/Main.sol index 10f605e..8af9f34 100644 --- a/src/Main.sol +++ b/src/Main.sol @@ -202,9 +202,10 @@ 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 function sendBombs(uint256 _amount) external missionNotCompleted { - require(_amount <= bombBalance(msg.sender), "not enough bombs"); - require(_amount <= unaboomer.totalSupply(), "not enough supply"); uint256 supply = unaboomer.totalSupply(); + require(_amount <= bombBalance(msg.sender), "not enough bombs"); + require(_amount <= supply, "not enough supply"); + require(_amount <= supply - unaboomersKilled(), "not enough active boomers"); for (uint256 i; i < _amount; i++) { uint256 randomBoomer = uint256(keccak256(abi.encodePacked(i, _amount, block.timestamp, msg.sender))) % supply; bool dud = unaboomer.tokenDead(randomBoomer); diff --git a/test/Unaboomer.t.sol b/test/Unaboomer.t.sol index 133d840..0631ec2 100644 --- a/test/Unaboomer.t.sol +++ b/test/Unaboomer.t.sol @@ -67,7 +67,7 @@ contract UnaboomerTest is Test { hoax(address(2)); main.sendBombs(10); hoax(address(1)); - main.sendBombs(25); + main.sendBombs(20); uint256 ptr = main.leaderboardPointer(); address leader = main.leaderboard(ptr); uint256 killcount = main.killCount(leader); diff --git a/testing.sh b/testing.sh index 89347f0..1703e4f 100644 --- a/testing.sh +++ b/testing.sh @@ -2,4 +2,4 @@ export $(cat .env) forge script script/Unaboomer.s.sol:DeployProject --private-key=$LOCAL_KEY --rpc-url http://localhost:8545 --broadcast -cast send --private-key=$LOCAL_KEY --rpc-url=$LOCAL_RPC --value "10 ether" 0x653D2d1D10c79017b2eA5F5a6F02D9Ab6e725395 \ No newline at end of file +cast send --private-key=$LOCAL_KEY --rpc-url=$LOCAL_RPC --value "10 ether" 0x653D2d1D10c79017b2eA5F5a6F02D9Ab6e725395