From c95014bf2981c0bcd5e85354fd0b98e062b84ed3 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Tue, 3 Jan 2023 21:28:08 -0800 Subject: [PATCH] drop erc721a due to crazy gas reqs --- .gitmodules | 3 --- lib/erc721a | 1 - src/Unaboomer.sol | 18 +++++++++++++----- test/Unaboomer.t.sol | 4 ++-- testing.sh | 13 +++++++++++++ 5 files changed, 28 insertions(+), 11 deletions(-) delete mode 160000 lib/erc721a diff --git a/.gitmodules b/.gitmodules index 9ba55b8..9369dcb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,6 +7,3 @@ [submodule "lib/openzeppelin-contracts"] path = lib/openzeppelin-contracts url = https://github.com/openzeppelin/openzeppelin-contracts -[submodule "lib/erc721a"] - path = lib/erc721a - url = https://github.com/chiru-labs/erc721a diff --git a/lib/erc721a b/lib/erc721a deleted file mode 160000 index b3ca898..0000000 --- a/lib/erc721a +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b3ca8989411f717fac2d6a21a1c59ef05188907f diff --git a/src/Unaboomer.sol b/src/Unaboomer.sol index 77e41fb..00d63ed 100644 --- a/src/Unaboomer.sol +++ b/src/Unaboomer.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; -import {ERC721A} from "erc721a/ERC721A.sol"; +import {ERC721} from "solmate/tokens/ERC721.sol"; import {Owned} from "solmate/auth/Owned.sol"; import {LibString} from "solmate/utils/LibString.sol"; import {Main} from "./Main.sol"; -contract Unaboomer is ERC721A, Owned { +contract Unaboomer is ERC721, Owned { using LibString for uint256; mapping(uint256 => bool) public tokenDead; @@ -19,7 +19,7 @@ contract Unaboomer is ERC721A, Owned { string public deadURI; Main public main; - constructor() ERC721A("Unaboomer", "BOOMR") Owned(msg.sender) {} + constructor() ERC721("Unaboomer", "BOOMR") Owned(msg.sender) {} // ========================================================================= // Admin @@ -60,10 +60,18 @@ contract Unaboomer is ERC721A, Owned { // Tokens // ========================================================================= + /// Helper function to get supply minted + function totalSupply() public view returns (uint256) { + return minted; + } + /// Mint tokens from main contract function radicalize(address _to, uint256 _amount) external payable onlyMain { require(totalSupply() + _amount <= MAX_SUPPLY, "supply reached"); - _safeMint(_to, _amount); + for (uint256 i; i < _amount; i++) { + _safeMint(_to, minted); + minted++; + } } /// Toggle token state from living to dead @@ -83,7 +91,7 @@ contract Unaboomer is ERC721A, Owned { } } - function supportsInterface(bytes4 interfaceId) public view virtual override (ERC721A) returns (bool) { + function supportsInterface(bytes4 interfaceId) public view virtual override (ERC721) returns (bool) { return super.supportsInterface(interfaceId); } } \ No newline at end of file diff --git a/test/Unaboomer.t.sol b/test/Unaboomer.t.sol index 1d50c21..69f08a7 100644 --- a/test/Unaboomer.t.sol +++ b/test/Unaboomer.t.sol @@ -75,9 +75,9 @@ contract UnaboomerTest is Test { function testSendingBombsAgain() public { hoax(address(1)); - main.radicalizeBoomers{value: 99 ether}(9900); + main.radicalizeBoomers{value: 10 ether}(1000); hoax(address(1)); - main.sendBombs(15); + main.sendBombs(10); } function testKilling() public { diff --git a/testing.sh b/testing.sh index 1703e4f..de85657 100644 --- a/testing.sh +++ b/testing.sh @@ -3,3 +3,16 @@ 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 + + +# cast send --private-key=$LOCAL_KEY --rpc-url=$LOCAL_RPC 0x5FbDB2315678afecb367f032d93F642f64180aa3 "radicalizeBoomers(uint256)" 1000 --value "10 ether" +# cast send --private-key=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 --rpc-url=$LOCAL_RPC 0x5FbDB2315678afecb367f032d93F642f64180aa3 "radicalizeBoomers(uint256)" 10 --value "0.1 ether" +# cast send --private-key=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d --rpc-url=$LOCAL_RPC 0x5FbDB2315678afecb367f032d93F642f64180aa3 "radicalizeBoomers(uint256)" 10 --value "0.1 ether" +# cast send --private-key=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a --rpc-url=$LOCAL_RPC 0x5FbDB2315678afecb367f032d93F642f64180aa3 "radicalizeBoomers(uint256)" 10 --value "0.1 ether" +# cast send --private-key=0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 --rpc-url=$LOCAL_RPC 0x5FbDB2315678afecb367f032d93F642f64180aa3 "radicalizeBoomers(uint256)" 10 --value "0.1 ether" +# cast send --private-key=0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a --rpc-url=$LOCAL_RPC 0x5FbDB2315678afecb367f032d93F642f64180aa3 "radicalizeBoomers(uint256)" 10 --value "0.1 ether" +# cast send --private-key=0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba --rpc-url=$LOCAL_RPC 0x5FbDB2315678afecb367f032d93F642f64180aa3 "radicalizeBoomers(uint256)" 10 --value "0.1 ether" +# cast send --private-key=0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e --rpc-url=$LOCAL_RPC 0x5FbDB2315678afecb367f032d93F642f64180aa3 "radicalizeBoomers(uint256)" 10 --value "0.1 ether" +# cast send --private-key=0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356 --rpc-url=$LOCAL_RPC 0x5FbDB2315678afecb367f032d93F642f64180aa3 "radicalizeBoomers(uint256)" 10 --value "0.1 ether" +# cast send --private-key=0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97 --rpc-url=$LOCAL_RPC 0x5FbDB2315678afecb367f032d93F642f64180aa3 "radicalizeBoomers(uint256)" 10 --value "0.1 ether" +# cast send --private-key=0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 --rpc-url=$LOCAL_RPC 0x5FbDB2315678afecb367f032d93F642f64180aa3 "radicalizeBoomers(uint256)" 10 --value "0.1 ether"