|
|
|
@ -27,12 +27,12 @@ contract Unaboomer is ERC721, Owned {
|
|
|
|
|
/// Track if a BOOMR token is toggled as alive or dead
|
|
|
|
|
mapping(uint256 => bool) public tokenDead;
|
|
|
|
|
/// Maximum supply of BOOMR tokens
|
|
|
|
|
uint256 public constant MAX_SUPPLY = 10000;
|
|
|
|
|
uint256 public constant MAX_SUPPLY = 35000;
|
|
|
|
|
/// Maximum amount of survivors remaining to advance to the next round
|
|
|
|
|
uint256 public constant MAX_SURVIVOR_COUNT = 1000;
|
|
|
|
|
/// The total amount of Unaboomers who have been killed during the game
|
|
|
|
|
uint256 public totalKillCount;
|
|
|
|
|
/// Number of tokens minted (total supply)
|
|
|
|
|
uint256 public constant MAX_SURVIVOR_COUNT = 10000;
|
|
|
|
|
/// Amount of Unaboomers killed (tokens burned)
|
|
|
|
|
uint256 public burned;
|
|
|
|
|
/// Amount of Unaboomers radicalized (tokens minted)
|
|
|
|
|
uint256 public minted;
|
|
|
|
|
/// Base URI for living Unaboomers - original pixelated avatars
|
|
|
|
|
string public aliveURI;
|
|
|
|
@ -82,14 +82,14 @@ contract Unaboomer is ERC721, Owned {
|
|
|
|
|
/// Helper function to get supply minted
|
|
|
|
|
/// @return supply Number of Unaboomers radicalized in totality (minted)
|
|
|
|
|
function totalSupply() public view returns (uint256) {
|
|
|
|
|
return minted;
|
|
|
|
|
return minted - burned;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Mint tokens from main contract
|
|
|
|
|
/// @param _to Address to mint BOOMR tokens to
|
|
|
|
|
/// @param _amount Amount of BOOMR tokens to mint
|
|
|
|
|
function radicalize(address _to, uint256 _amount) external onlyMain {
|
|
|
|
|
require(totalSupply() + _amount <= MAX_SUPPLY, "supply reached");
|
|
|
|
|
require(minted + _amount <= MAX_SUPPLY, "supply reached");
|
|
|
|
|
for (uint256 i; i < _amount; i++) {
|
|
|
|
|
minted++;
|
|
|
|
|
_safeMint(_to, minted);
|
|
|
|
@ -97,20 +97,28 @@ contract Unaboomer is ERC721, Owned {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Toggle token state from living to dead
|
|
|
|
|
/// @param tokenId Token ID of BOOMR to toggle living -> dead and increment kill count
|
|
|
|
|
function die(uint256 tokenId) external onlyMain {
|
|
|
|
|
require(tokenId <= totalSupply(), "invalid token id");
|
|
|
|
|
if (tokenDead[tokenId] == false) {
|
|
|
|
|
totalKillCount++;
|
|
|
|
|
tokenDead[tokenId] = true;
|
|
|
|
|
/// @param _tokenId Token ID of BOOMR to toggle living -> dead and increment kill count
|
|
|
|
|
function die(uint256 _tokenId) external onlyMain {
|
|
|
|
|
require(_tokenId <= minted, "invalid token id");
|
|
|
|
|
if (ownerOf(_tokenId) != address(0)) {
|
|
|
|
|
burned++;
|
|
|
|
|
_burn(_tokenId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Retrieve owner of given token ID
|
|
|
|
|
/// @param _tokenId Token ID to check owner of
|
|
|
|
|
/// @return owner Address of owner
|
|
|
|
|
/// @dev Overridden from Solmate contract to allow zero address returns
|
|
|
|
|
function ownerOf(uint256 _tokenId) public view override returns (address owner) {
|
|
|
|
|
return _ownerOf[_tokenId];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return URI to retrieve JSON metadata from - points to images and descriptions
|
|
|
|
|
/// @param _tokenId Token ID of BOOMR to fetch URI for
|
|
|
|
|
/// @return string IPFS or HTTP URI to retrieve JSON metadata from
|
|
|
|
|
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
|
|
|
|
|
if (tokenDead[_tokenId] == true) {
|
|
|
|
|
if (ownerOf(_tokenId) == address(0)) {
|
|
|
|
|
return string(abi.encodePacked(deadURI, _tokenId.toString(), ".json"));
|
|
|
|
|
} else {
|
|
|
|
|
return string(abi.encodePacked(aliveURI, _tokenId.toString(), ".json"));
|
|
|
|
|