|
|
|
@ -11,6 +11,7 @@ chaos ensues until 1000 survivors - the game stops
|
|
|
|
|
********/
|
|
|
|
|
|
|
|
|
|
import {ERC721} from "solmate/tokens/ERC721.sol";
|
|
|
|
|
import {Owned} from "solmate/auth/Owned.sol";
|
|
|
|
|
import {LibString} from "solmate/utils/LibString.sol";
|
|
|
|
|
|
|
|
|
|
error NotOwnerOfToken();
|
|
|
|
@ -24,67 +25,44 @@ error NotAdmin();
|
|
|
|
|
error NoRemoveSelf();
|
|
|
|
|
error NoRemoveDeployer();
|
|
|
|
|
|
|
|
|
|
contract Unaboomer is ERC721 {
|
|
|
|
|
contract Unaboomer is ERC721, Owned {
|
|
|
|
|
using LibString for uint256;
|
|
|
|
|
|
|
|
|
|
mapping(uint256 => bool) public tokenDead;
|
|
|
|
|
mapping(address => bool) public adminWallets;
|
|
|
|
|
|
|
|
|
|
uint256 public constant MAX_SUPPLY = 10000;
|
|
|
|
|
uint256 public minted;
|
|
|
|
|
string public livingURI;
|
|
|
|
|
string public aliveURI;
|
|
|
|
|
string public deadURI;
|
|
|
|
|
address public deployer;
|
|
|
|
|
address[] public payoutWallets;
|
|
|
|
|
address public MailBombContract;
|
|
|
|
|
|
|
|
|
|
constructor() ERC721("Unaboomer", "BOOMR") {
|
|
|
|
|
deployer = msg.sender;
|
|
|
|
|
adminWallets[msg.sender] = true;
|
|
|
|
|
}
|
|
|
|
|
constructor() ERC721("Unaboomer", "BOOMR") Owned(msg.sender) {}
|
|
|
|
|
|
|
|
|
|
// =========================================================================
|
|
|
|
|
// Admin
|
|
|
|
|
// =========================================================================
|
|
|
|
|
|
|
|
|
|
modifier onlyAdmin {
|
|
|
|
|
if (adminWallets[msg.sender] == false) revert NotAdmin();
|
|
|
|
|
_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///@dev Specify team wallets for payouts and contract administration
|
|
|
|
|
function updateAdmins(address[] calldata _admins) external onlyAdmin {
|
|
|
|
|
payoutWallets = _admins;
|
|
|
|
|
for (uint256 i; i < _admins.length; i++) {
|
|
|
|
|
adminWallets[_admins[i]] = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///@dev Remove admins if needed
|
|
|
|
|
function removeAdmin(address _admin) external onlyAdmin {
|
|
|
|
|
if (msg.sender == _admin) revert NoRemoveSelf();
|
|
|
|
|
if (_admin == deployer) revert NoRemoveDeployer();
|
|
|
|
|
adminWallets[_admin] = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///@dev Split payments to team
|
|
|
|
|
function withdraw() external onlyAdmin {
|
|
|
|
|
if (payoutWallets.length == 0) revert NoAdmins();
|
|
|
|
|
/// Withdraw funds to contract owner
|
|
|
|
|
function withdraw() external onlyOwner {
|
|
|
|
|
uint256 balance = address(this).balance;
|
|
|
|
|
for (uint256 i; i < payoutWallets.length; i++) {
|
|
|
|
|
// payable(payoutWallets[i]).transfer(balance / payoutWallets.length);
|
|
|
|
|
(bool success, ) = payable(payoutWallets[i]).call{value: balance / payoutWallets.length}("");
|
|
|
|
|
require(success, "failed to withdraw");
|
|
|
|
|
}
|
|
|
|
|
payable(msg.sender).transfer(balance);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function setLivingURI(string calldata _baseURI) external onlyAdmin {
|
|
|
|
|
livingURI = _baseURI;
|
|
|
|
|
/// Set metadata URI for alive BOOMR
|
|
|
|
|
function setAliveURI(string calldata _baseURI) external onlyOwner {
|
|
|
|
|
aliveURI = _baseURI;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function setDeadURI(string calldata _baseURI) external onlyAdmin {
|
|
|
|
|
/// Set metadata URI for dead BOOMR
|
|
|
|
|
function setDeadURI(string calldata _baseURI) external onlyOwner {
|
|
|
|
|
deadURI = _baseURI;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Set contract address for Mailbomb tokens
|
|
|
|
|
function setMailBombContract(address _address) external onlyOwner {
|
|
|
|
|
MailBombContract = _address;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// =========================================================================
|
|
|
|
|
// Tokens
|
|
|
|
|
// =========================================================================
|
|
|
|
@ -99,6 +77,7 @@ contract Unaboomer is ERC721 {
|
|
|
|
|
minted++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// also mint 2 BOMB to user
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function totalSupply() view public returns (uint256 supply) {
|
|
|
|
@ -106,14 +85,14 @@ contract Unaboomer is ERC721 {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
|
|
|
|
|
if (tokenDead[_tokenId] == false) {
|
|
|
|
|
return string(abi.encodePacked(livingURI, _tokenId.toString(), ".json"));
|
|
|
|
|
} else {
|
|
|
|
|
if (tokenDead[_tokenId]) {
|
|
|
|
|
return string(abi.encodePacked(deadURI, _tokenId.toString(), ".json"));
|
|
|
|
|
} else {
|
|
|
|
|
return string(abi.encodePacked(aliveURI, _tokenId.toString(), ".json"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function supportsInterface(bytes4 interfaceId) public view virtual override (ERC721) returns (bool) {
|
|
|
|
|
return super.supportsInterface(interfaceId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|