EthereumEthereum
0xd8...c9c3
The Moon Boyz

The Moon Boyz

MOONBOYZ

收藏品
底价
0.002 ETH
$2,345.34
大小
10,765
收藏品
所有者
3,682
34% 独特的所有者
此合同的源代码已经过验证!
合同元数据
编译器
0.8.7+commit.e28d00a7
语言
Solidity
合同源代码
文件 1 的 14:Address.sol
合同源代码
文件 2 的 14:Context.sol
合同源代码
文件 3 的 14:Counters.sol
合同源代码
文件 4 的 14:ERC165.sol
合同源代码
文件 5 的 14:ERC721.sol
合同源代码
文件 6 的 14:IERC165.sol
合同源代码
文件 7 的 14:IERC721.sol
合同源代码
文件 8 的 14:IERC721Metadata.sol
合同源代码
文件 9 的 14:IERC721Receiver.sol
合同源代码
文件 10 的 14:MoonBoyz.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.7;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Address.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeMath.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Counters.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/finance/PaymentSplitter.sol";
interface OldContract {
    function viewWhitelistOneStatus(address _user) external view returns(bool);
    function totalAvailableForUser(address _user) external view returns(uint);
    //WHITELISTS
    function whiteListOne(uint) external view returns (address);
    function whiteListTwo(uint) external view returns (address);
    function whiteListThree(uint) external view returns (address);
    function whiteListFour(uint) external view returns (address);
    function whiteListFive(uint) external view returns (address);
    function whiteListSix(uint) external view returns (address);
    function whiteListSeven(uint) external view returns (address);
    function whiteListEight(uint) external view returns (address);
    function whiteListNine(uint) external view returns (address);
    function whiteListTen(uint) external view returns (address);
    function whiteListEleven(uint) external view returns (address);
    //CURRENT OWNERS OF MOONBOYZ
    function totalSupply() external view returns(uint);
    function ownerOf(uint) external view returns(address);
    function balanceOf(address) external view returns(uint);
}

contract TheMoonBoyz is ERC721, Ownable, PaymentSplitter {
    using SafeMath for uint256;
    using Counters for Counters.Counter;
    using Address for address;
    
    Counters.Counter private _tokenIdCounter;
    
    uint256 public maxMoonBoyzSupply = 11111;
    
    bool public claimableSale = false;
    bool public regularSale = false;
    
    bool private revealed = false;
    
    address[] private _team = [
        0x700eec4D6Ed56ED0F97a0f43Fc9DF5B426Ba25Fc, 
        0xDFf1889Ec0F09d14dE9379938bDc3Df0c6D0B39C, 
        0x4c2a5a4ea0d3f7E9142535f260A05b975Ee1df02, 
        0xDbe3BfBEc8332b0835bf0f466bA34c64655Ba94D, 
        0x9389D778c5Fc4978d1dF24e1084e6853d3407863 
        ];
    
    uint256[] private _teamShares = [
        25,
        24,
        25,
        24,
        2
        ];
    
    uint public mintPrice;
    OldContract private oldContract;
    
    mapping (uint256 => string) private _tokenURIs;
    string public baseURI;
    
    mapping(address => uint256) public totalClaimable;
    mapping(address => uint256) public totalClaimed;
    address[] public claimers;
    
    uint private iOwner = 1;
    uint public maxPerTransaction = 10;
    
    constructor(uint _mintPrice, address _oldContract) ERC721("The Moon Boyz", "MOONBOYZ") PaymentSplitter(_team, _teamShares) {
        //SET MINT PRICE
        mintPrice = _mintPrice;
        //GET OLD CONTRACT
        oldContract = OldContract(_oldContract);
    }
    
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
        
        string memory base = _baseURI();
        if(!revealed){
            return bytes(base).length > 0 ? string(abi.encodePacked(base)) : "";
        }
        return bytes(base).length > 0 ? string(abi.encodePacked(base, uint2str(tokenId))) : "";
    }
    
    function _baseURI() internal view virtual override returns (string memory) {
        return baseURI;
    }
    
    function _setBaseURI(string memory _newBaseURI) public onlyOwner {
        baseURI = _newBaseURI;
    }
    
  	function setTotalSupply(uint _totalSupply) public onlyOwner{
  	    maxMoonBoyzSupply = _totalSupply;
  	}
  	
    function claim(uint _claimCount) public payable {
        require(claimableSale == true, "Claiming Not Active");
        uint sent = msg.value;
        require(sent == mintPrice * _claimCount, "Did not send required eth");
        require(_claimCount > 0 && _claimCount <= totalClaimable[msg.sender], "You are not eligible to claim this many tokens");
        //ADD USER TO ARRAY
        claimers.push(msg.sender);
        //ADD USER CLAIMED
        totalClaimed[msg.sender] += _claimCount;
        //REDUCE USER CLAIMABLE
        totalClaimable[msg.sender] -= _claimCount;
    }
    
    function airdrop(uint _from, uint _to) public onlyOwner {
        for(uint i = _from; i < _to && i < claimers.length; i++){
            require(_tokenIdCounter.current() < maxMoonBoyzSupply, "At Max Supply");
            
            for(uint j = 0; j < totalClaimed[claimers[i]]; j++){
                uint256 _tokenID = _tokenIdCounter.current();
                
                //REQUIRE TOKEN DOESNT EXIST
                require(!super._exists(_tokenID), "Token ID Exists");
                
                //MINT TO CLAIMERS ADDRESS
                _safeMint(claimers[i], _tokenID);
                _tokenIdCounter.increment();
            }
            totalClaimed[claimers[i]] = 0;
        }
    }
    
    function regularSaleMint(uint _count) public payable {
        require(regularSale == true, "Normal Sale Not Active");
        require(_count <= maxPerTransaction, "Over maxPerTransaction");
        require(msg.value == mintPrice * _count, "Insuffcient Amount Sent");
        
        require(_tokenIdCounter.current() < maxMoonBoyzSupply, "At Max Supply");
        
        
        for(uint i = 0; i < _count; i++){
            uint256 _tokenID = _tokenIdCounter.current();
            require(!super._exists(_tokenID), "Token ID Exists");
            _safeMint(msg.sender, _tokenID);
            _tokenIdCounter.increment();
        }
    }
    function ownerMint(uint _count)public onlyOwner {
        require(_tokenIdCounter.current() + _count < maxMoonBoyzSupply, "TOO MANY MOON BOYZ");
        for(uint i = 0; i < _count; i++){
            uint256 _tokenID = _tokenIdCounter.current();
            require(!super._exists(_tokenID), "Token ID Exists");
            require(_tokenIdCounter.current() < maxMoonBoyzSupply, "At Max Supply");
            _safeMint(msg.sender, _tokenID);
            _tokenIdCounter.increment();
        }
    }
    function whitelistFunctions(uint iFunc, uint i) private view returns(address explicit){
        if(iFunc==0){
            try oldContract.whiteListOne(i) returns (address _address) {
                return(_address);
            } catch {
                return(address(0));
            }
        }
        else if(iFunc==1){
            try oldContract.whiteListTwo(i) returns (address _address) {
                return(_address);
            } catch {
                return(address(0));
            }
        } 
        else if (iFunc==2){
            try oldContract.whiteListThree(i) returns (address _address) {
                return(_address);
            } catch {
                return(address(0));
            }
        
        }
        else if(iFunc==3){
            try oldContract.whiteListFour(i)returns (address _address) {
                return(_address);
            } catch {
                return(address(0));
            }
        } 
        else if(iFunc==4){
            try oldContract.whiteListFive(i)returns (address _address) {
                return(_address);
            } catch {
                return(address(0));
            }
        } 
        else if (iFunc==5){
            try oldContract.whiteListSix(i)returns (address _address) {
                return(_address);
            } catch {
                return(address(0));
            }
        }
        else if(iFunc==6){
            try oldContract.whiteListSeven(i)returns (address _address) {
                return(_address);
            } catch {
                return(address(0));
            }
        }
        else if(iFunc==7){
            try oldContract.whiteListEight(i)returns (address _address) {
                return(_address);
            } catch {
                return(address(0));
            }
        } 
        else if(iFunc==8){
            try oldContract.whiteListNine(i)returns (address _address) {
                return(_address);
            } catch {
                return(address(0));
            }
        } 
        else if (iFunc==9){
            try oldContract.whiteListTen(i)returns (address _address) {
                return(_address);
            } catch {
                return(address(0));
            }
        }
        else if(iFunc==10){
            try oldContract.whiteListEleven(i)returns (address _address) {
                return(_address);
            } catch {
                return(address(0));
            }
        } 
        
    }
    
    
    function pullWhitelist(uint _from, uint _to) public onlyOwner
    {
        for(uint f = _from; f < _to; f++){
            bool tmp = false;
            for(uint i = 0; !tmp; i++){
                address tmpAddress = whitelistFunctions(f,i);
                if(tmpAddress != address(0)){
                    if(totalClaimable[tmpAddress] <= 0){
                        totalClaimable[tmpAddress] += oldContract.totalAvailableForUser(tmpAddress);
                    }
                } else {
                    tmp = true;
                }
            }
        }
    }
    
    function pullCurrentOwners(uint _to) public onlyOwner {
        uint oldTotalSupply = oldContract.totalSupply();
        if(_to > iOwner){
            for(uint i = iOwner; i <= oldTotalSupply && i < _to; i++){
                iOwner += 1;
                try oldContract.ownerOf(i) returns (address _address) {
                    if(_address != address(0)){
                        claimers.push(_address);
                        totalClaimed[_address] += 1;
                    }
                } catch {
                }
            }
        }
    }
    function totalSupply() external view returns (uint256) {
        return _tokenIdCounter.current();
    }
    
    function flipClaimableSale() public onlyOwner {
        claimableSale = !claimableSale;
    }
    
    function flipRevealed() public onlyOwner {
        revealed = !revealed;
    }
    
    function flipRegularSale() public onlyOwner {
        regularSale = !regularSale;
    }
    
    
    function setMintPrice(uint256 _mintPrice) external onlyOwner {
        mintPrice = _mintPrice;
    }
    
    function withdrawAll() external onlyOwner {
        for (uint256 i = 0; i < _team.length; i++) {
            address payable wallet = payable(_team[i]);
            release(wallet);
        }
    }
    
    function getClaimers() public view returns(address[] memory){
        return claimers;
    }
    function uint2str(uint _i) private pure returns (string memory _uintAsString) {
        if (_i == 0) {
            return "0";
        }
        uint j = _i;
        uint len;
        while (j != 0) {
            len++;
            j /= 10;
        }
        bytes memory bstr = new bytes(len);
        uint k = len;
        while (_i != 0) {
            k = k-1;
            uint8 temp = (48 + uint8(_i - _i / 10 * 10));
            bytes1 b1 = bytes1(temp);
            bstr[k] = b1;
            _i /= 10;
        }
        return string(bstr);
    }
}
合同源代码
文件 11 的 14:Ownable.sol
合同源代码
文件 12 的 14:PaymentSplitter.sol
合同源代码
文件 13 的 14:SafeMath.sol
合同源代码
文件 14 的 14:Strings.sol
设置
{
  "compilationTarget": {
    "ERC721Contracts/FULLOLDCONTRACT/MoonBoyz.sol": "TheMoonBoyz"
  },
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "remappings": []
}
ABI
[{"inputs":[{"internalType":"uint256","name":"_mintPrice","type":"uint256"},{"internalType":"address","name":"_oldContract","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"PayeeAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"string","name":"_newBaseURI","type":"string"}],"name":"_setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"airdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_claimCount","type":"uint256"}],"name":"claim","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"claimableSale","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"claimers","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flipClaimableSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"flipRegularSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"flipRevealed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getClaimers","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxMoonBoyzSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPerTransaction","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_count","type":"uint256"}],"name":"ownerMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"payee","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"pullCurrentOwners","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"pullWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"regularSale","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_count","type":"uint256"}],"name":"regularSaleMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address payable","name":"account","type":"address"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"released","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mintPrice","type":"uint256"}],"name":"setMintPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_totalSupply","type":"uint256"}],"name":"setTotalSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"shares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"totalClaimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"totalClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalReleased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]