Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0xe76512732B1e49Eb259dfc6D9d49E4c5dAc6a75C
Balance 0 ETH
Nonce 1
Code Size 9628 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

9628 bytes
0x60806040526004361061018a5760003560e01c80633e39d638116100e157806395d89b411161008a578063c06ddc3811610064578063c06ddc38146104d2578063e985e9c5146104f2578063f242432a14610512578063f2fde38b1461053257600080fd5b806395d89b41146104495780639b642de114610492578063a22cb465146104b257600080fd5b8063715018a6116100bb578063715018a6146103f55780638395b8421461040a5780638da5cb5b1461042a57600080fd5b80633e39d638146103535780634e1273f4146103905780636352211e146103bd57600080fd5b806306fdde031161014357806318160ddd1161011d57806318160ddd146102da5780632a55205a146102f45780632eb2c2d61461033357600080fd5b806306fdde03146102445780630e89341c1461029a57806316e8d273146102ba57600080fd5b8061ab4f1161016f578061ab4f146101d9578062fdd58e146101e157806301ffc9a71461021457600080fd5b8060dd1461018f57806108a8146101a45780616000146101c4575b600080fd5b6101a261019d366004611dca565b610552565b005b3480156101b057600080fd5b506101a26101bf366004611df8565b61079d565b3480156101d057600080fd5b506101a2610845565b6101a26108ec565b3480156101ed57600080fd5b506102016101fc366004611e15565b61096d565b6040519081526020015b60405180910390f35b34801561022057600080fd5b5061023461022f366004611e57565b61099b565b604051901515815260200161020b565b34801561025057600080fd5b5061028d6040518060400160405280600781526020017f517561736172730000000000000000000000000000000000000000000000000081525081565b60405161020b9190611ec1565b3480156102a657600080fd5b5061028d6102b5366004611dca565b6109d9565b3480156102c657600080fd5b506101a26102d5366004611ee2565b610a6e565b3480156102e657600080fd5b506127135460001901610201565b34801561030057600080fd5b5061031461030f366004611eff565b610add565b604080516001600160a01b03909316835260208301919091520161020b565b34801561033f57600080fd5b506101a261034e366004612067565b610b1b565b34801561035f57600080fd5b5061037361036e366004611dca565b610e29565b6040516bffffffffffffffffffffffff909116815260200161020b565b34801561039c57600080fd5b506103b06103ab366004612115565b610e4b565b60405161020b9190612212565b3480156103c957600080fd5b506103dd6103d8366004611dca565b610f5b565b6040516001600160a01b03909116815260200161020b565b34801561040157600080fd5b506101a2610f81565b34801561041657600080fd5b506101a2610425366004611dca565b610fe6565b34801561043657600080fd5b50612712546001600160a01b03166103dd565b34801561045557600080fd5b5061028d6040518060400160405280600381526020017f515352000000000000000000000000000000000000000000000000000000000081525081565b34801561049e57600080fd5b506101a26104ad366004612225565b611099565b3480156104be57600080fd5b506101a26104cd366004612297565b611106565b3480156104de57600080fd5b506101a26104ed366004611df8565b611173565b3480156104fe57600080fd5b5061023461050d3660046122d0565b6112ea565b34801561051e57600080fd5b506101a261052d3660046122fe565b61148e565b34801561053e57600080fd5b506101a261054d366004611df8565b6116eb565b601581106105a75760405162461bcd60e51b815260206004820152600660248201527f4d6178203230000000000000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b612710816127135401106105e85760405162461bcd60e51b815260206004820152600860248201526714dbdb19081bdd5d60c21b604482015260640161059e565b34662386f26fc100008202146106405760405162461bcd60e51b815260206004820152600b60248201527f57726f6e67207072696365000000000000000000000000000000000000000000604482015260640161059e565b60008167ffffffffffffffff81111561065b5761065b611f21565b604051908082528060200260200182016040528015610684578160200160208202803683370190505b50905060008267ffffffffffffffff8111156106a2576106a2611f21565b6040519080825280602002602001820160405280156106cb578160200160208202803683370190505b50905060005b838110156107735780612713546106e8919061237d565b8382815181106106fa576106fa612395565b60209081029190910181019190915260408051339281019290925281018290524260608201526080016040516020818303038152906040528051906020012060001c82828151811061074e5761074e612395565b6bffffffffffffffffffffffff909216602092830291909101909101526001016106d1565b5061078f338383604051806020016040528060008152506117ce565b505061271380549091019055565b6127106127135411156107dd5760405162461bcd60e51b815260206004820152600860248201526714dbdb19081bdd5d60c21b604482015260640161059e565b6127135460408051336020820152908101919091524260608201526000906080016040516020818303038152906040528051906020012060001c905061083782612713548360405180602001604052806000815250611a0a565b505061271380546001019055565b6127106127135411156108855760405162461bcd60e51b815260206004820152600860248201526714dbdb19081bdd5d60c21b604482015260640161059e565b6127135460408051336020820152908101919091524260608201526000906080016040516020818303038152906040528051906020012060001c90506108df33612713548360405180602001604052806000815250611a0a565b5061271380546001019055565b612712546001600160a01b031633146109475760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161059e565b60405133904780156108fc02916000818181858888f1935050505061096b57600080fd5b565b6000826001600160a01b031661098283610f5b565b6001600160a01b03161415610995575060015b92915050565b60006001600160e01b031982167f2a55205a000000000000000000000000000000000000000000000000000000001480610995575061099582611be6565b606061271480546109e9906123ab565b80601f0160208091040260200160405190810160405280929190818152602001828054610a15906123ab565b8015610a625780601f10610a3757610100808354040283529160200191610a62565b820191906000526020600020905b815481529060010190602001808311610a4557829003601f168201915b50505050509050919050565b612712546001600160a01b03163314610ac95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161059e565b612715805460ff1916911515919091179055565b600080610af3612712546001600160a01b031690565b9150620f42406127165484610b0891906123e6565b610b129190612405565b90509250929050565b825182518114610b6d5760405162461bcd60e51b815260206004820152600f60248201527f4c454e4754485f4d49534d415443480000000000000000000000000000000000604482015260640161059e565b336001600160a01b0387161480610b895750610b8986336112ea565b610bd55760405162461bcd60e51b815260206004820152600e60248201527f4e4f545f415554484f52495a4544000000000000000000000000000000000000604482015260640161059e565b60005b81811015610cd5576000858281518110610bf457610bf4612395565b602002602001015190506000858381518110610c1257610c12612395565b6020026020010151905080600114610c6c5760405162461bcd60e51b815260206004820152601560248201527f43616e206f6e6c79207472616e73666572206f6e650000000000000000000000604482015260640161059e565b886001600160a01b0316610c7f83610f5b565b6001600160a01b031614610cc15760405162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015260640161059e565b610ccb8289611c7f565b5050600101610bd8565b50846001600160a01b0316866001600160a01b0316336001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051610d25929190612427565b60405180910390a46001600160a01b0385163b15610dd55760405163bc197c8160e01b808252906001600160a01b0387169063bc197c8190610d739033908b908a908a908a90600401612455565b602060405180830381600087803b158015610d8d57600080fd5b505af1158015610da1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc591906124b3565b6001600160e01b03191614610de2565b6001600160a01b03851615155b610e215760405162461bcd60e51b815260206004820152601060248201526f155394d0519157d49150d2541251539560821b604482015260640161059e565b505050505050565b600060a06000836127118110610e4157610e41612395565b0154901c92915050565b81518151606091908114610ea15760405162461bcd60e51b815260206004820152600f60248201527f4c454e4754485f4d49534d415443480000000000000000000000000000000000604482015260640161059e565b835167ffffffffffffffff811115610ebb57610ebb611f21565b604051908082528060200260200182016040528015610ee4578160200160208202803683370190505b50915060005b81811015610f5357610f2e858281518110610f0757610f07612395565b6020026020010151858381518110610f2157610f21612395565b602002602001015161096d565b838281518110610f4057610f40612395565b6020908102919091010152600101610eea565b505092915050565b600080826127118110610f7057610f70612395565b01546001600160a01b031692915050565b612712546001600160a01b03163314610fdc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161059e565b61096b6000611cd1565b612712546001600160a01b031633146110415760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161059e565b620f424081106110935760405162461bcd60e51b815260206004820152600d60248201527f4d757374206265203c2031653600000000000000000000000000000000000000604482015260640161059e565b61271655565b612712546001600160a01b031633146110f45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161059e565b6111016127148383611d31565b505050565b336000818152612711602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b612712546001600160a01b031633146111ce5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161059e565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0382169063a9059cbb90339083906370a082319060240160206040518083038186803b15801561123057600080fd5b505afa158015611244573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126891906124d0565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b1580156112ae57600080fd5b505af11580156112c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e691906124e9565b5050565b6127155460009060ff161561145c5746600414156113ad5760405163c455279160e01b81526001600160a01b03848116600483015283169073f57b2c51ded3a29e6891aba85459d600256cf3179063c45527919060240160206040518083038186803b15801561135957600080fd5b505afa15801561136d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113919190612506565b6001600160a01b031614156113a857506001610995565b61145c565b466001141561145c5760405163c455279160e01b81526001600160a01b03848116600483015283169073a5409ec958c83c3f309868babaca7c86dcb077c19063c45527919060240160206040518083038186803b15801561140d57600080fd5b505afa158015611421573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114459190612506565b6001600160a01b0316141561145c57506001610995565b6001600160a01b038084166000908152612711602090815260408083209386168352929052205460ff165b9392505050565b336001600160a01b03861614806114aa57506114aa85336112ea565b6114f65760405162461bcd60e51b815260206004820152600e60248201527f4e4f545f415554484f52495a4544000000000000000000000000000000000000604482015260640161059e565b816001146115465760405162461bcd60e51b815260206004820152601560248201527f43616e206f6e6c79207472616e73666572206f6e650000000000000000000000604482015260640161059e565b846001600160a01b031661155984610f5b565b6001600160a01b03161461159b5760405162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015260640161059e565b6115a58385611c7f565b60408051848152602081018490526001600160a01b03808716929088169133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46001600160a01b0384163b156116985760405163f23a6e6160e01b808252906001600160a01b0386169063f23a6e61906116369033908a90899089908990600401612523565b602060405180830381600087803b15801561165057600080fd5b505af1158015611664573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061168891906124b3565b6001600160e01b031916146116a5565b6001600160a01b03841615155b6116e45760405162461bcd60e51b815260206004820152601060248201526f155394d0519157d49150d2541251539560821b604482015260640161059e565b5050505050565b612712546001600160a01b031633146117465760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161059e565b6001600160a01b0381166117c25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161059e565b6117cb81611cd1565b50565b825160008167ffffffffffffffff8111156117eb576117eb611f21565b604051908082528060200260200182016040528015611814578160200160208202803683370190505b50905060005b8281101561192157600086828151811061183657611836612395565b60200260200101519050600086838151811061185457611854612395565b60200260200101519050600082612711811061187257611872612395565b0154156118c15760405162461bcd60e51b815260206004820152600e60248201527f416c7265616479206d696e746564000000000000000000000000000000000000604482015260640161059e565b886001600160a01b031660a0826bffffffffffffffffffffffff16901b1760008361271181106118f3576118f3612395565b0181905550600184848151811061190c5761190c612395565b6020908102919091010152505060010161181a565b50856001600160a01b031660006001600160a01b0316336001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8885604051611972929190612427565b60405180910390a46001600160a01b0386163b156119c15760405163bc197c8160e01b808252906001600160a01b0388169063bc197c8190610d739033906000908b9088908b90600401612455565b6001600160a01b038616610e215760405162461bcd60e51b815260206004820152601060248201526f155394d0519157d49150d2541251539560821b604482015260640161059e565b6000836127118110611a1e57611a1e612395565b015415611a6d5760405162461bcd60e51b815260206004820152600e60248201527f416c7265616479206d696e746564000000000000000000000000000000000000604482015260640161059e565b836001600160a01b031660a0836bffffffffffffffffffffffff16901b176000846127118110611a9f57611a9f612395565b015560408051848152600160208201526001600160a01b0386169160009133917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46001600160a01b0384163b15611b945760405163f23a6e6160e01b808252906001600160a01b0386169063f23a6e6190611b3290339060009089906001908990600401612523565b602060405180830381600087803b158015611b4c57600080fd5b505af1158015611b60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b8491906124b3565b6001600160e01b03191614611ba1565b6001600160a01b03841615155b611be05760405162461bcd60e51b815260206004820152601060248201526f155394d0519157d49150d2541251539560821b604482015260640161059e565b50505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161480611c4957507fd9b67a26000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b806109955750506001600160e01b0319167f0e89341c000000000000000000000000000000000000000000000000000000001490565b806001600160a01b03166000836127118110611c9d57611c9d612395565b015473ffffffffffffffffffffffffffffffffffffffff1916176000836127118110611ccb57611ccb612395565b01555050565b61271280546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054611d3d906123ab565b90600052602060002090601f016020900481019282611d5f5760008555611da5565b82601f10611d785782800160ff19823516178555611da5565b82800160010185558215611da5579182015b82811115611da5578235825591602001919060010190611d8a565b50611db1929150611db5565b5090565b5b80821115611db15760008155600101611db6565b600060208284031215611ddc57600080fd5b5035919050565b6001600160a01b03811681146117cb57600080fd5b600060208284031215611e0a57600080fd5b813561148781611de3565b60008060408385031215611e2857600080fd5b8235611e3381611de3565b946020939093013593505050565b6001600160e01b0319811681146117cb57600080fd5b600060208284031215611e6957600080fd5b813561148781611e41565b6000815180845260005b81811015611e9a57602081850181015186830182015201611e7e565b81811115611eac576000602083870101525b50601f01601f19169290920160200192915050565b6020815260006114876020830184611e74565b80151581146117cb57600080fd5b600060208284031215611ef457600080fd5b813561148781611ed4565b60008060408385031215611f1257600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611f6057611f60611f21565b604052919050565b600067ffffffffffffffff821115611f8257611f82611f21565b5060051b60200190565b600082601f830112611f9d57600080fd5b81356020611fb2611fad83611f68565b611f37565b82815260059290921b84018101918181019086841115611fd157600080fd5b8286015b84811015611fec5780358352918301918301611fd5565b509695505050505050565b600082601f83011261200857600080fd5b813567ffffffffffffffff81111561202257612022611f21565b612035601f8201601f1916602001611f37565b81815284602083860101111561204a57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a0868803121561207f57600080fd5b853561208a81611de3565b9450602086013561209a81611de3565b9350604086013567ffffffffffffffff808211156120b757600080fd5b6120c389838a01611f8c565b945060608801359150808211156120d957600080fd5b6120e589838a01611f8c565b935060808801359150808211156120fb57600080fd5b5061210888828901611ff7565b9150509295509295909350565b6000806040838503121561212857600080fd5b823567ffffffffffffffff8082111561214057600080fd5b818501915085601f83011261215457600080fd5b81356020612164611fad83611f68565b82815260059290921b8401810191818101908984111561218357600080fd5b948201945b838610156121aa57853561219b81611de3565b82529482019490820190612188565b965050860135925050808211156121c057600080fd5b506121cd85828601611f8c565b9150509250929050565b600081518084526020808501945080840160005b83811015612207578151875295820195908201906001016121eb565b509495945050505050565b60208152600061148760208301846121d7565b6000806020838503121561223857600080fd5b823567ffffffffffffffff8082111561225057600080fd5b818501915085601f83011261226457600080fd5b81358181111561227357600080fd5b86602082850101111561228557600080fd5b60209290920196919550909350505050565b600080604083850312156122aa57600080fd5b82356122b581611de3565b915060208301356122c581611ed4565b809150509250929050565b600080604083850312156122e357600080fd5b82356122ee81611de3565b915060208301356122c581611de3565b600080600080600060a0868803121561231657600080fd5b853561232181611de3565b9450602086013561233181611de3565b93506040860135925060608601359150608086013567ffffffffffffffff81111561235b57600080fd5b61210888828901611ff7565b634e487b7160e01b600052601160045260246000fd5b6000821982111561239057612390612367565b500190565b634e487b7160e01b600052603260045260246000fd5b600181811c908216806123bf57607f821691505b602082108114156123e057634e487b7160e01b600052602260045260246000fd5b50919050565b600081600019048311821515161561240057612400612367565b500290565b60008261242257634e487b7160e01b600052601260045260246000fd5b500490565b60408152600061243a60408301856121d7565b828103602084015261244c81856121d7565b95945050505050565b60006001600160a01b03808816835280871660208401525060a0604083015261248160a08301866121d7565b828103606084015261249381866121d7565b905082810360808401526124a78185611e74565b98975050505050505050565b6000602082840312156124c557600080fd5b815161148781611e41565b6000602082840312156124e257600080fd5b5051919050565b6000602082840312156124fb57600080fd5b815161148781611ed4565b60006020828403121561251857600080fd5b815161148781611de3565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a0608083015261255b60a0830184611e74565b97965050505050505056fea264697066735822122046cd924cff1b48ec0057a5d357acd1ce89a265fdb90579d17333142e23af9a8164736f6c63430008090033

Verified Source Code Full Match

Compiler: v0.8.9+commit.e5eed63a EVM: london Optimization: Yes (1000 runs)
Quasars.sol 146 lines
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.9;

import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import './ERC1155U.sol';

interface ProxyRegistry {
    function proxies(address) external view returns (address);
}

interface IERC2981 {
    function royaltyInfo(uint256 _tokenId, uint256 _salePrice)
        external
        view
        returns (address receiver, uint256 royaltyAmount);
}

contract Quasars is ERC1155U, IERC2981, Ownable {
    uint256 _currentTokenId = 1;
    uint256 constant MAX_TOKENS = 10_000;
    uint256 constant PRICE_WHEN_MINTING_SEVERAL_AT_A_TIME = 0.01 ether;

    string private _uri = 'https://codemakes.art/token/quasars/{id}';
    bool private _gaslessTrading = true;
    uint256 private _royaltyPartsPerMillion = 50_000;

    string public constant name = 'Quasars';
    string public constant symbol = 'QSR';

    function mint_One_4d() external {
        require(_currentTokenId <= MAX_TOKENS, 'Sold out');

        uint96 dna = uint96(uint256(keccak256(abi.encode(msg.sender, _currentTokenId, block.timestamp))));
        _mint(msg.sender, _currentTokenId, dna, '');

        unchecked {
            // Can't overflow
            _currentTokenId++;
        }
    }

    function gift_One_bca(address to) external {
        require(_currentTokenId <= MAX_TOKENS, 'Sold out');

        // NOTE: dna still derived from sender
        uint96 dna = uint96(uint256(keccak256(abi.encode(msg.sender, _currentTokenId, block.timestamp))));
        _mint(to, _currentTokenId, dna, '');

        unchecked {
            // Can't overflow
            _currentTokenId++;
        }
    }

    function mint_Several_nmW(uint256 count) external payable {
        require(count < 21, 'Max 20');
        unchecked {
            // Can't overflow
            require(_currentTokenId + count < MAX_TOKENS, 'Sold out');
            require(count * PRICE_WHEN_MINTING_SEVERAL_AT_A_TIME == msg.value, 'Wrong price');
        }

        uint256[] memory ids = new uint256[](count);
        uint96[] memory dnas = new uint96[](count);

        for (uint256 i = 0; i < count; ) {
            ids[i] = _currentTokenId + i;
            dnas[i] = uint96(uint256(keccak256(abi.encode(msg.sender, i, block.timestamp))));

            // An array can't have a total length
            // larger than the max uint256 value.
            unchecked {
                i++;
            }
        }

        _batchMint(msg.sender, ids, dnas, '');

        unchecked {
            // Can't overflow
            _currentTokenId += count;
        }
    }

    function totalSupply() public view returns (uint256) {
        unchecked {
            // Starts with 1
            return _currentTokenId - 1;
        }
    }

    function uri(uint256) public view override returns (string memory) {
        return _uri;
    }

    function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) {
        return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
    }

    function royaltyInfo(uint256, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount) {
        receiver = owner();
        royaltyAmount = (salePrice * _royaltyPartsPerMillion) / 1_000_000;
    }

    function isApprovedForAll(address owner, address operator) public view override returns (bool) {
        // Allow easier listing for sale on OpenSea. Based on
        // https://github.com/ProjectOpenSea/opensea-creatures/blob/f7257a043e82fae8251eec2bdde37a44fee474c4/migrations/2_deploy_contracts.js#L29
        if (_gaslessTrading) {
            if (block.chainid == 4) {
                if (ProxyRegistry(0xF57B2c51dED3A29e6891aba85459d600256Cf317).proxies(owner) == operator) {
                    return true;
                }
            } else if (block.chainid == 1) {
                if (ProxyRegistry(0xa5409ec958C83C3f309868babACA7c86DCB077c1).proxies(owner) == operator) {
                    return true;
                }
            }
        }

        return super.isApprovedForAll(owner, operator);
    }

    // Admin

    function setUri(string calldata newUri) public onlyOwner {
        _uri = newUri;
    }

    function setAllowGaslessListing(bool allow) public onlyOwner {
        _gaslessTrading = allow;
    }

    function setRoyaltyPPM(uint256 newValue) public onlyOwner {
        require(newValue < 1_000_000, 'Must be < 1e6');
        _royaltyPartsPerMillion = newValue;
    }

    function thankYouForSupportingUs_o4k() public payable onlyOwner {
        require(payable(msg.sender).send(address(this).balance));
    }

    function thankYouForSupportingUsERC20_V1M(IERC20 erc20Token) public onlyOwner {
        erc20Token.transfer(msg.sender, erc20Token.balanceOf(address(this)));
    }
}
ERC1155U.sol 254 lines
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Minimalist and gas efficient standard ERC1155 implementation.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC1155.sol)
abstract contract ERC1155U {
    /*///////////////////////////////////////////////////////////////
                                EVENTS
    //////////////////////////////////////////////////////////////*/

    event TransferSingle(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256 id,
        uint256 amount
    );

    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] amounts
    );

    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    event URI(string value, uint256 indexed id);

    /*///////////////////////////////////////////////////////////////
                            ERC1155 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256[10001] private _attrs;

    mapping(address => mapping(address => bool)) private _isApprovedForAll;

    /*///////////////////////////////////////////////////////////////
                             METADATA LOGIC
    //////////////////////////////////////////////////////////////*/

    function uri(uint256 id) public view virtual returns (string memory);

    /*///////////////////////////////////////////////////////////////
                             Ownership & Data
    //////////////////////////////////////////////////////////////*/

    function ownerOf(uint256 id) public view returns (address) {
        return address(uint160(_attrs[id] & 0x00ffffffffffffffffffffffffffffffffffffffff));
    }

    function dnaOf(uint256 id) public view returns (uint96) {
        return uint96(_attrs[id] >> 160);
    }

    function _setOwner(uint256 id, address to) private {
        _attrs[id] = (_attrs[id] & (0xffffffffffffffffffffffff << 160)) | uint160(to);
    }

    /*///////////////////////////////////////////////////////////////
                             ERC1155 LOGIC
    //////////////////////////////////////////////////////////////*/

    function isApprovedForAll(address owner, address operator) public view virtual returns (bool) {
        return _isApprovedForAll[owner][operator];
    }

    function setApprovalForAll(address operator, bool approved) public virtual {
        _isApprovedForAll[msg.sender][operator] = approved;

        emit ApprovalForAll(msg.sender, operator, approved);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual {
        require(msg.sender == from || isApprovedForAll(from, msg.sender), 'NOT_AUTHORIZED');
        require(amount == 1, 'Can only transfer one');
        require(ownerOf(id) == from, 'Not owner');

        _setOwner(id, to);

        emit TransferSingle(msg.sender, from, to, id, amount);

        require(
            to.code.length == 0
                ? to != address(0)
                : ERC1155TokenReceiver(to).onERC1155Received(msg.sender, from, id, amount, data) ==
                    ERC1155TokenReceiver.onERC1155Received.selector,
            'UNSAFE_RECIPIENT'
        );
    }

    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual {
        uint256 idsLength = ids.length; // Saves MLOADs.

        require(idsLength == amounts.length, 'LENGTH_MISMATCH');

        require(msg.sender == from || isApprovedForAll(from, msg.sender), 'NOT_AUTHORIZED');

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

            require(amount == 1, 'Can only transfer one');
            require(ownerOf(id) == from, 'Not owner');

            _setOwner(id, to);

            // An array can't have a total length
            // larger than the max uint256 value.
            unchecked {
                i++;
            }
        }

        emit TransferBatch(msg.sender, from, to, ids, amounts);

        require(
            to.code.length == 0
                ? to != address(0)
                : ERC1155TokenReceiver(to).onERC1155BatchReceived(msg.sender, from, ids, amounts, data) ==
                    ERC1155TokenReceiver.onERC1155BatchReceived.selector,
            'UNSAFE_RECIPIENT'
        );
    }

    function balanceOf(address owner, uint256 id) public view virtual returns (uint256 balance) {
        if (ownerOf(id) == owner) {
            balance = 1;
        }
    }

    function balanceOfBatch(address[] memory owners, uint256[] memory ids)
        public
        view
        virtual
        returns (uint256[] memory balances)
    {
        uint256 ownersLength = owners.length; // Saves MLOADs.

        require(ownersLength == ids.length, 'LENGTH_MISMATCH');

        balances = new uint256[](owners.length);

        // Unchecked because the only math done is incrementing
        // the array index counter which cannot possibly overflow.
        unchecked {
            for (uint256 i = 0; i < ownersLength; i++) {
                balances[i] = balanceOf(owners[i], ids[i]);
            }
        }
    }

    /*///////////////////////////////////////////////////////////////
                              ERC165 LOGIC
    //////////////////////////////////////////////////////////////*/

    function supportsInterface(bytes4 interfaceId) public pure virtual returns (bool) {
        return
            interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165
            interfaceId == 0xd9b67a26 || // ERC165 Interface ID for ERC1155
            interfaceId == 0x0e89341c; // ERC165 Interface ID for ERC1155MetadataURI
    }

    /*///////////////////////////////////////////////////////////////
                        INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    function _mint(
        address to,
        uint256 id,
        uint96 dna,
        bytes memory data
    ) internal {
        require(_attrs[id] == 0, 'Already minted');
        _attrs[id] = (uint256(dna) << 160) | uint160(to);

        emit TransferSingle(msg.sender, address(0), to, id, 1);

        require(
            to.code.length == 0
                ? to != address(0)
                : ERC1155TokenReceiver(to).onERC1155Received(msg.sender, address(0), id, 1, data) ==
                    ERC1155TokenReceiver.onERC1155Received.selector,
            'UNSAFE_RECIPIENT'
        );
    }

    function _batchMint(
        address to,
        uint256[] memory ids,
        uint96[] memory dnas,
        bytes memory data
    ) internal {
        uint256 idsLength = ids.length; // Saves MLOADs.
        uint256[] memory amounts = new uint256[](idsLength);

        for (uint256 i = 0; i < idsLength; ) {
            uint256 id = ids[i];
            uint96 dna = dnas[i];
            require(_attrs[id] == 0, 'Already minted');
            _attrs[id] = (uint256(dna) << 160) | uint160(to);
            amounts[i] = 1;

            // An array can't have a total length
            // larger than the max uint256 value.
            unchecked {
                i++;
            }
        }

        emit TransferBatch(msg.sender, address(0), to, ids, amounts);

        require(
            to.code.length == 0
                ? to != address(0)
                : ERC1155TokenReceiver(to).onERC1155BatchReceived(msg.sender, address(0), ids, amounts, data) ==
                    ERC1155TokenReceiver.onERC1155BatchReceived.selector,
            'UNSAFE_RECIPIENT'
        );
    }
}

/// @notice A generic interface for a contract which properly accepts ERC1155 tokens.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC1155.sol)
interface ERC1155TokenReceiver {
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external returns (bytes4);

    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external returns (bytes4);
}
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;
    }
}
Ownable.sol 71 lines
// SPDX-License-Identifier: MIT

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() {
        _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);
    }
}
IERC20.sol 81 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @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);
}

Read Contract

balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
dnaOf 0x3e39d638 → uint96
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
royaltyInfo 0x2a55205a → address, uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
uri 0x0e89341c → string

Write Contract 13 functions

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

gift_One_bca 0x000008a8
address to
mint_One_4d 0x00006000
No parameters
mint_Several_nmW 0x000000dd
uint256 count
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
setAllowGaslessListing 0x16e8d273
bool allow
setApprovalForAll 0xa22cb465
address operator
bool approved
setRoyaltyPPM 0x8395b842
uint256 newValue
setUri 0x9b642de1
string newUri
thankYouForSupportingUsERC20_V1M 0xc06ddc38
address erc20Token
thankYouForSupportingUs_o4k 0x0000ab4f
No parameters
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

No transactions found for this address