updating shib

master
lza_menace 2 years ago
parent 8c3dc30d4f
commit 1f42b1b1d7

@ -55,14 +55,22 @@ contract Unaboomer is ERC721, Owned {
main = UnaboomerCommon(_address);
}
// =========================================================================
// Modifiers
// =========================================================================
modifier onlyMain {
require(msg.sender == address(main), "invalid minter");
_;
}
// =========================================================================
// Tokens
// =========================================================================
/// Mint tokens from main contract
function mint(address _to, uint256 _amount) external payable {
function mint(address _to, uint256 _amount) external payable onlyMain {
require(minted + _amount <= MAX_SUPPLY, "supply reached");
require(msg.sender == address(main), "invalid minter");
unchecked {
for (uint256 i; i < _amount; i++) {
minted++;
@ -72,8 +80,7 @@ contract Unaboomer is ERC721, Owned {
}
/// Toggle token state from living to dead
function kill(uint256 tokenId) external {
require(msg.sender == address(main), "invalid minter");
function kill(uint256 tokenId) external onlyMain {
require(tokenId < minted, "invalid token id");
if (tokenDead[tokenId] == false) {
killCount++;

@ -21,16 +21,73 @@ contract UnaboomerTest is Test {
main.setMailbombContract(address(bomb));
}
function testWithdraws() public {
vm.deal(address(main), 10 ether);
vm.prank(address(main.owner()));
main.withdraw();
// function testWithdraws() public {
// vm.deal(address(main), 10 ether);
// vm.prank(address(main.owner()));
// main.withdraw();
// }
// function testMint() public {
// hoax(address(1));
// main.radicalizeBoomers{value: 0.05 ether}(5);
// assertEq(boomr.totalSupply(), 5);
// assertEq(boomr.tokenDead(1), false);
// }
// src/Mailbomb.sol: function withdraw() external onlyOwner {
// src/Mailbomb.sol: function setBaseURI(string calldata _baseURI) external onlyOwner {
// src/Mailbomb.sol: /// Set main contract address for executing functions
// src/Mailbomb.sol: function setMainContract(address _address) external onlyOwner {
// src/Mailbomb.sol: function mint(address _to, uint256 _amount) external payable {
// src/Mailbomb.sol: function burn(uint256 tokenId) external {
// src/Mailbomb.sol: function totalSupply() public view returns (uint256 supply) {
// src/Mailbomb.sol: function tokenURI(uint256 _tokenId) public view override returns (string memory) {
// src/Mailbomb.sol: function supportsInterface(bytes4 interfaceId) public view virtual override (ERC721) returns (bool) {
// src/UnaboomerCommon.sol: function withdraw() external onlyOwner {
// src/UnaboomerCommon.sol: function setBombPrice(uint256 _price) external onlyOwner {
// src/UnaboomerCommon.sol: function setBoomerPrice(uint256 _price) external onlyOwner {
// src/UnaboomerCommon.sol: function setUnaboomerContract(address _address) external onlyOwner {
// src/UnaboomerCommon.sol: function setMailbombContract(address _address) external onlyOwner {
// 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
// =========================================================================
// Unaboomer
// =========================================================================
function testWithdrawUnaboomer() public {}
function testUnaboomerSetters() public {
string memory aliveURI = 'ipfs://xxxx/';
string memory deadURI = 'ipfs://yyyy/';
boomr.setAliveURI(aliveURI);
boomr.setDeadURI(deadURI);
assertEq(boomr.aliveURI(), aliveURI);
assertEq(boomr.deadURI(), deadURI);
}
function testMint() public {
hoax(address(1));
main.radicalizeBoomers{value: 0.05 ether}(5);
assertEq(boomr.totalSupply(), 5);
assertEq(boomr.tokenDead(1), false);
function testUnaboomerDirectMint() public {
startHoax(address(5));
vm.expectRevert(bytes("invalid minter"));
boomr.mint(address(5), 2);
}
function testUnaboomerDirectKill() public {
startHoax(address(5));
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 {}
}

Loading…
Cancel
Save