From 3fec003f98951c1f96e2c2280e748ef29f404f50 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Thu, 29 Dec 2022 00:05:05 -0800 Subject: [PATCH] improving contract --- src/Main.sol | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/src/Main.sol b/src/Main.sol index 1e795aa..e94e5cd 100644 --- a/src/Main.sol +++ b/src/Main.sol @@ -66,19 +66,48 @@ contract Main is Owned { } // ========================================================================= - // Tokens + // Getters // ========================================================================= - /// Get balance of BOOMR tokens + /// Get BOOMR token balance of wallet function boomerBalance(address _address) public view returns (uint256) { return unaboomer.balanceOf(_address); } - /// Get balance of BOMB tokens + /// Get BOOMR token total supply + function boomerSupply() public view returns (uint256) { + return unaboomer.totalSupply(); + } + + /// Get BOOMR kill count (unaboomers killed) + function boomerKillCount() public view returns (uint256) { + return unaboomer.killCount(); + } + + /// Get BOOMR token max supply + function boomerMaxSupply() public view returns (uint256) { + return unaboomer.MAX_SUPPLY(); + } + + /// Get BOOMR token survivor count + function boomerSurvivorCount() public view returns (uint256) { + return unaboomer.SURVIVOR_COUNT(); + } + + /// Get BOMB token balance of wallet function bombBalance(address _address) public view returns (uint256) { return mailbomb.balanceOf(_address, 1); } + /// Get BOMB token supply + function bombSupply() public view returns (uint256) { + return mailbomb.bombsAssembled(); + } + + // ========================================================================= + // Tokens + // ========================================================================= + /// Radicalize a boomer to become a Unaboomer - start with 2 bombs function radicalizeBoomers(uint256 _amount) external payable missionNotCompleted { require(msg.value >= _amount * boomerPrice, "not enough ether"); @@ -104,9 +133,9 @@ contract Main is Owned { require(_amount <= unaboomer.totalSupply(), "not enough supply"); bool[] memory res = new bool[](_amount); uint256[] memory killed = new uint256[](_amount); - uint256 boomerSupply = unaboomer.totalSupply(); + uint256 supply = unaboomer.totalSupply(); for (uint256 i; i < _amount; i++) { - uint256 randomBoomer = uint256(keccak256(abi.encodePacked(i, block.timestamp, msg.sender))) % boomerSupply; + uint256 randomBoomer = uint256(keccak256(abi.encodePacked(i, block.timestamp, msg.sender))) % supply; bool dud = unaboomer.tokenDead(randomBoomer); unaboomer.die(randomBoomer); res[i] = dud;