Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0xA264aa947Fabb5370D3031F57D8eDF8b932bE1ef
Balance 0 ETH
Nonce 1
Code Size 13056 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

13056 bytes
0x60806040526004361061039b5760003560e01c8063715018a6116101dc578063b88d4fde11610102578063d547cfb7116100a0578063e398145d1161006f578063e398145d14610a71578063e985e9c514610a91578063f23a6e6114610ada578063f2fde38b14610b0757600080fd5b8063d547cfb714610a1a578063d959419914610a2f578063da67e22a14610a45578063e08a5f9e14610a5b57600080fd5b8063c87b56dd116100dc578063c87b56dd146109ad578063c9b298f1146109cd578063c9d5bde4146109e0578063ce9c605314610a0057600080fd5b8063b88d4fde14610918578063bc197c8114610938578063bc660cac1461098057600080fd5b806398d5fdca1161017a578063a22cb46511610149578063a22cb465146108a3578063a2309ff8146108c3578063ae11c7f8146108d8578063b88906d7146108f857600080fd5b806398d5fdca1461083b5780639c0c6997146108505780639ebd911514610870578063a0712d681461089057600080fd5b806382bdbca4116101b657806382bdbca4146107c25780638da5cb5b146107f2578063903f16a31461081057806395d89b411461082657600080fd5b8063715018a614610778578063742583c81461078d578063752c0ace146107ad57600080fd5b80633d7fe791116102c157806355f804b31161025f5780636817c76c1161022e5780636817c76c1461070a57806368428a1b146107205780636d44aef51461073857806370a082311461075857600080fd5b806355f804b31461068a5780635fc3ea0b146106aa5780636352211e146106ca57806363dfbbf4146106ea57600080fd5b806346694b7d1161029b57806346694b7d14610602578063493143e414610632578063518cb9911461065257806353135ca01461067257600080fd5b80633d7fe791146105a257806342842e0e146105c257806342966c68146105e257600080fd5b8063197b831411610339578063288752751161030857806328875275146105365780632f745c591461054c57806332cb6b0c1461056c57806336118b521461058257600080fd5b8063197b8314146104cb5780631a9c1dec146104e05780631dd0c2fd146104f657806323b872dd1461051657600080fd5b8063095ea7b311610375578063095ea7b3146104365780630a3fac4a146104585780631411669e1461049557806318160ddd146104a857600080fd5b806301ffc9a7146103a757806306fdde03146103dc578063081812fc146103fe57600080fd5b366103a257005b600080fd5b3480156103b357600080fd5b506103c76103c2366004612934565b610b27565b60405190151581526020015b60405180910390f35b3480156103e857600080fd5b506103f1610b38565b6040516103d391906129a1565b34801561040a57600080fd5b5061041e6104193660046129b4565b610bca565b6040516001600160a01b0390911681526020016103d3565b34801561044257600080fd5b506104566104513660046129e2565b610c57565b005b34801561046457600080fd5b506104886104733660046129b4565b60166020526000908152604090205460ff1681565b6040516103d39190612a24565b6104566104a3366004612a4c565b610d6c565b3480156104b457600080fd5b506104bd610efa565b6040519081526020016103d3565b3480156104d757600080fd5b50610456610f16565b3480156104ec57600080fd5b506104bd60145481565b34801561050257600080fd5b50610456610511366004612a6e565b610f2d565b34801561052257600080fd5b50610456610531366004612a8b565b611007565b34801561054257600080fd5b506104bd600d5481565b34801561055857600080fd5b506104bd6105673660046129e2565b611038565b34801561057857600080fd5b506104bd6101f481565b34801561058e57600080fd5b5061045661059d366004612acc565b611101565b3480156105ae57600080fd5b506104566105bd366004612afc565b6111ac565b3480156105ce57600080fd5b506104566105dd366004612a8b565b6112c4565b3480156105ee57600080fd5b506104566105fd3660046129b4565b6112df565b34801561060e57600080fd5b506103c761061d3660046129b4565b60136020526000908152604090205460ff1681565b34801561063e57600080fd5b5061045661064d3660046129b4565b611361565b34801561065e57600080fd5b50600f5461041e906001600160a01b031681565b34801561067e57600080fd5b50600b544210156103c7565b34801561069657600080fd5b506104566106a5366004612bd6565b61136e565b3480156106b657600080fd5b506104566106c5366004612c1f565b6113a6565b3480156106d657600080fd5b5061041e6106e53660046129b4565b611474565b3480156106f657600080fd5b506104bd610705366004612a6e565b61150b565b34801561071657600080fd5b506104bd60105481565b34801561072c57600080fd5b50600c544210156103c7565b34801561074457600080fd5b506104566107533660046129b4565b6115e6565b34801561076457600080fd5b506104bd610773366004612a6e565b6115f3565b34801561078457600080fd5b5061045661167a565b34801561079957600080fd5b50600e5461041e906001600160a01b031681565b3480156107b957600080fd5b506104bd601981565b3480156107ce57600080fd5b506103c76107dd366004612a6e565b60176020526000908152604090205460ff1681565b3480156107fe57600080fd5b506007546001600160a01b031661041e565b34801561081c57600080fd5b506104bd60115481565b34801561083257600080fd5b506103f161168e565b34801561084757600080fd5b506104bd61169d565b34801561085c57600080fd5b5061045661086b366004612c6f565b611726565b34801561087c57600080fd5b5061045661088b366004612a6e565b61175e565b61045661089e3660046129b4565b611805565b3480156108af57600080fd5b506104566108be366004612c94565b61187a565b3480156108cf57600080fd5b506104bd61193e565b3480156108e457600080fd5b506104566108f3366004612cc2565b611950565b34801561090457600080fd5b50610456610913366004612c94565b611a8e565b34801561092457600080fd5b50610456610933366004612cf0565b611ac1565b34801561094457600080fd5b50610967610953366004612dfe565b63bc197c8160e01b98975050505050505050565b6040516001600160e01b031990911681526020016103d3565b34801561098c57600080fd5b506104bd61099b366004612a6e565b60126020526000908152604090205481565b3480156109b957600080fd5b506103f16109c83660046129b4565b611af3565b6104566109db3660046129b4565b611bbe565b3480156109ec57600080fd5b506104566109fb366004612c1f565b611c87565b348015610a0c57600080fd5b50600a546103c79060ff1681565b348015610a2657600080fd5b506103f1611d48565b348015610a3b57600080fd5b506104bd60155481565b348015610a5157600080fd5b506104bd600c5481565b348015610a6757600080fd5b506104bd600b5481565b348015610a7d57600080fd5b506104bd610a8c366004612a6e565b611dd6565b348015610a9d57600080fd5b506103c7610aac366004612cc2565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b348015610ae657600080fd5b50610967610af5366004612ec9565b63f23a6e6160e01b9695505050505050565b348015610b1357600080fd5b50610456610b22366004612a6e565b611e87565b6000610b3282611efd565b92915050565b606060008054610b4790612f45565b80601f0160208091040260200160405190810160405280929190818152602001828054610b7390612f45565b8015610bc05780601f10610b9557610100808354040283529160200191610bc0565b820191906000526020600020905b815481529060010190602001808311610ba357829003601f168201915b5050505050905090565b6000610bd582611f22565b610c3b5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600560205260409020546001600160a01b031690565b6000610c6282611474565b9050806001600160a01b0316836001600160a01b031603610ccf5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610c32565b336001600160a01b0382161480610ceb5750610ceb8133610aac565b610d5d5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610c32565b610d678383611f76565b505050565b33610d7683611474565b6001600160a01b031614610d9d5760405163251c9d6360e01b815260040160405180910390fd5b60008281526016602052604081205460ff166002811115610dc057610dc0612a0e565b14610dde57604051633043918360e11b815260040160405180910390fd5b600d54421115610e0157604051634a6c002960e01b815260040160405180910390fd5b80600114158015610e13575080600214155b15610e555760405162461bcd60e51b8152602060048201526012602482015271496e76616c6964207072696e742073697a6560701b6044820152606401610c32565b80600103610e8557601454341015610e805760405163cd1c886760e01b815260040160405180910390fd5b610eb0565b80600203610eb057601554341015610eb05760405163cd1c886760e01b815260040160405180910390fd5b80600103610ed457506000908152601660205260409020805460ff19166001179055565b80600203610ef6576000828152601660205260409020805460ff191660021790555b5050565b6000600254610f0761193e565b610f119190612f95565b905090565b610f1e611fe4565b600a805460ff19166001179055565b610f35611fe4565b610f3d61193e565b15610f8a5760405162461bcd60e51b815260206004820152601a60248201527f466972737420746f6b656e20616c7265616479206d696e7465640000000000006044820152606401610c32565b6001600160a01b038116610fe05760405162461bcd60e51b815260206004820152601960248201527f496e76616c696420726563697069656e742061646472657373000000000000006044820152606401610c32565b600e80546001600160a01b0319166001600160a01b0383161790556110048161203e565b50565b6110113382612057565b61102d5760405162461bcd60e51b8152600401610c3290612fa8565b610d67838383612141565b600080805b6003548110156110a457846001600160a01b03166003828154811061106457611064612ff9565b6000918252602090912001546001600160a01b03160361109c5783820361108e579150610b329050565b61109960018361300f565b91505b60010161103d565b5060405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610c32565b611109611fe4565b6001600160a01b03811661112f5760405162461bcd60e51b8152600401610c3290613022565b478211156111765760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610c32565b6040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015610d67573d6000803e3d6000fd5b6111b4611fe4565b6001600160a01b0381166111da5760405162461bcd60e51b8152600401610c3290613022565b6001600160a01b0384166112005760405162461bcd60e51b8152600401610c329061304d565b600082116112415760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610c32565b604051637921219560e11b81523060048201526001600160a01b038281166024830152604482018590526064820184905260a06084830152600060a483015285169063f242432a9060c401600060405180830381600087803b1580156112a657600080fd5b505af11580156112ba573d6000803e3d6000fd5b5050505050505050565b610d6783838360405180602001604052806000815250611ac1565b60008181526013602052604090205460ff161561130f57604051631f33bf6360e31b815260040160405180910390fd5b3360009081526017602052604090205460ff161561133057611004816122f5565b61133a3382612057565b1561134857611004816122f5565b604051631f33bf6360e31b815260040160405180910390fd5b611369611fe4565b600c55565b611376611fe4565b600a5460ff161561139a576040516303187a6760e31b815260040160405180910390fd5b6009610ef682826130ca565b6113ae611fe4565b6001600160a01b0381166113d45760405162461bcd60e51b8152600401610c3290613022565b6001600160a01b0383166113fa5760405162461bcd60e51b8152600401610c329061304d565b60405163a9059cbb60e01b81526001600160a01b0382811660048301526024820184905284169063a9059cbb906044015b6020604051808303816000875af115801561144a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061146e9190613189565b50505050565b600061147f82611f22565b6114dd5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610c32565b600382815481106114f0576114f0612ff9565b6000918252602090912001546001600160a01b031692915050565b6001600160a01b0381811660008181526012602052604080822054600f5491516370a0823160e01b8152600481019490945291939192849291909116906370a0823190602401602060405180830381865afa15801561156e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159291906131a6565b90506000606482106115a65750600a6115c3565b60328211156115b7575060056115c3565b601482106115c3575060025b808310156115da576115d58382612f95565b6115dd565b60005b95945050505050565b6115ee611fe4565b600b55565b60006001600160a01b03821661165e5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610c32565b506001600160a01b031660009081526004602052604090205490565b611682611fe4565b61168c60006123bc565b565b606060018054610b4790612f45565b600f546040516370a0823160e01b815233600482015260009182916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156116ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170e91906131a6565b9050801561171e57505060115490565b505060105490565b3361173083611474565b6001600160a01b031603610ef6576000828152601360205260409020805482151560ff199091161790555050565b611766611fe4565b6001600160a01b03811661178c5760405162461bcd60e51b8152600401610c3290613022565b47806117cf5760405162461bcd60e51b81526020600482015260126024820152714e6f2045544820746f20776974686472617760701b6044820152606401610c32565b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610d67573d6000803e3d6000fd5b61180d61240e565b600c54421015611830576040516316851a3760e11b815260040160405180910390fd5b600061183a61169d565b905061184681836131bf565b3410156118665760405163cd1c886760e01b815260040160405180910390fd5b61186f82612467565b506110046001600855565b336001600160a01b038316036118d25760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610c32565b3360008181526006602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600354600090610f1190600190612f95565b611958611fe4565b6001600160a01b03811661197e5760405162461bcd60e51b8152600401610c3290613022565b6001600160a01b0382166119a45760405162461bcd60e51b8152600401610c329061304d565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa1580156119eb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a0f91906131a6565b905060008111611a595760405162461bcd60e51b81526020600482015260156024820152744e6f20746f6b656e7320746f20776974686472617760581b6044820152606401610c32565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb9060440161142b565b611a96611fe4565b6001600160a01b03919091166000908152601760205260409020805460ff1916911515919091179055565b611acb3383612057565b611ae75760405162461bcd60e51b8152600401610c3290612fa8565b61146e848484846124da565b6060611afe82611f22565b611b625760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610c32565b6000611b6c61250d565b90506000815111611b8c5760405180602001604052806000815250611bb7565b80611b968461251c565b604051602001611ba79291906131d6565b6040516020818303038152906040525b9392505050565b611bc661240e565b600b54421015611be9576040516316851a3760e11b815260040160405180910390fd5b6000611bf433611dd6565b905080821115611c175760405163248716bf60e21b815260040160405180910390fd5b6000611c2161169d565b9050611c2d81846131bf565b341015611c4d5760405163cd1c886760e01b815260040160405180910390fd5b3360009081526012602052604081208054859290611c6c90849061300f565b90915550611c7b905083612467565b50506110046001600855565b611c8f611fe4565b6001600160a01b038116611cb55760405162461bcd60e51b8152600401610c3290613022565b6001600160a01b038316611cdb5760405162461bcd60e51b8152600401610c329061304d565b6040516323b872dd60e01b81523060048201526001600160a01b038281166024830152604482018490528416906323b872dd90606401600060405180830381600087803b158015611d2b57600080fd5b505af1158015611d3f573d6000803e3d6000fd5b50505050505050565b60098054611d5590612f45565b80601f0160208091040260200160405190810160405280929190818152602001828054611d8190612f45565b8015611dce5780601f10611da357610100808354040283529160200191611dce565b820191906000526020600020905b815481529060010190602001808311611db157829003601f168201915b505050505081565b600f546040516370a0823160e01b81526001600160a01b03838116600483015260009283929116906370a0823190602401602060405180830381865afa158015611e24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e4891906131a6565b905060648110611e5b5750600a92915050565b6032811115611e6d5750600592915050565b60148110611e7e5750600292915050565b50600092915050565b611e8f611fe4565b6001600160a01b038116611ef45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c32565b611004816123bc565b60006001600160e01b03198216630271189760e51b1480610b325750610b32826125af565b6000611f2c61193e565b821115611f3b57506000919050565b60006001600160a01b031660038381548110611f5957611f59612ff9565b6000918252602090912001546001600160a01b0316141592915050565b600081815260056020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611fab82611474565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6007546001600160a01b0316331461168c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c32565b61100481604051806020016040528060008152506125ff565b600061206282611f22565b6120c35760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610c32565b60006120ce83611474565b9050806001600160a01b0316846001600160a01b031614806121095750836001600160a01b03166120fe84610bca565b6001600160a01b0316145b8061213957506001600160a01b0380821660009081526006602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661215482611474565b6001600160a01b0316146121bc5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610c32565b6001600160a01b03821661221e5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610c32565b612229600082611f76565b6001600160a01b0383166000908152600460205260408120805460019290612252908490612f95565b90915550506001600160a01b038216600090815260046020526040812080546001929061228090849061300f565b92505081905550816003828154811061229b5761229b612ff9565b6000918252602082200180546001600160a01b0319166001600160a01b03938416179055604051839285811692908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9190a4505050565b600061230082611474565b905061230d600083611f76565b6002805490600061231d83613205565b90915550506001600160a01b038116600090815260046020526040812080546001929061234b908490612f95565b9250508190555060006003838154811061236757612367612ff9565b6000918252602082200180546001600160a01b0319166001600160a01b0393841617905560405184928416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6002600854036124605760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c32565b6002600855565b601981111561248957604051633e29b4fb60e11b815260040160405180910390fd5b6101f48161249561193e565b61249f919061300f565b11156124be576040516352df9fe560e01b815260040160405180910390fd5b60005b81811015610ef6576124d23361203e565b6001016124c1565b6124e5848484612141565b6124f184848484612642565b61146e5760405162461bcd60e51b8152600401610c329061321e565b606060098054610b4790612f45565b6060600061252983612743565b600101905060008167ffffffffffffffff81111561254957612549612b46565b6040519080825280601f01601f191660200182016040528015612573576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461257d57509392505050565b60006001600160e01b031982166380ac58cd60e01b14806125e057506001600160e01b03198216635b5e139f60e01b145b80610b3257506301ffc9a760e01b6001600160e01b0319831614610b32565b6126088261281b565b61262660008360016003805490506126209190612f95565b84612642565b610ef65760405162461bcd60e51b8152600401610c329061321e565b60006001600160a01b0384163b1561273857604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612686903390899088908890600401613270565b6020604051808303816000875af19250505080156126c1575060408051601f3d908101601f191682019092526126be918101906132ad565b60015b61271e573d8080156126ef576040519150601f19603f3d011682016040523d82523d6000602084013e6126f4565b606091505b5080516000036127165760405162461bcd60e51b8152600401610c329061321e565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612139565b506001949350505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106127825772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106127ae576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106127cc57662386f26fc10000830492506010015b6305f5e10083106127e4576305f5e100830492506008015b61271083106127f857612710830492506004015b6064831061280a576064830492506002015b600a8310610b325760010192915050565b6001600160a01b0381166128715760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610c32565b6003546001600160a01b038216600090815260046020526040812080546001929061289d90849061300f565b90915550506003805460018101825560009182527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0385169081179091556040518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001600160e01b03198116811461100457600080fd5b60006020828403121561294657600080fd5b8135611bb78161291e565b60005b8381101561296c578181015183820152602001612954565b50506000910152565b6000815180845261298d816020860160208601612951565b601f01601f19169290920160200192915050565b602081526000611bb76020830184612975565b6000602082840312156129c657600080fd5b5035919050565b6001600160a01b038116811461100457600080fd5b600080604083850312156129f557600080fd5b8235612a00816129cd565b946020939093013593505050565b634e487b7160e01b600052602160045260246000fd5b6020810160038310612a4657634e487b7160e01b600052602160045260246000fd5b91905290565b60008060408385031215612a5f57600080fd5b50508035926020909101359150565b600060208284031215612a8057600080fd5b8135611bb7816129cd565b600080600060608486031215612aa057600080fd5b8335612aab816129cd565b92506020840135612abb816129cd565b929592945050506040919091013590565b60008060408385031215612adf57600080fd5b823591506020830135612af1816129cd565b809150509250929050565b60008060008060808587031215612b1257600080fd5b8435612b1d816129cd565b935060208501359250604085013591506060850135612b3b816129cd565b939692955090935050565b634e487b7160e01b600052604160045260246000fd5b60008067ffffffffffffffff841115612b7757612b77612b46565b50604051601f19601f85018116603f0116810181811067ffffffffffffffff82111715612ba657612ba6612b46565b604052838152905080828401851015612bbe57600080fd5b83836020830137600060208583010152509392505050565b600060208284031215612be857600080fd5b813567ffffffffffffffff811115612bff57600080fd5b8201601f81018413612c1057600080fd5b61213984823560208401612b5c565b600080600060608486031215612c3457600080fd5b8335612c3f816129cd565b9250602084013591506040840135612c56816129cd565b809150509250925092565b801515811461100457600080fd5b60008060408385031215612c8257600080fd5b823591506020830135612af181612c61565b60008060408385031215612ca757600080fd5b8235612cb2816129cd565b91506020830135612af181612c61565b60008060408385031215612cd557600080fd5b8235612ce0816129cd565b91506020830135612af1816129cd565b60008060008060808587031215612d0657600080fd5b8435612d11816129cd565b93506020850135612d21816129cd565b925060408501359150606085013567ffffffffffffffff811115612d4457600080fd5b8501601f81018713612d5557600080fd5b612d6487823560208401612b5c565b91505092959194509250565b60008083601f840112612d8257600080fd5b50813567ffffffffffffffff811115612d9a57600080fd5b6020830191508360208260051b8501011115612db557600080fd5b9250929050565b60008083601f840112612dce57600080fd5b50813567ffffffffffffffff811115612de657600080fd5b602083019150836020828501011115612db557600080fd5b60008060008060008060008060a0898b031215612e1a57600080fd5b8835612e25816129cd565b97506020890135612e35816129cd565b9650604089013567ffffffffffffffff811115612e5157600080fd5b612e5d8b828c01612d70565b909750955050606089013567ffffffffffffffff811115612e7d57600080fd5b612e898b828c01612d70565b909550935050608089013567ffffffffffffffff811115612ea957600080fd5b612eb58b828c01612dbc565b999c989b5096995094979396929594505050565b60008060008060008060a08789031215612ee257600080fd5b8635612eed816129cd565b95506020870135612efd816129cd565b94506040870135935060608701359250608087013567ffffffffffffffff811115612f2757600080fd5b612f3389828a01612dbc565b979a9699509497509295939492505050565b600181811c90821680612f5957607f821691505b602082108103612f7957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b81810381811115610b3257610b32612f7f565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b80820180821115610b3257610b32612f7f565b602080825260119082015270125b9d985b1a59081c9958da5c1a595b9d607a1b604082015260600190565b602080825260159082015274496e76616c696420746f6b656e206164647265737360581b604082015260600190565b601f821115610d6757806000526020600020601f840160051c810160208510156130a35750805b601f840160051c820191505b818110156130c357600081556001016130af565b5050505050565b815167ffffffffffffffff8111156130e4576130e4612b46565b6130f8816130f28454612f45565b8461307c565b6020601f82116001811461312c57600083156131145750848201515b600019600385901b1c1916600184901b1784556130c3565b600084815260208120601f198516915b8281101561315c578785015182556020948501946001909201910161313c565b508482101561317a5786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b60006020828403121561319b57600080fd5b8151611bb781612c61565b6000602082840312156131b857600080fd5b5051919050565b8082028115828204841417610b3257610b32612f7f565b600083516131e8818460208801612951565b8351908301906131fc818360208801612951565b01949350505050565b60006001820161321757613217612f7f565b5060010190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906132a390830184612975565b9695505050505050565b6000602082840312156132bf57600080fd5b8151611bb78161291e56fea264697066735822122006aafaf19b8d79535b3f8193b18bd4c3f90f91790302ff587cf6b73c573eb7f964736f6c634300081c0033

Verified Source Code Full Match

Compiler: v0.8.28+commit.7893614a EVM: paris Optimization: Yes (200 runs)
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

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() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(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");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
ReentrancyGuard.sol 77 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}
IERC1155.sol 119 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(
        address[] calldata accounts,
        uint256[] calldata ids
    ) external view returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}
IERC1155Receiver.sol 58 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}
ERC1155Receiver.sol 19 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "../IERC1155Receiver.sol";
import "../../../utils/introspection/ERC165.sol";

/**
 * @dev _Available since v3.1._
 */
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
    }
}
IERC20.sol 78 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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);
}
IERC721.sol 132 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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`.
     *
     * 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;

    /**
     * @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 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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * 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 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 the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @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);
}
IERC721Receiver.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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 `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}
Address.sol 244 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @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
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or 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 {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // 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
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (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;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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.1 (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);
}
Math.sol 339 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}
SignedMath.sol 43 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}
Strings.sol 85 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @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] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}
CyberBanditsGen2.sol 519 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "./ERC721S.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol";

/*

                    2222222222222222
              2222222222222222222222222222
           22222222222222222222222222222222222
        2222222222222222222222222222222222222222
     2222222222222222222222222222222222222222222222
    222222222222222222222222222222222222222222222222
   222222222222222222222222222222222222222222222222222
  2222222222222222222222222222222222222222222222222222
 222222222222222222222222222222222222222222222222222222
 2222222222222222222222222222222222222222222222222222222
22222222222222222222222222222222222222222222222222222222
22222222222222222222222222222222222222222222222222222222
22222222222222222222222222222222222222222222222222222222
22222222222222222222222222222222222222222222222222222222
22222222222222222222222222222222222222222222222222222222
22222222222222222222222222222222222222222222222222222222
222222222222222222       22222222222222222222       2222
22222222222222222         222222222222222222         222
222222222222222222       22222222222222222222       2222
22222222222222222222222222222222222   222222222222222222
2222222222222222222222222222222222     22222222222222222
 22222222222222222222222222222222      22222222222222222
  2  222222222222222222222222222   2    2222222222222222
 2222  2222222222222222222222222   22    2222222222222
  22222222      222222222222222    22   2222222222
  22222222        2222222222222222222222222222222
   2222222        2222222222222222222222222222222
   2222222          22222    22222222222222222222
   22222222         22222    2222222 22222 222222
   22222222222                               2222
   22222222222222222     222222222 2222 222222222
   22222222222222222222  2222222222222222222222222
     222222222222222222222222222222222222222222222
          222222222222222222222222222222222222222
              2222222222222222222222222222222222
                  22222222222222222222222222222
                        222222222222222222222
                               22222222222

 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 $      Cyber Bandits Gen II ~ By Michael Reeder       $
 $         cyber-bandits.com • reederone.com           $
 $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 */

/// @title CyberBandits Gen II
/// @author Jacob DeHart
/// @notice CyberBandits ERC721 NFT
/// @custom:website https://cyber-bandits.com
contract CyberBanditsGen2 is ERC721Sequential, Ownable, ReentrancyGuard, ERC1155Receiver {
    error ExceedsAllotment();
    error SaleNotStarted();
    error MintingTooMany();
    error SoldOut();
    error InsufficientPayment();
    error BaseURIIsFrozen();
    error burnNotAllowed();
    error notOwner();
    error alreadyPrinted();
    error printNotAvailable();

    string public baseTokenURI;
    bool public baseTokenURIFrozen;
    uint256 public startPresaleDate;
    uint256 public startMintDate;
    uint256 public endPrintDate;
    address public firstTokenAddress;
    address public banditContractAddress;
    uint256 public constant MAX_SUPPLY = 500;
    uint256 public mintPrice;
    uint256 public discountedMintPrice;
    uint256 public constant MAX_PURCHASE_COUNT = 25;
    mapping(address => uint256) public presaleMinted;
    mapping(uint256 => bool) public tokenLocked;

    uint256 public smallPrintPrice;
    uint256 public largePrintPrice;
    enum PrintStatus { UNPRINTED, SMALL_PRINT, LARGE_PRINT }
    mapping(uint256 => PrintStatus) public printStatus;
    mapping(address => bool) public burnOperator;

    /**
     * @notice Initializes the CyberBanditsGen2 contract with presale and sale dates, base URI, bandit contract address, and pricing.
     * @param _startPresaleDate The timestamp when the presale starts.
     * @param _startMintDate The timestamp when the public sale starts.
     * @param _endPrintDate The timestamp when the print window ends.
     * @param _baseTokenURI The initial base URI for token metadata.
     * @param _banditContractAddress The address of the original Bandit contract for presale eligibility.
     * @param _mintPrice The price for regular minting in wei.
     * @param _discountedMintPrice The discounted price for Bandit NFT holders in wei.
     * @param _smallPrintPrice The price for small prints in wei.
     * @param _largePrintPrice The price for large prints in wei.
     */
    constructor(
        uint256 _startPresaleDate,
        uint256 _startMintDate,
        uint256 _endPrintDate,
        string memory _baseTokenURI,
        address _banditContractAddress,
        uint256 _mintPrice,
        uint256 _discountedMintPrice,
        uint256 _smallPrintPrice,
        uint256 _largePrintPrice
    ) ERC721Sequential("Cyber Bandits Gen 2", "BANDIT2") {
        startPresaleDate = _startPresaleDate;
        startMintDate = _startMintDate;
        endPrintDate = _endPrintDate;
        baseTokenURI = _baseTokenURI;
        banditContractAddress = _banditContractAddress;
        mintPrice = _mintPrice;
        discountedMintPrice = _discountedMintPrice;
        smallPrintPrice = _smallPrintPrice;
        largePrintPrice = _largePrintPrice;
    }

    /**
     * @notice Allows the contract owner to mint the first token to a specified address.
     * @dev This function can only be called once when no tokens have been minted yet.
     *      The first token is typically minted to a special address or the owner.
     * @param recipient The address to receive the first token.
     * @custom:reverts if tokens have already been minted.
     * @custom:reverts if caller is not the contract owner.
     */
    function mintFirstToken(address recipient) external onlyOwner {
        require(totalMinted() == 0, "First token already minted");
        require(recipient != address(0), "Invalid recipient address");
        firstTokenAddress = recipient;
        _safeMint(recipient);
    }

    /**
     * @notice Returns the current mint price for the caller based on their Bandit NFT holdings.
     * @dev Bandit NFT holders get a discounted price. Non-holders pay the full price.
     * @return The price in wei for the caller to mint one token.
     */
    function getPrice() public view returns (uint256) {
      uint256 cb1Balance = IERC721(banditContractAddress).balanceOf(msg.sender);
      if (cb1Balance > 0) {
        return discountedMintPrice;
      }
      return mintPrice;
    }

    /**
     * @notice Allows eligible users to mint NFTs during the presale phase using a signature pass and allotment.
     * @dev Checks presale status, user allowance, and dynamic pricing. Updates presale mint count and mints tokens.
     * @param numberOfTokens The number of tokens to mint in this transaction.
     * @custom:reverts SaleNotStarted if presale is not active.
     * @custom:reverts ExceedsAllotment if minting more than allowed.
     * @custom:reverts InsufficientPayment if not enough ETH is sent for the dynamic price.
     */
    function presaleMint(
        uint256 numberOfTokens
    ) external payable nonReentrant {
        if (!presaleActive()) revert SaleNotStarted();
        uint256 allowance = presaleAllowanceFor(msg.sender);
        if (numberOfTokens > allowance) revert ExceedsAllotment();
        uint256 price = getPrice();
        if (msg.value < numberOfTokens * price)
            revert InsufficientPayment();
        presaleMinted[msg.sender] += numberOfTokens;
        _mintNFT(numberOfTokens);
    }

    /**
     * @notice Returns the presale minting allowance for a user based on their Bandit NFT balance.
     * @param user The address to check allowance for.
     * @return The number of tokens the user is allowed to mint in presale.
     */
    function presaleAllowanceFor(address user) public view returns (uint256) {
        uint256 cb1Balance = IERC721(banditContractAddress).balanceOf(user);
        if (cb1Balance >= 100) {
            return 10;
        } else if (cb1Balance > 50) {
            return 5;
        } else if (cb1Balance >= 20) {
            return 2;
        }
        return 0;
    }

    /**
     * @notice Returns the remaining presale mint allowance for a user after accounting for already minted tokens.
     * @param user The address to check remaining allowance for.
     * @return The number of tokens the user can still mint in presale.
     */
    function presaleMintAllowance(address user) public view returns (uint256) {
        uint256 minted = presaleMinted[user];
        uint256 cb1Balance = IERC721(banditContractAddress).balanceOf(user);
        uint256 allowance = 0;
        if (cb1Balance >= 100) {
            allowance = 10;
        } else if (cb1Balance > 50) {
            allowance = 5;
        } else if (cb1Balance >= 20) {
            allowance = 2;
        }
        return minted >= allowance ? 0 : allowance - minted;
    }

    /**
     * @notice Allows users to mint NFTs during the public sale phase.
     * @dev Checks sale status, dynamic pricing, and supply limits. Mints the requested number of tokens.
     * @param numberOfTokens The number of tokens to mint in this transaction.
     * @custom:reverts SaleNotStarted if sale is not active.
     * @custom:reverts InsufficientPayment if not enough ETH is sent for the dynamic price.
     */
    function mint(uint256 numberOfTokens) external payable nonReentrant {
        if (!saleActive()) revert SaleNotStarted();
        uint256 price = getPrice();
        if (msg.value < numberOfTokens * price)
            revert InsufficientPayment();
        _mintNFT(numberOfTokens);
    }

    /**
     * @notice Internal helper to mint multiple NFTs for the caller.
     * @dev Checks purchase count and supply limits. Mints tokens to msg.sender.
     * @param numberOfTokens The number of tokens to mint.
     * @custom:reverts MintingTooMany if minting more than allowed per transaction.
     * @custom:reverts SoldOut if minting would exceed max supply.
     */
    function _mintNFT(uint256 numberOfTokens) internal {
        if (numberOfTokens > MAX_PURCHASE_COUNT) revert MintingTooMany();
        if (totalMinted() + numberOfTokens > MAX_SUPPLY) revert SoldOut();
        for (uint256 i = 0; i < numberOfTokens; i++) {
            _safeMint(msg.sender);
        }
    }

    /**
     * @notice Returns true if the presale is currently active.
     * @return presaleActive True if presale is active, false otherwise.
     */
    function presaleActive() public view returns (bool) {
        return startPresaleDate <= block.timestamp;
    }

    /**
     * @notice Returns true if the public sale is currently active.
     * @return saleActive True if public sale is active, false otherwise.
     */
    function saleActive() public view returns (bool) {
        return startMintDate <= block.timestamp;
    }

    /**
     * @notice Returns the base URI for token metadata.
     * @dev Overrides ERC721S to provide the custom baseTokenURI.
     * @return The current baseTokenURI string.
     */
    function _baseURI() internal view virtual override returns (string memory) {
        return baseTokenURI;
    }

    /**
     * @notice Updates the base URI for all token metadata.
     * @dev Only callable by the contract owner. Cannot update if the URI is frozen.
     * @param _baseTokenURI The new baseTokenURI string.
     * @custom:reverts BaseURIIsFrozen if the URI is already frozen.
     */
    function setBaseURI(string memory _baseTokenURI) external onlyOwner {
        if (baseTokenURIFrozen) revert BaseURIIsFrozen();
        baseTokenURI = _baseTokenURI;
    }

    /**
     * @notice Freezes the base token URI, preventing further changes.
     * @dev Only callable by the contract owner. Once frozen, cannot be unfrozen.
     */
    function freezeBaseTokenURI() external onlyOwner {
        baseTokenURIFrozen = true;
    }

    /**
     * @notice Updates the presale start date.
     * @dev Only callable by the contract owner.
     * @param _startPresaleDate The new presale start timestamp.
     */
    function setStartPresaleDate(uint256 _startPresaleDate) external onlyOwner {
        startPresaleDate = _startPresaleDate;
    }

    /**
     * @notice Updates the public sale start date.
     * @dev Only callable by the contract owner.
     * @param _startMintDate The new public sale start timestamp.
     */
    function setStartMintDate(uint256 _startMintDate) external onlyOwner {
        startMintDate = _startMintDate;
    }



    /*//////////////////////////////////////////////////////////////
                              PRINTABLE
    //////////////////////////////////////////////////////////////*/

    /**
     * @notice Allows token owners to redeem physical prints of their NFT within a 7-day window after minting.
     * @dev Only the token owner can print, and only once per token. Must be within the print window.
     * @param id The token ID to print.
     * @param size The print size: 1 for small print (0.1 ETH), 2 for large print (0.2 ETH).
     * @custom:reverts notOwner if caller is not the token owner.
     * @custom:reverts alreadyPrinted if the token has already been printed.
     * @custom:reverts printNotAvailable if the 7-day print window has expired.
     * @custom:reverts InsufficientPayment if not enough ETH is sent for the selected print size.
     */
    function printToken(uint256 id, uint256 size) external payable {
      if (ownerOf(id) != msg.sender) {
        revert notOwner();
      }
      if (printStatus[id] != PrintStatus.UNPRINTED) {
        revert alreadyPrinted();
      }
      if (block.timestamp > endPrintDate) {
        revert printNotAvailable();
      }
      if (size != 1 && size != 2) {
        revert("Invalid print size");
      }
      if (size == 1) {
        if (msg.value < smallPrintPrice) {
          revert InsufficientPayment();
        }
      } else if (size == 2) {
        if (msg.value < largePrintPrice) {
          revert InsufficientPayment();
        }
      }
      if (size == 1) {
        printStatus[id] = PrintStatus.SMALL_PRINT;
      } else if (size == 2) {
        printStatus[id] = PrintStatus.LARGE_PRINT;
      }
    }

    /*//////////////////////////////////////////////////////////////
                              BURNABLE
    //////////////////////////////////////////////////////////////*/

    /**
     * @notice Burns a token if the caller is a burnOperator or is approved/owner, and the token is not locked.
     * @dev The burnOperator can be a future contract with burn permissions. Owners/approved can also burn their tokens.
     * @param id The token ID to burn.
     * @custom:reverts burnNotAllowed if the token is locked or caller lacks permission.
     */
    function burn(uint256 id) public virtual {
        if (tokenLocked[id]) {
          revert burnNotAllowed();
        }
        if (burnOperator[msg.sender]) {
            return _burn(id);
        }
        if (_isApprovedOrOwner(msg.sender, id)) {
            return _burn(id);
        }
        revert burnNotAllowed();
    }

    /**
     * @notice Allows the token owner to lock or unlock their token, preventing or allowing burning.
     * @dev Only the token owner can change the lock status. When locked, the token cannot be burned by anyone.
     * @param id The token ID to lock or unlock.
     * @param locked True to lock the token, false to unlock.
     */
    function setTokenLocked(uint256 id, bool locked) external {
      if (ownerOf(id) == msg.sender) {
        tokenLocked[id] = locked;
      }
    }

    /**
     * @notice Sets a burnOperator address, which is allowed to burn any token in the collection.
     * @dev Only the contract owner can set a burnOperator. Intended for future contract integrations.
     * @param operator The address to grant burnOperator permissions.
     */
    function setBurnOperator(address operator, bool canBurn) external onlyOwner {
        burnOperator[operator] = canBurn;
    }

    /**
     * @notice Allows the contract owner to withdraw ETH from the contract.
     * @dev Only the contract owner can withdraw funds.
     * @param amount The amount of ETH to withdraw in wei.
     * @param recipient The address to send the ETH to.
     */
    function withdrawETH(uint256 amount, address payable recipient) external onlyOwner {
        require(recipient != address(0), "Invalid recipient");
        require(amount <= address(this).balance, "Insufficient balance");
        recipient.transfer(amount);
    }

    /**
     * @notice Allows the contract owner to withdraw all ETH from the contract.
     * @dev Only the contract owner can withdraw funds.
     * @param recipient The address to send the ETH to.
     */
    function withdrawAllETH(address payable recipient) external onlyOwner {
        require(recipient != address(0), "Invalid recipient");
        uint256 balance = address(this).balance;
        require(balance > 0, "No ETH to withdraw");
        recipient.transfer(balance);
    }

    /**
     * @notice Allows the contract owner to withdraw ERC20 tokens from the contract.
     * @dev Only the contract owner can withdraw tokens.
     * @param token The ERC20 token contract address.
     * @param amount The amount of tokens to withdraw.
     * @param recipient The address to send the tokens to.
     */
    function withdrawERC20(address token, uint256 amount, address recipient) external onlyOwner {
        require(recipient != address(0), "Invalid recipient");
        require(token != address(0), "Invalid token address");

        IERC20(token).transfer(recipient, amount);
    }

    /**
     * @notice Allows the contract owner to withdraw all ERC20 tokens from the contract.
     * @dev Only the contract owner can withdraw tokens.
     * @param token The ERC20 token contract address.
     * @param recipient The address to send the tokens to.
     */
    function withdrawAllERC20(address token, address recipient) external onlyOwner {
        require(recipient != address(0), "Invalid recipient");
        require(token != address(0), "Invalid token address");

        uint256 balance = IERC20(token).balanceOf(address(this));
        require(balance > 0, "No tokens to withdraw");

        IERC20(token).transfer(recipient, balance);
    }

    /**
     * @notice Allows the contract owner to transfer ERC721 tokens that were accidentally sent to this contract.
     * @dev Only the contract owner can transfer tokens.
     * @param token The ERC721 token contract address.
     * @param tokenId The ID of the token to transfer.
     * @param recipient The address to send the token to.
     */
    function transferERC721(address token, uint256 tokenId, address recipient) external onlyOwner {
        require(recipient != address(0), "Invalid recipient");
        require(token != address(0), "Invalid token address");

        IERC721(token).transferFrom(address(this), recipient, tokenId);
    }

    /**
     * @notice Allows the contract owner to transfer ERC1155 tokens that were accidentally sent to this contract.
     * @dev Only the contract owner can transfer tokens.
     * @param token The ERC1155 token contract address.
     * @param tokenId The ID of the token to transfer.
     * @param amount The amount of tokens to transfer.
     * @param recipient The address to send the tokens to.
     */
    function transferERC1155(address token, uint256 tokenId, uint256 amount, address recipient) external onlyOwner {
        require(recipient != address(0), "Invalid recipient");
        require(token != address(0), "Invalid token address");
        require(amount > 0, "Invalid amount");

        IERC1155(token).safeTransferFrom(address(this), recipient, tokenId, amount, "");
    }

    /**
     * @notice ERC1155Receiver implementation - called when ERC1155 tokens are transferred to this contract.
     * @dev This function is required for the contract to receive ERC1155 tokens.
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external override returns (bytes4) {
        return this.onERC1155Received.selector;
    }

    /**
     * @notice ERC1155Receiver implementation - called when ERC1155 batch tokens are transferred to this contract.
     * @dev This function is required for the contract to receive ERC1155 batch tokens.
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external override returns (bytes4) {
        return this.onERC1155BatchReceived.selector;
    }

    /**
     * @notice Override supportsInterface to support both ERC721 and ERC1155Receiver interfaces.
     * @dev This function is required for the contract to properly implement multiple interfaces.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Sequential, ERC1155Receiver) returns (bool) {
        return super.supportsInterface(interfaceId);
    }

    /**
     * @notice Allows the contract to receive ETH.
     * @dev This function is required for the contract to accept ETH payments.
     */
    receive() external payable {}
}
ERC721S.sol 526 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/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 ERC721Sequential is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Total number of tokens burned
    uint256 internal _burnCount;

    // Array of all tokens storing the owner's address
    address[] internal _tokens = [address(0x0)];

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

    function totalMinted() public view returns (uint256) {
        return _tokens.length - 1;
    }

    function totalSupply() public view returns (uint256) {
        return totalMinted() - _burnCount;
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     * This is implementation is O(n) and should not be
     * called by other contracts.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index)
        public
        view
        returns (uint256)
    {
        uint256 currentIndex = 0;
        for (uint256 i = 0; i < _tokens.length; i++) {
            if (_tokens[i] == owner) {
                if (currentIndex == index) {
                    return i;
                }
                currentIndex += 1;
            }
        }
        revert("ERC721Enumerable: owner index out of bounds");
    }

    /**
     * @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)
    {
        require(
            _exists(tokenId),
            "ERC721: owner query for nonexistent token"
        );
        return _tokens[tokenId];
    }

    /**
     * @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 = ERC721Sequential.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) {
        if (tokenId > totalMinted()) {
          return false;
        }
        return _tokens[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 = ERC721Sequential.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) internal virtual {
        _safeMint(to, "");
    }

    /**
     * @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, bytes memory _data) internal virtual {
        _mint(to);
        require(
            _checkOnERC721Received(address(0), to, _tokens.length - 1, _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) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");

        uint256 tokenId = _tokens.length;
        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _tokens.push(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 = ERC721Sequential.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);
        _burnCount++;
        _balances[owner] -= 1;
        _tokens[tokenId] = address(0);

        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(
            ERC721Sequential.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;
        _tokens[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(ERC721Sequential.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 {}
}

Read Contract

MAX_PURCHASE_COUNT 0x752c0ace → uint256
MAX_SUPPLY 0x32cb6b0c → uint256
balanceOf 0x70a08231 → uint256
banditContractAddress 0x518cb991 → address
baseTokenURI 0xd547cfb7 → string
baseTokenURIFrozen 0xce9c6053 → bool
burnOperator 0x82bdbca4 → bool
discountedMintPrice 0x903f16a3 → uint256
endPrintDate 0x28875275 → uint256
firstTokenAddress 0x742583c8 → address
getApproved 0x081812fc → address
getPrice 0x98d5fdca → uint256
isApprovedForAll 0xe985e9c5 → bool
largePrintPrice 0xd9594199 → uint256
mintPrice 0x6817c76c → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
presaleActive 0x53135ca0 → bool
presaleAllowanceFor 0xe398145d → uint256
presaleMintAllowance 0x63dfbbf4 → uint256
presaleMinted 0xbc660cac → uint256
printStatus 0x0a3fac4a → uint8
saleActive 0x68428a1b → bool
smallPrintPrice 0x1a9c1dec → uint256
startMintDate 0xda67e22a → uint256
startPresaleDate 0xe08a5f9e → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenLocked 0x46694b7d → bool
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalMinted 0xa2309ff8 → uint256
totalSupply 0x18160ddd → uint256

Write Contract 26 functions

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

approve 0x095ea7b3
address to
uint256 tokenId
burn 0x42966c68
uint256 id
freezeBaseTokenURI 0x197b8314
No parameters
mint 0xa0712d68
uint256 numberOfTokens
mintFirstToken 0x1dd0c2fd
address recipient
onERC1155BatchReceived 0xbc197c81
address operator
address from
uint256[] ids
uint256[] values
bytes data
returns: bytes4
onERC1155Received 0xf23a6e61
address operator
address from
uint256 id
uint256 value
bytes data
returns: bytes4
presaleMint 0xc9b298f1
uint256 numberOfTokens
printToken 0x1411669e
uint256 id
uint256 size
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 _baseTokenURI
setBurnOperator 0xb88906d7
address operator
bool canBurn
setStartMintDate 0x493143e4
uint256 _startMintDate
setStartPresaleDate 0x6d44aef5
uint256 _startPresaleDate
setTokenLocked 0x9c0c6997
uint256 id
bool locked
transferERC1155 0x3d7fe791
address token
uint256 tokenId
uint256 amount
address recipient
transferERC721 0xc9d5bde4
address token
uint256 tokenId
address recipient
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdrawAllERC20 0xae11c7f8
address token
address recipient
withdrawAllETH 0x9ebd9115
address recipient
withdrawERC20 0x5fc3ea0b
address token
uint256 amount
address recipient
withdrawETH 0x36118b52
uint256 amount
address recipient

Token Balances (1)

View Transfers →
WETH 0

Recent Transactions

No transactions found for this address