|
|
@ -11,7 +11,6 @@ chaos ensues until 1000 survivors - the game stops
|
|
|
|
********/
|
|
|
|
********/
|
|
|
|
|
|
|
|
|
|
|
|
import {ERC721} from "solmate/tokens/ERC721.sol";
|
|
|
|
import {ERC721} from "solmate/tokens/ERC721.sol";
|
|
|
|
import {Owned} from "solmate/auth/Owned.sol";
|
|
|
|
|
|
|
|
import {LibString} from "solmate/utils/LibString.sol";
|
|
|
|
import {LibString} from "solmate/utils/LibString.sol";
|
|
|
|
|
|
|
|
|
|
|
|
error NotOwnerOfToken();
|
|
|
|
error NotOwnerOfToken();
|
|
|
@ -21,32 +20,39 @@ error NoContract();
|
|
|
|
error WrongEtherAmount();
|
|
|
|
error WrongEtherAmount();
|
|
|
|
error MaxAmountReached();
|
|
|
|
error MaxAmountReached();
|
|
|
|
error NoAdmins();
|
|
|
|
error NoAdmins();
|
|
|
|
|
|
|
|
error NotAdmin();
|
|
|
|
|
|
|
|
error NoRemoveSelf();
|
|
|
|
|
|
|
|
error NoRemoveDeployer();
|
|
|
|
|
|
|
|
|
|
|
|
contract Unaboomer is Owned, ERC721 {
|
|
|
|
contract Unaboomer is ERC721 {
|
|
|
|
using LibString for uint256;
|
|
|
|
using LibString for uint256;
|
|
|
|
|
|
|
|
|
|
|
|
enum TokenState {
|
|
|
|
mapping(uint256 => bool) public tokenDead;
|
|
|
|
LIVING,
|
|
|
|
|
|
|
|
DEAD
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mapping(uint256 => TokenState) public tokenState;
|
|
|
|
|
|
|
|
mapping(address => bool) public adminWallets;
|
|
|
|
mapping(address => bool) public adminWallets;
|
|
|
|
|
|
|
|
|
|
|
|
uint256 public constant MAX_SUPPLY = 10000;
|
|
|
|
uint256 public constant MAX_SUPPLY = 10000;
|
|
|
|
uint256 public minted;
|
|
|
|
uint256 public minted;
|
|
|
|
string public livingURI;
|
|
|
|
string public livingURI;
|
|
|
|
string public deadURI;
|
|
|
|
string public deadURI;
|
|
|
|
|
|
|
|
address public deployer;
|
|
|
|
address[] public payoutWallets;
|
|
|
|
address[] public payoutWallets;
|
|
|
|
|
|
|
|
|
|
|
|
constructor() ERC721("Unaboomer", "BOOMR") Owned(msg.sender) {}
|
|
|
|
constructor() ERC721("Unaboomer", "BOOMR") {
|
|
|
|
|
|
|
|
deployer = msg.sender;
|
|
|
|
|
|
|
|
adminWallets[msg.sender] = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// =========================================================================
|
|
|
|
// =========================================================================
|
|
|
|
// Admin
|
|
|
|
// Admin
|
|
|
|
// =========================================================================
|
|
|
|
// =========================================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modifier onlyAdmin {
|
|
|
|
|
|
|
|
if (adminWallets[msg.sender] == false) revert NotAdmin();
|
|
|
|
|
|
|
|
_;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///@dev Specify team wallets for payouts and contract administration
|
|
|
|
///@dev Specify team wallets for payouts and contract administration
|
|
|
|
function updateAdmins(address[] calldata _admins) external onlyOwner {
|
|
|
|
function updateAdmins(address[] calldata _admins) external onlyAdmin {
|
|
|
|
payoutWallets = _admins;
|
|
|
|
payoutWallets = _admins;
|
|
|
|
for (uint256 i; i < _admins.length; i++) {
|
|
|
|
for (uint256 i; i < _admins.length; i++) {
|
|
|
|
adminWallets[_admins[i]] = true;
|
|
|
|
adminWallets[_admins[i]] = true;
|
|
|
@ -54,19 +60,31 @@ contract Unaboomer is Owned, ERC721 {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///@dev Remove admins if needed
|
|
|
|
///@dev Remove admins if needed
|
|
|
|
function removeAdmin(address _admin) external onlyOwner {
|
|
|
|
function removeAdmin(address _admin) external onlyAdmin {
|
|
|
|
|
|
|
|
if (msg.sender == _admin) revert NoRemoveSelf();
|
|
|
|
|
|
|
|
if (_admin == deployer) revert NoRemoveDeployer();
|
|
|
|
adminWallets[_admin] = false;
|
|
|
|
adminWallets[_admin] = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///@dev Split payments to team
|
|
|
|
///@dev Split payments to team
|
|
|
|
function withdraw() external onlyOwner {
|
|
|
|
function withdraw() external onlyAdmin {
|
|
|
|
if (payoutWallets.length == 0) revert NoAdmins();
|
|
|
|
if (payoutWallets.length == 0) revert NoAdmins();
|
|
|
|
uint256 balance = address(this).balance;
|
|
|
|
uint256 balance = address(this).balance;
|
|
|
|
for (uint256 i; i < payoutWallets.length; i++) {
|
|
|
|
for (uint256 i; i < payoutWallets.length; i++) {
|
|
|
|
payable(payoutWallets[i]).transfer(balance / payoutWallets.length);
|
|
|
|
// payable(payoutWallets[i]).transfer(balance / payoutWallets.length);
|
|
|
|
|
|
|
|
(bool success, ) = payable(payoutWallets[i]).call{value: balance / payoutWallets.length}("");
|
|
|
|
|
|
|
|
require(success, "failed to withdraw");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function setLivingURI(string calldata _baseURI) external onlyAdmin {
|
|
|
|
|
|
|
|
livingURI = _baseURI;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function setDeadURI(string calldata _baseURI) external onlyAdmin {
|
|
|
|
|
|
|
|
deadURI = _baseURI;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// =========================================================================
|
|
|
|
// =========================================================================
|
|
|
|
// Tokens
|
|
|
|
// Tokens
|
|
|
|
// =========================================================================
|
|
|
|
// =========================================================================
|
|
|
@ -87,12 +105,8 @@ contract Unaboomer is Owned, ERC721 {
|
|
|
|
return minted;
|
|
|
|
return minted;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function setBaseURI(string calldata _baseURI) external onlyOwner {
|
|
|
|
|
|
|
|
livingURI = _baseURI;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
|
|
|
|
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
|
|
|
|
if (tokenState[_tokenId] == TokenState.LIVING) {
|
|
|
|
if (tokenDead[_tokenId] == false) {
|
|
|
|
return string(abi.encodePacked(livingURI, _tokenId.toString(), ".json"));
|
|
|
|
return string(abi.encodePacked(livingURI, _tokenId.toString(), ".json"));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return string(abi.encodePacked(deadURI, _tokenId.toString(), ".json"));
|
|
|
|
return string(abi.encodePacked(deadURI, _tokenId.toString(), ".json"));
|
|
|
|