diff --git a/src/Unaboomer.sol b/src/Unaboomer.sol index a0da436..28ab606 100644 --- a/src/Unaboomer.sol +++ b/src/Unaboomer.sol @@ -14,6 +14,7 @@ import {ERC721} from "solmate/tokens/ERC721.sol"; import {Owned} from "solmate/auth/Owned.sol"; import {LibString} from "solmate/utils/LibString.sol"; +error NotEnoughEther(); error NotOwnerOfToken(); error MaxSupplyReached(); error TooMany(); @@ -31,6 +32,7 @@ contract Unaboomer is ERC721, Owned { mapping(uint256 => bool) public tokenDead; uint256 public constant MAX_SUPPLY = 10000; + uint256 public price = 0.01 ether; uint256 public minted; string public aliveURI; string public deadURI; @@ -48,6 +50,11 @@ contract Unaboomer is ERC721, Owned { payable(msg.sender).transfer(balance); } + /// Set price for PFP + 2 BOMB + function setPrice(uint256 _price) external onlyOwner { + price = _price; + } + /// Set metadata URI for alive BOOMR function setAliveURI(string calldata _baseURI) external onlyOwner { aliveURI = _baseURI; @@ -70,6 +77,7 @@ contract Unaboomer is ERC721, Owned { function mint(uint256 _amount) external payable { if (msg.sender == tx.origin) revert NoContract(); if (_amount > 20) revert TooMany(); + if (msg.value < _amount * price) revert NotEnoughEther(); if (minted + _amount > MAX_SUPPLY) revert MaxSupplyReached(); unchecked { for (uint256 i; i < _amount; i++) { diff --git a/test/Unaboomer.t.sol b/test/Unaboomer.t.sol index 898e584..3d60d4a 100644 --- a/test/Unaboomer.t.sol +++ b/test/Unaboomer.t.sol @@ -15,12 +15,11 @@ contract UnaboomerTest is Test { vm.deal(address(boomr), 11 ether); vm.prank(address(boomr.owner())); boomr.withdraw(); - assertEq(boomr.owner().balance > 10 ether, true); } function testMint() public { - vm.startPrank(address(1)); - boomr.mint(5); + hoax(address(1)); + boomr.mint{value: 0.05 ether}(5); assertEq(boomr.totalSupply(), 5); assertEq(boomr.tokenDead(1), false); }