Address Contract Verified
Address
0x4CEAe3C1c32471bfAeE9420C922B32590790734C
Balance
0 ETH
Nonce
1
Code Size
10279 bytes
Creator
0x22B34858...c624 at tx 0xfeac5b95...fbbd49
Indexed Transactions
0
Contract Bytecode
10279 bytes
0x6080604052600436106101f95760003560e01c80638b40c1f41161010d578063b88d4fde116100a0578063cfc86f7b1161006f578063cfc86f7b146105ec578063e6a72acf14610601578063e985e9c514610621578063ee5e73b01461066a578063ff2e9ff41461068057600080fd5b8063b88d4fde1461055c578063b91816111461057c578063c87b56dd146105ac578063cf1c316a146105cc57600080fd5b806396090c5e116100dc57806396090c5e146104b45780639fb7c59e146104f6578063a0fadf6714610526578063a22cb4651461053c57600080fd5b80638b40c1f41461046057806392334722146104765780639315b0d11461048c57806395d89b411461049f57600080fd5b8063438b63001161019057806354574ceb1161015f57806354574ceb146103bc57806355f804b3146103e05780636352211e1461040057806370a082311461042057806385663bb61461044057600080fd5b8063438b63001461032f578063485d7d941461035c5780634f920f3e1461037c57806351cff8d91461039c57600080fd5b8063183bbe80116101cc578063183bbe80146102af57806323b872dd146102cf57806342842e0e146102ef57806342966c681461030f57600080fd5b806301ffc9a7146101fe57806306fdde0314610233578063081812fc14610255578063095ea7b31461028d575b600080fd5b34801561020a57600080fd5b5061021e610219366004612379565b610696565b60405190151581526020015b60405180910390f35b34801561023f57600080fd5b506102486106e8565b60405161022a919061262a565b34801561026157600080fd5b50610275610270366004612425565b61077a565b6040516001600160a01b03909116815260200161022a565b34801561029957600080fd5b506102ad6102a836600461234f565b610814565b005b3480156102bb57600080fd5b506102ad6102ca3660046121a6565b61092a565b3480156102db57600080fd5b506102ad6102ea3660046121fb565b61099c565b3480156102fb57600080fd5b506102ad61030a3660046121fb565b610a18565b34801561031b57600080fd5b506102ad61032a366004612425565b610a33565b34801561033b57600080fd5b5061034f61034a3660046121a6565b610aad565b60405161022a91906125e6565b34801561036857600080fd5b506102ad6103773660046121a6565b610b8c565b34801561038857600080fd5b506102ad61039736600461234f565b610c69565b3480156103a857600080fd5b506102ad6103b73660046121a6565b610dc3565b3480156103c857600080fd5b506103d2600a5481565b60405190815260200161022a565b3480156103ec57600080fd5b506102ad6103fb3660046123b3565b610e7d565b34801561040c57600080fd5b5061027561041b366004612425565b610ed9565b34801561042c57600080fd5b506103d261043b3660046121a6565b610f50565b34801561044c57600080fd5b506102ad61045b366004612476565b610fd7565b34801561046c57600080fd5b506103d260085481565b34801561048257600080fd5b506103d2600d5481565b6102ad61049a36600461243e565b611135565b3480156104ab57600080fd5b50610248611376565b3480156104c057600080fd5b506104e46104cf366004612425565b60106020526000908152604090205460ff1681565b60405160ff909116815260200161022a565b34801561050257600080fd5b5061021e6105113660046121a6565b60116020526000908152604090205460ff1681565b34801561053257600080fd5b506103d260095481565b34801561054857600080fd5b506102ad610557366004612313565b611385565b34801561056857600080fd5b506102ad610577366004612237565b611390565b34801561058857600080fd5b5061021e6105973660046121a6565b60066020526000908152604090205460ff1681565b3480156105b857600080fd5b506102486105c7366004612425565b611412565b3480156105d857600080fd5b506102ad6105e73660046121a6565b6114b2565b3480156105f857600080fd5b50610248611539565b34801561060d57600080fd5b506103d261061c366004612425565b6115c7565b34801561062d57600080fd5b5061021e61063c3660046121c8565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561067657600080fd5b506103d2600c5481565b34801561068c57600080fd5b506103d2600b5481565b60006001600160e01b031982166380ac58cd60e01b14806106c757506001600160e01b03198216635b5e139f60e01b145b806106e257506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600080546106f790612709565b80601f016020809104026020016040519081016040528092919081815260200182805461072390612709565b80156107705780601f1061074557610100808354040283529160200191610770565b820191906000526020600020905b81548152906001019060200180831161075357829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166107f85760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b600061081f82610ed9565b9050806001600160a01b0316836001600160a01b0316141561088d5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016107ef565b336001600160a01b03821614806108a957506108a9813361063c565b61091b5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016107ef565b61092583836116a1565b505050565b3360009081526006602052604090205460ff1661097a5760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b60448201526064016107ef565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b6109a7335b8261170f565b610a0d5760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6044820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b60648201526084016107ef565b610925838383611806565b61092583838360405180602001604052806000815250611390565b610a3c336109a1565b610aa15760405162461bcd60e51b815260206004820152603060248201527f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760448201526f1b995c881b9bdc88185c1c1c9bdd995960821b60648201526084016107ef565b610aaa816119a6565b50565b60606000610aba83610f50565b905060008167ffffffffffffffff811115610ad757610ad76127c5565b604051908082528060200260200182016040528015610b00578160200160208202803683370190505b509050600060015b600d54811015610b8257610b1b81610ed9565b6001600160a01b0316866001600160a01b03161415610b705780838381518110610b4757610b476127af565b602090810291909101015281610b5c8161273e565b925050838210610b70575090949350505050565b80610b7a8161273e565b915050610b08565b5090949350505050565b3360009081526006602052604090205460ff16610bdc5760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b60448201526064016107ef565b6001600160a01b038116610bef57600080fd5b6001600160a01b038116331415610c485760405162461bcd60e51b815260206004820152601d60248201527f43616e27742072656d6f766520796f7572206f776e206164647265737300000060448201526064016107ef565b6001600160a01b03166000908152600660205260409020805460ff19169055565b3360009081526006602052604090205460ff16610cb95760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b60448201526064016107ef565b6000818152600260205260409020546001600160a01b0316610d115760405162461bcd60e51b81526020600482015260116024820152702737b732bc34b9ba32b73a103a37b5b2b760791b60448201526064016107ef565b816001600160a01b0316610d2482610ed9565b6001600160a01b031614610d7a5760405162461bcd60e51b815260206004820152601a60248201527f546f6b656e206e6f74206f776e6564206279206164647265737300000000000060448201526064016107ef565b80610db65760405162461bcd60e51b815260206004820152600c60248201526b043616e2774206275726e20360a41b60448201526064016107ef565b610dbf816119a6565b5050565b3360009081526006602052604090205460ff16610e135760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b60448201526064016107ef565b60026007541415610e665760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107ef565b6002600755610e758147611a41565b506001600755565b3360009081526006602052604090205460ff16610ecd5760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b60448201526064016107ef565b610925600e83836120f1565b6000818152600260205260408120546001600160a01b0316806106e25760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016107ef565b60006001600160a01b038216610fbb5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016107ef565b506001600160a01b031660009081526003602052604090205490565b3360009081526006602052604090205460ff166110275760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b60448201526064016107ef565b600082600581111561103b5761103b612799565b9050600081600581111561105157611051612799565b14156110905760405162461bcd60e51b815260206004820152600e60248201526d43616e277420736574207479706560901b60448201526064016107ef565b60018160058111156110a4576110a4612799565b14156110b1575060085550565b60028160058111156110c5576110c5612799565b14156110d2575060095550565b60038160058111156110e6576110e6612799565b14156110f35750600a5550565b600481600581111561110757611107612799565b14156111145750600b5550565b600581600581111561112857611128612799565b14156109255750600c5550565b3332146111845760405162461bcd60e51b815260206004820152601360248201527f4e6f20736d61727420636f6e747261637473210000000000000000000000000060448201526064016107ef565b600082600581111561119857611198612799565b905060008160058111156111ae576111ae612799565b14156111ea5760405162461bcd60e51b815260206004820152600b60248201526a426164206b65795479706560a81b60448201526064016107ef565b60408051602080820186905233828401528251808303840181526060909201909252805191012061121b8184611b5a565b6112585760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21031b7bab837b760911b60448201526064016107ef565b3360009081526011602052604090205460ff16156112b85760405162461bcd60e51b815260206004820152601760248201527f596f75206861766520616c7265616479206d696e74656400000000000000000060448201526064016107ef565b60006112c3856115c7565b90508034146113145760405162461bcd60e51b815260206004820152601160248201527f496e636f7272656374207061796d656e7400000000000000000000000000000060448201526064016107ef565b600d8054906001906000611328838561269a565b90915550506000818152601060209081526040808320805460ff8b1660ff19918216179091553380855260119093529220805490921660011790915561136e9082611c3d565b505050505050565b6060600180546106f790612709565b610dbf338383611c57565b61139a338361170f565b6114005760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6044820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b60648201526084016107ef565b61140c84848484611d26565b50505050565b6000818152600260205260409020546060906001600160a01b031661146d5760405162461bcd60e51b81526020600482015260116024820152702737b732bc34b9ba32b73a103a37b5b2b760791b60448201526064016107ef565b60008281526010602052604090205460ff16600e61148a82611d59565b60405160200161149b929190612503565b604051602081830303815290604052915050919050565b3360009081526006602052604090205460ff166115025760405162461bcd60e51b815260206004820152600e60248201526d139bdd08185d5d1a1bdc9a5e995960921b60448201526064016107ef565b6001600160a01b03811661151557600080fd5b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b600e805461154690612709565b80601f016020809104026020016040519081016040528092919081815260200182805461157290612709565b80156115bf5780601f10611594576101008083540402835291602001916115bf565b820191906000526020600020905b8154815290600101906020018083116115a257829003601f168201915b505050505081565b6000808260058111156115dc576115dc612799565b905060018160058111156115f2576115f2612799565b1415611602575050600854919050565b600281600581111561161657611616612799565b1415611626575050600954919050565b600381600581111561163a5761163a612799565b141561164a575050600a54919050565b600481600581111561165e5761165e612799565b141561166e575050600b54919050565b600581600581111561168257611682612799565b1415611692575050600c54919050565b50600092915050565b50919050565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906116d682610ed9565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b03166117885760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016107ef565b600061179383610ed9565b9050806001600160a01b0316846001600160a01b031614806117ce5750836001600160a01b03166117c38461077a565b6001600160a01b0316145b806117fe57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661181982610ed9565b6001600160a01b0316146118815760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b60648201526084016107ef565b6001600160a01b0382166118e35760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016107ef565b6118ee6000826116a1565b6001600160a01b03831660009081526003602052604081208054600192906119179084906126c6565b90915550506001600160a01b038216600090815260036020526040812080546001929061194590849061269a565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60006119b182610ed9565b90506119be6000836116a1565b6001600160a01b03811660009081526003602052604081208054600192906119e79084906126c6565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b80471015611a915760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016107ef565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611ade576040519150601f19603f3d011682016040523d82523d6000602084013e611ae3565b606091505b50509050806109255760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016107ef565b600080600184611b706060860160408701612498565b604080516000815260208181018084529490945260ff909216908201528535606082015290850135608082015260a0016020604051602081039080840390855afa158015611bc2573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611c255760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e617475726500000000000000000000000000000060448201526064016107ef565b600f546001600160a01b039081169116149392505050565b610dbf828260405180602001604052806000815250611e6f565b816001600160a01b0316836001600160a01b03161415611cb95760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016107ef565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611d31848484611806565b611d3d84848484611ea2565b61140c5760405162461bcd60e51b81526004016107ef9061263d565b606081611d7d5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611da75780611d918161273e565b9150611da09050600a836126b2565b9150611d81565b60008167ffffffffffffffff811115611dc257611dc26127c5565b6040519080825280601f01601f191660200182016040528015611dec576020820181803683370190505b5090505b84156117fe57611e016001836126c6565b9150611e0e600a86612759565b611e1990603061269a565b60f81b818381518110611e2e57611e2e6127af565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350611e68600a866126b2565b9450611df0565b611e798383611faf565b611e866000848484611ea2565b6109255760405162461bcd60e51b81526004016107ef9061263d565b60006001600160a01b0384163b15611fa457604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611ee69033908990889088906004016125aa565b602060405180830381600087803b158015611f0057600080fd5b505af1925050508015611f30575060408051601f3d908101601f19168201909252611f2d91810190612396565b60015b611f8a573d808015611f5e576040519150601f19603f3d011682016040523d82523d6000602084013e611f63565b606091505b508051611f825760405162461bcd60e51b81526004016107ef9061263d565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506117fe565b506001949350505050565b6001600160a01b0382166120055760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016107ef565b6000818152600260205260409020546001600160a01b03161561206a5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016107ef565b6001600160a01b038216600090815260036020526040812080546001929061209390849061269a565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546120fd90612709565b90600052602060002090601f01602090048101928261211f5760008555612165565b82601f106121385782800160ff19823516178555612165565b82800160010185558215612165579182015b8281111561216557823582559160200191906001019061214a565b50612171929150612175565b5090565b5b808211156121715760008155600101612176565b80356001600160a01b03811681146121a157600080fd5b919050565b6000602082840312156121b857600080fd5b6121c18261218a565b9392505050565b600080604083850312156121db57600080fd5b6121e48361218a565b91506121f26020840161218a565b90509250929050565b60008060006060848603121561221057600080fd5b6122198461218a565b92506122276020850161218a565b9150604084013590509250925092565b6000806000806080858703121561224d57600080fd5b6122568561218a565b93506122646020860161218a565b925060408501359150606085013567ffffffffffffffff8082111561228857600080fd5b818701915087601f83011261229c57600080fd5b8135818111156122ae576122ae6127c5565b604051601f8201601f19908116603f011681019083821181831017156122d6576122d66127c5565b816040528281528a60208487010111156122ef57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b6000806040838503121561232657600080fd5b61232f8361218a565b91506020830135801515811461234457600080fd5b809150509250929050565b6000806040838503121561236257600080fd5b61236b8361218a565b946020939093013593505050565b60006020828403121561238b57600080fd5b81356121c1816127db565b6000602082840312156123a857600080fd5b81516121c1816127db565b600080602083850312156123c657600080fd5b823567ffffffffffffffff808211156123de57600080fd5b818501915085601f8301126123f257600080fd5b81358181111561240157600080fd5b86602082850101111561241357600080fd5b60209290920196919550909350505050565b60006020828403121561243757600080fd5b5035919050565b600080828403608081121561245257600080fd5b833592506060601f198201121561246857600080fd5b506020830190509250929050565b6000806040838503121561248957600080fd5b50508035926020909101359150565b6000602082840312156124aa57600080fd5b813560ff811681146121c157600080fd5b600081518084526124d38160208601602086016126dd565b601f01601f19169290920160200192915050565b600081516124f98185602086016126dd565b9290920192915050565b600080845481600182811c91508083168061251f57607f831692505b602080841082141561253f57634e487b7160e01b86526022600452602486fd5b818015612553576001811461256457612591565b60ff19861689528489019650612591565b60008b81526020902060005b868110156125895781548b820152908501908301612570565b505084890196505b5050505050506125a181856124e7565b95945050505050565b60006001600160a01b038087168352808616602084015250836040830152608060608301526125dc60808301846124bb565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561261e57835183529284019291840191600101612602565b50909695505050505050565b6020815260006121c160208301846124bb565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527f63656976657220696d706c656d656e7465720000000000000000000000000000606082015260800190565b600082198211156126ad576126ad61276d565b500190565b6000826126c1576126c1612783565b500490565b6000828210156126d8576126d861276d565b500390565b60005b838110156126f85781810151838201526020016126e0565b8381111561140c5750506000910152565b600181811c9082168061271d57607f821691505b6020821081141561169b57634e487b7160e01b600052602260045260246000fd5b60006000198214156127525761275261276d565b5060010190565b60008261276857612768612783565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114610aaa57600080fdfea2646970667358221220d20b26bc223771bf4c239bf89a29b2d88394bf2c4a17c3e00223c4ba7083dd0364736f6c63430008070033
Verified Source Code Full Match
Compiler: v0.8.7+commit.e28d00a7
EVM: london
Optimization: Yes (400 runs)
y0uKey.sol 177 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "./Authorizable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "./OnlySender.sol";
interface IY0uKey {
function burnKey(address _address, uint256 tokenId) external;
}
struct Coupon {
bytes32 r;
bytes32 s;
uint8 v;
}
contract Y0uKey is
IY0uKey,
ERC721,
ERC721Burnable,
Authorizable,
ReentrancyGuard,
OnlySender {
using Address for address;
using Strings for uint256;
enum KeyType { None, Y0U, Platinum, Diamond, Gold, Member }
uint256 public y0uKeyPrice = 0;
uint256 public platinumKeyPrice = 0;
uint256 public diamondKeyPrice = 0;
uint256 public goldKeyPrice = 0;
uint256 public memberKeyPrice = 0;
uint256 public nextInd = 1;
string public _baseTokenURI = "https://y0uclub.mypinata.cloud/ipfs/QmacPhsWvCyQyST1gvZFh37cnFB6rREGtKUAFvw7Wfzsd5/";
address private _adminSigner = 0x7dF9601333aD61394c9344dc6d097A87feB7F8F9;
mapping(uint256 => uint8) public tokenKeyTypes;
mapping(address => bool) public addressDidMint;
// solhint-disable-next-line no-empty-blocks, func-visibility
constructor() ERC721("Y0uKey", "Y0UKEY") {}
function mintPrice(uint256 _keyType) public view returns (uint256) {
KeyType keyType = KeyType(_keyType);
if (keyType == KeyType.Y0U) {
return y0uKeyPrice;
} else if (keyType == KeyType.Platinum) {
return platinumKeyPrice;
} else if (keyType == KeyType.Diamond) {
return diamondKeyPrice;
} else if (keyType == KeyType.Gold) {
return goldKeyPrice;
} else if (keyType == KeyType.Member) {
return memberKeyPrice;
} else {
return 0;
}
}
function _isVerifiedCoupon(bytes32 digest, Coupon calldata coupon) internal view returns(bool) {
address signer = ecrecover(digest, coupon.v, coupon.r, coupon.s);
require(signer != address(0), "Invalid signature");
return signer == _adminSigner;
}
function publicMint(uint256 _keyType, Coupon calldata coupon) external payable onlySender {
KeyType keyType = KeyType(_keyType);
require(keyType != KeyType.None, "Bad keyType");
bytes32 digest = keccak256(abi.encode(_keyType, msg.sender));
require(
_isVerifiedCoupon(digest, coupon),
"Invalid coupon"
);
require(!addressDidMint[msg.sender], "You have already minted");
uint256 price = mintPrice(_keyType);
require(msg.value == price, "Incorrect payment");
uint256 _tokenInd = nextInd;
nextInd += 1;
tokenKeyTypes[_tokenInd] = uint8(_keyType);
addressDidMint[msg.sender] = true;
_safeMint(msg.sender, _tokenInd);
}
function setBaseURI(string calldata baseURI) external onlyAuthorized {
_baseTokenURI = baseURI;
}
function tokenURI(uint256 _tokenId)
public
view
virtual
override
returns (string memory)
{
require(_exists(_tokenId), "Nonexistent token");
uint256 keyType = uint256(tokenKeyTypes[_tokenId]);
return
string(
abi.encodePacked(
_baseTokenURI,
keyType.toString()
)
);
}
function _baseURI() internal view virtual override returns (string memory) {
return _baseTokenURI;
}
function burnKey(address _address, uint256 tokenId) external override onlyAuthorized {
require(_exists(tokenId), "Nonexistent token");
require(ownerOf(tokenId) == _address, "Token not owned by address");
require(tokenId != 0, "Can't burn 0");
_burn(tokenId);
}
function setKeyPrice(uint256 _keyType, uint256 _price) external onlyAuthorized {
KeyType keyType = KeyType(_keyType);
require(keyType != KeyType.None, "Can't set type");
if (keyType == KeyType.Y0U) {
y0uKeyPrice = _price;
} else if (keyType == KeyType.Platinum) {
platinumKeyPrice = _price;
} else if (keyType == KeyType.Diamond) {
diamondKeyPrice = _price;
} else if (keyType == KeyType.Gold) {
goldKeyPrice = _price;
} else if (keyType == KeyType.Member) {
memberKeyPrice = _price;
}
}
function withdraw(address _address) external onlyAuthorized nonReentrant {
// solhint-disable mark-callable-contracts
Address.sendValue(payable(_address), address(this).balance);
}
function setAdminSigner(address _signer) external onlyAuthorized {
_adminSigner = _signer;
}
function walletOfOwner(address _address) external view returns (uint[] memory) {
uint balance = balanceOf(_address);
uint[] memory tokens = new uint[](balance);
uint index;
for (uint i = 1; i < nextInd; i++) {
if (_address == ownerOf(i)) {
tokens[index] = i;
index++;
if (index >= balance) {
return tokens;
}
}
}
return tokens;
}
}
OnlySender.sol 12 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
contract OnlySender {
modifier onlySender {
require(msg.sender == tx.origin, "No smart contracts!");
_;
}
}
Authorizable.sol 30 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
contract Authorizable {
mapping(address => bool) public authorized;
// solhint-disable func-visibility
constructor() {
authorized[msg.sender] = true;
}
modifier onlyAuthorized() {
require(authorized[msg.sender], "Not authorized");
_;
}
function addAuthorized(address _address) external onlyAuthorized {
require(_address != address(0));
authorized[_address] = true;
}
function removeAuthorized(address _address) external onlyAuthorized {
require(_address != address(0));
require(_address != msg.sender, "Can't remove your own address");
authorized[_address] = false;
}
}
Address.sol 217 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "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] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
ERC721.sol 424 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/ERC721.sol)
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @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}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
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) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _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(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view 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 See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || 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 {
_setApprovalForAll(_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 || 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);
}
/**
* @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 Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @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.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
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` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, 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;
}
ReentrancyGuard.sol 63 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
ERC721Burnable.sol 26 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/ERC721Burnable.sol)
pragma solidity ^0.8.0;
import "../ERC721.sol";
import "../../../utils/Context.sol";
/**
* @title ERC721 Burnable Token
* @dev ERC721 Token that can be irreversibly burned (destroyed).
*/
abstract contract ERC721Burnable is Context, ERC721 {
/**
* @dev Burns `tokenId`. See {ERC721-_burn}.
*
* Requirements:
*
* - The caller must own `tokenId` or be an approved operator.
*/
function burn(uint256 tokenId) public virtual {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
_burn(tokenId);
}
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
Read Contract
_baseTokenURI 0xcfc86f7b → string
addressDidMint 0x9fb7c59e → bool
authorized 0xb9181611 → bool
balanceOf 0x70a08231 → uint256
diamondKeyPrice 0x54574ceb → uint256
getApproved 0x081812fc → address
goldKeyPrice 0xff2e9ff4 → uint256
isApprovedForAll 0xe985e9c5 → bool
memberKeyPrice 0xee5e73b0 → uint256
mintPrice 0xe6a72acf → uint256
name 0x06fdde03 → string
nextInd 0x92334722 → uint256
ownerOf 0x6352211e → address
platinumKeyPrice 0xa0fadf67 → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenKeyTypes 0x96090c5e → uint8
tokenURI 0xc87b56dd → string
walletOfOwner 0x438b6300 → uint256[]
y0uKeyPrice 0x8b40c1f4 → uint256
Write Contract 14 functions
These functions modify contract state and require a wallet transaction to execute.
addAuthorized 0xcf1c316a
address _address
approve 0x095ea7b3
address to
uint256 tokenId
burn 0x42966c68
uint256 tokenId
burnKey 0x4f920f3e
address _address
uint256 tokenId
publicMint 0xed1ab180
uint256 _keyType
tuple coupon
removeAuthorized 0x485d7d94
address _address
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setAdminSigner 0x183bbe80
address _signer
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string baseURI
setKeyPrice 0x85663bb6
uint256 _keyType
uint256 _price
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
withdraw 0x51cff8d9
address _address
Recent Transactions
No transactions found for this address