Address Contract Partially Verified
Address
0x366fea9d4183d5088952849Ea02b2Db7207686F0
Balance
0 ETH
Nonce
1
Code Size
13940 bytes
Creator
0x7B69d07E...5d92 at tx 0x709bf254...9e1a9c
Indexed Transactions
0 (1 on-chain, 1.0% indexed)
Contract Bytecode
13940 bytes
0x60806040526004361061025c5760003560e01c806351f468c011610144578063a22cb465116100b6578063e35568cb1161007a578063e35568cb14610708578063e985e9c514610730578063ecbfc07714610779578063f2fde38b14610793578063fd3a0f34146107b3578063ff48c1c0146107d357600080fd5b8063a22cb46514610662578063b88d4fde14610682578063c469bff1146106a2578063c87b56dd146106d3578063ca3cb522146106f357600080fd5b8063715018a611610108578063715018a6146105ba57806372cd1fa5146105cf5780637d97c9d2146105ef57806381ac81031461060f5780638da5cb5b1461062f57806395d89b411461064d57600080fd5b806351f468c01461050d57806355dd574c1461052d5780635bf5d54c1461054c5780636352211e1461057a57806370a082311461059a57600080fd5b806323b872dd116101dd5780633f2578c6116101a15780633f2578c61461046757806342842e0e1461048757806342a3c3ae146104a7578063438b6300146104ba57806346e04a2f146104e75780634bbf3a7a146104fa57600080fd5b806323b872dd146103c85780632a55205a146103e85780632af11474146104275780632eb4a7ab1461043c5780633ccfd60b1461045257600080fd5b80630adc688f116102245780630adc688f1461032757806318160ddd146103475780631a735f18146103665780631fe543e31461039357806321f6d587146103b357600080fd5b806301ffc9a71461026157806303502b5a1461029657806306fdde03146102ad578063081812fc146102cf578063095ea7b314610307575b600080fd5b34801561026d57600080fd5b5061028161027c366004612fde565b610803565b60405190151581526020015b60405180910390f35b3480156102a257600080fd5b506102ab610864565b005b3480156102b957600080fd5b506102c26108ab565b60405161028d919061334e565b3480156102db57600080fd5b506102ef6102ea366004612fc5565b61093d565b6040516001600160a01b03909116815260200161028d565b34801561031357600080fd5b506102ab610322366004612ee9565b6109d2565b34801561033357600080fd5b506102ab610342366004613033565b610ae8565b34801561035357600080fd5b506011545b60405190815260200161028d565b34801561037257600080fd5b50610358610381366004612fc5565b600c6020526000908152604090205481565b34801561039f57600080fd5b506102ab6103ae3660046130ad565b610b36565b3480156103bf57600080fd5b50600f54610358565b3480156103d457600080fd5b506102ab6103e3366004612df6565b610bbe565b3480156103f457600080fd5b50610408610403366004613165565b610bef565b604080516001600160a01b03909316835260208301919091520161028d565b34801561043357600080fd5b506102ab610c9b565b34801561044857600080fd5b50610358601a5481565b34801561045e57600080fd5b506102ab610ee1565b34801561047357600080fd5b506102ab610482366004613018565b610ff6565b34801561049357600080fd5b506102ab6104a2366004612df6565b6110a4565b6102ab6104b5366004612f4b565b6110bf565b3480156104c657600080fd5b506104da6104d5366004612da1565b61147d565b60405161028d919061330a565b6102ab6104f5366004612fc5565b61157b565b6102ab610508366004612fc5565b611870565b34801561051957600080fd5b506102ab610528366004612fc5565b611bc7565b34801561053957600080fd5b50600e5461028190610100900460ff1681565b34801561055857600080fd5b506014546105679061ffff1681565b60405161ffff909116815260200161028d565b34801561058657600080fd5b506102ef610595366004612fc5565b611bf6565b3480156105a657600080fd5b506103586105b5366004612da1565b611c6d565b3480156105c657600080fd5b506102ab611cf4565b3480156105db57600080fd5b506102ab6105ea366004612f13565b611d68565b3480156105fb57600080fd5b506102ab61060a366004612fc5565b611d9c565b34801561061b57600080fd5b506102ab61062a366004613018565b611dcb565b34801561063b57600080fd5b506002546001600160a01b03166102ef565b34801561065957600080fd5b506102c2611e0d565b34801561066e57600080fd5b506102ab61067d366004612ead565b611e1c565b34801561068e57600080fd5b506102ab61069d366004612e32565b611ee1565b3480156106ae57600080fd5b506105676106bd366004612fc5565b60176020526000908152604090205461ffff1681565b3480156106df57600080fd5b506102c26106ee366004612fc5565b611f19565b3480156106ff57600080fd5b506102ab611ff3565b34801561071457600080fd5b5060145461ffff166000908152601b6020526040902054610358565b34801561073c57600080fd5b5061028161074b366004612dc3565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b34801561078557600080fd5b50600e546102819060ff1681565b34801561079f57600080fd5b506102ab6107ae366004612da1565b61203a565b3480156107bf57600080fd5b506102ab6107ce366004613187565b612125565b3480156107df57600080fd5b506102816107ee366004612fc5565b600d6020526000908152604090205460ff1681565b60006001600160e01b031982166380ac58cd60e01b148061083457506001600160e01b03198216635b5e139f60e01b145b8061084f57506001600160e01b0319821663152a902d60e11b145b8061085e575061085e8261219b565b92915050565b6002546001600160a01b031633146108975760405162461bcd60e51b815260040161088e906133ea565b60405180910390fd5b600e805460ff19811660ff90911615179055565b6060600380546108ba9061352e565b80601f01602080910402602001604051908101604052809291908181526020018280546108e69061352e565b80156109335780601f1061090857610100808354040283529160200191610933565b820191906000526020600020905b81548152906001019060200180831161091657829003601f168201915b5050505050905090565b6000818152600560205260408120546001600160a01b03166109b65760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161088e565b506000908152600760205260409020546001600160a01b031690565b60006109dd82611bf6565b9050806001600160a01b0316836001600160a01b03161415610a4b5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161088e565b336001600160a01b0382161480610a675750610a67813361074b565b610ad95760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161088e565b610ae383836121d0565b505050565b6002546001600160a01b03163314610b125760405162461bcd60e51b815260040161088e906133ea565b61ffff821660009081526019602090815260409091208251610ae392840190612c83565b336001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e699091614610bb05760405163073e64fd60e21b81523360048201526001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e6990916602482015260440161088e565b610bba828261223e565b5050565b610bc833826122bf565b610be45760405162461bcd60e51b815260040161088e9061341f565b610ae38383836123b6565b60008281526001602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610c645750604080518082019091526000546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610c83906001600160601b0316876134cc565b610c8d91906134b8565b915196919550909350505050565b6002546001600160a01b03163314610cc55760405162461bcd60e51b815260040161088e906133ea565b601054601154610cd69060146134a0565b1115610d245760405162461bcd60e51b815260206004820152601960248201527f4e6f20746f6b656e73206c65667420746f207265736572766500000000000000604482015260640161088e565b6012546013546fffffffffffffffffffffffffffffffff90911611610db15760405162461bcd60e51b815260206004820152603d60248201527f313030204e6674732068617665206265656e20616c726561647920726573657260448201527f7665642c20796f752063616e206e6f742072657365727665206d6f7265000000606482015260840161088e565b6040805160148082526102a082019092526000916020820161028080368337019050509050601460136000828254610de991906134a0565b90915550600090505b6014811015610ed357601160008154610e0a9061358b565b919050819055828281518110610e2257610e226135fc565b602002602001018181525050600060176000848481518110610e4657610e466135fc565b6020026020010151815260200190815260200160002060006101000a81548161ffff021916908361ffff160217905550818181518110610e8857610e886135fc565b602002602001015160186000848481518110610ea657610ea66135fc565b60200260200101518152602001908152602001600020819055508080610ecb9061358b565b915050610df2565b50610ede3382612556565b50565b6002546001600160a01b03163314610f0b5760405162461bcd60e51b815260040161088e906133ea565b47600073974a394ea3d1eabdabb53aa0b102b8894f16c60b612710610f328461028a6134cc565b610f3c91906134b8565b604051600081818185875af1925050503d8060008114610f78576040519150601f19603f3d011682016040523d82523d6000602084013e610f7d565b606091505b5050905080610f8b57600080fd5b600033612710610f9d856124866134cc565b610fa791906134b8565b604051600081818185875af1925050503d8060008114610fe3576040519150601f19603f3d011682016040523d82523d6000602084013e610fe8565b606091505b5050905080610ae357600080fd5b6002546001600160a01b031633146110205760405162461bcd60e51b815260040161088e906133ea565b61ffff81166000908152601b6020526040902054610ede5760015b6105dc8161ffff1611610bba5761ffff8083166000908152601b60209081526040822080546001810182559083529120601082040180548484166002600f909416939093026101000a92830292909302199092161790558061109c81613569565b91505061103b565b610ae383838360405180602001604052806000815250611ee1565b3233146110de5760405162461bcd60e51b815260040161088e906133b3565b600e54610100900460ff166111355760405162461bcd60e51b815260206004820152601860248201527f50726573616c65206e6f74207374617274656420796574200000000000000000604482015260640161088e565b336000908152601560205260409020546002906111539083906134a0565b11156111a15760405162461bcd60e51b815260206004820152601c60248201527f596f752063616e6e6f7420636c61696d206d6f726520746f6b656e7300000000604482015260640161088e565b601054816011546111b291906134a0565b11156112005760405162461bcd60e51b815260206004820152601c60248201527f4e6f20746f6b656e73206c65667420746f20626520636c61696d656400000000604482015260640161088e565b80600f5461120e91906134cc565b3410156112675760405162461bcd60e51b815260206004820152602160248201527f4e6f7420656e6f75676820457468657220746f20636c61696d206120746f6b656044820152603760f91b606482015260840161088e565b33600090815260156020526040812080548392906112869084906134a0565b90915550506040516bffffffffffffffffffffffff193360601b16602082015260009060340160405160208183030381529060405280519060200120905061130584848080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050601a549150849050612745565b6113425760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b210283937b7b31760911b604482015260640161088e565b6000826001600160401b0381111561135c5761135c613612565b604051908082528060200260200182016040528015611385578160200160208202803683370190505b50905060005b8381101561146b576011600081546113a29061358b565b9190508190558282815181106113ba576113ba6135fc565b6020026020010181815250506000601760008484815181106113de576113de6135fc565b6020026020010151815260200190815260200160002060006101000a81548161ffff021916908361ffff160217905550818181518110611420576114206135fc565b60200260200101516018600084848151811061143e5761143e6135fc565b602002602001015181526020019081526020016000208190555080806114639061358b565b91505061138b565b506114763382612556565b5050505050565b6060600061148a83611c6d565b90506000816001600160401b038111156114a6576114a6613612565b6040519080825280602002602001820160405280156114cf578160200160208202803683370190505b509050600160005b83811080156114e857506105dc8211155b15611571576000828152600560205260409020546001600160a01b03161561155f57600061151583611bf6565b9050866001600160a01b0316816001600160a01b0316141561155d5782848381518110611544576115446135fc565b6020908102919091010152816115598161358b565b9250505b505b816115698161358b565b9250506114d7565b5090949350505050565b32331461159a5760405162461bcd60e51b815260040161088e906133b3565b600e5460ff166115e05760405162461bcd60e51b8152602060048201526011602482015270596f752061726520746f6f206561726c7960781b604482015260640161088e565b80600f546115ee91906134cc565b3410156116495760405162461bcd60e51b8152602060048201526024808201527f4e6f7420656e6f75676820457468657220746f20636c61696d2074686520746f6044820152636b656e7360e01b606482015260840161088e565b336000908152601660205260409020546004906116679083906134a0565b11156116b55760405162461bcd60e51b815260206004820152601c60248201527f596f752063616e6e6f7420636c61696d206d6f726520746f6b656e7300000000604482015260640161088e565b601054816011546116c691906134a0565b11156117145760405162461bcd60e51b815260206004820152601c60248201527f4e6f20746f6b656e73206c65667420746f20626520636c61696d656400000000604482015260640161088e565b6000816001600160401b0381111561172e5761172e613612565b604051908082528060200260200182016040528015611757578160200160208202803683370190505b503360009081526016602052604081208054929350849290919061177c9084906134a0565b90915550600090505b828110156118655760116000815461179c9061358b565b9190508190558282815181106117b4576117b46135fc565b6020026020010181815250506000601760008484815181106117d8576117d86135fc565b6020026020010151815260200190815260200160002060006101000a81548161ffff021916908361ffff16021790555081818151811061181a5761181a6135fc565b602002602001015160186000848481518110611838576118386135fc565b6020026020010151815260200190815260200160002081905550808061185d9061358b565b915050611785565b50610bba3382612556565b32331461188f5760405162461bcd60e51b815260040161088e906133b3565b600e5460ff166118d55760405162461bcd60e51b8152602060048201526011602482015270596f752061726520746f6f206561726c7960781b604482015260640161088e565b336118df82611bf6565b6001600160a01b0316146119415760405162461bcd60e51b815260206004820152602360248201527f596f7520617265206e6f7420746865206f776e6572206f66207468697320746f60448201526235b2b760e91b606482015260840161088e565b60145460008281526017602052604090205461ffff9182169116106119b75760405162461bcd60e51b815260206004820152602660248201527f596f7520617265206e6f7420656c696769626c6520666f722063757272656e7460448201526520737461676560d01b606482015260840161088e565b6000818152600d602052604090205460ff1615611a165760405162461bcd60e51b815260206004820152601a60248201527f596f7520686176652072657175657374656420616c7265616479000000000000604482015260640161088e565b60145461ffff166000908152601b602052604090205460011115611a7c5760405162461bcd60e51b815260206004820152601960248201527f73776170696e6720706670206e6f7420617661696c61626c6500000000000000604482015260640161088e565b60008181526017602052604090205461ffff1615611ae657600f54341015611ae65760405162461bcd60e51b815260206004820181905260248201527f4e6f7420656e6f75676820457468657220746f20737761702074686520504650604482015260640161088e565b600954600a54600b546040516305d3b1d360e41b81526004810192909252600160a01b83046001600160401b031660248301526003604483015263ffffffff166064820152600160848201526000916001600160a01b031690635d3b1d309060a401602060405180830381600087803b158015611b6257600080fd5b505af1158015611b76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9a9190613094565b6000908152600c60209081526040808320859055938252600d905291909120805460ff1916600117905550565b6002546001600160a01b03163314611bf15760405162461bcd60e51b815260040161088e906133ea565b600f55565b6000818152600560205260408120546001600160a01b03168061085e5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161088e565b60006001600160a01b038216611cd85760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161088e565b506001600160a01b031660009081526006602052604090205490565b6002546001600160a01b03163314611d1e5760405162461bcd60e51b815260040161088e906133ea565b6002546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600280546001600160a01b0319169055565b6002546001600160a01b03163314611d925760405162461bcd60e51b815260040161088e906133ea565b610bba828261275b565b6002546001600160a01b03163314611dc65760405162461bcd60e51b815260040161088e906133ea565b601a55565b6002546001600160a01b03163314611df55760405162461bcd60e51b815260040161088e906133ea565b6014805461ffff191661ffff92909216919091179055565b6060600480546108ba9061352e565b6001600160a01b038216331415611e755760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161088e565b3360008181526008602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611eeb33836122bf565b611f075760405162461bcd60e51b815260040161088e9061341f565b611f1384848484612858565b50505050565b6000818152600560205260409020546060906001600160a01b0316611f985760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b606482015260840161088e565b60008281526017602090815260408083205461ffff16835260198252808320858452601890925290912054611fcc9061288b565b604051602001611fdd929190613226565b6040516020818303038152906040529050919050565b6002546001600160a01b0316331461201d5760405162461bcd60e51b815260040161088e906133ea565b600e805461ff001981166101009182900460ff1615909102179055565b6002546001600160a01b031633146120645760405162461bcd60e51b815260040161088e906133ea565b6001600160a01b0381166120c95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161088e565b6002546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600280546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b0316331461214f5760405162461bcd60e51b815260040161088e906133ea565b600980546001600160401b03909416600160a01b0267ffffffffffffffff60a01b1990941693909317909255600a55600b805463ffffffff90921663ffffffff19909216919091179055565b60006001600160e01b0319821663152a902d60e11b148061085e57506301ffc9a760e01b6001600160e01b031983161461085e565b600081815260076020526040902080546001600160a01b0319166001600160a01b038416908117909155819061220582611bf6565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000828152600c60205260408120546014548351919261227b9261ffff9092169185919061226e5761226e6135fc565b6020026020010151612988565b60009182526018602090815260408084209290925560145460178252828420805461ffff191661ffff909216919091179055600d90529020805460ff191690555050565b6000818152600560205260408120546001600160a01b03166123385760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161088e565b600061234383611bf6565b9050806001600160a01b0316846001600160a01b0316148061237e5750836001600160a01b03166123738461093d565b6001600160a01b0316145b806123ae57506001600160a01b0380821660009081526008602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b03166123c982611bf6565b6001600160a01b0316146124315760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b606482015260840161088e565b6001600160a01b0382166124935760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161088e565b61249e6000826121d0565b6001600160a01b03831660009081526006602052604081208054600192906124c79084906134eb565b90915550506001600160a01b03821660009081526006602052604081208054600192906124f59084906134a0565b909155505060008181526005602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001600160a01b0382166125ac5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161088e565b80516001600160a01b038316600090815260066020526040812080549091906125d69084906134a0565b90915550600090505b8151811015610ae3576126228282815181106125fd576125fd6135fc565b60200260200101516000908152600560205260409020546001600160a01b0316151590565b1561266f5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161088e565b612687600084848481518110611f1357611f136135fc565b826005600084848151811061269e5761269e6135fc565b6020026020010151815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508181815181106126ea576126ea6135fc565b6020026020010151836001600160a01b031660006001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a48061273d8161358b565b9150506125df565b6000826127528584612b02565b14949350505050565b6127106001600160601b03821611156127c95760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b606482015260840161088e565b6001600160a01b03821661281f5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c696420726563656976657200000000000000604482015260640161088e565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600055565b6128638484846123b6565b61286f84848484612b76565b611f135760405162461bcd60e51b815260040161088e90613361565b6060816128af5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156128d957806128c38161358b565b91506128d29050600a836134b8565b91506128b3565b6000816001600160401b038111156128f3576128f3613612565b6040519080825280601f01601f19166020018201604052801561291d576020820181803683370190505b5090505b84156123ae576129326001836134eb565b915061293f600a866135a6565b61294a9060306134a0565b60f81b81838151811061295f5761295f6135fc565b60200101906001600160f81b031916908160001a905350612981600a866134b8565b9450612921565b61ffff82166000908152601b602052604081205481906129a890846135a6565b61ffff85166000908152601b6020526040812080549293509091839081106129d2576129d26135fc565b6000918252602080832060108304015461ffff8981168552601b90925260409093208054600f9093166002026101000a909304169250612a14906001906134eb565b81548110612a2457612a246135fc565b90600052602060002090601091828204019190066002029054906101000a900461ffff16601b60008761ffff1661ffff1681526020019081526020016000208381548110612a7457612a746135fc565b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff160217905550601b60008661ffff1661ffff168152602001908152602001600020805480612acd57612acd6135e6565b600082815260209020601060001990920191820401805461ffff6002600f8516026101000a0219169055905591505092915050565b600081815b8451811015612b6e576000858281518110612b2457612b246135fc565b60200260200101519050808311612b4a5760008381526020829052604090209250612b5b565b600081815260208490526040902092505b5080612b668161358b565b915050612b07565b509392505050565b60006001600160a01b0384163b15612c7857604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612bba9033908990889088906004016132cd565b602060405180830381600087803b158015612bd457600080fd5b505af1925050508015612c04575060408051601f3d908101601f19168201909252612c0191810190612ffb565b60015b612c5e573d808015612c32576040519150601f19603f3d011682016040523d82523d6000602084013e612c37565b606091505b508051612c565760405162461bcd60e51b815260040161088e90613361565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506123ae565b506001949350505050565b828054612c8f9061352e565b90600052602060002090601f016020900481019282612cb15760008555612cf7565b82601f10612cca57805160ff1916838001178555612cf7565b82800160010185558215612cf7579182015b82811115612cf7578251825591602001919060010190612cdc565b50612d03929150612d07565b5090565b5b80821115612d035760008155600101612d08565b60006001600160401b03831115612d3557612d35613612565b612d48601f8401601f1916602001613470565b9050828152838383011115612d5c57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b0381168114612d8a57600080fd5b919050565b803561ffff81168114612d8a57600080fd5b600060208284031215612db357600080fd5b612dbc82612d73565b9392505050565b60008060408385031215612dd657600080fd5b612ddf83612d73565b9150612ded60208401612d73565b90509250929050565b600080600060608486031215612e0b57600080fd5b612e1484612d73565b9250612e2260208501612d73565b9150604084013590509250925092565b60008060008060808587031215612e4857600080fd5b612e5185612d73565b9350612e5f60208601612d73565b92506040850135915060608501356001600160401b03811115612e8157600080fd5b8501601f81018713612e9257600080fd5b612ea187823560208401612d1c565b91505092959194509250565b60008060408385031215612ec057600080fd5b612ec983612d73565b915060208301358015158114612ede57600080fd5b809150509250929050565b60008060408385031215612efc57600080fd5b612f0583612d73565b946020939093013593505050565b60008060408385031215612f2657600080fd5b612f2f83612d73565b915060208301356001600160601b0381168114612ede57600080fd5b600080600060408486031215612f6057600080fd5b83356001600160401b0380821115612f7757600080fd5b818601915086601f830112612f8b57600080fd5b813581811115612f9a57600080fd5b8760208260051b8501011115612faf57600080fd5b6020928301989097509590910135949350505050565b600060208284031215612fd757600080fd5b5035919050565b600060208284031215612ff057600080fd5b8135612dbc81613628565b60006020828403121561300d57600080fd5b8151612dbc81613628565b60006020828403121561302a57600080fd5b612dbc82612d8f565b6000806040838503121561304657600080fd5b61304f83612d8f565b915060208301356001600160401b0381111561306a57600080fd5b8301601f8101851361307b57600080fd5b61308a85823560208401612d1c565b9150509250929050565b6000602082840312156130a657600080fd5b5051919050565b600080604083850312156130c057600080fd5b823591506020808401356001600160401b03808211156130df57600080fd5b818601915086601f8301126130f357600080fd5b81358181111561310557613105613612565b8060051b9150613116848301613470565b8181528481019084860184860187018b101561313157600080fd5b600095505b83861015613154578035835260019590950194918601918601613136565b508096505050505050509250929050565b6000806040838503121561317857600080fd5b50508035926020909101359150565b60008060006060848603121561319c57600080fd5b83356001600160401b03811681146131b357600080fd5b925060208401359150604084013563ffffffff811681146131d357600080fd5b809150509250925092565b600081518084526131f6816020860160208601613502565b601f01601f19169290920160200192915050565b6000815161321c818560208601613502565b9290920192915050565b600080845481600182811c91508083168061324257607f831692505b602080841082141561326257634e487b7160e01b86526022600452602486fd5b8180156132765760018114613287576132b4565b60ff198616895284890196506132b4565b60008b81526020902060005b868110156132ac5781548b820152908501908301613293565b505084890196505b5050505050506132c4818561320a565b95945050505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613300908301846131de565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561334257835183529284019291840191600101613326565b50909695505050505050565b602081526000612dbc60208301846131de565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252601e908201527f5468652063616c6c657220697320616e6f7468657220636f6e74726163740000604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b604051601f8201601f191681016001600160401b038111828210171561349857613498613612565b604052919050565b600082198211156134b3576134b36135ba565b500190565b6000826134c7576134c76135d0565b500490565b60008160001904831182151516156134e6576134e66135ba565b500290565b6000828210156134fd576134fd6135ba565b500390565b60005b8381101561351d578181015183820152602001613505565b83811115611f135750506000910152565b600181811c9082168061354257607f821691505b6020821081141561356357634e487b7160e01b600052602260045260246000fd5b50919050565b600061ffff80831681811415613581576135816135ba565b6001019392505050565b600060001982141561359f5761359f6135ba565b5060010190565b6000826135b5576135b56135d0565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114610ede57600080fdfea2646970667358221220bfd2d217c435b24f3dcb2494a86e1d67471eb96c1a22c76aa392ec735a97b51464736f6c63430008070033
Verified Source Code Partial Match
Compiler: v0.8.7+commit.e28d00a7
EVM: london
Optimization: Yes (200 runs)
CosmeComics.sol 1772 lines
/**
*Submitted for verification at Etherscan.io on 2022-05-22
*/
// 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);
}
/**
* @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;
}
}
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant alphabet = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(
uint256 value,
uint256 length
) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = alphabet[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
/*
* @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) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @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;
// solhint-disable-next-line no-inline-assembly
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"
);
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(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");
// solhint-disable-next-line avoid-low-level-calls
(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");
// solhint-disable-next-line avoid-low-level-calls
(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");
// solhint-disable-next-line avoid-low-level-calls
(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
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
*/
function royaltyInfo(
uint256 tokenId,
uint256 salePrice
) external view returns (address receiver, uint256 royaltyAmount);
}
/**
* @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
*
* Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
* specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
*
* Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
* fee is specified in basis points by default.
*
* IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
* https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
* voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
*
* _Available since v4.5._
*/
abstract contract ERC2981 is IERC2981, ERC165 {
struct RoyaltyInfo {
address receiver;
uint96 royaltyFraction;
}
RoyaltyInfo private _defaultRoyaltyInfo;
mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(
bytes4 interfaceId
) public view virtual override(IERC165, ERC165) returns (bool) {
return
interfaceId == type(IERC2981).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @inheritdoc IERC2981
*/
function royaltyInfo(
uint256 _tokenId,
uint256 _salePrice
) public view virtual override returns (address, uint256) {
RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];
if (royalty.receiver == address(0)) {
royalty = _defaultRoyaltyInfo;
}
uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) /
_feeDenominator();
return (royalty.receiver, royaltyAmount);
}
/**
* @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
* fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
* override.
*/
function _feeDenominator() internal pure virtual returns (uint96) {
return 10000;
}
/**
* @dev Sets the royalty information that all ids in this contract will default to.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setDefaultRoyalty(
address receiver,
uint96 feeNumerator
) internal virtual {
require(
feeNumerator <= _feeDenominator(),
"ERC2981: royalty fee will exceed salePrice"
);
require(receiver != address(0), "ERC2981: invalid receiver");
_defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Removes default royalty information.
*/
function _deleteDefaultRoyalty() internal virtual {
delete _defaultRoyaltyInfo;
}
/**
* @dev Sets the royalty information for a specific token id, overriding the global default.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator.
*/
function _setTokenRoyalty(
uint256 tokenId,
address receiver,
uint96 feeNumerator
) internal virtual {
require(
feeNumerator <= _feeDenominator(),
"ERC2981: royalty fee will exceed salePrice"
);
require(receiver != address(0), "ERC2981: Invalid parameters");
_tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
}
/**
* @dev Resets royalty information for the token id back to the global default.
*/
function _resetTokenRoyalty(uint256 tokenId) internal virtual {
delete _tokenRoyaltyInfo[tokenId];
}
}
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(
address indexed from,
address indexed to,
uint256 indexed tokenId
);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(
address indexed owner,
address indexed approved,
uint256 indexed tokenId
);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(
address indexed owner,
address indexed operator,
bool approved
);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(
uint256 tokenId
) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(
address owner,
address operator
) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(
address owner,
uint256 index
) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
/**
* @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() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), 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 {
emit OwnershipTransferred(_owner, address(0));
_owner = 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"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
abstract contract ERC721 is
Context,
ERC2981,
IERC721,
IERC721Metadata,
Ownable
{
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) internal _owners;
// Mapping owner address to token count
mapping(address => uint256) internal _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(
bytes4 interfaceId
) public view virtual override(ERC2981, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
interfaceId == type(IERC2981).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(
address owner
) public view virtual override returns (uint256) {
require(
owner != address(0),
"ERC721: balance query for the zero address"
);
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(
uint256 tokenId
) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(
owner != address(0),
"ERC721: owner query for nonexistent token"
);
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Base URI for computing {tokenURI}. Empty by default, can be overriden
* in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner ||
ERC721.isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(
uint256 tokenId
) public view virtual override returns (address) {
require(
_exists(tokenId),
"ERC721: approved query for nonexistent token"
);
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(
address operator,
bool approved
) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(
address owner,
address operator
) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721: transfer caller is not owner nor approved"
);
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(
_isApprovedOrOwner(_msgSender(), tokenId),
"ERC721: transfer caller is not owner nor approved"
);
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(
_checkOnERC721Received(from, to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(
address spender,
uint256 tokenId
) internal view virtual returns (bool) {
require(
_exists(tokenId),
"ERC721: operator query for nonexistent token"
);
address owner = ERC721.ownerOf(tokenId);
return (spender == owner ||
getApproved(tokenId) == spender ||
ERC721.isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
function _batchMint(
address to,
uint256[] memory tokenIds
) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
_balances[to] += tokenIds.length;
for (uint256 i; i < tokenIds.length; i++) {
require(!_exists(tokenIds[i]), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenIds[i]);
_owners[tokenIds[i]] = to;
emit Transfer(address(0), to, tokenIds[i]);
}
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(
ERC721.ownerOf(tokenId) == from,
"ERC721: transfer of token that is not own"
);
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try
IERC721Receiver(to).onERC721Received(
_msgSender(),
from,
tokenId,
_data
)
returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert(
"ERC721: transfer to non ERC721Receiver implementer"
);
} else {
// solhint-disable-next-line no-inline-assembly
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
/**
* @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.
*
* WARNING: You should avoid using leaf values that are 64 bytes long prior to
* hashing, or use a hash function other than keccak256 for hashing leaves.
* This is because the concatenation of a sorted pair of internal nodes in
* the merkle tree could be reinterpreted as a leaf value.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(
bytes32[] memory proof,
bytes32 leaf
) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = _efficientHash(computedHash, proofElement);
} else {
// Hash(current element of the proof + current computed hash)
computedHash = _efficientHash(proofElement, computedHash);
}
}
return computedHash;
}
function _efficientHash(
bytes32 a,
bytes32 b
) private pure returns (bytes32 value) {
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
interface VRFCoordinatorV2Interface {
function getRequestConfig()
external
view
returns (uint16, uint32, bytes32[] memory);
function requestRandomWords(
bytes32 keyHash,
uint64 subId,
uint16 minimumRequestConfirmations,
uint32 callbackGasLimit,
uint32 numWords
) external returns (uint256 requestId);
function createSubscription() external returns (uint64 subId);
function getSubscription(
uint64 subId
)
external
view
returns (
uint96 balance,
uint64 reqCount,
address owner,
address[] memory consumers
);
function requestSubscriptionOwnerTransfer(
uint64 subId,
address newOwner
) external;
function acceptSubscriptionOwnerTransfer(uint64 subId) external;
function addConsumer(uint64 subId, address consumer) external;
function removeConsumer(uint64 subId, address consumer) external;
function cancelSubscription(uint64 subId, address to) external;
function pendingRequestExists(uint64 subId) external view returns (bool);
}
abstract contract VRFConsumerBaseV2 {
error OnlyCoordinatorCanFulfill(address have, address want);
address private immutable vrfCoordinator;
constructor(address _vrfCoordinator) {
vrfCoordinator = _vrfCoordinator;
}
function fulfillRandomWords(
uint256 requestId,
uint256[] memory randomWords
) internal virtual;
function rawFulfillRandomWords(
uint256 requestId,
uint256[] memory randomWords
) external {
if (msg.sender != vrfCoordinator) {
revert OnlyCoordinatorCanFulfill(msg.sender, vrfCoordinator);
}
fulfillRandomWords(requestId, randomWords);
}
}
contract CosmeComics is ERC721, VRFConsumerBaseV2 {
VRFCoordinatorV2Interface private COORDINATOR;
using Strings for uint256;
uint64 private s_subscriptionId = 564;
bytes32 private s_keyHash =
0x8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef;
uint32 private CALLBACK_GAS_LIMIT = 100000;
uint16 constant REQUEST_CONFIRMATIONS = 3;
mapping(uint256 => uint256) public requestMap;
mapping(uint256 => bool) public blockedToken;
/**
* @notice Allow owner to change VRF config
*/
function setVRFConfig(
uint64 sID,
bytes32 keyHash,
uint32 gasLimit
) external onlyOwner {
s_subscriptionId = sID;
s_keyHash = keyHash;
CALLBACK_GAS_LIMIT = gasLimit;
}
modifier callerIsUser() {
require(tx.origin == msg.sender, "The caller is another contract");
_;
}
modifier claimStarted() {
require(startClaim, "You are too early");
_;
}
bool public startClaim = false;
bool public startPreSale = false;
uint256 private claimPrice = 0.068 ether;
uint256 private totalTokens = 1500;
uint256 private totalMintedTokens = 0;
uint128 private resNfts = 100;
uint256 private totalReserved = 0;
uint16 public currentStage = 0;
mapping(address => uint256) private claimedTokensPreSale;
mapping(address => uint256) private claimedTokensPublicSale;
mapping(uint256 => uint16) public tokenStage;
mapping(uint256 => uint256) internal tokenMap;
mapping(uint16 => string) private baseURI;
bytes32 public merkleRoot =
0xbcc7b3368728ef5149db9e16de1d44fc7576cb22cdf60a5f0586b38c4e39edff;
mapping(uint16 => uint16[]) private availableTokens;
constructor() ERC721("Cosme", "COSME") VRFConsumerBaseV2(0x271682DEB8C4E0901D1a1550aD2e64D568E69909) {
COORDINATOR = VRFCoordinatorV2Interface(0x271682DEB8C4E0901D1a1550aD2e64D568E69909);
_setDefaultRoyalty(0xE0b632314A09561c3c4E35f247B6390dB9204De6, 500);
baseURI[0] = "ipfs://QmcuRCBU1FFgniaYVdVZs4FPYS665C419suujvU6e6BeeH/?";
}
/**
* @notice Allow owner to update the royalty fee
*/
function setRoyaltyFee(address addr, uint96 fee) external onlyOwner {
_setDefaultRoyalty(addr, fee);
}
/**
* @dev Sets the claim price for each token
*/
function setClaimPrice(uint256 _claimPrice) external onlyOwner {
claimPrice = _claimPrice;
}
/**
* @dev Set markle root
*/
function setMarkleRoot(bytes32 _root) external onlyOwner {
merkleRoot = _root;
}
/**
* @dev toggle the claim start
*/
function toggleClaimStart() external onlyOwner {
startClaim = !startClaim;
}
/**
* @dev toggle the claim start
*/
function togglePreSale() external onlyOwner {
startPreSale = !startPreSale;
}
/**
* @dev Sets the current active stage
*/
function setCurrentStage(uint16 _stage) external onlyOwner {
currentStage = _stage;
}
/**
* @dev Populates the available tokens
*/
function addAvailableTokens(uint16 _stage) external onlyOwner {
if (availableTokens[_stage].length == 0) {
for (uint16 i = 1; i <= 1500; i++) {
availableTokens[_stage].push(i);
}
}
}
function withdraw() external onlyOwner {
uint256 totalBalance = address(this).balance;
(bool devOk, ) = payable(0x974a394ea3d1EAbDAbb53aa0B102b8894f16c60b)
.call{value: (totalBalance * 650) / 10000}("");
require(devOk);
(bool ownerOk, ) = payable(msg.sender).call{
value: (totalBalance * 9350) / 10000
}("");
require(ownerOk);
}
/**
* ...
// [truncated — 56979 bytes total]
Read Contract
balanceOf 0x70a08231 → uint256
blockedToken 0xff48c1c0 → bool
currentStage 0x5bf5d54c → uint16
getApproved 0x081812fc → address
getAvailableTokens 0xe35568cb → uint256
getClaimPrice 0x21f6d587 → uint256
isApprovedForAll 0xe985e9c5 → bool
merkleRoot 0x2eb4a7ab → bytes32
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
requestMap 0x1a735f18 → uint256
royaltyInfo 0x2a55205a → address, uint256
startClaim 0xecbfc077 → bool
startPreSale 0x55dd574c → bool
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenStage 0xc469bff1 → uint16
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
walletOfOwner 0x438b6300 → uint256[]
Write Contract 22 functions
These functions modify contract state and require a wallet transaction to execute.
addAvailableTokens 0x3f2578c6
uint16 _stage
approve 0x095ea7b3
address to
uint256 tokenId
claimTokenWhitelist 0x42a3c3ae
bytes32[] _merkleProof
uint256 amount
claimTokens 0x46e04a2f
uint256 amount
rawFulfillRandomWords 0x1fe543e3
uint256 requestId
uint256[] randomWords
renounceOwnership 0x715018a6
No parameters
reserveNfts 0x2af11474
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseTokenURI 0x0adc688f
uint16 _stage
string _uri
setClaimPrice 0x51f468c0
uint256 _claimPrice
setCurrentStage 0x81ac8103
uint16 _stage
setMarkleRoot 0x7d97c9d2
bytes32 _root
setRoyaltyFee 0x72cd1fa5
address addr
uint96 fee
setVRFConfig 0xfd3a0f34
uint64 sID
bytes32 keyHash
uint32 gasLimit
swapToken 0x4bbf3a7a
uint256 _id
toggleClaimStart 0x03502b5a
No parameters
togglePreSale 0xca3cb522
No parameters
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
This address has 1 on-chain transactions, but only 1.0% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →