minor adjusts

master
lza_menace 2 years ago
parent 4eff231da3
commit 6675ff38cc

@ -202,9 +202,10 @@ 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 /// @param _amount Amount of bombs to send to kill Unaboomers
function sendBombs(uint256 _amount) external missionNotCompleted { 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(); 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++) { for (uint256 i; i < _amount; i++) {
uint256 randomBoomer = uint256(keccak256(abi.encodePacked(i, _amount, block.timestamp, msg.sender))) % supply; uint256 randomBoomer = uint256(keccak256(abi.encodePacked(i, _amount, block.timestamp, msg.sender))) % supply;
bool dud = unaboomer.tokenDead(randomBoomer); bool dud = unaboomer.tokenDead(randomBoomer);

@ -67,7 +67,7 @@ contract UnaboomerTest is Test {
hoax(address(2)); hoax(address(2));
main.sendBombs(10); main.sendBombs(10);
hoax(address(1)); hoax(address(1));
main.sendBombs(25); main.sendBombs(20);
uint256 ptr = main.leaderboardPointer(); uint256 ptr = main.leaderboardPointer();
address leader = main.leaderboard(ptr); address leader = main.leaderboard(ptr);
uint256 killcount = main.killCount(leader); uint256 killcount = main.killCount(leader);

@ -2,4 +2,4 @@
export $(cat .env) export $(cat .env)
forge script script/Unaboomer.s.sol:DeployProject --private-key=$LOCAL_KEY --rpc-url http://localhost:8545 --broadcast 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 cast send --private-key=$LOCAL_KEY --rpc-url=$LOCAL_RPC --value "10 ether" 0x653D2d1D10c79017b2eA5F5a6F02D9Ab6e725395

Loading…
Cancel
Save