diff --git a/src/UnaboomerCommon.sol b/src/UnaboomerCommon.sol index fcff907..299e505 100644 --- a/src/UnaboomerCommon.sol +++ b/src/UnaboomerCommon.sol @@ -87,7 +87,7 @@ contract UnaboomerCommon is Owned { /// @dev Pick a pseudo-random tokenID from Unaboomer contract and toggle a mapping value /// @dev The likelihood of killing a boomer decreases as time goes on - i.e. more duds function sendBombs(uint256[] calldata tokenIds) external missionNotCompleted returns (bool[] memory results) { - require(tokenIds.length <= mailbomb.balanceOf(msg.sender)); + require(tokenIds.length <= mailbomb.balanceOf(msg.sender), "not enough bombs"); bool[] memory res = new bool[](tokenIds.length); uint256 boomerSupply = unaboomer.totalSupply(); for (uint256 i; i < tokenIds.length; i++) { diff --git a/test/Unaboomer.t.sol b/test/Unaboomer.t.sol index aaec63e..a21d09f 100644 --- a/test/Unaboomer.t.sol +++ b/test/Unaboomer.t.sol @@ -51,9 +51,8 @@ contract UnaboomerTest is Test { // src/UnaboomerCommon.sol: function radicalizeBoomers(uint256 _amount) external payable missionNotCompleted { // src/UnaboomerCommon.sol: function assembleBombs(uint256 _amount) external payable missionNotCompleted { // src/UnaboomerCommon.sol: function sendBombs(uint256[] calldata tokenIds) external missionNotCompleted returns (bool[] memory results) { - // src/Unaboomer.sol: function kill(uint256 tokenId) external { - // src/Unaboomer.sol: function totalSupply() public view returns (uint256 supply) { - // src/Unaboomer.sol: function tokenURI + + // function testX() public {} // ========================================================================= // Unaboomer @@ -68,7 +67,27 @@ contract UnaboomerTest is Test { assertEq(boomr.aliveURI(), aliveURI); assertEq(boomr.deadURI(), deadURI); } + function testUnaboomerMainMint() public { + startHoax(address(3)); + main.radicalizeBoomers{value: .1 ether}(10); + assertEq(boomr.totalSupply(), 10); + assertEq(bomb.totalSupply(), 20); + } + function testUnaboomerMainKill() public { + startHoax(address(3)); + main.radicalizeBoomers{value: .01 ether}(1); + uint256[] memory bombs = new uint256[](2); + bombs[0] = 1; + bombs[1] = 2; + main.sendBombs(bombs); + vm.expectRevert(bytes("not enough bombs")); + main.sendBombs(bombs); + main.radicalizeBoomers{value: .01 ether}(1); + main.sendBombs(bombs); + } + function testUnaboomerSupply() public {} + function testUnaboomerTokenURIs() public {} function testUnaboomerDirectMint() public { startHoax(address(5)); vm.expectRevert(bytes("invalid minter")); @@ -79,15 +98,6 @@ contract UnaboomerTest is Test { main.radicalizeBoomers{value: .05 ether}(5); vm.expectRevert(bytes("invalid minter")); boomr.kill(1); - uint256[] memory bombs = new uint256[](3); - bombs[0] = 1; - bombs[1] = 2; - bombs[2] = 3; - main.sendBombs(bombs); } - function testUnaboomerMainMint() public {} - function testUnaboomerMainKill() public {} - function testUnaboomerSupply() public {} - function testUnaboomerTokenURIs() public {} - // function testX() public {} + }