ERC-20
Overview
Max Total Supply
299,409.8184 TNT
Holders
114
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
1,500 TNTValue
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
Tyranite
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 2000000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT /*__/\\\\\\\\\\\\\\\__/\\\________/\\\____/\\\\\\\\\_________/\\\\\\\\\_____/\\\\\_____/\\\__/\\\\\\\\\\\__/\\\\\\\\\\\\\\\__/\\\\\\\\\\\\\\\_ _\///////\\\/////__\///\\\____/\\\/___/\\\///////\\\_____/\\\\\\\\\\\\\__\/\\\\\\___\/\\\_\/////\\\///__\///////\\\/////__\/\\\///////////__ _______\/\\\_________\///\\\/\\\/____\/\\\_____\/\\\____/\\\/////////\\\_\/\\\/\\\__\/\\\_____\/\\\___________\/\\\_______\/\\\_____________ _______\/\\\___________\///\\\/______\/\\\\\\\\\\\/____\/\\\_______\/\\\_\/\\\//\\\_\/\\\_____\/\\\___________\/\\\_______\/\\\\\\\\\\\_____ _______\/\\\_____________\/\\\_______\/\\\//////\\\____\/\\\\\\\\\\\\\\\_\/\\\\//\\\\/\\\_____\/\\\___________\/\\\_______\/\\\///////______ _______\/\\\_____________\/\\\_______\/\\\____\//\\\___\/\\\/////////\\\_\/\\\_\//\\\/\\\_____\/\\\___________\/\\\_______\/\\\_____________ _______\/\\\_____________\/\\\_______\/\\\_____\//\\\__\/\\\_______\/\\\_\/\\\__\//\\\\\\_____\/\\\___________\/\\\_______\/\\\_____________ _______\/\\\_____________\/\\\_______\/\\\______\//\\\_\/\\\_______\/\\\_\/\\\___\//\\\\\__/\\\\\\\\\\\_______\/\\\_______\/\\\\\\\\\\\\\\\_ _______\///______________\///________\///________\///__\///________\///__\///_____\/////__\///////////________\///________\///////////////__ */ pragma solidity >=0.8.0 <0.9.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "contracts/Tyranz_Genesis_721FAT.sol"; import "contracts/Drill_1155.sol"; contract Tyranite is ERC20 { struct token_ids{uint256 ids;} mapping(address => mapping(uint256 => uint256)) private checkpoints; mapping(address => token_ids[]) private deposited_ids; mapping(address => mapping(uint256 => bool)) private has_deposited; mapping(uint256 => uint256) private token_mined; mapping(address => bool) public Owner; TyranzGenesis public nft; TyraniteDrill public item; uint256 public blockReward = 0.0007 ether; uint256 public maxSupply = 60644750 ether; uint256 public maxreward = 18250 ether; uint256 public maxreward2 = 27375 ether; constructor(address drillContract,address GenesisContract) ERC20("Tyranite", "TNT") { Owner[msg.sender] = true; item = TyraniteDrill(drillContract); nft = TyranzGenesis(GenesisContract); } function deposit(uint256 tokenid) public { unchecked{ address depositary = msg.sender; if(totalSupply() >= maxSupply) revert ("Max Supply Reached"); if(nft.legendary(tokenid) == true){ if(nft.revlegendary(tokenid) == false) { revert ("Primal not Revealed"); }else{if(token_mined[tokenid] >= maxreward2) revert ("Max Reward Reached");} }else{if(token_mined[tokenid] >= maxreward) revert ("Max Reward Reached");} nft.transferFrom(depositary, address(this),tokenid); checkpoints[depositary][tokenid] = block.number; has_deposited[depositary][tokenid] = true; deposited_ids[depositary].push(token_ids(tokenid)); } } function batch_deposit(uint256[]memory tokenid) public { unchecked{ address depositary = msg.sender; if(totalSupply() >= maxSupply) revert ("Max Supply Reached"); for(uint256 i = 0;i<tokenid.length;i++){ uint256 id = tokenid[i]; if(nft.legendary(id) == true){ if(nft.revlegendary(id) == false) { revert ("Primal not Revealed"); }else{if(token_mined[id] >= maxreward2) revert ("Max Reward Reached");} }else{if(token_mined[id] >= maxreward) revert ("Max Reward Reached");} nft.transferFrom(depositary, address(this),id); checkpoints[depositary][id] = block.number; has_deposited[depositary][id] = true; deposited_ids[depositary].push(token_ids(id)); } } } function withdraw(uint256 tokenid) public{ unchecked{ address depositary = msg.sender; if(has_deposited[depositary][tokenid] == false) revert ("Invalid Token Id"); collect(tokenid); nft.transferFrom(address(this), depositary,tokenid); has_deposited[depositary][tokenid] = false; uint256 length = deposited_ids[depositary].length; for(uint256 i = 0;i<length;i++){ if(tokenid == deposited_ids[depositary][i].ids){ deposited_ids[depositary][i].ids = deposited_ids[depositary][length-1].ids; deposited_ids[depositary].pop(); break; } } } } function batch_withdraw(uint256[] memory tokenid) public{ unchecked{ address depositary = msg.sender; for(uint256 z = 0;z<tokenid.length;z++){ uint256 id = tokenid[z]; if(has_deposited[depositary][id] == false) revert ("Invalid Token Id"); collect(id); nft.transferFrom(address(this), depositary,id); has_deposited[depositary][id] = false; uint256 length = deposited_ids[depositary].length; for(uint256 i = 0;i<length;i++){ if(id == deposited_ids[depositary][i].ids){ deposited_ids[depositary][i].ids = deposited_ids[depositary][length-1].ids; deposited_ids[depositary].pop(); break; } } } } } function collect(uint256 tokenid) public { unchecked{ address depositary = msg.sender; if(has_deposited[depositary][tokenid] != true) revert ("No Tokens to Withdarw"); uint256 reward = calculateReward(tokenid); token_mined[tokenid] += reward; _mint(depositary, reward); checkpoints[depositary][tokenid] = block.number; } } function batch_collect(uint256[] memory tokenid) public { unchecked{ address depositary = msg.sender; for(uint256 i = 0;i<tokenid.length;i++){ uint256 id = tokenid[i]; if(has_deposited[depositary][id] != true) revert ("No Tokens to Withdarw"); uint256 reward = calculateReward(id); token_mined[id] += reward; _mint(depositary, reward); checkpoints[depositary][id] = block.number; } } } //Admin Pannel--------------------------------------------------------------------- function update_blockReward(uint256 new_blockReward) public { if(Owner[msg.sender] != true) revert ("Staff Use Only"); blockReward = new_blockReward;//remember to type value in wei } function airdrop(address beneficiary,uint256 amount) public { if(Owner[msg.sender] != true) revert ("Staff Use Only"); _mint(beneficiary,amount);//remember to type value in wei } function multisender (address[] memory address_list, uint256[] memory amounts) public { if(Owner[msg.sender] != true) revert ("Staff Use Only"); for(uint256 i=0;i<address_list.length;i++){ _mint(address_list[i],amounts[i]); } } function adminrole(address new_admin,bool role) public { if(Owner[msg.sender] != true) revert ("Staff Use Only"); Owner[new_admin] = role; } function set_maxRewards(uint256 new_maxrw,uint256 new_maxrw2) public { if(Owner[msg.sender] != true) revert ("Staff Use Only"); //remember to type value in wei maxreward = new_maxrw; maxreward2 = new_maxrw2; } //METRICS----------------------------------------------------------------------- function calculateReward(uint256 tokenid) public view returns(uint256 rewards) { unchecked{ address depositary = msg.sender; if(has_deposited[depositary][tokenid] == false||totalSupply() >= maxSupply) {return 0;} uint256 Drill = item.balanceOf(depositary,1); uint256 reward = (block.number - checkpoints[depositary][tokenid]) * blockReward; uint256 temp_mined = token_mined[tokenid]; uint256 temp_maxreward = 18250 ether; if(nft.Injected(tokenid) == true){ if(temp_mined >= temp_maxreward) {return 0;} if(Drill == 0) {if((reward*2) + temp_mined >= temp_maxreward) {return temp_maxreward - temp_mined;}return reward *2;} if(Drill == 1) {if(((reward/4) + reward) + reward + temp_mined >= temp_maxreward) {return temp_maxreward - temp_mined;}return ((reward/4) + reward) + reward;} if(Drill == 2) {if(((reward/2) + reward) + reward + temp_mined >= temp_maxreward) {return temp_maxreward - temp_mined;}return ((reward/2) + reward) + reward;} if(Drill >= 3) {if((reward *2) + reward + temp_mined >= temp_maxreward) {return temp_maxreward - temp_mined;}return (reward *2) + reward;} } if(nft.revlegendary(tokenid) == false){ if(temp_mined >= temp_maxreward) {return 0;} if(Drill == 0) {if(reward + temp_mined >= temp_maxreward) {return temp_maxreward - temp_mined;}return reward;} if(Drill == 1) {if(((reward/4) + reward) + temp_mined >= temp_maxreward) {return temp_maxreward - temp_mined;}return ((reward/4) + reward);} if(Drill == 2) {if(((reward/2) + reward) + temp_mined >= temp_maxreward) {return temp_maxreward - temp_mined;}return ((reward/2) + reward);} if(Drill >= 3) {if((reward *2) + temp_mined >= temp_maxreward) {return temp_maxreward - temp_mined;}return (reward *2);} }else { uint256 temp_maxreward2 = 27375 ether; if(temp_mined >= temp_maxreward2) {return 0;} if(Drill == 0) {if((reward*2) + temp_mined >= temp_maxreward2) {return temp_maxreward2 - temp_mined;}return reward*2;} if(Drill == 1) {if(((reward/4) + reward) + reward + temp_mined >= temp_maxreward2) {return temp_maxreward2 - temp_mined;}return ((reward/4) + reward) + reward;} if(Drill == 2) {if(((reward/2) + reward) + reward + temp_mined >= temp_maxreward2) {return temp_maxreward2 - temp_mined;}return ((reward/2) + reward) + reward;} if(Drill >= 3) {if((reward *2) + reward + temp_mined >= temp_maxreward2) {return temp_maxreward2 - temp_mined;}return (reward *2) + reward;} } } } function nft_isDelegated(uint256 tokenid) public view returns(bool) { return has_deposited[msg.sender][tokenid]; } function nft_tokenclaimed(uint256 tokenid) public view returns(uint256) { return token_mined[tokenid]; } function nft_id_in_Staking(address Staker) public view returns(token_ids[] memory) { return deposited_ids[Staker]; } function nft_id_in_Wallet(address Staker) public view returns(uint256[] memory) { return nft.tokensOfOwner(Staker); } function drill_in_Wallet(address Staker) public view returns(uint256) { return item.balanceOf(Staker,1); } function isInjected(uint256 tokenid) public view returns(bool) { return nft.Injected(tokenid); } }
// SPDX-License-Identifier: MIT import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/common/ERC2981.sol"; pragma solidity >=0.8.0 <0.9.0; contract TyraniteDrill is ERC1155,Ownable,ERC2981 { string public name; string public symbol; uint public totalSupply = 0; uint public maxSupply = 165; uint public WhiteLimit = 1; uint public PublicLimit = 2; uint public maxMintAmount = 2; uint public cost = 0.05 ether; bool public publicsale = false; bool public onlyOG = false; mapping (uint => string) private tokenURI; mapping (address => uint) public AddressMintedBalance_WL; mapping (address => uint) public AddressMintedBalance_PB; bytes32 public root; constructor(string memory _name,string memory _symbol,string memory _baseURI) ERC1155("") { name = _name; symbol = _symbol; tokenURI[1] = _baseURI; } function supportsInterface(bytes4 interfaceId) public view virtual override (ERC1155,ERC2981) returns (bool) { return super.supportsInterface(interfaceId); } function uri(uint _id) public view virtual override returns (string memory) { return tokenURI[_id]; } function _publicsale (bool _state) public onlyOwner { publicsale = _state; } function _onlyOG(bool _state) public onlyOwner { onlyOG = _state; } function set_root(bytes32 _root) public onlyOwner { root = _root; } function set_cost(uint256 new_cost) public onlyOwner { cost = new_cost; } function sale_switch() public onlyOwner { onlyOG = false; publicsale = true; } function set_uri(string memory new_tokenURI) public onlyOwner{ tokenURI[1] = new_tokenURI; } function set_royalties(address receiver,uint96 feeNumerator) public onlyOwner{ _setDefaultRoyalty(receiver,feeNumerator);// 1% = 100 } function publicmint(uint256 amount) public payable { if(totalSupply + amount > maxSupply) revert("Amount Exceeds Max Supply"); if(amount <= 0) revert("Mint at Least 1"); if(msg.sender != owner()){ if (publicsale == false) revert ("Function Disabled"); if (amount + AddressMintedBalance_PB[msg.sender] > PublicLimit) revert ("Address Limit Reached"); if(amount > maxMintAmount) revert ("Max Mint x Session Reached"); if (msg.value != cost * amount) revert ("Incorrect Amount"); } totalSupply += amount; AddressMintedBalance_PB[msg.sender]+= amount; _mint(msg.sender,1, amount ,"Thank You!!"); } function OGmint(bytes32[] memory proof) public payable { if (onlyOG == false) revert ("Function Disabled"); if(totalSupply == maxSupply) revert ("Sold Out"); if(AddressMintedBalance_WL[msg.sender] == WhiteLimit) revert ("Address Limit Reached"); if(msg.value != cost) revert ("Incorrect Amount"); bytes32 leaf = keccak256(abi.encodePacked(msg.sender)); if (!MerkleProof.verify(proof,root,leaf)) revert ("User not Whitelisted"); totalSupply++; AddressMintedBalance_WL[msg.sender]++; _mint(msg.sender,1, 1 ,"Welcome aboard Pioneer!!"); } function Withdraw(address Withdraw_Address) public onlyOwner { address payable to = payable(Withdraw_Address); to.transfer(address(this).balance); //WITHDRAW ETH FROM THE SMARTCONTRACT TO A SPECIFIC ADDRESS// } function Airdrop (address to , uint256 amount) public onlyOwner{ if (totalSupply + amount > maxSupply) revert ("Amount Exceeds Max Supply"); _mint(to,1,amount,"This is a Gift for You!!"); totalSupply+= amount; //AIRDROP AMOUNT OF DRILLS TO A SPECIFIC ADDRESS// } }
/*SPDX-License-Identifier: MIT _____ _____ _____ _____ _____ _____ /\ \ |\ \ /\ \ /\ \ /\ \ /\ \ /::\ \ |:\____\ /::\ \ /::\ \ /::\____\ /::\ \ \:::\ \ |::| | /::::\ \ /::::\ \ /::::| | \:::\ \ \:::\ \ |::| | /::::::\ \ /::::::\ \ /:::::| | \:::\ \ \:::\ \ |::| | /:::/\:::\ \ /:::/\:::\ \ /::::::| | \:::\ \ \:::\ \ |::| | /:::/__\:::\ \ /:::/__\:::\ \ /:::/|::| | \:::\ \ /::::\ \ |::| | /::::\ \:::\ \ /::::\ \:::\ \ /:::/ |::| | \:::\ \ /::::::\ \ |::|___|______ /::::::\ \:::\ \ /::::::\ \:::\ \ /:::/ |::| | _____ \:::\ \ /:::/\:::\ \ /::::::::\ \ /:::/\:::\ \:::\____\ /:::/\:::\ \:::\ \ /:::/ |::| |/\ \ \:::\ \ /:::/ \:::\____\ /::::::::::\____\/:::/ \:::\ \:::| |/:::/ \:::\ \:::\____\/:: / |::| /::\____\_______________\:::\____\ /:::/ \::/ / /:::/~~~~/~~ \::/ |::::\ /:::|____|\::/ \:::\ /:::/ /\::/ /|::| /:::/ /\::::::::::::::::::/ / /:::/ / \/____/ /:::/ / \/____|:::::\/:::/ / \/____/ \:::\/:::/ / \/____/ |::| /:::/ / \::::::::::::::::/____/ /:::/ / /:::/ / |:::::::::/ / \::::::/ / |::|/:::/ / \:::\~~~~\~~~~~~ /:::/ / /:::/ / |::|\::::/ / \::::/ / |::::::/ / \:::\ \ \::/ / \::/ / |::| \::/____/ /:::/ / |:::::/ / \:::\ \ \/____/ \/____/ |::| ~| /:::/ / |::::/ / \:::\ \ |::| | /:::/ / /:::/ / \:::\ \ \::| | /:::/ / /:::/ / \:::\____\ \:| | \::/ / \::/ / \::/ / \|___| \/____/ \/____/ \/____/ */ pragma solidity >=0.8.0 <0.9.0; import ".deps/ERC721F.sol"; import ".deps/IERC4906.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "@openzeppelin/contracts/token/common/ERC2981.sol"; import "contracts/Drill_1155.sol"; import ".deps/project_os/DefaultOperatorFilterer.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract TyranzGenesis is ERC721FAT,ERC2981,IERC4906,Ownable,DefaultOperatorFilterer { using Strings for uint256; string public baseURI; string public notRevealedUri; string public legendURI; string public notRevLegendUri; string public InjectedURI; string public baseExtension = ".json"; uint256 public pre_maxSupply = 3168; uint256 public maxSupply = 3333; uint256 public cost = 0.033 ether; uint256 public maxMintAmount = 3; uint256 public nftPerAddressLimit = 3; uint256 public Infusion_cap; uint256 public Infusion_cost = 1000 ether; bool public presaleactive = false; bool public saleactive = false; bool public freemintactive = false; bool public revealed = false; bool public injecting = false; mapping(address => uint256) public addressMintedBalance; mapping(address => uint256) public addressMintedBalance_WL; mapping(address => uint256) public addressMintedTyranite; mapping (uint256 => bool) public legendary; mapping (uint256 => bool) public revlegendary; mapping(uint256 => bool) public Injected; bytes32 public root; bytes32 public free_root; TyraniteDrill public item; IERC20 public token; constructor(string memory _name, string memory _symbol, string memory _initNotRevealedUri, string memory _initNotRevLegendUri,address drillContract) ERC721FAT(_name, _symbol) { setNotRevealedURI(_initNotRevealedUri); setNotRevLegendURI(_initNotRevLegendUri); item = TyraniteDrill(drillContract); isLegendary(); } function supportsInterface(bytes4 interfaceId) public view virtual override (ERC721FAT,ERC2981,IERC165) returns (bool) { return super.supportsInterface(interfaceId); } //Metadata Service Functions function _startTokenId() internal view virtual override returns (uint256) { return 1; } function _baseURI() internal view virtual override returns (string memory) { return baseURI; } function _legendURI() internal view virtual returns (string memory) { return legendURI; } function _notRevealedUri() internal view virtual returns (string memory) { return notRevealedUri; } function _notRevLegendUri() internal view virtual returns (string memory) { return notRevLegendUri; } function _InjectedURI() internal view virtual returns (string memory) { return InjectedURI; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; emit BatchMetadataUpdate(11,3333); } function setLegendURI(string memory _newLegendURI) public onlyOwner { legendURI = _newLegendURI; emit BatchMetadataUpdate(1,10); } function setNotRevealedURI(string memory _notRevealedURI) public onlyOwner { notRevealedUri = _notRevealedURI; } function setNotRevLegendURI(string memory _notRevLegendURI) public onlyOwner { notRevLegendUri = _notRevLegendURI; } function setInjectedURI(string memory _InjectURI) public onlyOwner { InjectedURI = _InjectURI; } function bulk_metadata_refresh(uint256 startid,uint256 lastid) public onlyOwner { emit BatchMetadataUpdate(startid,lastid); } function sigle_metadata_refresh(uint256 tokenid) public onlyOwner { emit MetadataUpdate(tokenid); } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (_exists(tokenId) == false) revert ("URI query for unexistent Token"); if(revealed == false && legendary[tokenId] == false) { return notRevealedUri; } if(revealed == false && legendary[tokenId] == true ) { return notRevLegendUri; } if(revealed == true && legendary[tokenId] == true && revlegendary[tokenId] == false ) { return notRevLegendUri; } if(revealed == true && Injected[tokenId] == true && legendary[tokenId] == false){ string memory currentInjectedURI = _InjectedURI(); return bytes(currentInjectedURI).length != 0 ? string(abi.encodePacked(InjectedURI,tokenId.toString(),baseExtension)) : ''; } if(revealed == true && legendary[tokenId] == true && revlegendary[tokenId] == true){ string memory currentlegendURI = _legendURI(); return bytes(currentlegendURI).length != 0 ? string(abi.encodePacked(legendURI,tokenId.toString(),baseExtension)) : ''; } string memory currentbaseURI = _baseURI(); return bytes(currentbaseURI).length != 0 ? string(abi.encodePacked(baseURI,tokenId.toString(),baseExtension)) : ''; } //Admin Service Function function active_Infusion(bool _state) public onlyOwner { injecting = _state; } function presale(bool _state) public onlyOwner { presaleactive = _state; } function freemint(bool _state) public onlyOwner { freemintactive = _state; } function publicsale(bool _state) public onlyOwner { saleactive = _state; } function sale_switch() public onlyOwner { presaleactive = false; saleactive = true; } function isLegendary() private onlyOwner { legendary[1] = true; legendary[2] = true; legendary[3] = true; legendary[4] = true; legendary[5] = true; legendary[6] = true; legendary[7] = true; legendary[8] = true; legendary[9] = true; legendary[10] = true; } function revLegendary(uint256 tokenId) public onlyOwner { revlegendary[tokenId] = true; emit MetadataUpdate(tokenId); } function reveal(string memory _newBaseURI) public onlyOwner { require (!revealed,"one time use Only be careful my Dev"); baseURI = _newBaseURI; revealed = true; emit BatchMetadataUpdate(11,3333); } function set_root(bytes32 new_root) public onlyOwner{ root = new_root; } function set_freeroot(bytes32 new_freeroot) public onlyOwner{ free_root = new_freeroot; } function Whitdraw(address Withdraw_Address) public onlyOwner { address payable to = payable(Withdraw_Address); to.transfer(address(this).balance); } function set_royalties(address receiver,uint96 feeNumerator) public onlyOwner{ _setDefaultRoyalty(receiver,feeNumerator); } function set_cost(uint256 new_cost) public onlyOwner{ cost = new_cost; } function set_Infusion_cost(uint256 new_Infusion_cost) public onlyOwner{ Infusion_cost = new_Infusion_cost; } function set_public_limits(uint256 new_nftPerAddressLimit,uint256 new_maxMintAmount) public onlyOwner{ maxMintAmount = new_nftPerAddressLimit; nftPerAddressLimit = new_maxMintAmount; } function airdrop(address beneficiary,uint256 amount) public onlyOwner{ uint256 supply = totalSupply(); if(supply + amount > maxSupply) revert ("Max Supply reached"); _safeMint(beneficiary,amount); } function set_tyranite_contract(address tyraniteContract) public onlyOwner{ token = IERC20(tyraniteContract); } //Minting Stage function public_sale(uint256 quantity) public payable { uint256 supply = totalSupply(); uint256 ownerMintedCount = addressMintedBalance[msg.sender]; if(quantity <= 0) revert ("need to mint at least 1 NFT"); if(supply + quantity > maxSupply) revert ("Sold Out"); if (msg.sender != owner()) { if(supply + quantity > pre_maxSupply) revert ("Sold Out"); if(saleactive == false) revert ("Function Disabled"); if(ownerMintedCount + quantity > nftPerAddressLimit) revert ("max NFT per address exceeded"); if(quantity > maxMintAmount) revert ("max mint x session reached"); if(msg.value != cost * quantity) revert ("incorrect amount"); addressMintedBalance[msg.sender] += quantity; _safeMint(msg.sender,quantity); }else{ _safeMint(msg.sender,quantity); } } function pre_sale(uint256 quantity,bytes32[] memory proof) public payable { uint256 supply = totalSupply(); uint256 ownerMintedCount = addressMintedBalance_WL[msg.sender]; uint256 drills = item.balanceOf(msg.sender,1); uint256 pre_nftPerAddressLimit_WL = drills *3; uint256 nftPerAddressLimit_WL = 3 + pre_nftPerAddressLimit_WL; bytes32 leaf = keccak256(abi.encodePacked(msg.sender)); if(presaleactive == false) revert ("Function Disabled"); if(MerkleProof.verify(proof,root,leaf) == false) revert ("user not Whitelisted"); if(quantity <= 0) revert ("need to mint at least 1 NFT"); if(supply + quantity > pre_maxSupply) revert ("Sold Out"); if(ownerMintedCount + quantity > nftPerAddressLimit_WL) revert ("max NFT per address exceeded"); if(quantity > 6) revert ("max mint x session reached"); if(msg.value != cost * quantity) revert ("incorrect amount"); addressMintedBalance_WL[msg.sender] += quantity; _safeMint(msg.sender,quantity); } function free_claim(uint256 quantity,bytes32[] memory proof) public { uint256 supply = totalSupply(); uint256 ownerMintedCount_free = addressMintedTyranite[msg.sender]; bytes32 leaf = keccak256(abi.encodePacked(msg.sender,quantity)); if(freemintactive == false) revert ("Function Disabled"); if(MerkleProof.verify(proof,free_root,leaf) == false) revert ("not eligible to claim"); if(ownerMintedCount_free > 0) revert ("Already Claimed"); if(quantity <= 0) revert ("need to mint at least 1 NFT"); if(supply + quantity > maxSupply) revert ("Sold Out"); for(uint256 i = 0; i < quantity; i++) { addressMintedTyranite[msg.sender]++; _safeMint(msg.sender,1); } } //OS operator filter function overrides//---------------------------------------------------- function setApprovalForAll(address operator, bool approved) public virtual override (ERC721FAT,IERC721) onlyAllowedOperatorApproval(operator) { super.setApprovalForAll(operator, approved); } function approve(address operator, uint256 tokenId) public virtual override (ERC721FAT,IERC721) onlyAllowedOperatorApproval(operator) { super.approve(operator, tokenId); } function transferFrom(address from, address to, uint256 tokenId) public virtual override (ERC721FAT,IERC721) onlyAllowedOperator(from) { super.transferFrom(from, to, tokenId); } function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override (ERC721FAT,IERC721) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId); } function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override (ERC721FAT,IERC721) onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId, data); } //DAPP METRICS---------------------------------------------------- function drill_of_Holder(address Holder) public view returns(uint256) { return item.balanceOf(Holder,1); } function Tyranite_Balance(address Staker) public view returns(uint256) { return token.balanceOf(Staker); } //Special Mechanics------------------------------------------------- function InfuseTyranite(uint256 tokenid) public { uint256 tyranitebalance = token.balanceOf(msg.sender); if(injecting == false) revert ("Function Disabled"); if(msg.sender != ownerOf(tokenid)) revert ("Sender must be Owner"); if(Infusion_cap >= 33) revert ("Infusion Cap Reached"); if(legendary[tokenid] == true) revert ("Can't Infuse Primals"); if(Injected[tokenid] == true) revert ("Already Infused"); if(tyranitebalance < Infusion_cost) revert ("Insufficent Tyranite"); Infusion_cap++; Injected[tokenid] = true; emit MetadataUpdate(tokenid); token.transferFrom(msg.sender,address(this),Infusion_cost); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "./OperatorFilterer.sol"; import "./lib/Constants.sol"; /** * @title DefaultOperatorFilterer * @notice Inherits from OperatorFilterer and automatically subscribes to the default OpenSea subscription. * @dev Please note that if your token contract does not provide an owner with EIP-173, it must provide * administration methods on the contract itself to interact with the registry otherwise the subscription * will be locked to the options set during construction. */ abstract contract DefaultOperatorFilterer is OperatorFilterer { /// @dev The constructor that is called when the contract is being deployed. constructor() OperatorFilterer(CANONICAL_CORI_SUBSCRIPTION, true) {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates merkle trees that are safe * against this attack out of the box. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} * * _Available since v4.7._ */ function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} * * _Available since v4.7._ */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; interface IERC4906 is IERC165, IERC721 { /// @dev This event emits when the metadata of a token is changed. /// So that the third-party platforms such as NFT market could /// timely update the images and related attributes of the NFT. event MetadataUpdate(uint256 _tokenId); /// @dev This event emits when the metadata of a range of tokens is changed. /// So that the third-party platforms such as NFT market could /// timely update the images and related attributes of the NFTs. event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; error ApprovalCallerNotOwnerNorApproved(); error ApprovalQueryForNonexistentToken(); error ApproveToCaller(); error ApprovalToCurrentOwner(); error BalanceQueryForZeroAddress(); error MintedQueryForZeroAddress(); error BurnedQueryForZeroAddress(); error AuxQueryForZeroAddress(); error MintToZeroAddress(); error MintZeroQuantity(); error OwnerIndexOutOfBounds(); error OwnerQueryForNonexistentToken(); error TokenIndexOutOfBounds(); error TransferCallerNotOwnerNorApproved(); error TransferFromIncorrectOwner(); error TransferToNonERC721ReceiverImplementer(); error TransferToZeroAddress(); error URIQueryForNonexistentToken(); /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension. Built to optimize for lower gas during batch mints. * * Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..). * * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721FAT is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Compiler will pack this into a single 256bit word. struct TokenOwnership { // The address of the owner. address addr; // Keeps track of the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; } // Compiler will pack this into a single 256bit word. struct AddressData { // Realistically, 2**64-1 is more than enough. uint64 balance; // Keeps track of mint count with minimal overhead for tokenomics. uint64 numberMinted; // Keeps track of burn count with minimal overhead for tokenomics. uint64 numberBurned; // For miscellaneous variable(s) pertaining to the address // (e.g. number of whitelist mint slots used). // If there are multiple variables, please pack them into a uint64. uint64 aux; } // The tokenId of the next token to be minted. uint256 internal _currentIndex; // The number of tokens burned. uint256 internal _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details. mapping(uint256 => TokenOwnership) internal _ownerships; // Mapping owner address to address data mapping(address => AddressData) private _addressData; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } /** * To change the starting tokenId, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev See {IERC721Enumerable-totalSupply}. * @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens. */ function totalSupply() public view returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than _currentIndex - _startTokenId() times unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view returns (uint256) { // Counter underflow is impossible as _currentIndex does not decrement, // and it is initialized to _startTokenId() unchecked { return _currentIndex - _startTokenId(); } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return uint256(_addressData[owner].balance); } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { if (owner == address(0)) revert MintedQueryForZeroAddress(); return uint256(_addressData[owner].numberMinted); } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { if (owner == address(0)) revert BurnedQueryForZeroAddress(); return uint256(_addressData[owner].numberBurned); } /** * Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { if (owner == address(0)) revert AuxQueryForZeroAddress(); return _addressData[owner].aux; } /** * Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal { if (owner == address(0)) revert AuxQueryForZeroAddress(); _addressData[owner].aux = aux; } /** * Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around in the collection over time. */ function ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr && curr < _currentIndex) { TokenOwnership memory ownership = _ownerships[curr]; if (!ownership.burned) { if (ownership.addr != address(0)) { return ownership; } // Invariant: // There will always be an ownership that has an address and is not burned // before an ownership that does not have an address and is not burned. // Hence, curr will not underflow. while (true) { curr--; ownership = _ownerships[curr]; if (ownership.addr != address(0)) { return ownership; } } } } } revert OwnerQueryForNonexistentToken(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return ownershipOf(tokenId).addr; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721FAT.ownerOf(tokenId); if (to == owner) revert ApprovalToCurrentOwner(); if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) { revert ApprovalCallerNotOwnerNorApproved(); } _approve(to, tokenId, owner); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { if (operator == _msgSender()) revert ApproveToCaller(); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { _transfer(from, to, tokenId); if (to.isContract() && !_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), */ function _exists(uint256 tokenId) internal view returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && !_ownerships[tokenId].burned; } function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ''); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { _mint(to, quantity, _data, true); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _mint( address to, uint256 quantity, bytes memory _data, bool safe ) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1 // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1 unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; uint256 end = updatedIndex + quantity; if (safe && to.isContract()) { do { emit Transfer(address(0), to, updatedIndex); if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (updatedIndex != end); // Reentrancy protection if (_currentIndex != startTokenId) revert(); } else { do { emit Transfer(address(0), to, updatedIndex++); } while (updatedIndex != end); } _currentIndex = updatedIndex; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal { TokenOwnership memory prevOwnership = ownershipOf(tokenId); bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr || isApprovedForAll(prevOwnership.addr, _msgSender()) || getApproved(tokenId) == _msgSender()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); if (prevOwnership.addr != from) revert TransferFromIncorrectOwner(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, prevOwnership.addr); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256. unchecked { _addressData[from].balance -= 1; _addressData[to].balance += 1; _ownerships[tokenId].addr = to; _ownerships[tokenId].startTimestamp = uint64(block.timestamp); // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; if (_ownerships[nextTokenId].addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId < _currentIndex) { _ownerships[nextTokenId].addr = prevOwnership.addr; _ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { TokenOwnership memory prevOwnership = ownershipOf(tokenId); _beforeTokenTransfers(prevOwnership.addr, address(0), tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, prevOwnership.addr); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256. unchecked { _addressData[prevOwnership.addr].balance -= 1; _addressData[prevOwnership.addr].numberBurned += 1; // Keep track of who burned the token, and the timestamp of burning. _ownerships[tokenId].addr = prevOwnership.addr; _ownerships[tokenId].startTimestamp = uint64(block.timestamp); _ownerships[tokenId].burned = true; // If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; if (_ownerships[nextTokenId].addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId < _currentIndex) { _ownerships[nextTokenId].addr = prevOwnership.addr; _ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(prevOwnership.addr, address(0), tokenId); _afterTokenTransfers(prevOwnership.addr, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve( address to, uint256 tokenId, address owner ) private { _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } /** * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. * And also called before burning one token. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes * minting. * And also called after one token has been burned. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /// @dev Returns the tokenIds of the address. O(totalSupply) in complexity. function tokensOfOwner(address owner) external view returns (uint256[] memory) { unchecked { uint256[] memory a = new uint256[](balanceOf(owner)); uint256 end = _currentIndex; uint256 tokenIdsIdx; address currOwnershipAddr; for (uint256 i; i < end; i++) { TokenOwnership memory ownership = _ownerships[i]; if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { a[tokenIdsIdx++] = i; } } return a; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.0; import "./IERC1155.sol"; import "./IERC1155Receiver.sol"; import "./extensions/IERC1155MetadataURI.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 * * _Available since v3.1._ */ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { using Address for address; // Mapping from token ID to account balances mapping(uint256 => mapping(address => uint256)) private _balances; // Mapping from account to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /** * @dev See {_setURI}. */ constructor(string memory uri_) { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256) public view virtual override returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require(account != address(0), "ERC1155: address zero is not a valid owner"); return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch"); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not token owner or approved" ); _safeTransferFrom(from, to, id, amount, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not token owner or approved" ); _safeBatchTransferFrom(from, to, ids, amounts, data); } /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, to, ids, amounts, data); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; emit TransferSingle(operator, from, to, id, amount); _afterTokenTransfer(operator, from, to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; } emit TransferBatch(operator, from, to, ids, amounts); _afterTokenTransfer(operator, from, to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); _balances[id][to] += amount; emit TransferSingle(operator, address(0), to, id, amount); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); for (uint256 i = 0; i < ids.length; i++) { _balances[ids[i]][to] += amounts[i]; } emit TransferBatch(operator, address(0), to, ids, amounts); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } /** * @dev Destroys `amount` tokens of token type `id` from `from` * * Emits a {TransferSingle} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `amount` tokens of token type `id`. */ function _burn( address from, uint256 id, uint256 amount ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } emit TransferSingle(operator, from, address(0), id, amount); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. */ function _burnBatch( address from, uint256[] memory ids, uint256[] memory amounts ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); for (uint256 i = 0; i < ids.length; i++) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } } emit TransferBatch(operator, from, address(0), ids, amounts); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC1155: setting approval status for self"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `ids` and `amounts` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} /** * @dev Hook that is called after any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non-ERC1155Receiver implementer"); } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non-ERC1155Receiver implementer"); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol) pragma solidity ^0.8.0; import "../IERC1155.sol"; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. * * _Available since v3.1._ */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; address constant CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS = 0x000000000000AAeB6D7670E522A718067333cd4E; address constant CANONICAL_CORI_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "./IOperatorFilterRegistry.sol"; import "./lib/Constants.sol"; /** * @title OperatorFilterer * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another * registrant's entries in the OperatorFilterRegistry. * @dev This smart contract is meant to be inherited by token contracts so they can use the following: * - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods. * - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods. * Please note that if your token contract does not provide an owner with EIP-173, it must provide * administration methods on the contract itself to interact with the registry otherwise the subscription * will be locked to the options set during construction. */ abstract contract OperatorFilterer { /// @dev Emitted when an operator is not allowed. error OperatorNotAllowed(address operator); IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY = IOperatorFilterRegistry(CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS); /// @dev The constructor that is called when the contract is being deployed. constructor(address subscriptionOrRegistrantToCopy, bool subscribe) { // If an inheriting token contract is deployed to a network without the registry deployed, the modifier // will not revert, but the contract will need to be registered with the registry once it is deployed in // order for the modifier to filter addresses. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { if (subscribe) { OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy); } else { if (subscriptionOrRegistrantToCopy != address(0)) { OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy); } else { OPERATOR_FILTER_REGISTRY.register(address(this)); } } } } /** * @dev A helper function to check if an operator is allowed. */ modifier onlyAllowedOperator(address from) virtual { // Allow spending tokens from addresses with balance // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred // from an EOA. if (from != msg.sender) { _checkFilterOperator(msg.sender); } _; } /** * @dev A helper function to check if an operator approval is allowed. */ modifier onlyAllowedOperatorApproval(address operator) virtual { _checkFilterOperator(operator); _; } /** * @dev A helper function to check if an operator is allowed. */ function _checkFilterOperator(address operator) internal view virtual { // Check registry code length to facilitate testing in environments without a deployed registry. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { // under normal circumstances, this function will revert rather than return false, but inheriting contracts // may specify their own OperatorFilterRegistry implementations, which may behave differently if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) { revert OperatorNotAllowed(operator); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IOperatorFilterRegistry { /** * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns * true if supplied registrant address is not registered. */ function isOperatorAllowed(address registrant, address operator) external view returns (bool); /** * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner. */ function register(address registrant) external; /** * @notice Registers an address with the registry and "subscribes" to another address's filtered operators and codeHashes. */ function registerAndSubscribe(address registrant, address subscription) external; /** * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another * address without subscribing. */ function registerAndCopyEntries(address registrant, address registrantToCopy) external; /** * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner. * Note that this does not remove any filtered addresses or codeHashes. * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes. */ function unregister(address addr) external; /** * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered. */ function updateOperator(address registrant, address operator, bool filtered) external; /** * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates. */ function updateOperators(address registrant, address[] calldata operators, bool filtered) external; /** * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered. */ function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external; /** * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates. */ function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external; /** * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous * subscription if present. * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case, * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be * used. */ function subscribe(address registrant, address registrantToSubscribe) external; /** * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes. */ function unsubscribe(address registrant, bool copyExistingEntries) external; /** * @notice Get the subscription address of a given registrant, if any. */ function subscriptionOf(address addr) external returns (address registrant); /** * @notice Get the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscribers(address registrant) external returns (address[] memory); /** * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscriberAt(address registrant, uint256 index) external returns (address); /** * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr. */ function copyEntriesOf(address registrant, address registrantToCopy) external; /** * @notice Returns true if operator is filtered by a given address or its subscription. */ function isOperatorFiltered(address registrant, address operator) external returns (bool); /** * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription. */ function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool); /** * @notice Returns true if a codeHash is filtered by a given address or its subscription. */ function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool); /** * @notice Returns a list of filtered operators for a given address or its subscription. */ function filteredOperators(address addr) external returns (address[] memory); /** * @notice Returns the set of filtered codeHashes for a given address or its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashes(address addr) external returns (bytes32[] memory); /** * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredOperatorAt(address registrant, uint256 index) external returns (address); /** * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32); /** * @notice Returns true if an address has registered */ function isRegistered(address addr) external returns (bool); /** * @dev Convenience method to compute the code hash of an arbitrary contract */ function codeHashOf(address addr) external returns (bytes32); }
{ "optimizer": { "enabled": true, "runs": 2000000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"drillContract","type":"address"},{"internalType":"address","name":"GenesisContract","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"Owner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"new_admin","type":"address"},{"internalType":"bool","name":"role","type":"bool"}],"name":"adminrole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"airdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenid","type":"uint256[]"}],"name":"batch_collect","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenid","type":"uint256[]"}],"name":"batch_deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenid","type":"uint256[]"}],"name":"batch_withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"blockReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"calculateReward","outputs":[{"internalType":"uint256","name":"rewards","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"collect","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"Staker","type":"address"}],"name":"drill_in_Wallet","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"isInjected","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"item","outputs":[{"internalType":"contract TyraniteDrill","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxreward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxreward2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"address_list","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"multisender","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nft","outputs":[{"internalType":"contract TyranzGenesis","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"Staker","type":"address"}],"name":"nft_id_in_Staking","outputs":[{"components":[{"internalType":"uint256","name":"ids","type":"uint256"}],"internalType":"struct Tyranite.token_ids[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"Staker","type":"address"}],"name":"nft_id_in_Wallet","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"nft_isDelegated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"nft_tokenclaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"new_maxrw","type":"uint256"},{"internalType":"uint256","name":"new_maxrw2","type":"uint256"}],"name":"set_maxRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"new_blockReward","type":"uint256"}],"name":"update_blockReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenid","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405266027ca57357c000600c556a322a067c286fca2d780000600d556903dd55a0a35b1ee80000600e556905cc0070f508ae5c0000600f553480156200004757600080fd5b50604051620032be380380620032be8339810160408190526200006a9162000133565b60405180604001604052806008815260200167547972616e69746560c01b8152506040518060400160405280600381526020016215139560ea1b8152508160039081620000b8919062000210565b506004620000c7828262000210565b5050336000908152600960205260409020805460ff1916600117905550600b80546001600160a01b039384166001600160a01b031991821617909155600a8054929093169116179055620002dc565b80516001600160a01b03811681146200012e57600080fd5b919050565b600080604083850312156200014757600080fd5b620001528362000116565b9150620001626020840162000116565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200019657607f821691505b602082108103620001b757634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200020b57600081815260208120601f850160051c81016020861015620001e65750805b601f850160051c820191505b818110156200020757828155600101620001f2565b5050505b505050565b81516001600160401b038111156200022c576200022c6200016b565b62000244816200023d845462000181565b84620001bd565b602080601f8311600181146200027c5760008415620002635750858301515b600019600386901b1c1916600185901b17855562000207565b600085815260208120601f198616915b82811015620002ad578886015182559484019460019091019084016200028c565b5085821015620002cc5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b612fd280620002ec6000396000f3fe608060405234801561001057600080fd5b506004361061025c5760003560e01c8063992b750811610145578063bc02e238116100bd578063d2d7231f1161008c578063dd62ed3e11610071578063dd62ed3e14610564578063f2a4a82e146105aa578063ff1f8631146105ca57600080fd5b8063d2d7231f14610548578063d5abeb011461055b57600080fd5b8063bc02e238146104d4578063c8be9616146104e7578063ce3f865f14610507578063cecf49481461051a57600080fd5b8063a5e220c211610114578063abb37956116100f9578063abb379561461049b578063b1d7d42e146104ae578063b6b55f25146104c157600080fd5b8063a5e220c214610465578063a9059cbb1461048857600080fd5b8063992b7508146104165780639d46c1ce1461041f5780639ef7789c1461043f578063a457c2d71461045257600080fd5b806339509351116101d85780636d50cd52116101a757806387c985071161018c57806387c98507146103db5780638ba4cc3c146103fb57806395d89b411461040e57600080fd5b80636d50cd521461039257806370a08231146103a557600080fd5b806339509351146103145780633a9445c81461032757806347ccca021461033a578063531641301461037f57600080fd5b806318160ddd1161022f57806323b872dd1161021457806323b872dd146102df5780632e1a7d4d146102f2578063313ce5671461030557600080fd5b806318160ddd146102ce5780631f6ff847146102d657600080fd5b806306fdde0314610261578063095ea7b31461027f5780630ac168a1146102a25780630d184b7f146102b9575b600080fd5b6102696105dd565b6040516102769190612950565b60405180910390f35b61029261028d3660046129e5565b61066f565b6040519015158152602001610276565b6102ab600c5481565b604051908152602001610276565b6102cc6102c7366004612a20565b610689565b005b6002546102ab565b6102ab600e5481565b6102926102ed366004612a57565b610762565b6102cc610300366004612a93565b610786565b60405160128152602001610276565b6102926103223660046129e5565b610a86565b610292610335366004612a93565b610ad2565b600a5461035a9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610276565b6102cc61038d366004612bb9565b610b66565b6102cc6103a0366004612c79565b610c43565b6102ab6103b3366004612c9b565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6103ee6103e9366004612c9b565b610ccc565b6040516102769190612cbd565b6102cc6104093660046129e5565b610d4d565b610269610dd9565b6102ab600f5481565b61043261042d366004612c9b565b610de8565b6040516102769190612d02565b6102cc61044d366004612d3a565b610e9f565b6102926104603660046129e5565b6111e8565b610292610473366004612c9b565b60096020526000908152604090205460ff1681565b6102926104963660046129e5565b6112b9565b6102ab6104a9366004612c9b565b6112c7565b6102cc6104bc366004612d3a565b611361565b6102cc6104cf366004612a93565b6117c5565b6102cc6104e2366004612d3a565b611bf5565b6102ab6104f5366004612a93565b60009081526008602052604090205490565b6102cc610515366004612a93565b611d29565b610292610528366004612a93565b336000908152600760209081526040808320938352929052205460ff1690565b6102ab610556366004612a93565b611e11565b6102ab600d5481565b6102ab610572366004612d77565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b600b5461035a9073ffffffffffffffffffffffffffffffffffffffff1681565b6102cc6105d8366004612a93565b6122e7565b6060600380546105ec90612daa565b80601f016020809104026020016040519081016040528092919081815260200182805461061890612daa565b80156106655780601f1061063a57610100808354040283529160200191610665565b820191906000526020600020905b81548152906001019060200180831161064857829003601f168201915b5050505050905090565b60003361067d81858561236a565b60019150505b92915050565b3360009081526009602052604090205460ff16151560011461070c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f537461666620557365204f6e6c7900000000000000000000000000000000000060448201526064015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260096020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60003361077085828561251d565b61077b8585856125ee565b506001949350505050565b33600081815260076020908152604080832085845290915281205460ff161515900361080e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f496e76616c696420546f6b656e204964000000000000000000000000000000006044820152606401610703565b61081782611d29565b600a546040517f23b872dd00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015260448201859052909116906323b872dd90606401600060405180830381600087803b15801561089157600080fd5b505af11580156108a5573d6000803e3d6000fd5b50505073ffffffffffffffffffffffffffffffffffffffff82166000818152600760209081526040808320878452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055928252600690529081205491505b81811015610a805773ffffffffffffffffffffffffffffffffffffffff8316600090815260066020526040902080548290811061094b5761094b612dfd565b90600052602060002001600001548403610a785773ffffffffffffffffffffffffffffffffffffffff8316600090815260066020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84019081106109b8576109b8612dfd565b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff86168352600690915260409091208054839081106109fb576109fb612dfd565b600091825260208083209091019290925573ffffffffffffffffffffffffffffffffffffffff85168152600690915260409020805480610a3d57610a3d612e2c565b60008281526020812082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810191909155019055610a80565b60010161090c565b50505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061067d9082908690610acd908790612e8a565b61236a565b600a546040517fcefeac250000000000000000000000000000000000000000000000000000000081526004810183905260009173ffffffffffffffffffffffffffffffffffffffff169063cefeac2590602401602060405180830381865afa158015610b42573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106839190612e9d565b3360009081526009602052604090205460ff161515600114610be4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f537461666620557365204f6e6c790000000000000000000000000000000000006044820152606401610703565b60005b8251811015610c3e57610c2c838281518110610c0557610c05612dfd565b6020026020010151838381518110610c1f57610c1f612dfd565b602002602001015161285d565b80610c3681612eba565b915050610be7565b505050565b3360009081526009602052604090205460ff161515600114610cc1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f537461666620557365204f6e6c790000000000000000000000000000000000006044820152606401610703565b600e91909155600f55565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600660209081526040808320805482518185028101850190935280835260609492939192909184015b82821015610d4257600084815260209081902060408051808401909152908401548152825260019092019101610d11565b505050509050919050565b3360009081526009602052604090205460ff161515600114610dcb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f537461666620557365204f6e6c790000000000000000000000000000000000006044820152606401610703565b610dd5828261285d565b5050565b6060600480546105ec90612daa565b600a546040517f8462151c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301526060921690638462151c90602401600060405180830381865afa158015610e59573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526106839190810190612ef2565b3360005b8251811015610c3e576000838281518110610ec057610ec0612dfd565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff851660009081526007835260408082208383529093529182205490925060ff1615159003610f6b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f496e76616c696420546f6b656e204964000000000000000000000000000000006044820152606401610703565b610f7481611d29565b600a546040517f23b872dd00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff858116602483015260448201849052909116906323b872dd90606401600060405180830381600087803b158015610fee57600080fd5b505af1158015611002573d6000803e3d6000fd5b50505073ffffffffffffffffffffffffffffffffffffffff84166000818152600760209081526040808320868452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055928252600690529081205491505b818110156111dd5773ffffffffffffffffffffffffffffffffffffffff851660009081526006602052604090208054829081106110a8576110a8612dfd565b906000526020600020016000015483036111d55773ffffffffffffffffffffffffffffffffffffffff8516600090815260066020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff840190811061111557611115612dfd565b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff881683526006909152604090912080548390811061115857611158612dfd565b600091825260208083209091019290925573ffffffffffffffffffffffffffffffffffffffff8716815260069091526040902080548061119a5761119a612e2c565b60008281526020812082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff908101919091550190556111dd565b600101611069565b505050600101610ea3565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152812054909190838110156112ac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610703565b61077b828686840361236a565b60003361067d8185856125ee565b600b546040517efdd58e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff838116600483015260016024830152600092169062fdd58e90604401602060405180830381865afa15801561133d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106839190612f83565b600d54339061136f60025490565b106113d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4d617820537570706c79205265616368656400000000000000000000000000006044820152606401610703565b60005b8251811015610c3e5760008382815181106113f6576113f6612dfd565b6020908102919091010151600a546040517feeffbe4e0000000000000000000000000000000000000000000000000000000081526004810183905291925073ffffffffffffffffffffffffffffffffffffffff169063eeffbe4e90602401602060405180830381865afa158015611471573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114959190612e9d565b151560010361161a57600a546040517ff7fc70380000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff9091169063f7fc703890602401602060405180830381865afa15801561150d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115319190612e9d565b151560000361159c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5072696d616c206e6f742052657665616c6564000000000000000000000000006044820152606401610703565b600f5460008281526008602052604090205410611615576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4d617820526577617264205265616368656400000000000000000000000000006044820152606401610703565b611693565b600e5460008281526008602052604090205410611693576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4d617820526577617264205265616368656400000000000000000000000000006044820152606401610703565b600a546040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015230602483015260448201849052909116906323b872dd90606401600060405180830381600087803b15801561170d57600080fd5b505af1158015611721573d6000803e3d6000fd5b50505073ffffffffffffffffffffffffffffffffffffffff84166000818152600560209081526040808320868452825280832043905583835260078252808320868452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155938352600682528083208151808401909252958152855480850187559583529120905193019290925550016113d9565b600d5433906117d360025490565b1061183a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4d617820537570706c79205265616368656400000000000000000000000000006044820152606401610703565b600a546040517feeffbe4e0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff9091169063eeffbe4e90602401602060405180830381865afa1580156118a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118cd9190612e9d565b1515600103611a5257600a546040517ff7fc70380000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff9091169063f7fc703890602401602060405180830381865afa158015611945573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119699190612e9d565b15156000036119d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5072696d616c206e6f742052657665616c6564000000000000000000000000006044820152606401610703565b600f5460008381526008602052604090205410611a4d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4d617820526577617264205265616368656400000000000000000000000000006044820152606401610703565b611acb565b600e5460008381526008602052604090205410611acb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4d617820526577617264205265616368656400000000000000000000000000006044820152606401610703565b600a546040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff838116600483015230602483015260448201859052909116906323b872dd90606401600060405180830381600087803b158015611b4557600080fd5b505af1158015611b59573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff166000818152600560209081526040808320858452825280832043905583835260078252808320858452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081179091559383526006825280832081518084019092529481528454938401855593825290209151910155565b3360005b8251811015610c3e576000838281518110611c1657611c16612dfd565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff85166000908152600783526040808220838352909352919091205490915060ff161515600114611cc3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f20546f6b656e7320746f20576974686461727700000000000000000000006044820152606401610703565b6000611cce82611e11565b60008381526008602052604090208054820190559050611cee848261285d565b5073ffffffffffffffffffffffffffffffffffffffff8316600090815260056020908152604080832093835292905220439055600101611bf9565b33600081815260076020908152604080832085845290915290205460ff161515600114611db2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f20546f6b656e7320746f20576974686461727700000000000000000000006044820152606401610703565b6000611dbd83611e11565b60008481526008602052604090208054820190559050611ddd828261285d565b5073ffffffffffffffffffffffffffffffffffffffff16600090815260056020908152604080832093835292905220439055565b33600081815260076020908152604080832085845290915281205490919060ff161580611e425750600d5460025410155b15611e505750600092915050565b600b546040517efdd58e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff838116600483015260016024830152600092169062fdd58e90604401602060405180830381865afa158015611ec6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eea9190612f83565b600c5473ffffffffffffffffffffffffffffffffffffffff84811660009081526005602090815260408083208a845282528083205460089092529182902054600a5492517fcefeac25000000000000000000000000000000000000000000000000000000008152600481018b90529596504391909103909302936903dd55a0a35b1ee8000092919091169063cefeac2590602401602060405180830381865afa158015611f9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fbf9190612e9d565b151560010361209857808210611fdc575060009695505050505050565b83600003612007578082846002020110611ffa570395945050505050565b5050600202949350505050565b8360010361203d57808284806004810401010110612029570395945050505050565b82806004815b040101979650505050505050565b836002036120695780828480600281040101011061205f570395945050505050565b828060028161202f565b600384106120985780828485600202010110612089570395945050505050565b50506002810201949350505050565b600a546040517ff7fc70380000000000000000000000000000000000000000000000000000000081526004810189905273ffffffffffffffffffffffffffffffffffffffff9091169063f7fc703890602401602060405180830381865afa158015612107573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061212b9190612e9d565b15156000036121ec57808210612148575060009695505050505050565b8360000361216e578082840110612163570395945050505050565b509095945050505050565b836001036121a0578082846004810401011061218e570395945050505050565b826004815b0401979650505050505050565b836002036121c957808284600281040101106121c0570395945050505050565b82600281612193565b600384106121e7578082846002020110611ffa570395945050505050565b6122dd565b6905cc0070f508ae5c000080831061220c57506000979650505050505050565b8460000361223c57808385600202011061222e57919091039695505050505050565b505050600202949350505050565b846001036122775780838580600481040101011061226257919091039695505050505050565b83806004815b04010198975050505050505050565b846002036122a75780838580600281040101011061229d57919091039695505050505050565b8380600281612268565b600385106122db57808385866002020101106122cb57919091039695505050505050565b5050506002810201949350505050565b505b5050505050919050565b3360009081526009602052604090205460ff161515600114612365576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f537461666620557365204f6e6c790000000000000000000000000000000000006044820152606401610703565b600c55565b73ffffffffffffffffffffffffffffffffffffffff831661240c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610703565b73ffffffffffffffffffffffffffffffffffffffff82166124af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610703565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610a8057818110156125e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610703565b610a80848484840361236a565b73ffffffffffffffffffffffffffffffffffffffff8316612691576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610703565b73ffffffffffffffffffffffffffffffffffffffff8216612734576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610703565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054818110156127ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610703565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610a80565b73ffffffffffffffffffffffffffffffffffffffff82166128da576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610703565b80600260008282546128ec9190612e8a565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600060208083528351808285015260005b8181101561297d57858101830151858201604001528201612961565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146129e057600080fd5b919050565b600080604083850312156129f857600080fd5b612a01836129bc565b946020939093013593505050565b8015158114612a1d57600080fd5b50565b60008060408385031215612a3357600080fd5b612a3c836129bc565b91506020830135612a4c81612a0f565b809150509250929050565b600080600060608486031215612a6c57600080fd5b612a75846129bc565b9250612a83602085016129bc565b9150604084013590509250925092565b600060208284031215612aa557600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612b2257612b22612aac565b604052919050565b600067ffffffffffffffff821115612b4457612b44612aac565b5060051b60200190565b600082601f830112612b5f57600080fd5b81356020612b74612b6f83612b2a565b612adb565b82815260059290921b84018101918181019086841115612b9357600080fd5b8286015b84811015612bae5780358352918301918301612b97565b509695505050505050565b60008060408385031215612bcc57600080fd5b823567ffffffffffffffff80821115612be457600080fd5b818501915085601f830112612bf857600080fd5b81356020612c08612b6f83612b2a565b82815260059290921b84018101918181019089841115612c2757600080fd5b948201945b83861015612c4c57612c3d866129bc565b82529482019490820190612c2c565b96505086013592505080821115612c6257600080fd5b50612c6f85828601612b4e565b9150509250929050565b60008060408385031215612c8c57600080fd5b50508035926020909101359150565b600060208284031215612cad57600080fd5b612cb6826129bc565b9392505050565b6020808252825182820181905260009190848201906040850190845b81811015612cf65783515183529284019291840191600101612cd9565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015612cf657835183529284019291840191600101612d1e565b600060208284031215612d4c57600080fd5b813567ffffffffffffffff811115612d6357600080fd5b612d6f84828501612b4e565b949350505050565b60008060408385031215612d8a57600080fd5b612d93836129bc565b9150612da1602084016129bc565b90509250929050565b600181811c90821680612dbe57607f821691505b602082108103612df7577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561068357610683612e5b565b600060208284031215612eaf57600080fd5b8151612cb681612a0f565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612eeb57612eeb612e5b565b5060010190565b60006020808385031215612f0557600080fd5b825167ffffffffffffffff811115612f1c57600080fd5b8301601f81018513612f2d57600080fd5b8051612f3b612b6f82612b2a565b81815260059190911b82018301908381019087831115612f5a57600080fd5b928401925b82841015612f7857835182529284019290840190612f5f565b979650505050505050565b600060208284031215612f9557600080fd5b505191905056fea26469706673582212202cfb60782bb6368e29cd97251838f45b9dcd1492e5ed476fc7bfc1f6aebf15b964736f6c634300081300330000000000000000000000009d2d194a33a976c654df31c65fc6c870fefb4d8d0000000000000000000000007c9077bdc7598ea2baa372de588ed3c7ff4a657d
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061025c5760003560e01c8063992b750811610145578063bc02e238116100bd578063d2d7231f1161008c578063dd62ed3e11610071578063dd62ed3e14610564578063f2a4a82e146105aa578063ff1f8631146105ca57600080fd5b8063d2d7231f14610548578063d5abeb011461055b57600080fd5b8063bc02e238146104d4578063c8be9616146104e7578063ce3f865f14610507578063cecf49481461051a57600080fd5b8063a5e220c211610114578063abb37956116100f9578063abb379561461049b578063b1d7d42e146104ae578063b6b55f25146104c157600080fd5b8063a5e220c214610465578063a9059cbb1461048857600080fd5b8063992b7508146104165780639d46c1ce1461041f5780639ef7789c1461043f578063a457c2d71461045257600080fd5b806339509351116101d85780636d50cd52116101a757806387c985071161018c57806387c98507146103db5780638ba4cc3c146103fb57806395d89b411461040e57600080fd5b80636d50cd521461039257806370a08231146103a557600080fd5b806339509351146103145780633a9445c81461032757806347ccca021461033a578063531641301461037f57600080fd5b806318160ddd1161022f57806323b872dd1161021457806323b872dd146102df5780632e1a7d4d146102f2578063313ce5671461030557600080fd5b806318160ddd146102ce5780631f6ff847146102d657600080fd5b806306fdde0314610261578063095ea7b31461027f5780630ac168a1146102a25780630d184b7f146102b9575b600080fd5b6102696105dd565b6040516102769190612950565b60405180910390f35b61029261028d3660046129e5565b61066f565b6040519015158152602001610276565b6102ab600c5481565b604051908152602001610276565b6102cc6102c7366004612a20565b610689565b005b6002546102ab565b6102ab600e5481565b6102926102ed366004612a57565b610762565b6102cc610300366004612a93565b610786565b60405160128152602001610276565b6102926103223660046129e5565b610a86565b610292610335366004612a93565b610ad2565b600a5461035a9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610276565b6102cc61038d366004612bb9565b610b66565b6102cc6103a0366004612c79565b610c43565b6102ab6103b3366004612c9b565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6103ee6103e9366004612c9b565b610ccc565b6040516102769190612cbd565b6102cc6104093660046129e5565b610d4d565b610269610dd9565b6102ab600f5481565b61043261042d366004612c9b565b610de8565b6040516102769190612d02565b6102cc61044d366004612d3a565b610e9f565b6102926104603660046129e5565b6111e8565b610292610473366004612c9b565b60096020526000908152604090205460ff1681565b6102926104963660046129e5565b6112b9565b6102ab6104a9366004612c9b565b6112c7565b6102cc6104bc366004612d3a565b611361565b6102cc6104cf366004612a93565b6117c5565b6102cc6104e2366004612d3a565b611bf5565b6102ab6104f5366004612a93565b60009081526008602052604090205490565b6102cc610515366004612a93565b611d29565b610292610528366004612a93565b336000908152600760209081526040808320938352929052205460ff1690565b6102ab610556366004612a93565b611e11565b6102ab600d5481565b6102ab610572366004612d77565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b600b5461035a9073ffffffffffffffffffffffffffffffffffffffff1681565b6102cc6105d8366004612a93565b6122e7565b6060600380546105ec90612daa565b80601f016020809104026020016040519081016040528092919081815260200182805461061890612daa565b80156106655780601f1061063a57610100808354040283529160200191610665565b820191906000526020600020905b81548152906001019060200180831161064857829003601f168201915b5050505050905090565b60003361067d81858561236a565b60019150505b92915050565b3360009081526009602052604090205460ff16151560011461070c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f537461666620557365204f6e6c7900000000000000000000000000000000000060448201526064015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260096020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60003361077085828561251d565b61077b8585856125ee565b506001949350505050565b33600081815260076020908152604080832085845290915281205460ff161515900361080e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f496e76616c696420546f6b656e204964000000000000000000000000000000006044820152606401610703565b61081782611d29565b600a546040517f23b872dd00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015260448201859052909116906323b872dd90606401600060405180830381600087803b15801561089157600080fd5b505af11580156108a5573d6000803e3d6000fd5b50505073ffffffffffffffffffffffffffffffffffffffff82166000818152600760209081526040808320878452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055928252600690529081205491505b81811015610a805773ffffffffffffffffffffffffffffffffffffffff8316600090815260066020526040902080548290811061094b5761094b612dfd565b90600052602060002001600001548403610a785773ffffffffffffffffffffffffffffffffffffffff8316600090815260066020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84019081106109b8576109b8612dfd565b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff86168352600690915260409091208054839081106109fb576109fb612dfd565b600091825260208083209091019290925573ffffffffffffffffffffffffffffffffffffffff85168152600690915260409020805480610a3d57610a3d612e2c565b60008281526020812082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810191909155019055610a80565b60010161090c565b50505050565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919061067d9082908690610acd908790612e8a565b61236a565b600a546040517fcefeac250000000000000000000000000000000000000000000000000000000081526004810183905260009173ffffffffffffffffffffffffffffffffffffffff169063cefeac2590602401602060405180830381865afa158015610b42573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106839190612e9d565b3360009081526009602052604090205460ff161515600114610be4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f537461666620557365204f6e6c790000000000000000000000000000000000006044820152606401610703565b60005b8251811015610c3e57610c2c838281518110610c0557610c05612dfd565b6020026020010151838381518110610c1f57610c1f612dfd565b602002602001015161285d565b80610c3681612eba565b915050610be7565b505050565b3360009081526009602052604090205460ff161515600114610cc1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f537461666620557365204f6e6c790000000000000000000000000000000000006044820152606401610703565b600e91909155600f55565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600660209081526040808320805482518185028101850190935280835260609492939192909184015b82821015610d4257600084815260209081902060408051808401909152908401548152825260019092019101610d11565b505050509050919050565b3360009081526009602052604090205460ff161515600114610dcb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f537461666620557365204f6e6c790000000000000000000000000000000000006044820152606401610703565b610dd5828261285d565b5050565b6060600480546105ec90612daa565b600a546040517f8462151c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83811660048301526060921690638462151c90602401600060405180830381865afa158015610e59573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526106839190810190612ef2565b3360005b8251811015610c3e576000838281518110610ec057610ec0612dfd565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff851660009081526007835260408082208383529093529182205490925060ff1615159003610f6b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f496e76616c696420546f6b656e204964000000000000000000000000000000006044820152606401610703565b610f7481611d29565b600a546040517f23b872dd00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff858116602483015260448201849052909116906323b872dd90606401600060405180830381600087803b158015610fee57600080fd5b505af1158015611002573d6000803e3d6000fd5b50505073ffffffffffffffffffffffffffffffffffffffff84166000818152600760209081526040808320868452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055928252600690529081205491505b818110156111dd5773ffffffffffffffffffffffffffffffffffffffff851660009081526006602052604090208054829081106110a8576110a8612dfd565b906000526020600020016000015483036111d55773ffffffffffffffffffffffffffffffffffffffff8516600090815260066020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff840190811061111557611115612dfd565b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff881683526006909152604090912080548390811061115857611158612dfd565b600091825260208083209091019290925573ffffffffffffffffffffffffffffffffffffffff8716815260069091526040902080548061119a5761119a612e2c565b60008281526020812082017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff908101919091550190556111dd565b600101611069565b505050600101610ea3565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152812054909190838110156112ac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610703565b61077b828686840361236a565b60003361067d8185856125ee565b600b546040517efdd58e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff838116600483015260016024830152600092169062fdd58e90604401602060405180830381865afa15801561133d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106839190612f83565b600d54339061136f60025490565b106113d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4d617820537570706c79205265616368656400000000000000000000000000006044820152606401610703565b60005b8251811015610c3e5760008382815181106113f6576113f6612dfd565b6020908102919091010151600a546040517feeffbe4e0000000000000000000000000000000000000000000000000000000081526004810183905291925073ffffffffffffffffffffffffffffffffffffffff169063eeffbe4e90602401602060405180830381865afa158015611471573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114959190612e9d565b151560010361161a57600a546040517ff7fc70380000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff9091169063f7fc703890602401602060405180830381865afa15801561150d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115319190612e9d565b151560000361159c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5072696d616c206e6f742052657665616c6564000000000000000000000000006044820152606401610703565b600f5460008281526008602052604090205410611615576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4d617820526577617264205265616368656400000000000000000000000000006044820152606401610703565b611693565b600e5460008281526008602052604090205410611693576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4d617820526577617264205265616368656400000000000000000000000000006044820152606401610703565b600a546040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015230602483015260448201849052909116906323b872dd90606401600060405180830381600087803b15801561170d57600080fd5b505af1158015611721573d6000803e3d6000fd5b50505073ffffffffffffffffffffffffffffffffffffffff84166000818152600560209081526040808320868452825280832043905583835260078252808320868452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155938352600682528083208151808401909252958152855480850187559583529120905193019290925550016113d9565b600d5433906117d360025490565b1061183a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4d617820537570706c79205265616368656400000000000000000000000000006044820152606401610703565b600a546040517feeffbe4e0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff9091169063eeffbe4e90602401602060405180830381865afa1580156118a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118cd9190612e9d565b1515600103611a5257600a546040517ff7fc70380000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff9091169063f7fc703890602401602060405180830381865afa158015611945573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119699190612e9d565b15156000036119d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5072696d616c206e6f742052657665616c6564000000000000000000000000006044820152606401610703565b600f5460008381526008602052604090205410611a4d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4d617820526577617264205265616368656400000000000000000000000000006044820152606401610703565b611acb565b600e5460008381526008602052604090205410611acb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4d617820526577617264205265616368656400000000000000000000000000006044820152606401610703565b600a546040517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff838116600483015230602483015260448201859052909116906323b872dd90606401600060405180830381600087803b158015611b4557600080fd5b505af1158015611b59573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff166000818152600560209081526040808320858452825280832043905583835260078252808320858452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081179091559383526006825280832081518084019092529481528454938401855593825290209151910155565b3360005b8251811015610c3e576000838281518110611c1657611c16612dfd565b60209081029190910181015173ffffffffffffffffffffffffffffffffffffffff85166000908152600783526040808220838352909352919091205490915060ff161515600114611cc3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f20546f6b656e7320746f20576974686461727700000000000000000000006044820152606401610703565b6000611cce82611e11565b60008381526008602052604090208054820190559050611cee848261285d565b5073ffffffffffffffffffffffffffffffffffffffff8316600090815260056020908152604080832093835292905220439055600101611bf9565b33600081815260076020908152604080832085845290915290205460ff161515600114611db2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4e6f20546f6b656e7320746f20576974686461727700000000000000000000006044820152606401610703565b6000611dbd83611e11565b60008481526008602052604090208054820190559050611ddd828261285d565b5073ffffffffffffffffffffffffffffffffffffffff16600090815260056020908152604080832093835292905220439055565b33600081815260076020908152604080832085845290915281205490919060ff161580611e425750600d5460025410155b15611e505750600092915050565b600b546040517efdd58e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff838116600483015260016024830152600092169062fdd58e90604401602060405180830381865afa158015611ec6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eea9190612f83565b600c5473ffffffffffffffffffffffffffffffffffffffff84811660009081526005602090815260408083208a845282528083205460089092529182902054600a5492517fcefeac25000000000000000000000000000000000000000000000000000000008152600481018b90529596504391909103909302936903dd55a0a35b1ee8000092919091169063cefeac2590602401602060405180830381865afa158015611f9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fbf9190612e9d565b151560010361209857808210611fdc575060009695505050505050565b83600003612007578082846002020110611ffa570395945050505050565b5050600202949350505050565b8360010361203d57808284806004810401010110612029570395945050505050565b82806004815b040101979650505050505050565b836002036120695780828480600281040101011061205f570395945050505050565b828060028161202f565b600384106120985780828485600202010110612089570395945050505050565b50506002810201949350505050565b600a546040517ff7fc70380000000000000000000000000000000000000000000000000000000081526004810189905273ffffffffffffffffffffffffffffffffffffffff9091169063f7fc703890602401602060405180830381865afa158015612107573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061212b9190612e9d565b15156000036121ec57808210612148575060009695505050505050565b8360000361216e578082840110612163570395945050505050565b509095945050505050565b836001036121a0578082846004810401011061218e570395945050505050565b826004815b0401979650505050505050565b836002036121c957808284600281040101106121c0570395945050505050565b82600281612193565b600384106121e7578082846002020110611ffa570395945050505050565b6122dd565b6905cc0070f508ae5c000080831061220c57506000979650505050505050565b8460000361223c57808385600202011061222e57919091039695505050505050565b505050600202949350505050565b846001036122775780838580600481040101011061226257919091039695505050505050565b83806004815b04010198975050505050505050565b846002036122a75780838580600281040101011061229d57919091039695505050505050565b8380600281612268565b600385106122db57808385866002020101106122cb57919091039695505050505050565b5050506002810201949350505050565b505b5050505050919050565b3360009081526009602052604090205460ff161515600114612365576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f537461666620557365204f6e6c790000000000000000000000000000000000006044820152606401610703565b600c55565b73ffffffffffffffffffffffffffffffffffffffff831661240c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610703565b73ffffffffffffffffffffffffffffffffffffffff82166124af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610703565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610a8057818110156125e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610703565b610a80848484840361236a565b73ffffffffffffffffffffffffffffffffffffffff8316612691576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610703565b73ffffffffffffffffffffffffffffffffffffffff8216612734576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610703565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054818110156127ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610703565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610a80565b73ffffffffffffffffffffffffffffffffffffffff82166128da576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610703565b80600260008282546128ec9190612e8a565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b600060208083528351808285015260005b8181101561297d57858101830151858201604001528201612961565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146129e057600080fd5b919050565b600080604083850312156129f857600080fd5b612a01836129bc565b946020939093013593505050565b8015158114612a1d57600080fd5b50565b60008060408385031215612a3357600080fd5b612a3c836129bc565b91506020830135612a4c81612a0f565b809150509250929050565b600080600060608486031215612a6c57600080fd5b612a75846129bc565b9250612a83602085016129bc565b9150604084013590509250925092565b600060208284031215612aa557600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612b2257612b22612aac565b604052919050565b600067ffffffffffffffff821115612b4457612b44612aac565b5060051b60200190565b600082601f830112612b5f57600080fd5b81356020612b74612b6f83612b2a565b612adb565b82815260059290921b84018101918181019086841115612b9357600080fd5b8286015b84811015612bae5780358352918301918301612b97565b509695505050505050565b60008060408385031215612bcc57600080fd5b823567ffffffffffffffff80821115612be457600080fd5b818501915085601f830112612bf857600080fd5b81356020612c08612b6f83612b2a565b82815260059290921b84018101918181019089841115612c2757600080fd5b948201945b83861015612c4c57612c3d866129bc565b82529482019490820190612c2c565b96505086013592505080821115612c6257600080fd5b50612c6f85828601612b4e565b9150509250929050565b60008060408385031215612c8c57600080fd5b50508035926020909101359150565b600060208284031215612cad57600080fd5b612cb6826129bc565b9392505050565b6020808252825182820181905260009190848201906040850190845b81811015612cf65783515183529284019291840191600101612cd9565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015612cf657835183529284019291840191600101612d1e565b600060208284031215612d4c57600080fd5b813567ffffffffffffffff811115612d6357600080fd5b612d6f84828501612b4e565b949350505050565b60008060408385031215612d8a57600080fd5b612d93836129bc565b9150612da1602084016129bc565b90509250929050565b600181811c90821680612dbe57607f821691505b602082108103612df7577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561068357610683612e5b565b600060208284031215612eaf57600080fd5b8151612cb681612a0f565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612eeb57612eeb612e5b565b5060010190565b60006020808385031215612f0557600080fd5b825167ffffffffffffffff811115612f1c57600080fd5b8301601f81018513612f2d57600080fd5b8051612f3b612b6f82612b2a565b81815260059190911b82018301908381019087831115612f5a57600080fd5b928401925b82841015612f7857835182529284019290840190612f5f565b979650505050505050565b600060208284031215612f9557600080fd5b505191905056fea26469706673582212202cfb60782bb6368e29cd97251838f45b9dcd1492e5ed476fc7bfc1f6aebf15b964736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000009d2d194a33a976c654df31c65fc6c870fefb4d8d0000000000000000000000007c9077bdc7598ea2baa372de588ed3c7ff4a657d
-----Decoded View---------------
Arg [0] : drillContract (address): 0x9d2D194A33A976c654Df31C65fc6C870FeFb4D8D
Arg [1] : GenesisContract (address): 0x7C9077bDC7598ea2BaA372dE588Ed3C7FF4a657D
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000009d2d194a33a976c654df31c65fc6c870fefb4d8d
Arg [1] : 0000000000000000000000007c9077bdc7598ea2baa372de588ed3c7ff4a657d
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.