Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0xA222768E78E83DC085531aEF204d6e7a7033bC0e
Balance 0 ETH
Nonce 1
Code Size 13417 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

13417 bytes
0x6080604052600436106101d75760003560e01c80636b20c45411610102578063af933b5711610095578063e985e9c511610064578063e985e9c5146105ab578063f242432a146105f4578063f2fde38b14610614578063f5298aca1461063457600080fd5b8063af933b5714610507578063bd85b03914610527578063bf0c8c1614610554578063bf3952d71461057457600080fd5b80638da5cb5b116100d15780638da5cb5b1461048a57806395d89b41146104b2578063a22cb465146104c7578063a8f6d746146104e757600080fd5b80636b20c454146103f9578063715018a6146104195780638456cb591461042e5780638d1c0ce91461044357600080fd5b80632c218df91161017a5780634506c46a116101495780634506c46a146103725780634e1273f4146103855780634f558e79146103b25780635c975abb146103e157600080fd5b80632c218df9146102d65780632eb2c2d6146102f65780633f4ba83a14610316578063412556d81461032b57600080fd5b806306fdde03116101b657806306fdde031461026157806308ab2e261461028357806309686f84146102a35780630e89341c146102b657600080fd5b8062fdd58e146101dc57806301ffc9a71461020f57806302fe53051461023f575b600080fd5b3480156101e857600080fd5b506101fc6101f736600461295d565b610654565b6040519081526020015b60405180910390f35b34801561021b57600080fd5b5061022f61022a366004612b8e565b6106eb565b6040519015158152602001610206565b34801561024b57600080fd5b5061025f61025a366004612bc6565b61073d565b005b34801561026d57600080fd5b50610276610773565b6040516102069190612f5e565b34801561028f57600080fd5b5061025f61029e366004612a88565b610805565b61025f6102b1366004612c7f565b6108b3565b3480156102c257600080fd5b506102766102d1366004612c00565b610ca9565b3480156102e257600080fd5b5061025f6102f1366004612c3c565b610d47565b34801561030257600080fd5b5061025f6103113660046127a8565b610d94565b34801561032257600080fd5b5061025f610e2b565b34801561033757600080fd5b506101fc610346366004612c18565b60008281526009602090815260408083206001600160a01b0385168452600a0190915290205492915050565b61025f610380366004612c5e565b610e5f565b34801561039157600080fd5b506103a56103a03660046129bc565b611173565b6040516102069190612eb4565b3480156103be57600080fd5b5061022f6103cd366004612c00565b600090815260046020526040902054151590565b3480156103ed57600080fd5b5060035460ff1661022f565b34801561040557600080fd5b5061025f6104143660046128b7565b6112d4565b34801561042557600080fd5b5061025f61131c565b34801561043a57600080fd5b5061025f611350565b34801561044f57600080fd5b506101fc61045e366004612c18565b60008281526009602090815260408083206001600160a01b0385168452600b0190915290205492915050565b34801561049657600080fd5b506005546040516001600160a01b039091168152602001610206565b3480156104be57600080fd5b50610276611382565b3480156104d357600080fd5b5061025f6104e2366004612929565b611391565b3480156104f357600080fd5b5061025f610502366004612b06565b611468565b34801561051357600080fd5b5061025f610522366004612754565b61154a565b34801561053357600080fd5b506101fc610542366004612c00565b60009081526004602052604090205490565b34801561056057600080fd5b5061025f61056f366004612c3c565b6115ac565b34801561058057600080fd5b5061059461058f366004612c00565b611600565b6040516102069b9a99989796959493929190612ef5565b3480156105b757600080fd5b5061022f6105c6366004612770565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b34801561060057600080fd5b5061025f61060f366004612851565b6116ed565b34801561062057600080fd5b5061025f61062f366004612754565b611732565b34801561064057600080fd5b5061025f61064f366004612988565b6117ca565b60006001600160a01b0383166106c55760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201526a65726f206164647265737360a81b60648201526084015b60405180910390fd5b506000908152602081815260408083206001600160a01b03949094168352929052205490565b60006001600160e01b03198216636cdb3d1360e11b148061071c57506001600160e01b031982166303a24d0760e21b145b8061073757506301ffc9a760e01b6001600160e01b03198316145b92915050565b6005546001600160a01b031633146107675760405162461bcd60e51b81526004016106bc90613118565b6107708161180d565b50565b606060068054610782906132b9565b80601f01602080910402602001604051908101604052809291908181526020018280546107ae906132b9565b80156107fb5780601f106107d0576101008083540402835291602001916107fb565b820191906000526020600020905b8154815290600101906020018083116107de57829003601f168201915b5050505050905090565b6005546001600160a01b0316331461082f5760405162461bcd60e51b81526004016106bc90613118565b60006009600061083e60085490565b81526020808201929092526040016000208a8155600181018a905560038101899055600481018890556005810187905560068101869055600781018590558351909250610893916009840191908501906125c4565b506008908101805461ffff19169055805460010190555050505050505050565b6040516bffffffffffffffffffffffff193360601b1660208201526000906034016040516020818303038152906040528051906020012090506108f860035460ff1690565b1561093a5760405162461bcd60e51b815260206004820152601260248201527118dbdb9d1c9858dd081a5cc81c185d5cd95960721b60448201526064016106bc565b60008481526009602052604090206001015461098e5760405162461bcd60e51b8152602060048201526013602482015272151a595c88191bd95cc81b9bdd08195e1a5cdd606a1b60448201526064016106bc565b60008481526009602052604090206008015460ff166109e85760405162461bcd60e51b81526020600482015260166024820152755072652d73616c65206973206e6f7420656e61626c6560501b60448201526064016106bc565b600084815260096020526040902060040154610a05908690611824565b341015610a4c5760405162461bcd60e51b8152602060048201526015602482015274115d1a195c881d985b1d59481a5b98dbdc9c9958dd605a1b60448201526064016106bc565b60008481526009602052604090206001810154600290910154610a6f9087611837565b1115610abd5760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746f74616c20737570706c79206c696d697400000000000060448201526064016106bc565b60008481526009602090815260408083206005810154338552600a90910190925290912054610aec9087611837565b1115610b0a5760405162461bcd60e51b81526004016106bc9061314d565b600084815260096020526040902060070154851115610b3b5760405162461bcd60e51b81526004016106bc9061318e565b610b8683838080602002602001604051908101604052809392919081815260200183836020028082843760009201829052508981526009602052604090205492508591506118439050565b610bdc5760405162461bcd60e51b815260206004820152602160248201527f4d65726b6c654469737472696275746f723a20496e76616c69642070726f6f666044820152601760f91b60648201526084016106bc565b6000848152600960209081526040808320338452600a01909152902054610c039086611837565b6000858152600960208181526040808420338552600a810183529084209490945591879052905260020154610c389086611837565b6009600086815260200190815260200160002060020181905550610c6d33858760405180602001604052806000815250611900565b60405185815233907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859060200160405180910390a25050505050565b60008181526004602052604081205460609110610d015760405162461bcd60e51b81526020600482015260166024820152752aa9249d103737b732bc34b9ba32b73a103a37b5b2b760511b60448201526064016106bc565b610d0a82611912565b60096000848152602001908152602001600020600901604051602001610d31929190612d62565b6040516020818303038152906040529050919050565b6005546001600160a01b03163314610d715760405162461bcd60e51b81526004016106bc90613118565b600091825260096020526040909120600801805460ff1916911515919091179055565b6001600160a01b038516331480610db05750610db085336105c6565b610e175760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f74206044820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b60648201526084016106bc565b610e2485858585856119a6565b5050505050565b6005546001600160a01b03163314610e555760405162461bcd60e51b81526004016106bc90613118565b610e5d611b6c565b565b60035460ff1615610ea75760405162461bcd60e51b815260206004820152601260248201527118dbdb9d1c9858dd081a5cc81c185d5cd95960721b60448201526064016106bc565b600081815260096020526040902060010154610efb5760405162461bcd60e51b8152602060048201526013602482015272151a595c88191bd95cc81b9bdd08195e1a5cdd606a1b60448201526064016106bc565b600081815260096020526040902060080154610100900460ff16610f565760405162461bcd60e51b815260206004820152601260248201527153616c65206973206e6f7420656e61626c6560701b60448201526064016106bc565b600081815260096020526040902060030154610f73908390611824565b341015610fba5760405162461bcd60e51b8152602060048201526015602482015274115d1a195c881d985b1d59481a5b98dbdc9c9958dd605a1b60448201526064016106bc565b60008181526009602052604090206001810154600290910154610fdd9084611837565b111561102b5760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746f74616c20737570706c79206c696d697400000000000060448201526064016106bc565b60008181526009602090815260408083206006810154338552600b9091019092529091205461105a9084611837565b11156110785760405162461bcd60e51b81526004016106bc9061314d565b6000818152600960205260409020600701548211156110a95760405162461bcd60e51b81526004016106bc9061318e565b6000818152600960209081526040808320338452600b019091529020546110d09083611837565b6000828152600960208181526040808420338552600b8101835290842094909455918490529052600201546111059083611837565b600960008381526020019081526020016000206002018190555061113a33828460405180602001604052806000815250611900565b60405182815233907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859060200160405180910390a25050565b606081518351146111d85760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b60648201526084016106bc565b600083516001600160401b0381111561120157634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561122a578160200160208202803683370190505b50905060005b84518110156112cc5761129185828151811061125c57634e487b7160e01b600052603260045260246000fd5b602002602001015185838151811061128457634e487b7160e01b600052603260045260246000fd5b6020026020010151610654565b8282815181106112b157634e487b7160e01b600052603260045260246000fd5b60209081029190910101526112c581613320565b9050611230565b509392505050565b6001600160a01b0383163314806112f057506112f083336105c6565b61130c5760405162461bcd60e51b81526004016106bc90612ffd565b611317838383611bff565b505050565b6005546001600160a01b031633146113465760405162461bcd60e51b81526004016106bc90613118565b610e5d6000611c0a565b6005546001600160a01b0316331461137a5760405162461bcd60e51b81526004016106bc90613118565b610e5d611c5c565b606060078054610782906132b9565b336001600160a01b03831614156113fc5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b60648201526084016106bc565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6005546001600160a01b031633146114925760405162461bcd60e51b81526004016106bc90613118565b6000818152600960205260409020600201548810156114ec5760405162461bcd60e51b8152602060048201526016602482015275496e636f727265637420746f74616c20737570706c7960501b60448201526064016106bc565b60008181526009602081815260409092208b8155600181018b9055600381018a905560048101899055600581018890556006810187905560078101869055845161153e939190920191908501906125c4565b50505050505050505050565b6005546001600160a01b031633146115745760405162461bcd60e51b81526004016106bc90613118565b60405147906001600160a01b0383169082156108fc029083906000818181858888f19350505050158015611317573d6000803e3d6000fd5b6005546001600160a01b031633146115d65760405162461bcd60e51b81526004016106bc90613118565b60009182526009602052604090912060080180549115156101000261ff0019909216919091179055565b60096020819052600091825260409091208054600182015460028301546003840154600485015460058601546006870154600788015460088901549989018054989a979996989597949693959294919360ff80841694610100909404169290919061166a906132b9565b80601f0160208091040260200160405190810160405280929190818152602001828054611696906132b9565b80156116e35780601f106116b8576101008083540402835291602001916116e3565b820191906000526020600020905b8154815290600101906020018083116116c657829003601f168201915b505050505090508b565b6001600160a01b038516331480611709575061170985336105c6565b6117255760405162461bcd60e51b81526004016106bc90612ffd565b610e248585858585611cd7565b6005546001600160a01b0316331461175c5760405162461bcd60e51b81526004016106bc90613118565b6001600160a01b0381166117c15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106bc565b61077081611c0a565b6001600160a01b0383163314806117e657506117e683336105c6565b6118025760405162461bcd60e51b81526004016106bc90612ffd565b611317838383611e03565b80516118209060029060208401906125c4565b5050565b60006118308284613257565b9392505050565b6000611830828461323f565b600081815b85518110156118f557600086828151811061187357634e487b7160e01b600052603260045260246000fd5b602002602001015190508083116118b55760408051602081018590529081018290526060016040516020818303038152906040528051906020012092506118e2565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b50806118ed81613320565b915050611848565b509092149392505050565b61190c84848484611e0e565b50505050565b606060028054611921906132b9565b80601f016020809104026020016040519081016040528092919081815260200182805461194d906132b9565b801561199a5780601f1061196f5761010080835404028352916020019161199a565b820191906000526020600020905b81548152906001019060200180831161197d57829003601f168201915b50505050509050919050565b81518351146119c75760405162461bcd60e51b81526004016106bc906131d4565b6001600160a01b0384166119ed5760405162461bcd60e51b81526004016106bc90613046565b336119fc818787878787611e43565b60005b8451811015611afe576000858281518110611a2a57634e487b7160e01b600052603260045260246000fd5b602002602001015190506000858381518110611a5657634e487b7160e01b600052603260045260246000fd5b602090810291909101810151600084815280835260408082206001600160a01b038e168352909352919091205490915081811015611aa65760405162461bcd60e51b81526004016106bc906130ce565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290611ae390849061323f565b9250508190555050505080611af790613320565b90506119ff565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051611b4e929190612ec7565b60405180910390a4611b64818787878787611e51565b505050505050565b60035460ff16611bb55760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016106bc565b6003805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b611317838383611fbc565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60035460ff1615611ca25760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016106bc565b6003805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611be23390565b6001600160a01b038416611cfd5760405162461bcd60e51b81526004016106bc90613046565b33611d1c818787611d0d8861205a565b611d168861205a565b87611e43565b6000848152602081815260408083206001600160a01b038a16845290915290205483811015611d5d5760405162461bcd60e51b81526004016106bc906130ce565b6000858152602081815260408083206001600160a01b038b8116855292528083208785039055908816825281208054869290611d9a90849061323f565b909155505060408051868152602081018690526001600160a01b03808916928a821692918616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611dfa8288888888886120b3565b50505050505050565b61131783838361217d565b611e1a848484846121b0565b60008381526004602052604081208054849290611e3890849061323f565b909155505050505050565b611b648686868686866122b1565b6001600160a01b0384163b15611b645760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190611e959089908990889088908890600401612e11565b602060405180830381600087803b158015611eaf57600080fd5b505af1925050508015611edf575060408051601f3d908101601f19168201909252611edc91810190612baa565b60015b611f8c57611eeb613367565b806308c379a01415611f255750611f0061337f565b80611f0b5750611f27565b8060405162461bcd60e51b81526004016106bc9190612f5e565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e20455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b60648201526084016106bc565b6001600160e01b0319811663bc197c8160e01b14611dfa5760405162461bcd60e51b81526004016106bc90612f71565b611fc7838383612319565b60005b825181101561190c57818181518110611ff357634e487b7160e01b600052603260045260246000fd5b60200260200101516004600085848151811061201f57634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060008282546120449190613276565b90915550612053905081613320565b9050611fca565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106120a257634e487b7160e01b600052603260045260246000fd5b602090810291909101015292915050565b6001600160a01b0384163b15611b645760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906120f79089908990889088908890600401612e6f565b602060405180830381600087803b15801561211157600080fd5b505af1925050508015612141575060408051601f3d908101601f1916820190925261213e91810190612baa565b60015b61214d57611eeb613367565b6001600160e01b0319811663f23a6e6160e01b14611dfa5760405162461bcd60e51b81526004016106bc90612f71565b6121888383836124c3565b600082815260046020526040812080548392906121a6908490613276565b9091555050505050565b6001600160a01b0384166122105760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b60648201526084016106bc565b3361222181600087611d0d8861205a565b6000848152602081815260408083206001600160a01b03891684529091528120805485929061225190849061323f565b909155505060408051858152602081018590526001600160a01b0380881692600092918516917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4610e24816000878787876120b3565b60035460ff1615611b645760405162461bcd60e51b815260206004820152602c60248201527f455243313135355061757361626c653a20746f6b656e207472616e736665722060448201526b1dda1a5b19481c185d5cd95960a21b60648201526084016106bc565b6001600160a01b03831661233f5760405162461bcd60e51b81526004016106bc9061308b565b80518251146123605760405162461bcd60e51b81526004016106bc906131d4565b600033905061238381856000868660405180602001604052806000815250611e43565b60005b83518110156124645760008482815181106123b157634e487b7160e01b600052603260045260246000fd5b6020026020010151905060008483815181106123dd57634e487b7160e01b600052603260045260246000fd5b602090810291909101810151600084815280835260408082206001600160a01b038c16835290935291909120549091508181101561242d5760405162461bcd60e51b81526004016106bc90612fb9565b6000928352602083815260408085206001600160a01b038b168652909152909220910390558061245c81613320565b915050612386565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516124b5929190612ec7565b60405180910390a450505050565b6001600160a01b0383166124e95760405162461bcd60e51b81526004016106bc9061308b565b33612518818560006124fa8761205a565b6125038761205a565b60405180602001604052806000815250611e43565b6000838152602081815260408083206001600160a01b0388168452909152902054828110156125595760405162461bcd60e51b81526004016106bc90612fb9565b6000848152602081815260408083206001600160a01b03898116808652918452828520888703905582518981529384018890529092908616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a45050505050565b8280546125d0906132b9565b90600052602060002090601f0160209004810192826125f25760008555612638565b82601f1061260b57805160ff1916838001178555612638565b82800160010185558215612638579182015b8281111561263857825182559160200191906001019061261d565b50612644929150612648565b5090565b5b808211156126445760008155600101612649565b600082601f83011261266d578081fd5b8135602061267a8261321c565b60405161268782826132f4565b8381528281019150858301600585901b870184018810156126a6578586fd5b855b858110156126c4578135845292840192908401906001016126a8565b5090979650505050505050565b803580151581146126e157600080fd5b919050565b600082601f8301126126f6578081fd5b81356001600160401b0381111561270f5761270f613351565b604051612726601f8301601f1916602001826132f4565b81815284602083860101111561273a578283fd5b816020850160208301379081016020019190915292915050565b600060208284031215612765578081fd5b813561183081613408565b60008060408385031215612782578081fd5b823561278d81613408565b9150602083013561279d81613408565b809150509250929050565b600080600080600060a086880312156127bf578081fd5b85356127ca81613408565b945060208601356127da81613408565b935060408601356001600160401b03808211156127f5578283fd5b61280189838a0161265d565b94506060880135915080821115612816578283fd5b61282289838a0161265d565b93506080880135915080821115612837578283fd5b50612844888289016126e6565b9150509295509295909350565b600080600080600060a08688031215612868578081fd5b853561287381613408565b9450602086013561288381613408565b9350604086013592506060860135915060808601356001600160401b038111156128ab578182fd5b612844888289016126e6565b6000806000606084860312156128cb578283fd5b83356128d681613408565b925060208401356001600160401b03808211156128f1578384fd5b6128fd8783880161265d565b93506040860135915080821115612912578283fd5b5061291f8682870161265d565b9150509250925092565b6000806040838503121561293b578081fd5b823561294681613408565b9150612954602084016126d1565b90509250929050565b6000806040838503121561296f578182fd5b823561297a81613408565b946020939093013593505050565b60008060006060848603121561299c578081fd5b83356129a781613408565b95602085013595506040909401359392505050565b600080604083850312156129ce578182fd5b82356001600160401b03808211156129e4578384fd5b818501915085601f8301126129f7578384fd5b81356020612a048261321c565b604051612a1182826132f4565b8381528281019150858301600585901b870184018b1015612a30578889fd5b8896505b84871015612a5b578035612a4781613408565b835260019690960195918301918301612a34565b5096505086013592505080821115612a71578283fd5b50612a7e8582860161265d565b9150509250929050565b600080600080600080600080610100898b031215612aa4578586fd5b883597506020890135965060408901359550606089013594506080890135935060a0890135925060c0890135915060e08901356001600160401b03811115612aea578182fd5b612af68b828c016126e6565b9150509295985092959890939650565b60008060008060008060008060006101208a8c031215612b24578283fd5b8935985060208a0135975060408a0135965060608a0135955060808a0135945060a08a0135935060c08a0135925060e08a01356001600160401b03811115612b6a578182fd5b612b768c828d016126e6565b9250506101008a013590509295985092959850929598565b600060208284031215612b9f578081fd5b81356118308161341d565b600060208284031215612bbb578081fd5b81516118308161341d565b600060208284031215612bd7578081fd5b81356001600160401b03811115612bec578182fd5b612bf8848285016126e6565b949350505050565b600060208284031215612c11578081fd5b5035919050565b60008060408385031215612c2a578182fd5b82359150602083013561279d81613408565b60008060408385031215612c4e578182fd5b82359150612954602084016126d1565b60008060408385031215612c70578182fd5b50508035926020909101359150565b60008060008060608587031215612c94578182fd5b843593506020850135925060408501356001600160401b0380821115612cb8578384fd5b818701915087601f830112612ccb578384fd5b813581811115612cd9578485fd5b8860208260051b8501011115612ced578485fd5b95989497505060200194505050565b6000815180845260208085019450808401835b83811015612d2b57815187529582019590820190600101612d0f565b509495945050505050565b60008151808452612d4e81602086016020860161328d565b601f01601f19169290920160200192915050565b600083516020612d75828583890161328d565b8454918401918390600181811c9080831680612d9257607f831692505b858310811415612db057634e487b7160e01b88526022600452602488fd5b808015612dc45760018114612dd557612e01565b60ff19851688528388019550612e01565b60008b815260209020895b85811015612df95781548a820152908401908801612de0565b505083880195505b50939a9950505050505050505050565b6001600160a01b0386811682528516602082015260a060408201819052600090612e3d90830186612cfc565b8281036060840152612e4f8186612cfc565b90508281036080840152612e638185612d36565b98975050505050505050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090612ea990830184612d36565b979650505050505050565b6020815260006118306020830184612cfc565b604081526000612eda6040830185612cfc565b8281036020840152612eec8185612cfc565b95945050505050565b60006101608d83528c60208401528b60408401528a60608401528960808401528860a08401528760c08401528660e084015285151561010084015284151561012084015280610140840152612f4c81840185612d36565b9e9d5050505050505050505050505050565b6020815260006118306020830184612d36565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b60208082526024908201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604082015263616e636560e01b606082015260800190565b60208082526029908201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260408201526808185c1c1c9bdd995960ba1b606082015260800190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526023908201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260408201526265737360e81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526021908201527f45786365656473206d6178206d696e74206c696d6974207065722077616c6c656040820152601d60fa1b606082015260800190565b60208082526026908201527f45786365656473206d6178206d696e74206c696d697420706572207472616e7360408201526530b1ba34b7b760d11b606082015260800190565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206040820152670dad2e6dac2e8c6d60c31b606082015260800190565b60006001600160401b0382111561323557613235613351565b5060051b60200190565b600082198211156132525761325261333b565b500190565b60008160001904831182151516156132715761327161333b565b500290565b6000828210156132885761328861333b565b500390565b60005b838110156132a8578181015183820152602001613290565b8381111561190c5750506000910152565b600181811c908216806132cd57607f821691505b602082108114156132ee57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8201601f191681016001600160401b038111828210171561331957613319613351565b6040525050565b60006000198214156133345761333461333b565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600060033d111561337c57600481823e5160e01c5b90565b600060443d101561338d5790565b6040516003193d81016004833e81513d6001600160401b0381602484011181841117156133bc57505050505090565b82850191508151818111156133d45750505050505090565b843d87010160208285010111156133ee5750505050505090565b6133fd602082860101876132f4565b509095945050505050565b6001600160a01b038116811461077057600080fd5b6001600160e01b03198116811461077057600080fdfea2646970667358221220b1e9b8a132441e1ae7d7a3e89dfc05a61721c886a58ac5263a35e75b66d1fc0864736f6c63430008040033

Verified Source Code Partial Match

Compiler: v0.8.4+commit.c7e474f2 EVM: istanbul Optimization: Yes (200 runs)
ERC165.sol 28 lines
// SPDX-License-Identifier: MIT

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;
    }
}
Address.sol 210 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return _verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(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) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) private pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
Context.sol 23 lines
// SPDX-License-Identifier: MIT

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;
    }
}
ERC1155.sol 451 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./IERC1155MetadataURI.sol";
import "./Address.sol";
import "./Context.sol";
import "./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: balance query for the zero address");
        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 {
        require(_msgSender() != operator, "ERC1155: setting approval status for self");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_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 owner nor 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: transfer caller is not owner nor 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();

        _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), 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);

        _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);

        _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 `account`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(
        address account,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(account != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data);

        _balances[id][account] += amount;
        emit TransferSingle(operator, address(0), account, id, amount);

        _doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * 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);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `account`
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens of token type `id`.
     */
    function _burn(
        address account,
        uint256 id,
        uint256 amount
    ) internal virtual {
        require(account != address(0), "ERC1155: burn from the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");

        uint256 accountBalance = _balances[id][account];
        require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
        unchecked {
            _balances[id][account] = accountBalance - amount;
        }

        emit TransferSingle(operator, account, address(0), id, amount);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(
        address account,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual {
        require(account != address(0), "ERC1155: burn from the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, account, address(0), ids, amounts, "");

        for (uint256 i = 0; i < ids.length; i++) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 accountBalance = _balances[id][account];
            require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
            unchecked {
                _balances[id][account] = accountBalance - amount;
            }
        }

        emit TransferBatch(operator, account, address(0), ids, amounts);
    }

    /**
     * @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 `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 _beforeTokenTransfer(
        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(to).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(to).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;
    }
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT

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);
}
Ownable.sol 71 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./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() {
        _setOwner(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        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 {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
Counters.sol 42 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}
IERC1155.sol 124 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./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 be 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;
}
Pausable.sol 90 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}
SafeMath.sol 226 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}
MerkleProof.sol 43 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Trees proofs.
 *
 * The proofs can be generated using the JavaScript library
 * https://github.com/miguelmota/merkletreejs[merkletreejs].
 * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
 *
 * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
 */
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) {
        bytes32 computedHash = leaf;

        for (uint256 i = 0; i < proof.length; i++) {
            bytes32 proofElement = proof[i];

            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
            }
        }

        // Check if the computed hash (root) is equal to the provided root
        return computedHash == root;
    }
}
ERC1155Supply.sol 85 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./ERC1155.sol";

/**
 * @dev Extension of ERC1155 that adds tracking of total supply per id.
 *
 * Useful for scenarios where Fungible and Non-fungible tokens have to be
 * clearly identified. Note: While a totalSupply of 1 might mean the
 * corresponding is an NFT, there is no guarantees that no other token with the
 * same id are not going to be minted.
 */
abstract contract ERC1155Supply is ERC1155 {
    mapping(uint256 => uint256) private _totalSupply;

    /**
     * @dev Total amount of tokens in with a given id.
     */
    function totalSupply(uint256 id) public view virtual returns (uint256) {
        return _totalSupply[id];
    }

    /**
     * @dev Indicates weither any token exist with a given id, or not.
     */
    function exists(uint256 id) public view virtual returns (bool) {
        return ERC1155Supply.totalSupply(id) > 0;
    }

    /**
     * @dev See {ERC1155-_mint}.
     */
    function _mint(
        address account,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual override {
        super._mint(account, id, amount, data);
        _totalSupply[id] += amount;
    }

    /**
     * @dev See {ERC1155-_mintBatch}.
     */
    function _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual override {
        super._mintBatch(to, ids, amounts, data);
        for (uint256 i = 0; i < ids.length; ++i) {
            _totalSupply[ids[i]] += amounts[i];
        }
    }

    /**
     * @dev See {ERC1155-_burn}.
     */
    function _burn(
        address account,
        uint256 id,
        uint256 amount
    ) internal virtual override {
        super._burn(account, id, amount);
        _totalSupply[id] -= amount;
    }

    /**
     * @dev See {ERC1155-_burnBatch}.
     */
    function _burnBatch(
        address account,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual override {
        super._burnBatch(account, ids, amounts);
        for (uint256 i = 0; i < ids.length; ++i) {
            _totalSupply[ids[i]] -= amounts[i];
        }
    }
}
ERC1155Burnable.sol 39 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./ERC1155.sol";

/**
 * @dev Extension of {ERC1155} that allows token holders to destroy both their
 * own tokens and those that they have been approved to use.
 *
 * _Available since v3.1._
 */
abstract contract ERC1155Burnable is ERC1155 {
    function burn(
        address account,
        uint256 id,
        uint256 value
    ) public virtual {
        require(
            account == _msgSender() || isApprovedForAll(account, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );

        _burn(account, id, value);
    }

    function burnBatch(
        address account,
        uint256[] memory ids,
        uint256[] memory values
    ) public virtual {
        require(
            account == _msgSender() || isApprovedForAll(account, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );

        _burnBatch(account, ids, values);
    }
}
ERC1155Pausable.sol 37 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./ERC1155.sol";
import "./Pausable.sol";

/**
 * @dev ERC1155 token with pausable token transfers, minting and burning.
 *
 * Useful for scenarios such as preventing trades until the end of an evaluation
 * period, or having an emergency switch for freezing all token transfers in the
 * event of a large bug.
 *
 * _Available since v3.1._
 */
abstract contract ERC1155Pausable is ERC1155, Pausable {
    /**
     * @dev See {ERC1155-_beforeTokenTransfer}.
     *
     * Requirements:
     *
     * - the contract must not be paused.
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual override {
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);

        require(!paused(), "ERC1155Pausable: token transfer while paused");
    }
}
CoffeeJunkieClub.sol 194 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "./ERC1155.sol";
import "./MerkleProof.sol";
import "./SafeMath.sol";
import "./Counters.sol";
import "./AbstractCoffeeJunkieClub.sol";

contract CoffeeJunkieClub is AbstractCoffeeJunkieClub {
    using SafeMath for uint256;
    using Counters for Counters.Counter;
	
    Counters.Counter private TierCounter; 
    mapping(uint256 => Tier) public Tiers;
    event Mint(address indexed account, uint amount);
	
    struct Tier {
        bytes32 merkleRoot;
        uint256 totalSupply;
        uint256 totalMinted;
		uint256 salePrice;
        uint256 presalePrice;
		uint256 presaleMintLimit;
		uint256 saleMintLimit;
		uint256 mintPerTransectionLimit;
		bool presaleStatus;
		bool saleStatus;
        string ipfsMetadataHash;
        mapping(address => uint256) presaleMintedNFT;
		mapping(address => uint256) saleMintedNFT;
    }
	
    constructor() ERC1155("ipfs://ipfs/") {
    }
	
    function addTier(
		bytes32 _merkleRoot, 
		uint256 _totalSupply, 
		uint256 _salePrice, 
		uint256 _presalePrice, 
		uint256  _presaleMintLimit, 
		uint256 _saleMintLimit, 
		uint256 _mintPerTransectionLimit, 
		string memory _ipfsMetadataHash
	) external onlyOwner {
        Tier storage tier = Tiers[TierCounter.current()];
        tier.merkleRoot = _merkleRoot;
        tier.totalSupply = _totalSupply;
        tier.salePrice = _salePrice;
		tier.presalePrice = _presalePrice;
		tier.presaleMintLimit = _presaleMintLimit;
		tier.saleMintLimit = _saleMintLimit;
		tier.mintPerTransectionLimit = _mintPerTransectionLimit;
		tier.ipfsMetadataHash = _ipfsMetadataHash;
		tier.presaleStatus = false;
		tier.saleStatus = false;
        TierCounter.increment();
    }
	
	function editTier (
		bytes32 _merkleRoot, 
		uint256 _totalSupply, 
		uint256 _salePrice, 
		uint256 _presalePrice, 
		uint256  _presaleMintLimit, 
		uint256 _saleMintLimit, 
		uint256 _mintPerTransectionLimit, 
		string memory _ipfsMetadataHash, 
		uint256 _tierIndex
	) external onlyOwner {
        require(_totalSupply >= Tiers[_tierIndex].totalMinted, "Incorrect total supply");
		Tiers[_tierIndex].merkleRoot = _merkleRoot;
        Tiers[_tierIndex].totalSupply = _totalSupply;
        Tiers[_tierIndex].salePrice = _salePrice;
		Tiers[_tierIndex].presalePrice = _presalePrice;
		Tiers[_tierIndex].presaleMintLimit = _presaleMintLimit;
		Tiers[_tierIndex].saleMintLimit = _saleMintLimit;
		Tiers[_tierIndex].mintPerTransectionLimit = _mintPerTransectionLimit;
		Tiers[_tierIndex].ipfsMetadataHash = _ipfsMetadataHash;
    }
	
	function preSaleMint(uint256 _count, uint256 _tierIndex,  bytes32[] calldata merkleProof) external payable {
        bytes32 node = keccak256(abi.encodePacked(msg.sender));
		require(
		   !paused(), 
		   "contract is paused"
		);
        require(
			Tiers[_tierIndex].totalSupply != 0, 
			"Tier does not exist"
		);
		require(
			Tiers[_tierIndex].presaleStatus, 
			"Pre-sale is not enable"
		);
        require(
			msg.value >= _count.mul(Tiers[_tierIndex].presalePrice), 
			"Ether value incorrect"
		);
		require(
			Tiers[_tierIndex].totalMinted.add(_count) <= Tiers[_tierIndex].totalSupply, 
			"Exceeds total supply limit"
		);
        require(
			Tiers[_tierIndex].presaleMintedNFT[msg.sender].add(_count) <= Tiers[_tierIndex].presaleMintLimit, 
			"Exceeds max mint limit per wallet"
		);
		require(
			_count <= Tiers[_tierIndex].mintPerTransectionLimit,
			"Exceeds max mint limit per transaction"
		);
        require(
			MerkleProof.verify(merkleProof, Tiers[_tierIndex].merkleRoot, node), 
			"MerkleDistributor: Invalid proof."
		);
		
        Tiers[_tierIndex].presaleMintedNFT[msg.sender] = Tiers[_tierIndex].presaleMintedNFT[msg.sender].add(_count);
		Tiers[_tierIndex].totalMinted = Tiers[_tierIndex].totalMinted.add(_count);
		
        _mint(msg.sender, _tierIndex, _count, "");
        emit Mint(msg.sender, _count);
    }
	
	function saleMint(uint256 _count, uint256 _tierIndex) external payable {
		require(
		   !paused(), 
		   "contract is paused"
		);
        require(
			Tiers[_tierIndex].totalSupply != 0, 
			"Tier does not exist"
		);
		require(
			Tiers[_tierIndex].saleStatus, 
			"Sale is not enable"
		);
        require(
			msg.value >= _count.mul(Tiers[_tierIndex].salePrice), 
			"Ether value incorrect"
		);
		require(
			Tiers[_tierIndex].totalMinted.add(_count) <= Tiers[_tierIndex].totalSupply, 
			"Exceeds total supply limit"
		);
        require(
			Tiers[_tierIndex].saleMintedNFT[msg.sender].add(_count) <= Tiers[_tierIndex].saleMintLimit, 
			"Exceeds max mint limit per wallet"
		);
		require(
			_count <= Tiers[_tierIndex].mintPerTransectionLimit,
			"Exceeds max mint limit per transaction"
		);
		
        Tiers[_tierIndex].saleMintedNFT[msg.sender] = Tiers[_tierIndex].saleMintedNFT[msg.sender].add(_count);
		Tiers[_tierIndex].totalMinted = Tiers[_tierIndex].totalMinted.add(_count);
		
        _mint(msg.sender, _tierIndex, _count, "");
        emit Mint(msg.sender, _count);
    }
	
	function updateSaleStatus (
		uint256 _tierIndex,
		bool _status
	) external onlyOwner {
		Tiers[_tierIndex].saleStatus = _status;
    }
	
	function updatePreSaleStatus (
		uint256 _tierIndex,
		bool _status
	) external onlyOwner {
		Tiers[_tierIndex].presaleStatus = _status;
    }
	
    function withdrawEther(address payable _to) public onlyOwner{
	    uint256 balance = address(this).balance;
        _to.transfer(balance);
    }
	
	function getPreSaleMinted(uint256 tier, address userAdress) public view returns (uint256) {
        return Tiers[tier].presaleMintedNFT[userAdress];
    }
	
	function getSaleMinted(uint256 tier, address userAdress) public view returns (uint256) {
        return Tiers[tier].saleMintedNFT[userAdress];
    }
	
    function uri(uint256 _id) public view override returns (string memory) {
       require(totalSupply(_id) > 0, "URI: nonexistent token");
       return string(abi.encodePacked(super.uri(_id), Tiers[_id].ipfsMetadataHash));
    }    
}
IERC1155Receiver.sol 52 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./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.
        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. 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);
}
IERC1155MetadataURI.sol 21 lines
// SPDX-License-Identifier: MIT

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);
}
AbstractCoffeeJunkieClub.sol 79 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import './Ownable.sol';
import './ERC1155Burnable.sol';
import './ERC1155Pausable.sol';
import './ERC1155Supply.sol';

abstract contract AbstractCoffeeJunkieClub is ERC1155Pausable, ERC1155Supply, ERC1155Burnable, Ownable {
    
    string private name_ = 'Coffee Junkie Club';
    string private symbol_ = 'CJC';   
    
    function pause() external onlyOwner {
        _pause();
    }

    function unpause() external onlyOwner {
        _unpause();
    }    

    function setURI(string memory baseURI) external onlyOwner {
        _setURI(baseURI);
    }    

    function name() public view returns (string memory) {
        return name_;
    }

    function symbol() public view returns (string memory) {
        return symbol_;
    }          

    function _mint(
        address account,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual override(ERC1155, ERC1155Supply) {
        super._mint(account, id, amount, data);
    }

    function _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual override(ERC1155, ERC1155Supply) {
        super._mintBatch(to, ids, amounts, data);
    }

    function _burn(
        address account,
        uint256 id,
        uint256 amount
    ) internal virtual override(ERC1155, ERC1155Supply) {
        super._burn(account, id, amount);
    }

    function _burnBatch(
        address account,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual override(ERC1155, ERC1155Supply) {
        super._burnBatch(account, ids, amounts);
    }  

    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual override(ERC1155Pausable, ERC1155) {
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
    }  
}

Read Contract

Tiers 0xbf3952d7 → bytes32, uint256, uint256, uint256, uint256, uint256, uint256, uint256, bool, bool, string
balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
exists 0x4f558e79 → bool
getPreSaleMinted 0x412556d8 → uint256
getSaleMinted 0x8d1c0ce9 → uint256
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
paused 0x5c975abb → bool
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
totalSupply 0xbd85b039 → uint256
uri 0x0e89341c → string

Write Contract 17 functions

These functions modify contract state and require a wallet transaction to execute.

addTier 0x08ab2e26
bytes32 _merkleRoot
uint256 _totalSupply
uint256 _salePrice
uint256 _presalePrice
uint256 _presaleMintLimit
uint256 _saleMintLimit
uint256 _mintPerTransectionLimit
string _ipfsMetadataHash
burn 0xf5298aca
address account
uint256 id
uint256 value
burnBatch 0x6b20c454
address account
uint256[] ids
uint256[] values
editTier 0xa8f6d746
bytes32 _merkleRoot
uint256 _totalSupply
uint256 _salePrice
uint256 _presalePrice
uint256 _presaleMintLimit
uint256 _saleMintLimit
uint256 _mintPerTransectionLimit
string _ipfsMetadataHash
uint256 _tierIndex
pause 0x8456cb59
No parameters
preSaleMint 0x09686f84
uint256 _count
uint256 _tierIndex
bytes32[] merkleProof
renounceOwnership 0x715018a6
No parameters
safeBatchTransferFrom 0x2eb2c2d6
address from
address to
uint256[] ids
uint256[] amounts
bytes data
safeTransferFrom 0xf242432a
address from
address to
uint256 id
uint256 amount
bytes data
saleMint 0x4506c46a
uint256 _count
uint256 _tierIndex
setApprovalForAll 0xa22cb465
address operator
bool approved
setURI 0x02fe5305
string baseURI
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters
updatePreSaleStatus 0x2c218df9
uint256 _tierIndex
bool _status
updateSaleStatus 0xbf0c8c16
uint256 _tierIndex
bool _status
withdrawEther 0xaf933b57
address _to

Recent Transactions

No transactions found for this address