Address Contract Verified
Address
0x3Acce66cD37518A6d77d9ea3039E00B3A2955460
Balance
0 ETH
Nonce
1
Code Size
11368 bytes
Creator
0xCe036d2e...54B8 at tx 0x5639dad1...c62857
Indexed Transactions
0
Contract Bytecode
11368 bytes
0x6080604052600436106101fe5760003560e01c806375794a3c1161011d578063b14990ab116100b0578063c87b56dd1161007f578063e985e9c511610064578063e985e9c514610598578063f04fdc31146105e1578063f2fde38b1461060157600080fd5b8063c87b56dd14610563578063cfc86f7b1461058357600080fd5b8063b14990ab146104fa578063b88d4fde1461050d578063c4e370951461052d578063c50497ae1461054d57600080fd5b80639daebca1116100ec5780639daebca114610491578063a035b1fe146104a4578063a22cb465146104ba578063abd3784e146104da57600080fd5b806375794a3c146104285780638da5cb5b1461043e57806391b7f5ed1461045c57806395d89b411461047c57600080fd5b806355f804b31161019557806368428a1b1161016457806368428a1b146103b95780636c19e783146103d357806370a08231146103f3578063715018a61461041357600080fd5b806355f804b31461032c5780635a3f26721461034c578063627804af146103795780636352211e1461039957600080fd5b806318160ddd116101d157806318160ddd146102b457806323b872dd146102d75780633ccfd60b146102f757806342842e0e1461030c57600080fd5b806301ffc9a71461020357806306fdde0314610238578063081812fc1461025a578063095ea7b314610292575b600080fd5b34801561020f57600080fd5b5061022361021e36600461286d565b610621565b60405190151581526020015b60405180910390f35b34801561024457600080fd5b5061024d6106be565b60405161022f9190612a5c565b34801561026657600080fd5b5061027a610275366004612968565b610750565b6040516001600160a01b03909116815260200161022f565b34801561029e57600080fd5b506102b26102ad3660046127bc565b6107ea565b005b3480156102c057600080fd5b506102c961091c565b60405190815260200161022f565b3480156102e357600080fd5b506102b26102f23660046126da565b610932565b34801561030357600080fd5b506102b26109b9565b34801561031857600080fd5b506102b26103273660046126da565b610b22565b34801561033857600080fd5b506102b261034736600461291f565b610b3d565b34801561035857600080fd5b5061036c61036736600461268c565b610baa565b60405161022f9190612a18565b34801561038557600080fd5b506102b26103943660046127bc565b610c7c565b3480156103a557600080fd5b5061027a6103b4366004612968565b610d5e565b3480156103c557600080fd5b50600c546102239060ff1681565b3480156103df57600080fd5b506102b26103ee36600461268c565b610de9565b3480156103ff57600080fd5b506102c961040e36600461268c565b610e64565b34801561041f57600080fd5b506102b2610efe565b34801561043457600080fd5b506102c960095481565b34801561044a57600080fd5b506006546001600160a01b031661027a565b34801561046857600080fd5b506102b2610477366004612968565b610f64565b34801561048857600080fd5b5061024d610fc3565b6102b261049f3660046128a7565b610fd2565b3480156104b057600080fd5b506102c9600a5481565b3480156104c657600080fd5b506102b26104d5366004612792565b61105c565b3480156104e657600080fd5b506102b26104f5366004612968565b611121565b6102b26105083660046127e6565b611184565b34801561051957600080fd5b506102b2610528366004612716565b611289565b34801561053957600080fd5b506102b2610548366004612852565b611317565b34801561055957600080fd5b506102c961271081565b34801561056f57600080fd5b5061024d61057e366004612968565b611384565b34801561058f57600080fd5b5061024d61146d565b3480156105a457600080fd5b506102236105b33660046126a7565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b3480156105ed57600080fd5b506102236105fc366004612968565b6114fb565b34801561060d57600080fd5b506102b261061c36600461268c565b61157e565b60006001600160e01b031982167f80ac58cd00000000000000000000000000000000000000000000000000000000148061068457506001600160e01b031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b806106b857507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b6060600080546106cd90612b44565b80601f01602080910402602001604051908101604052809291908181526020018280546106f990612b44565b80156107465780601f1061071b57610100808354040283529160200191610746565b820191906000526020600020905b81548152906001019060200180831161072957829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166107ce5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006107f582610d5e565b9050806001600160a01b0316836001600160a01b0316141561087f5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084016107c5565b336001600160a01b038216148061089b575061089b81336105b3565b61090d5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016107c5565b610917838361165d565b505050565b6000600160095461092d9190612b01565b905090565b61093c33826116cb565b6109ae5760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f76656400000000000000000000000000000060648201526084016107c5565b6109178383836117c2565b6006546001600160a01b03163314610a135760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107c5565b600c5460009061010090046001600160a01b03166064610a3447600f612ae2565b610a3e9190612ace565b604051600081818185875af1925050503d8060008114610a7a576040519150601f19603f3d011682016040523d82523d6000602084013e610a7f565b606091505b5050600d546040519192506000916001600160a01b039091169047908381818185875af1925050503d8060008114610ad3576040519150601f19603f3d011682016040523d82523d6000602084013e610ad8565b606091505b50509050811580610ae7575080155b15610b1e576040517f750b219c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050565b61091783838360405180602001604052806000815250611289565b6006546001600160a01b03163314610b975760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107c5565b8051610b1e90600b9060208401906124d2565b60606000610bb661091c565b90506000610bc384610e64565b67ffffffffffffffff811115610bdb57610bdb612c06565b604051908082528060200260200182016040528015610c04578160200160208202803683370190505b509050600060015b838111610c7257610c1c81610d5e565b6001600160a01b0316866001600160a01b03161415610c6057808383610c4181612b7f565b945081518110610c5357610c53612bf0565b6020026020010181815250505b80610c6a81612b7f565b915050610c0c565b5090949350505050565b6006546001600160a01b03163314610cd65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107c5565b600954612710610ce7600184612b01565b610cf19083612ab6565b1115610d29576040517f524f409b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b82811015610d5657610d3e848361198f565b60019091019080610d4e81612b7f565b915050610d2c565b506009555050565b6000818152600260205260408120546001600160a01b0316806106b85760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e000000000000000000000000000000000000000000000060648201526084016107c5565b6006546001600160a01b03163314610e435760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107c5565b600880546001600160a01b0319166001600160a01b03831617905550565b50565b60006001600160a01b038216610ee25760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f20616464726573730000000000000000000000000000000000000000000060648201526084016107c5565b506001600160a01b031660009081526003602052604090205490565b6006546001600160a01b03163314610f585760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107c5565b610f626000611ad1565b565b6006546001600160a01b03163314610fbe5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107c5565b600a55565b6060600180546106cd90612b44565b600954600c5460ff16610ff857604051630fe219dd60e21b815260040160405180910390fd5b61271081111561101b576040516352df9fe560e01b815260040160405180910390fd5b600a54341461103c5760405162bfc92160e01b815260040160405180910390fd5b611047848484611b23565b611051338261198f565b600101600955505050565b6001600160a01b0382163314156110b55760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016107c5565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6006546001600160a01b0316331461117b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107c5565b610e6181611ca5565b600954600c5460ff166111aa57604051630fe219dd60e21b815260040160405180910390fd5b6127106111b8600184612b01565b6111c29083612ab6565b11156111e1576040516352df9fe560e01b815260040160405180910390fd5b600a546111ef908390612ae2565b341461120d5760405162bfc92160e01b815260040160405180910390fd5b60005b8281101561127f5761125d86868381811061122d5761122d612bf0565b905060200281019061123f9190612a6f565b86868581811061125157611251612bf0565b90506020020135611b23565b611267338361198f565b6001909101908061127781612b7f565b915050611210565b5060095550505050565b61129333836116cb565b6113055760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f76656400000000000000000000000000000060648201526084016107c5565b61131184848484611d58565b50505050565b6006546001600160a01b031633146113715760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107c5565b600c805460ff1916911515919091179055565b6000818152600260205260409020546060906001600160a01b03166114115760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201527f6e6578697374656e7420746f6b656e000000000000000000000000000000000060648201526084016107c5565b600061141b611de1565b9050600081511161143b5760405180602001604052806000815250611466565b8061144584611df0565b6040516020016114569291906129ad565b6040516020818303038152906040525b9392505050565b600b805461147a90612b44565b80601f01602080910402602001604051908101604052809291908181526020018280546114a690612b44565b80156114f35780601f106114c8576101008083540402835291602001916114f3565b820191906000526020600020905b8154815290600101906020018083116114d657829003601f168201915b505050505081565b60075460009061150d90610100612ae2565b821061152c576040516363630e5960e11b815260040160405180910390fd5b600061153a61010084612ace565b9050600061154a61010085612b9a565b905060006007838154811061156157611561612bf0565b60009182526020909120015490911c600190811614949350505050565b6006546001600160a01b031633146115d85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107c5565b6001600160a01b0381166116545760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016107c5565b610e6181611ad1565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061169282610d5e565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b03166117445760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016107c5565b600061174f83610d5e565b9050806001600160a01b0316846001600160a01b0316148061178a5750836001600160a01b031661177f84610750565b6001600160a01b0316145b806117ba57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b03166117d582610d5e565b6001600160a01b0316146118515760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201527f73206e6f74206f776e000000000000000000000000000000000000000000000060648201526084016107c5565b6001600160a01b0382166118cc5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016107c5565b6118d760008261165d565b6001600160a01b0383166000908152600360205260408120805460019290611900908490612b01565b90915550506001600160a01b038216600090815260036020526040812080546001929061192e908490612ab6565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001600160a01b0382166119e55760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016107c5565b6000818152600260205260409020546001600160a01b031615611a4a5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016107c5565b6001600160a01b0382166000908152600360205260408120805460019290611a73908490612ab6565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516bffffffffffffffffffffffff193360601b16602082015260348101829052611b9e906054016040516020818303038152906040528051906020012084848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611f2292505050565b611bd4576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600754611be390610100612ae2565b8110611c02576040516363630e5960e11b815260040160405180910390fd5b6007805461010083049160ff841691600091829185908110611c2657611c26612bf0565b60009182526020909120015491505080821c60011680611c72576040517fddefae2800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b826001901b19821691508160078581548110611c9057611c90612bf0565b60009182526020909120015550505050505050565b6000611cb361010083612ace565b611cbe906001612ab6565b905060008167ffffffffffffffff811115611cdb57611cdb612c06565b604051908082528060200260200182016040528015611d04578160200160208202803683370190505b50905060005b82811015611d4457600019828281518110611d2757611d27612bf0565b602090810291909101015280611d3c81612b7f565b915050611d0a565b508051611311906007906020840190612556565b611d638484846117c2565b611d6f84848484611feb565b6113115760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e746572000000000000000000000000000060648201526084016107c5565b6060600b80546106cd90612b44565b606081611e3057505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115611e5a5780611e4481612b7f565b9150611e539050600a83612ace565b9150611e34565b60008167ffffffffffffffff811115611e7557611e75612c06565b6040519080825280601f01601f191660200182016040528015611e9f576020820181803683370190505b5090505b84156117ba57611eb4600183612b01565b9150611ec1600a86612b9a565b611ecc906030612ab6565b60f81b818381518110611ee157611ee1612bf0565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350611f1b600a86612ace565b9450611ea3565b6008546000906001600160a01b0316611f67576040517f4501a91900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611fc0846040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b6008549091506001600160a01b0316611fd9828561214e565b6001600160a01b031614949350505050565b60006001600160a01b0384163b1561214357604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061202f9033908990889088906004016129dc565b602060405180830381600087803b15801561204957600080fd5b505af1925050508015612079575060408051601f3d908101601f191682019092526120769181019061288a565b60015b612129573d8080156120a7576040519150601f19603f3d011682016040523d82523d6000602084013e6120ac565b606091505b5080516121215760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e746572000000000000000000000000000060648201526084016107c5565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506117ba565b506001949350505050565b600080600061215d8585612172565b9150915061216a816121e2565b509392505050565b6000808251604114156121a95760208301516040840151606085015160001a61219d8782858561239d565b945094505050506121db565b8251604014156121d357602083015160408401516121c886838361248a565b9350935050506121db565b506000905060025b9250929050565b60008160048111156121f6576121f6612bda565b14156121ff5750565b600181600481111561221357612213612bda565b14156122615760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016107c5565b600281600481111561227557612275612bda565b14156122c35760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016107c5565b60038160048111156122d7576122d7612bda565b14156123305760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016107c5565b600481600481111561234457612344612bda565b1415610e615760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016107c5565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156123d45750600090506003612481565b8460ff16601b141580156123ec57508460ff16601c14155b156123fd5750600090506004612481565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612451573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661247a57600060019250925050612481565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831660ff84901c601b016124c48782888561239d565b935093505050935093915050565b8280546124de90612b44565b90600052602060002090601f0160209004810192826125005760008555612546565b82601f1061251957805160ff1916838001178555612546565b82800160010185558215612546579182015b8281111561254657825182559160200191906001019061252b565b50612552929150612590565b5090565b828054828255906000526020600020908101928215612546579160200282018281111561254657825182559160200191906001019061252b565b5b808211156125525760008155600101612591565b600067ffffffffffffffff808411156125c0576125c0612c06565b604051601f8501601f19908116603f011681019082821181831017156125e8576125e8612c06565b8160405280935085815286868601111561260157600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b038116811461263257600080fd5b919050565b60008083601f84011261264957600080fd5b50813567ffffffffffffffff81111561266157600080fd5b6020830191508360208260051b85010111156121db57600080fd5b8035801515811461263257600080fd5b60006020828403121561269e57600080fd5b6114668261261b565b600080604083850312156126ba57600080fd5b6126c38361261b565b91506126d16020840161261b565b90509250929050565b6000806000606084860312156126ef57600080fd5b6126f88461261b565b92506127066020850161261b565b9150604084013590509250925092565b6000806000806080858703121561272c57600080fd5b6127358561261b565b93506127436020860161261b565b925060408501359150606085013567ffffffffffffffff81111561276657600080fd5b8501601f8101871361277757600080fd5b612786878235602084016125a5565b91505092959194509250565b600080604083850312156127a557600080fd5b6127ae8361261b565b91506126d16020840161267c565b600080604083850312156127cf57600080fd5b6127d88361261b565b946020939093013593505050565b600080600080604085870312156127fc57600080fd5b843567ffffffffffffffff8082111561281457600080fd5b61282088838901612637565b9096509450602087013591508082111561283957600080fd5b5061284687828801612637565b95989497509550505050565b60006020828403121561286457600080fd5b6114668261267c565b60006020828403121561287f57600080fd5b813561146681612c1c565b60006020828403121561289c57600080fd5b815161146681612c1c565b6000806000604084860312156128bc57600080fd5b833567ffffffffffffffff808211156128d457600080fd5b818601915086601f8301126128e857600080fd5b8135818111156128f757600080fd5b87602082850101111561290957600080fd5b6020928301989097509590910135949350505050565b60006020828403121561293157600080fd5b813567ffffffffffffffff81111561294857600080fd5b8201601f8101841361295957600080fd5b6117ba848235602084016125a5565b60006020828403121561297a57600080fd5b5035919050565b60008151808452612999816020860160208601612b18565b601f01601f19169290920160200192915050565b600083516129bf818460208801612b18565b8351908301906129d3818360208801612b18565b01949350505050565b60006001600160a01b03808716835280861660208401525083604083015260806060830152612a0e6080830184612981565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015612a5057835183529284019291840191600101612a34565b50909695505050505050565b6020815260006114666020830184612981565b6000808335601e19843603018112612a8657600080fd5b83018035915067ffffffffffffffff821115612aa157600080fd5b6020019150368190038213156121db57600080fd5b60008219821115612ac957612ac9612bae565b500190565b600082612add57612add612bc4565b500490565b6000816000190483118215151615612afc57612afc612bae565b500290565b600082821015612b1357612b13612bae565b500390565b60005b83811015612b33578181015183820152602001612b1b565b838111156113115750506000910152565b600181811c90821680612b5857607f821691505b60208210811415612b7957634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415612b9357612b93612bae565b5060010190565b600082612ba957612ba9612bc4565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114610e6157600080fdfea26469706673582212203bab1a9794aefc1990a5eb5da550a7ac1e2b36b413dbc219e4604123f0cea8f664736f6c63430008070033
Verified Source Code Full Match
Compiler: v0.8.7+commit.e28d00a7
EVM: london
Optimization: Yes (1000 runs)
Ticketed.sol 105 lines
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
error InvalidSignature();
error InvalidSpotId();
error AlreadyMinted();
error InvalidSignerAddress();
contract Ticketed {
using ECDSA for bytes32;
// maximum value of an unsigned 256-bit integer
uint256 private constant MAX_INT =
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
uint256[] _claimGroups;
address _signer = address(0);
// this technique is adopted from https://medium.com/donkeverse/hardcore-gas-savings-in-nft-minting-part-3-save-30-000-in-presale-gas-c945406e89f0
// it saves buyers from expensive SSTORE operations when marking an allowlist spot as "used"
function _claimAllowlistSpot(bytes calldata _signature, uint256 spotId)
internal
{
if (
!_verify(
keccak256(abi.encodePacked(msg.sender, spotId)),
_signature
)
) revert InvalidSignature();
// make sure the spot ID can fit somewhere in the array
// (ie, spotId of 1000 if claimGroups can only store 256 bytes, is invalid)
if (spotId >= _claimGroups.length * 256) revert InvalidSpotId();
uint256 groupIndex;
uint256 spotIndex;
uint256 localGroup;
uint256 storedBit;
unchecked {
// which index of the claimGroups array the provided ID falls into
// for ex, if the ID is 256, then we're in group[1]
// (group[0] would be 0-255, group[1] would be 256-511, etc)
groupIndex = spotId / 256;
// which of the 256 bits in that group the ID falls into
spotIndex = spotId % 256;
}
// assign the group we're interested into a temporary variable
localGroup = _claimGroups[groupIndex];
// shift the group bits to the right by the number of bits at the specified index
// this puts the bit we care about at the rightmost position
// bitwise AND the result with a 1 to zero-out everything except the bit being examined
storedBit = (localGroup >> spotIndex) & uint256(1);
// if we got a 0, then the spot is already claimed
if (storedBit == 0) revert AlreadyMinted();
// zero-out the bit at the specified index by shifting it back to its original spot, and then bitflip
localGroup = localGroup & ~(uint256(1) << spotIndex);
// store the modified group back into the array
// this modified group will have the spot ID set to 1 at its corresponding index
_claimGroups[groupIndex] = localGroup;
}
function isValidSpot(uint256 spotId) public view returns (bool) {
if (spotId >= _claimGroups.length * 256) revert InvalidSpotId();
uint256 groupIndex = spotId / 256;
uint256 spotIndex = spotId % 256;
uint256 localGroup = _claimGroups[groupIndex];
uint256 storedBit = (localGroup >> spotIndex) & uint256(1);
return storedBit == 1;
}
function _setClaimGroups(uint256 numSlots) internal {
// fill claimGroups array with MAX_INTs. Each group accounts for 256 spots.
uint256 slotCount = (numSlots / 256) + 1;
uint256[] memory arr = new uint256[](slotCount);
for (uint256 i; i < slotCount; i++) {
arr[i] = MAX_INT;
}
_claimGroups = arr;
}
function _verify(bytes32 hash, bytes memory signature)
internal
view
returns (bool)
{
if (_signer == address(0)) revert InvalidSignerAddress();
bytes32 signedHash = hash.toEthSignedMessageHash();
return signedHash.recover(signature) == _signer;
}
function _setClaimSigner(address _claimSigner) internal {
_signer = _claimSigner;
}
}
WonderPals.sol 180 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
/*
▄▄▄▄▄▄ ,▄▓███▄▄
██████████▄ ▄██████████▄
███╬╬╬╬╬╬████▌ ╓████▒╬╬╬╬╬███▌
███╬╬╬╬╬▒╬╬╬███ ▄███▒╬╬▒╬╬╬╬╣███
╙███▒╬╣████╬╬███▄███╬╬████╬╬▓███¬
╙████▓╬█████╬█████▒████▓╬████▀
╙▀███████████████████████▀
╙▀█████████████████▀─
└▀▀███████▀▀└ ,▄▄▓███▓▄▄,
▄▓█████████▄, ███ ,▄██████▀▀▀██████▄
▄████▀▀▀╙╙╙▀▀████▓▄ ,▄▄▄▓███████████████▓▓▄▄▄▄▄████▀└ '╙████,
╓███▀└ └╙████████████▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀████████▀└ ╙███▄
┌███⌐ └╙╙╙└└ ' └███
███▌ ███
███⌐ ███
╟██▌ ▐██▌
███⌐ ███¬
▐██▌ ███▌
▓██▌ '███▄
▐███ └███
███⌐ ╟███
▐██▌ ███
███⌐ ╫██▌
███ ▄▄▄ ▄▓▓▄ ▐███
▐███ █████ ▐████⌐ :███
▐██▌ ╙▀█▀└ ╙▀▀└ j███
▐███ ▐███
███ ████▄▄▄▄▄▄▄▄▄▄▄▄▄████⌐ ███▌
███▌ ╙▀▀███████████████▀▀~ j███
███, ███▀
╙███' ███▌
╙███▄ ,███▀
╙███▌ ▄███¬
▀███▄ ▄███▀
'▀███▄, ╓▓███▀
▀████▄, ▄▄████▀
╙▀█████▄▄ ,▄▄█████▀─
╙▀██████▓▄▄▄, ,▄▄▄███████▀╙
└╙▀█████████████████████████████████▀▀╙─
─└╙╙▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀╙╙└
---
dev: bueno.art
*/
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./Ticketed.sol";
error SaleInactive();
error SoldOut();
error InvalidPrice();
error InvalidQuantity();
error WithdrawFailed();
contract WonderPals is ERC721, Ownable, Ticketed {
uint256 public nextTokenId = 1;
uint256 public price = 0.08 ether;
// tokenIds will range from 1-10000
uint256 public constant SUPPLY = 10000;
string public _baseTokenURI;
bool public saleActive = false;
address private b1 = 0x985AFcA097414E5510c2C4faEbDb287E4F237A1B;
address private a1 = 0xCe95FD4D8CaBaAEDC35E0F3582b77709E6d1F0A4;
constructor(string memory baseURI) ERC721("WonderPals", "WNDR") {
_baseTokenURI = baseURI;
}
function mintOne(bytes calldata _signature, uint256 spotId)
external
payable
{
uint256 _nextTokenId = nextTokenId;
if (!saleActive) revert SaleInactive();
if (_nextTokenId > SUPPLY) revert SoldOut();
if (msg.value != price) revert InvalidPrice();
// invalidate the spotId passed in
_claimAllowlistSpot(_signature, spotId);
_mint(msg.sender, _nextTokenId);
unchecked {
_nextTokenId++;
}
nextTokenId = _nextTokenId;
}
function mint(bytes[] calldata _signatures, uint256[] calldata spotIds)
external
payable
{
uint256 _nextTokenId = nextTokenId;
if (!saleActive) revert SaleInactive();
// offset by 1 because we start at 1, and nextTokenId is incremented _after_ mint
if (_nextTokenId + (spotIds.length - 1) > SUPPLY) revert SoldOut();
if (msg.value != price * spotIds.length) revert InvalidPrice();
for (uint256 i = 0; i < spotIds.length; i++) {
// invalidate the spotId passed in
_claimAllowlistSpot(_signatures[i], spotIds[i]);
_mint(msg.sender, _nextTokenId);
unchecked {
_nextTokenId++;
}
}
nextTokenId = _nextTokenId;
}
function devMint(address receiver, uint256 qty) external onlyOwner {
uint256 _nextTokenId = nextTokenId;
if (_nextTokenId + (qty - 1) > SUPPLY) revert InvalidQuantity();
for (uint256 i = 0; i < qty; i++) {
_mint(receiver, _nextTokenId);
unchecked {
_nextTokenId++;
}
}
nextTokenId = _nextTokenId;
}
function totalSupply() public view virtual returns (uint256) {
return nextTokenId - 1;
}
function setSaleState(bool active) external onlyOwner {
saleActive = active;
}
function setClaimGroups(uint256 num) external onlyOwner {
_setClaimGroups(num);
}
function _baseURI() internal view virtual override returns (string memory) {
return _baseTokenURI;
}
function setBaseURI(string memory baseURI) external onlyOwner {
_baseTokenURI = baseURI;
}
function withdraw() external onlyOwner {
(bool s1, ) = b1.call{value: (address(this).balance * 15) / 100}("");
(bool s2, ) = a1.call{value: (address(this).balance)}("");
if (!s1 || !s2) revert WithdrawFailed();
}
function setPrice(uint256 newPrice) external onlyOwner {
price = newPrice;
}
function setSigner(address _signer) external onlyOwner {
_setClaimSigner(_signer);
}
function tokensOf(address wallet) public view returns (uint256[] memory) {
uint256 supply = totalSupply();
uint256[] memory tokenIds = new uint256[](balanceOf(wallet));
uint256 currIndex = 0;
for (uint256 i = 1; i <= supply; i++) {
if (wallet == ownerOf(i)) tokenIds[currIndex++] = i;
}
return tokenIds;
}
}
Address.sol 216 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @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 23 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Strings.sol 66 lines
// SPDX-License-Identifier: MIT
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);
}
}
Ownable.sol 71 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
ERC721.sol 411 lines
// SPDX-License-Identifier: MIT
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 {
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 || 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 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 142 lines
// SPDX-License-Identifier: MIT
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;
}
ECDSA.sol 219 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s;
uint8 v;
assembly {
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 27)
}
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}
ERC165.sol 28 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 26 lines
// SPDX-License-Identifier: MIT
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);
}
IERC721Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
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
SUPPLY 0xc50497ae → uint256
_baseTokenURI 0xcfc86f7b → string
balanceOf 0x70a08231 → uint256
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
isValidSpot 0xf04fdc31 → bool
name 0x06fdde03 → string
nextTokenId 0x75794a3c → uint256
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
price 0xa035b1fe → uint256
saleActive 0x68428a1b → bool
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
tokensOf 0x5a3f2672 → uint256[]
totalSupply 0x18160ddd → uint256
Write Contract 16 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
devMint 0x627804af
address receiver
uint256 qty
mint 0xb14990ab
bytes[] _signatures
uint256[] spotIds
mintOne 0x9daebca1
bytes _signature
uint256 spotId
renounceOwnership 0x715018a6
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
setBaseURI 0x55f804b3
string baseURI
setClaimGroups 0xabd3784e
uint256 num
setPrice 0x91b7f5ed
uint256 newPrice
setSaleState 0xc4e37095
bool active
setSigner 0x6c19e783
address _signer
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address