Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x1B23D0f0f6DC3547C1B6945152ACbfd6eAad85B0
Balance 0 ETH
Nonce 1
Code Size 15766 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

15766 bytes
0x6080604052600436106103cd5760003560e01c806375b238fc116101fd578063b9c4d9fb11610118578063dbe7db3b116100ab578063ed4a6b0c1161007a578063ed4a6b0c14610b2c578063f1559c8814610b4c578063f51f96dd14610b6c578063fa4020cb14610b82578063fc3483b414610b9a57600080fd5b8063dbe7db3b14610a8b578063dc9b125d14610aab578063df30e54b14610ac3578063e985e9c514610ae357600080fd5b8063ca6ce643116100e7578063ca6ce64314610a2d578063cea95c9514610a43578063d111515d14610a56578063d547741f14610a6b57600080fd5b8063b9c4d9fb1461099c578063c155531d146109c9578063c6ab67a3146109f8578063c87b56dd14610a0d57600080fd5b80639a37f52c11610190578063a22cb4651161015f578063a22cb4651461091c578063b49c2b491461093c578063b76ef6271461095c578063b88d4fde1461097c57600080fd5b80639a37f52c146108c45780639d5561e1146108dc578063a1394c94146108f2578063a217fddf1461090757600080fd5b806387e45c1e116101cc57806387e45c1e1461085c578063895b60421461087c57806391d148541461088f57806395d89b41146108af57600080fd5b806375b238fc146107f25780637c7bd02b146108145780637c94f2da146108345780638456cb591461084757600080fd5b806336568abe116102ed57806350f418ef116102805780636b29b79f1161024f5780636b29b79f1461077c5780636c94b65f1461079c5780636fb6ece7146107b257806370a08231146107d257600080fd5b806350f418ef1461070e5780635c975abb1461072e5780636352211e14610746578063682373291461076657600080fd5b8063411d8f2f116102bc578063411d8f2f1461067e578063421456ed1461069e57806342842e0e146106ce57806342966c68146106ee57600080fd5b806336568abe1461061e5780633ccfd60b1461063e5780633ded8502146106535780633f4ba83a1461066957600080fd5b80630fad0f511161036557806323b872dd1161033457806323b872dd1461058e578063248a9ca3146105ae5780632f2ff15d146105de5780633549345e146105fe57600080fd5b80630fad0f5114610504578063109695231461051e57806317a038f41461053e5780631919fed71461056e57600080fd5b8063081812fc116103a1578063081812fc14610467578063095ea7b31461049f5780630cba99f3146104c15780630ebd4c7f146104d757600080fd5b80620e7fa8146103d257806301ffc9a7146103fb578063054f7d9c1461042b57806306fdde0314610445575b600080fd5b3480156103de57600080fd5b506103e8600f5481565b6040519081526020015b60405180910390f35b34801561040757600080fd5b5061041b6104163660046131ed565b610bba565b60405190151581526020016103f2565b34801561043757600080fd5b50600b5461041b9060ff1681565b34801561045157600080fd5b5061045a610bcb565b6040516103f29190613262565b34801561047357600080fd5b50610487610482366004613275565b610c5d565b6040516001600160a01b0390911681526020016103f2565b3480156104ab57600080fd5b506104bf6104ba3660046132a3565b610cea565b005b3480156104cd57600080fd5b506103e8600c5481565b3480156104e357600080fd5b506104f76104f2366004613275565b610dff565b6040516103f291906132cf565b34801561051057600080fd5b5060145461041b9060ff1681565b34801561052a57600080fd5b506104bf6105393660046133b2565b610e6f565b34801561054a57600080fd5b5061041b6105593660046133fb565b60176020526000908152604090205460ff1681565b34801561057a57600080fd5b506104bf610589366004613275565b610ecb565b34801561059a57600080fd5b506104bf6105a9366004613418565b610f15565b3480156105ba57600080fd5b506103e86105c9366004613275565b60009081526007602052604090206001015490565b3480156105ea57600080fd5b506104bf6105f9366004613459565b610f47565b34801561060a57600080fd5b506104bf610619366004613275565b610f6c565b34801561062a57600080fd5b506104bf610639366004613459565b610fb6565b34801561064a57600080fd5b506104bf611030565b34801561065f57600080fd5b506103e86119ff81565b34801561067557600080fd5b506104bf611091565b34801561068a57600080fd5b50600954610487906001600160a01b031681565b3480156106aa57600080fd5b5061041b6106b93660046133fb565b60186020526000908152604090205460ff1681565b3480156106da57600080fd5b506104bf6106e9366004613418565b6110e0565b3480156106fa57600080fd5b506104bf610709366004613275565b6110fb565b34801561071a57600080fd5b506104bf610729366004613418565b611175565b34801561073a57600080fd5b5060065460ff1661041b565b34801561075257600080fd5b50610487610761366004613275565b6112ab565b34801561077257600080fd5b506103e8600a5481565b34801561078857600080fd5b506104bf6107973660046133fb565b611322565b3480156107a857600080fd5b506103e8600d5481565b3480156107be57600080fd5b506104bf6107cd366004613275565b611389565b3480156107de57600080fd5b506103e86107ed3660046133fb565b6113d3565b3480156107fe57600080fd5b506103e8600080516020613d4183398151915281565b34801561082057600080fd5b506104bf61082f3660046132a3565b61145a565b6104bf61084236600461349f565b6114c5565b34801561085357600080fd5b506104bf6115aa565b34801561086857600080fd5b506104bf610877366004613275565b6115f7565b6104bf61088a366004613524565b611641565b34801561089b57600080fd5b5061041b6108aa366004613459565b6117e8565b3480156108bb57600080fd5b5061045a611813565b3480156108d057600080fd5b50600d5442101561041b565b3480156108e857600080fd5b506103e860115481565b3480156108fe57600080fd5b5061045a611822565b34801561091357600080fd5b506103e8600081565b34801561092857600080fd5b506104bf6109373660046135ac565b6118b0565b34801561094857600080fd5b506104bf6109573660046133b2565b6118fa565b34801561096857600080fd5b506104bf610977366004613275565b61198e565b34801561098857600080fd5b506104bf6109973660046135da565b6119d8565b3480156109a857600080fd5b506109bc6109b7366004613275565b611a0a565b6040516103f2919061365a565b3480156109d557600080fd5b506109e96109e436600461369b565b611a91565b6040516103f29392919061371b565b348015610a0457600080fd5b5061045a611b0a565b348015610a1957600080fd5b5061045a610a28366004613275565b611b17565b348015610a3957600080fd5b506103e8600e5481565b6104bf610a5136600461374b565b611b9a565b348015610a6257600080fd5b506104bf611d40565b348015610a7757600080fd5b506104bf610a86366004613459565b611d9f565b348015610a9757600080fd5b506104bf610aa63660046137bb565b611dc4565b348015610ab757600080fd5b50600e5442101561041b565b348015610acf57600080fd5b506104bf610ade36600461386d565b611e59565b348015610aef57600080fd5b5061041b610afe36600461388a565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b348015610b3857600080fd5b50600854610487906001600160a01b031681565b348015610b5857600080fd5b506104bf610b67366004613275565b611eb1565b348015610b7857600080fd5b506103e860105481565b348015610b8e57600080fd5b50600c5442101561041b565b348015610ba657600080fd5b506104bf610bb5366004613275565b611efb565b6000610bc582611f45565b92915050565b606060008054610bda906138b8565b80601f0160208091040260200160405190810160405280929190818152602001828054610c06906138b8565b8015610c535780601f10610c2857610100808354040283529160200191610c53565b820191906000526020600020905b815481529060010190602001808311610c3657829003601f168201915b5050505050905090565b6000610c6882611f6a565b610cce5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b6000610cf5826112ab565b9050806001600160a01b0316836001600160a01b031603610d625760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610cc5565b336001600160a01b0382161480610d7e5750610d7e8133610afe565b610df05760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610cc5565b610dfa8383611f87565b505050565b6060610e0a82611f6a565b610e265760405162461bcd60e51b8152600401610cc5906138f2565b60408051600180825281830190925260009160208083019080368337019050509050600a5481600081518110610e5e57610e5e61390f565b602090810291909101015292915050565b610e87600080516020613d41833981519152336117e8565b80610e985750610e986000336117e8565b610eb45760405162461bcd60e51b8152600401610cc590613925565b8051610ec790601390602084019061313e565b5050565b610ee3600080516020613d41833981519152336117e8565b80610ef45750610ef46000336117e8565b610f105760405162461bcd60e51b8152600401610cc590613925565b601055565b610f20335b82611ff5565b610f3c5760405162461bcd60e51b8152600401610cc590613952565b610dfa8383836120df565b600082815260076020526040902060010154610f6281612286565b610dfa8383612290565b610f84600080516020613d41833981519152336117e8565b80610f955750610f956000336117e8565b610fb15760405162461bcd60e51b8152600401610cc590613925565b600f55565b6001600160a01b03811633146110265760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610cc5565b610ec78282612316565b61103b6000336117e8565b6110575760405162461bcd60e51b8152600401610cc5906139a3565b60085460405147916001600160a01b03169082156108fc029083906000818181858888f19350505050158015610ec7573d6000803e3d6000fd5b6110a9600080516020613d41833981519152336117e8565b806110ba57506110ba6000336117e8565b6110d65760405162461bcd60e51b8152600401610cc590613925565b6110de61237d565b565b610dfa838383604051806020016040528060008152506119d8565b61110433610f1a565b6111695760405162461bcd60e51b815260206004820152603060248201527f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760448201526f1b995c881b9bdc88185c1c1c9bdd995960821b6064820152608401610cc5565b61117281612410565b50565b61118d600080516020613d41833981519152336117e8565b8061119e575061119e6000336117e8565b6111ba5760405162461bcd60e51b8152600401610cc590613925565b60405163095ea7b360e01b8152306004820152602481018290526001600160a01b0384169063095ea7b3906044016020604051808303816000875af1158015611207573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061122b91906139d0565b506040516323b872dd60e01b81523060048201526001600160a01b038381166024830152604482018390528416906323b872dd906064016020604051808303816000875af1158015611281573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a591906139d0565b50505050565b6000818152600260205260408120546001600160a01b031680610bc55760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610cc5565b61133a600080516020613d41833981519152336117e8565b8061134b575061134b6000336117e8565b6113675760405162461bcd60e51b8152600401610cc590613925565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6113a1600080516020613d41833981519152336117e8565b806113b257506113b26000336117e8565b6113ce5760405162461bcd60e51b8152600401610cc590613925565b600c55565b60006001600160a01b03821661143e5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610cc5565b506001600160a01b031660009081526003602052604090205490565b611472600080516020613d41833981519152336117e8565b8061148357506114836000336117e8565b61149f5760405162461bcd60e51b8152600401610cc590613925565b600980546001600160a01b0319166001600160a01b039390931692909217909155600a55565b600e544210156114e75760405162461bcd60e51b8152600401610cc5906139ed565b6011548111156115095760405162461bcd60e51b8152600401610cc590613a0f565b34816010546115189190613a4c565b146115355760405162461bcd60e51b8152600401610cc590613a6b565b611541338585856124b7565b15156001146115625760405162461bcd60e51b8152600401610cc590613a8d565b60005b818110156115a357611591336011546119ff6115819190613ab3565b61158c906001613aca565b61257a565b60118054600019019055600101611565565b5050505050565b6115c2600080516020613d41833981519152336117e8565b806115d357506115d36000336117e8565b6115ef5760405162461bcd60e51b8152600401610cc590613925565b6110de612594565b61160f600080516020613d41833981519152336117e8565b8061162057506116206000336117e8565b61163c5760405162461bcd60e51b8152600401610cc590613925565b600d55565b600c544210156116635760405162461bcd60e51b8152600401610cc5906139ed565b6011548111156116855760405162461bcd60e51b8152600401610cc590613a0f565b3481600f546116949190613a4c565b146116b15760405162461bcd60e51b8152600401610cc590613a6b565b6116bd338787876124b7565b15156001146116de5760405162461bcd60e51b8152600401610cc590613a8d565b6116e983838961260f565b6117055760405162461bcd60e51b8152600401610cc590613ae2565b868111156117495760405162461bcd60e51b815260206004820152601160248201527008af0c6cacac8e6a0e4cae6c2d8ca9ac2f607b1b6044820152606401610cc5565b3360009081526017602052604090205460ff16156117935760405162461bcd60e51b815260206004820152600760248201526610db185a5b595960ca1b6044820152606401610cc5565b60005b818110156117c4576117b2336011546119ff6115819190613ab3565b60118054600019019055600101611796565b5050336000908152601760205260409020805460ff19166001179055505050505050565b60009182526007602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060018054610bda906138b8565b6012805461182f906138b8565b80601f016020809104026020016040519081016040528092919081815260200182805461185b906138b8565b80156118a85780601f1061187d576101008083540402835291602001916118a8565b820191906000526020600020905b81548152906001019060200180831161188b57829003601f168201915b505050505081565b60145460ff16156118ef5760405162461bcd60e51b815260206004820152600960248201526814dbdd5b189bdd5b9960ba1b6044820152606401610cc5565b610ec73383836126b9565b611912600080516020613d41833981519152336117e8565b8061192357506119236000336117e8565b61193f5760405162461bcd60e51b8152600401610cc590613925565b600b5460ff161561197b5760405162461bcd60e51b8152602060048201526006602482015265233937bd32b760d11b6044820152606401610cc5565b8051610ec790601290602084019061313e565b6119a6600080516020613d41833981519152336117e8565b806119b757506119b76000336117e8565b6119d35760405162461bcd60e51b8152600401610cc590613925565b601555565b6119e23383611ff5565b6119fe5760405162461bcd60e51b8152600401610cc590613952565b6112a584848484612787565b6060611a1582611f6a565b611a315760405162461bcd60e51b8152600401610cc5906138f2565b60408051600180825281830190925260009160208083019080368337505060095482519293506001600160a01b031691839150600090611a7357611a7361390f565b6001600160a01b039092166020928302919091019091015292915050565b600954600a5460009182916060916001600160a01b031690611ab590606490613b1a565b611abf9088613b1a565b868681818080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250969e959d50919b50939950505050505050505050565b6013805461182f906138b8565b6060611b2282611f6a565b611b3e5760405162461bcd60e51b8152600401610cc5906138f2565b6000611b486127ba565b90506000815111611b685760405180602001604052806000815250611b93565b80611b72846127c9565b604051602001611b83929190613b2e565b6040516020818303038152906040525b9392505050565b600d54421015611bbc5760405162461bcd60e51b8152600401610cc5906139ed565b601154811115611bde5760405162461bcd60e51b8152600401610cc590613a0f565b3481600f54611bed9190613a4c565b14611c0a5760405162461bcd60e51b8152600401610cc590613a6b565b611c16338787876124b7565b1515600114611c375760405162461bcd60e51b8152600401610cc590613a8d565b611c4183836128b0565b611c5d5760405162461bcd60e51b8152600401610cc590613ae2565b6002811115611ca25760405162461bcd60e51b815260206004820152601160248201527008af0c6cacac8e6a0e4cae6c2d8ca9ac2f607b1b6044820152606401610cc5565b3360009081526018602052604090205460ff1615611cec5760405162461bcd60e51b815260206004820152600760248201526610db185a5b595960ca1b6044820152606401610cc5565b60005b81811015611d1d57611d0b336011546119ff6115819190613ab3565b60118054600019019055600101611cef565b5050336000908152601860205260409020805460ff191660011790555050505050565b611d4b6000336117e8565b611d675760405162461bcd60e51b8152600401610cc5906139a3565b600b805460ff191660011790556040517fa8cab3d1893ed53071b052fafa843143492f25d1d6b0170d460789f7ab1954be90600090a1565b600082815260076020526040902060010154611dba81612286565b610dfa8383612316565b611dcf6000336117e8565b611deb5760405162461bcd60e51b8152600401610cc5906139a3565b60115481511115611e0e5760405162461bcd60e51b8152600401610cc590613a0f565b60005b8151811015610ec757611e47828281518110611e2f57611e2f61390f565b60200260200101516011546119ff6115819190613ab3565b60118054600019019055600101611e11565b611e71600080516020613d41833981519152336117e8565b80611e825750611e826000336117e8565b611e9e5760405162461bcd60e51b8152600401610cc590613925565b6014805460ff1916911515919091179055565b611ec9600080516020613d41833981519152336117e8565b80611eda5750611eda6000336117e8565b611ef65760405162461bcd60e51b8152600401610cc590613925565b601655565b611f13600080516020613d41833981519152336117e8565b80611f245750611f246000336117e8565b611f405760405162461bcd60e51b8152600401610cc590613925565b600e55565b60006001600160e01b03198216637965db0b60e01b1480610bc55750610bc582612952565b6000908152600260205260409020546001600160a01b0316151590565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611fbc826112ab565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061200082611f6a565b6120615760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610cc5565b600061206c836112ab565b9050806001600160a01b0316846001600160a01b031614806120b357506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b806120d75750836001600160a01b03166120cc84610c5d565b6001600160a01b0316145b949350505050565b826001600160a01b03166120f2826112ab565b6001600160a01b0316146121565760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610cc5565b6001600160a01b0382166121b85760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610cc5565b6121c3838383612977565b6121ce600082611f87565b6001600160a01b03831660009081526003602052604081208054600192906121f7908490613ab3565b90915550506001600160a01b0382166000908152600360205260408120805460019290612225908490613aca565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b611172813361298b565b61229a82826117e8565b610ec75760008281526007602090815260408083206001600160a01b03851684529091529020805460ff191660011790556122d23390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61232082826117e8565b15610ec75760008281526007602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60065460ff166123c65760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610cc5565b6006805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600061241b826112ab565b905061242981600084612977565b612434600083611f87565b6001600160a01b038116600090815260036020526040812080546001929061245d908490613ab3565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60408051606081018252601b602082019081527f5369676e2074686973206d65737361676520746f206c6f67696e210000000000928201929092529081526000906001612503826129ef565b6040805160008152602081018083529290925260ff881690820152606081018690526080810185905260a0016020604051602081039080840390855afa158015612551573d6000803e3d6000fd5b505050602060405103516001600160a01b0316866001600160a01b031614915050949350505050565b610ec7828260405180602001604052806000815250612b7b565b60065460ff16156125da5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610cc5565b6006805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586123f33390565b6040516bffffffffffffffffffffffff193360601b166020820152603481018290526000908190605401604051602081830303815290604052805190602001209050612692858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506015549150849050612bae565b6126ae5760405162461bcd60e51b8152600401610cc590613ae2565b506001949350505050565b816001600160a01b0316836001600160a01b03160361271a5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610cc5565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6127928484846120df565b61279e84848484612bc4565b6112a55760405162461bcd60e51b8152600401610cc590613b6d565b606060128054610bda906138b8565b60608160005b81156127f557806127df81613bbf565b91506127ee9050600a83613b1a565b91506127cf565b60008167ffffffffffffffff81111561281057612810613313565b6040519080825280601f01601f19166020018201604052801561283a576020820181803683370190505b508593509050815b83156128a757612853600a85613bd8565b61285e906030613aca565b60f81b8261286b83613bec565b9250828151811061287e5761287e61390f565b60200101906001600160f81b031916908160001a9053506128a0600a85613b1a565b9350612842565b50949350505050565b6040516bffffffffffffffffffffffff193360601b166020820152600090819060340160405160208183030381529060405280519060200120905061292c848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506016549150849050612bae565b6129485760405162461bcd60e51b8152600401610cc590613ae2565b5060019392505050565b60006001600160e01b0319821663c155531d60e01b1480610bc55750610bc582612cc2565b612982838383612ce7565b610dfa83612d4e565b61299582826117e8565b610ec7576129ad816001600160a01b03166014612d9f565b6129b8836020612d9f565b6040516020016129c9929190613c03565b60408051601f198184030181529082905262461bcd60e51b8252610cc591600401613262565b6000604051806080016040528060528152602001613cef60529139604051602001612a1a9190613c78565b60408051601f198184030181528282528051602091820120908301527fade9170006ba9b02cb92261e1bafa6e01c8d8b549223c438836a9c61f9694290908201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260016080820152733effdc0a9f4cdb249c886f4a65970fe14d6677bb60a082015260c0016040516020818303038152906040528051906020012060405180604001604052806012815260200171556e697428737472696e67206c6f67496e2960701b815250604051602001612af69190613c78565b60408051601f1981840301815282825280516020918201208651805190830120918401529082015260600160405160208183030381529060405280519060200120604051602001612b5e92919061190160f01b81526002810192909252602282015260420190565b604051602081830303815290604052805190602001209050919050565b612b858383612f3b565b612b926000848484612bc4565b610dfa5760405162461bcd60e51b8152600401610cc590613b6d565b600082612bbb858461307a565b14949350505050565b60006001600160a01b0384163b15612cba57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612c08903390899088908890600401613c94565b6020604051808303816000875af1925050508015612c43575060408051601f3d908101601f19168201909252612c4091810190613cd1565b60015b612ca0573d808015612c71576040519150601f19603f3d011682016040523d82523d6000602084013e612c76565b606091505b508051600003612c985760405162461bcd60e51b8152600401610cc590613b6d565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506120d7565b5060016120d7565b60006001600160e01b03198216632dde656160e21b1480610bc55750610bc5826130ee565b60065460ff1615610dfa5760405162461bcd60e51b815260206004820152602b60248201527f4552433732315061757361626c653a20746f6b656e207472616e73666572207760448201526a1a1a5b19481c185d5cd95960aa1b6064820152608401610cc5565b60145460ff161580612d6757506001600160a01b038116155b6111725760405162461bcd60e51b815260206004820152600960248201526814dbdd5b189bdd5b9960ba1b6044820152606401610cc5565b60606000612dae836002613a4c565b612db9906002613aca565b67ffffffffffffffff811115612dd157612dd1613313565b6040519080825280601f01601f191660200182016040528015612dfb576020820181803683370190505b509050600360fc1b81600081518110612e1657612e1661390f565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612e4557612e4561390f565b60200101906001600160f81b031916908160001a9053506000612e69846002613a4c565b612e74906001613aca565b90505b6001811115612eec576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612ea857612ea861390f565b1a60f81b828281518110612ebe57612ebe61390f565b60200101906001600160f81b031916908160001a90535060049490941c93612ee581613bec565b9050612e77565b508315611b935760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610cc5565b6001600160a01b038216612f915760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610cc5565b612f9a81611f6a565b15612fe75760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610cc5565b612ff360008383612977565b6001600160a01b038216600090815260036020526040812080546001929061301c908490613aca565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600081815b84518110156130e657600085828151811061309c5761309c61390f565b602002602001015190508083116130c257600083815260208290526040902092506130d3565b600081815260208490526040902092505b50806130de81613bbf565b91505061307f565b509392505050565b60006001600160e01b031982166380ac58cd60e01b148061311f57506001600160e01b03198216635b5e139f60e01b145b80610bc557506301ffc9a760e01b6001600160e01b0319831614610bc5565b82805461314a906138b8565b90600052602060002090601f01602090048101928261316c57600085556131b2565b82601f1061318557805160ff19168380011785556131b2565b828001600101855582156131b2579182015b828111156131b2578251825591602001919060010190613197565b506131be9291506131c2565b5090565b5b808211156131be57600081556001016131c3565b6001600160e01b03198116811461117257600080fd5b6000602082840312156131ff57600080fd5b8135611b93816131d7565b60005b8381101561322557818101518382015260200161320d565b838111156112a55750506000910152565b6000815180845261324e81602086016020860161320a565b601f01601f19169290920160200192915050565b602081526000611b936020830184613236565b60006020828403121561328757600080fd5b5035919050565b6001600160a01b038116811461117257600080fd5b600080604083850312156132b657600080fd5b82356132c18161328e565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b81811015613307578351835292840192918401916001016132eb565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561335257613352613313565b604052919050565b600067ffffffffffffffff83111561337457613374613313565b613387601f8401601f1916602001613329565b905082815283838301111561339b57600080fd5b828260208301376000602084830101529392505050565b6000602082840312156133c457600080fd5b813567ffffffffffffffff8111156133db57600080fd5b8201601f810184136133ec57600080fd5b6120d78482356020840161335a565b60006020828403121561340d57600080fd5b8135611b938161328e565b60008060006060848603121561342d57600080fd5b83356134388161328e565b925060208401356134488161328e565b929592945050506040919091013590565b6000806040838503121561346c57600080fd5b82359150602083013561347e8161328e565b809150509250929050565b803560ff8116811461349a57600080fd5b919050565b600080600080608085870312156134b557600080fd5b6134be85613489565b966020860135965060408601359560600135945092505050565b60008083601f8401126134ea57600080fd5b50813567ffffffffffffffff81111561350257600080fd5b6020830191508360208260051b850101111561351d57600080fd5b9250929050565b600080600080600080600060c0888a03121561353f57600080fd5b8735965061354f60208901613489565b95506040880135945060608801359350608088013567ffffffffffffffff81111561357957600080fd5b6135858a828b016134d8565b989b979a5095989497959660a090950135949350505050565b801515811461117257600080fd5b600080604083850312156135bf57600080fd5b82356135ca8161328e565b9150602083013561347e8161359e565b600080600080608085870312156135f057600080fd5b84356135fb8161328e565b9350602085013561360b8161328e565b925060408501359150606085013567ffffffffffffffff81111561362e57600080fd5b8501601f8101871361363f57600080fd5b61364e8782356020840161335a565b91505092959194509250565b6020808252825182820181905260009190848201906040850190845b818110156133075783516001600160a01b031683529284019291840191600101613676565b600080600080606085870312156136b157600080fd5b8435935060208501359250604085013567ffffffffffffffff808211156136d757600080fd5b818701915087601f8301126136eb57600080fd5b8135818111156136fa57600080fd5b88602082850101111561370c57600080fd5b95989497505060200194505050565b60018060a01b03841681528260208201526060604082015260006137426060830184613236565b95945050505050565b60008060008060008060a0878903121561376457600080fd5b61376d87613489565b95506020870135945060408701359350606087013567ffffffffffffffff81111561379757600080fd5b6137a389828a016134d8565b979a9699509497949695608090950135949350505050565b600060208083850312156137ce57600080fd5b823567ffffffffffffffff808211156137e657600080fd5b818501915085601f8301126137fa57600080fd5b81358181111561380c5761380c613313565b8060051b915061381d848301613329565b818152918301840191848101908884111561383757600080fd5b938501935b8385101561386157843592506138518361328e565b828252938501939085019061383c565b98975050505050505050565b60006020828403121561387f57600080fd5b8135611b938161359e565b6000806040838503121561389d57600080fd5b82356138a88161328e565b9150602083013561347e8161328e565b600181811c908216806138cc57607f821691505b6020821081036138ec57634e487b7160e01b600052602260045260246000fd5b50919050565b602080825260039082015262444e4560e81b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b60208082526013908201527221b0b63632b91034b9903737ba1030b236b4b760691b604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b60208082526013908201527221b0b63632b91034b9903737ba1037bbb732b960691b604082015260600190565b6000602082840312156139e257600080fd5b8151611b938161359e565b602080825260089082015267546f6f4561726c7960c01b604082015260600190565b6020808252600d908201526c45786365656473537570706c7960981b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615613a6657613a66613a36565b500290565b602080825260089082015267426164507269636560c01b604082015260600190565b6020808252600c908201526b4261645369676e617475726560a01b604082015260600190565b600082821015613ac557613ac5613a36565b500390565b60008219821115613add57613add613a36565b500190565b6020808252600890820152672130b2283937b7b360c11b604082015260600190565b634e487b7160e01b600052601260045260246000fd5b600082613b2957613b29613b04565b500490565b60008351613b4081846020880161320a565b835190830190613b5481836020880161320a565b64173539b7b760d91b9101908152600501949350505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600060018201613bd157613bd1613a36565b5060010190565b600082613be757613be7613b04565b500690565b600081613bfb57613bfb613a36565b506000190190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613c3b81601785016020880161320a565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613c6c81602884016020880161320a565b01602801949350505050565b60008251613c8a81846020870161320a565b9190910192915050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613cc790830184613236565b9695505050505050565b600060208284031215613ce357600080fd5b8151611b93816131d756fe454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429a49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a26469706673582212203730d5051ae7ed7e86e2f7f41289c9497fd6e78207cd8eb918c3327233486d9064736f6c634300080d0033

Verified Source Code Full Match

Compiler: v0.8.13+commit.abaa5c0e EVM: london Optimization: Yes (200 runs)
ERC2981.sol 35 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/introspection/ERC165.sol";

/*
 * Implements Rarible Royalties V1 Schema
 * @dev https://eips.ethereum.org/EIPS/eip-2981
 */
abstract contract ERC2981 is ERC165 {
  /*
   * bytes4(keccak256('royaltyInfo(uint256, uint256, bytes)')) == 0xc155531d
   */
  bytes4 private constant _INTERFACE_ID_ERC2981 = 0xc155531d;

  /// @notice Called with the sale price to determine how much royalty
  ///         is owed and to whom.
  /// @param _tokenId - the NFT asset queried for royalty information
  /// @param _value - the sale price of the NFT asset specified by _tokenId
  /// @param _data - information used by extensions of this ERC.
  ///                Must not to be used by implementers of EIP-2981
  ///                alone.
  /// @return _receiver - address of who should be sent the royalty payment
  /// @return _royaltyAmount - the royalty payment amount for _value sale price
  /// @return _royaltyPaymentData - information used by extensions of this ERC.
  ///                               Must not to be used by implementers of
  ///                               EIP-2981 alone.
  function royaltyInfo(uint256 _tokenId, uint256 _value, bytes calldata _data) external virtual returns (address _receiver, uint256 _royaltyAmount, bytes memory _royaltyPaymentData);

  function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
    return interfaceId == _INTERFACE_ID_ERC2981
      || super.supportsInterface(interfaceId);
  }
}
PILLHEADS.sol 436 lines
/*
            ...
        ,░░░░░░░░░░
       ╖╢▒▒▒░╜▒▒▒▒▒▒░░
      ╓▒▒▓▓╣▄▒▒▒▒▒▒▒▒▒▒x╓╓▄▄▄@mmmm▄▄▄╖,.
      ║▒▒▒▓▓▓▓▓╣╣╝╙   ▐▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▀Ñ▄,
       ▒▒▒╢▓▓▓▀░    ░,▓╣╣▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒╜▒▒▒▀▄
       ╙▒▒╢▓╜░░░░▄▄▓█▓▓╣╢▒▒▒▒▒▒▒▒▒▒▒▒▒░   ▒▒▒ 'X░╖
         ╙▒░▄███████▓▓▓╣╢╣╢╣▒▒▒▒▒▄████▄▄  ▒▒▒   ░▓▒▒
         ╓░██████▓▓▓▓▓▓╣╢╢╣╢╢╣▒▄█▒▒▒▒▒░'▀▄▒▒▒ ▄▄░▒▒▄▒,
        ┌╢█▓▓▓▓▓▓▓▓▓▓▓╣╢╢╢▒╢╣╣▒█▒▒▒▒▒▒░  █▌▒▒  ▀█▒▒▒█▒╖
        ╫█╢▓▓▓▓▓▓▓▓▓▓▓╣╢╣╢╢╢╣╢▒█▒▒▒▒▒▒░  █▌▒▒   ▐█▌▒▒▌▒┐
       ╟▒▒╢╢▓▓▓▓▓▓▓▓▓╣╢╢╢╣╢╢▒╢╢▒█▄▒▒▒▒ ▄█▀▒▒▒    ▀█▒▒▒▒╢
       ╢█╢╢╢╣▓▓▓▓▓▓▓▒▒▒▒╣╢╢╢╢╣▒▒▒▒▀▀▀▀▀   ▒▒▒    ▒██▒▒█╢L
      ]╢▌╢╢╢╣╢▓▓▓▓██▀▒▒▀██▒╢▒╣▒▒▒▒▒▒▒▒    ▒▒▒    ▒██▒▒█▒╡
      ]╢▌╣╢╢╢╢╢╣██▒╢╢╢╢╣╣▒█▌╢╢▒╢▒▒▒╣▒▒    ▒▒▒    ▒██▒▒█╢▌
       ╢█╢╣╣╢╢╣╢█╣╢╢╢╢╢╣╣╢▒█╢▒▒▒▒▒▒▒▒▒    ▒▒▒    ▒██▒▒█╢F
       ╫▐▒╢╣╢╢╢╣██╢╣╢╢╢╣▒▒█▌▒▒▒▒▒▒▒▒▒▒    ▒▒▒    ▐█▒▒▒▌╫
        ╢█╢╢╢╢╣╣╣▒██▄▒▒▄██▒╢▒▒▒▒▒▒▒▒▒▒    ▒▒▒   ,█▌▒▒█╢▓
        ╙▒█╢╢╣╣╢╣╢╣╣▒▒▒▒▒▒▒▒▒▒▒╢▒▒▒▒▒▒    ▒▒▒  ╓█▀▒▒█▒▓
         ╙▒█▒╢╢╢▒▒╢╣╢▒╢╢╢▒▒▒▒▒╢▒▒▒▒▒▒▒    ▒▒▒░▄█ ▒▒█▒▓
          `╬▀▄╢╢▒██▒╢╢╣╢╢╢▒▒╢╢▒▒▒▒▒▒▒▒    ▒▒██▀  ▄▀╫╝
            ╙▒▀▄▒╢▒███▄▒╢╢╢╢▒▒╢╣▒▒▒▒▒▒░ ▄▄██▒░ ╓╜▒▓
              ╙╣▒▓▒╢▒▒▀████▄▄▄▄▒▄▄▄▄███▀▀ ▒▒▒@" r`
                "╩╣▒▀▒▒▒▒▒▒▒▒▀▀▀▀▀▒▒▒▒░ ,A▀▒▒╝`
                    ╙╩▓▒▒▀▒▒▒▒▒▒▒▒▒▒▀▒░-  ┘`
                         `"╙╨▓▓▓▓▓▓▓▓`
                             ]▓▓██▓▓▌
                             ╟▓▓▓▓▓▓▓
                    .╒▄▄Φ╖╖┐,╫▓▓▓▓▓▓▓▓▓▓██▌▄▄▄▄▄
               ╓█████τ██▓▓▓▓▓▓▓▓▓▓▓╫▓▓▓▓▓█▓██████▓▓▄▄,
         ╓g╫▓▓▓▓██████▒▓▓▓▓▓▓▓▓▓▓▓╣╣╣▓▓▓▓▓███████▓▓▓▓▓▓▓▓
       g▓▓▓▓▓▓▓▓███████▒▓▓▓▓▓▓▓▓▓▓▓╣╢╢╢▓▌▓███████▓▓▓▓▓▓▓▓▓
      j▓▓▓▓▓▓▓▓█████████▒▓▓▓▓▓▓▓▓▓▓▓╣╣╢▓╫████████▓▓▓▓▓▓▓▓▓
       ▓▓▓▓▓▓▓▓██████████▌▓▓╢▓▓▓▓▓╣╢▓▓╢▓█████████▓▓▓▓▓▓▓▓▌
       ▓▓▓▓▓▓▓▓▓████████████▓▀█████▓▓████████████▓███▓▓▓▓U
       ╠▓▓▓▓███▓███████████ 𝙋𝙄𝙇𝙇𝙃𝙀𝘼𝘿𝙎 ███████████████▓▓▓▓
        ▓▓▓██████████████████████████████████████████▓▓▓█
        ▓▓▓▓█████████████████████████████████████████▓▓▓█
        ╟▓▓▓▓████████████████████████████████████████▓▓▓▓
        '▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"


@founder   cfw
           cfw.eth
           @iamcfw

@tech      white lights
           whitelights.eth
           @iamwhitelights

@SPDX-License-Identifier: MIT

*/

pragma solidity ^0.8.13;

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Pausable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "./RaribleV1Royalties.sol";
import "./ERC2981.sol";


contract PILLHEADS is ERC721Burnable, ERC721Pausable, RaribleV1Royalties, ERC2981, AccessControl {

  event Frozen();

  address payable public paymentSplitter = payable(0x000000000000000000000000000000000000dEaD);
  address payable public royaltySplitter = payable(0x000000000000000000000000000000000000dEaD);
  uint256 public bps = 1000;

  bool public frozen = false;
  uint256 public presale1ActivationTime = 1655410800;
  uint256 public presale2ActivationTime = 1655583600;
  uint256 public saleActivationTime = 1655670000;
  uint256 public presalePrice = 100000000000000000;
  uint256 public salePrice = 140000000000000000;
  uint256 public mintsLeft = 6655;
  uint256 public constant MINTS_MAX = 6655;
  string public apiBaseURL;
  string public provenanceHash;

  // Admin identifier
  bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");

  // Soulbinding transfer lock -- true upon deploy
  bool public soulbound = true;

  // Merkle Tree root hashes for happylist presale phases
  bytes32 private presale1Root = bytes32(0);
  bytes32 private presale2Root = bytes32(0);

  mapping(address => bool) public presale1Claimed;
  mapping(address => bool) public presale2Claimed;

  // EIP712
  struct Unit { string logIn; }
  string private constant EIP712_DOMAIN  = "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)";
  string private constant UNIT_TYPE = "Unit(string logIn)";
  bytes32 private constant EIP712_DOMAIN_TYPEHASH = keccak256(abi.encodePacked(EIP712_DOMAIN));
  bytes32 private constant UNIT_TYPEHASH = keccak256(abi.encodePacked(UNIT_TYPE));
  bytes32 private constant DOMAIN_SEPARATOR = keccak256(abi.encode(
    EIP712_DOMAIN_TYPEHASH, // type
    keccak256("PILLHEADS"), // name
    keccak256("1"), // version
    1, // network
    0x3EFfDc0A9F4CDB249C886f4a65970fe14D6677Bb // address hash
  ));

  constructor() ERC721("Pillheads", "PILLHEADS") {
    _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
  }

  modifier onlyOwner() {
    require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "Caller is not owner");
    _;
  }

  modifier onlyAdmin() {
    require(hasRole(ADMIN_ROLE, _msgSender()) || hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "Caller is not admin");
    _;
  }

  function withdraw() public onlyOwner {
    uint256 balance = address(this).balance;
    paymentSplitter.transfer(balance);
  }

  function supportsInterface(bytes4 interfaceId) public view override(ERC721, RaribleV1Royalties, ERC2981, AccessControl ) returns (bool) {
    return super.supportsInterface(interfaceId);
  }

  function setPaymentSplitter(address payable newAddress) external onlyAdmin {
    paymentSplitter = newAddress;
  }

  function setRoyaltySplitter(address payable newAddress, uint256 newBps) external onlyAdmin {
    royaltySplitter = newAddress;
    bps = newBps;
  }

  function setSoulbound(bool bound) external onlyAdmin {
    soulbound = bound;
  }

  function setPresalePrice(uint256 price) external onlyAdmin {
    presalePrice = price;
  }

  function setSalePrice(uint256 price) external onlyAdmin {
    salePrice = price;
  }

  function setProvenanceHash(string memory hash) external onlyAdmin {
    provenanceHash = hash;
  }

  function setPresale1ActivationTime(uint256 timestampInSeconds) external onlyAdmin {
    presale1ActivationTime = timestampInSeconds;
  }

  function setPresale2ActivationTime(uint256 timestampInSeconds) external onlyAdmin {
    presale2ActivationTime = timestampInSeconds;
  }

  function setSaleActivationTime(uint256 timestampInSeconds) external onlyAdmin {
    saleActivationTime = timestampInSeconds;
  }

  function setPresale1MerkleRoot(bytes32 newRoot) external onlyAdmin {
    presale1Root = newRoot;
  }

  function setPresale2MerkleRoot(bytes32 newRoot) external onlyAdmin {
    presale2Root = newRoot;
  }

  function setAPIBaseURL(string memory url) external onlyAdmin {
    require(frozen == false, "Frozen");
    apiBaseURL = url;
  }

  function presale1Activated() public view returns (bool) {
    return block.timestamp >= presale1ActivationTime;
  }

  function presale2Activated() public view returns (bool) {
    return block.timestamp >= presale2ActivationTime;
  }

  function saleActivated() public view returns (bool) {
    return block.timestamp >= saleActivationTime;
  }

  function _baseURI() internal view override returns (string memory) {
    return apiBaseURL;
  }

  function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
    require(_exists(tokenId), "DNE");

    string memory baseURI = _baseURI();
    return bytes(baseURI).length > 0
      ? string(abi.encodePacked(baseURI, tokenID2str(tokenId), ".json"))
      : "";
  }

  function freezeMetadata() external onlyOwner {
    frozen = true;
    emit Frozen();
  }

  /*
   * In case we need to stop transfers AND minting.
   */
  function pause() external onlyAdmin {
    _pause();
  }

  /*
   * In case the emergency is no longer an issue.
   */
  function unpause() external onlyAdmin {
    _unpause();
  }

  function mintOwner(address[] memory addresses) public onlyOwner {
    require(addresses.length <= mintsLeft, "ExceedsSupply");
    for(uint i; i < addresses.length;) {
      // reduce the total pop after minting
      _safeMint(addresses[i], MINTS_MAX - mintsLeft + 1);
      unchecked { mintsLeft--; }
      unchecked { i++; }
    }
  }

  /*
   * The first five parameters of this are used to validate the call.
   * If the max mint, v, r, s, or the merkle proof are incorrect this reverts.
   * If they are all correct, the user can mint <= to their maxMints.
   * After that, they can never mint in this presale again.
   */
  function mintPresale1(uint256 maxMints, uint8 sigV, bytes32 sigR, bytes32 sigS, bytes32[] calldata merkleProof, uint256 amount) public payable {
    require(presale1Activated(), "TooEarly");
    require(amount <= mintsLeft, "ExceedsSupply");
    require(presalePrice * amount == msg.value, "BadPrice");
    require(verify(msg.sender, sigV, sigR, sigS) == true, "BadSignature");
    require(checkPresale1MerkleProof(merkleProof, maxMints), "BadProof");
    require(amount <= maxMints, "ExceedsPresaleMax");
    require(!presale1Claimed[msg.sender], "Claimed");

    // mint their tokens
    for(uint i; i < amount;) {
      // reduce the total pop after minting
      _safeMint(msg.sender, MINTS_MAX - mintsLeft + 1);
      unchecked { mintsLeft--; }
      unchecked { i++; }
    }

    // lock them out of re-entering presale 1
    unchecked { presale1Claimed[msg.sender] = true; }
  }

  /*
   * The first four parameters of this are used to validate the call.
   * If the v, r, s, or the merkle proof are incorrect this reverts.
   * If they are all correct, the user can mint one token.
   * After that, they can never mint in this presale again.
   */
  function mintPresale2(uint8 sigV, bytes32 sigR, bytes32 sigS, bytes32[] calldata merkleProof, uint256 amount) public payable {
    require(presale2Activated(), "TooEarly");
    require(amount <= mintsLeft, "ExceedsSupply");
    require(presalePrice * amount == msg.value, "BadPrice");
    require(verify(msg.sender, sigV, sigR, sigS) == true, "BadSignature");
    require(checkPresale2MerkleProof(merkleProof), "BadProof");
    require(amount <= 2, "ExceedsPresaleMax");
    require(!presale2Claimed[msg.sender], "Claimed");

    // mint their tokens
    for(uint i; i < amount;) {
      // reduce the total pop after minting
      _safeMint(msg.sender, MINTS_MAX - mintsLeft + 1);
      unchecked { mintsLeft--; }
      unchecked { i++; }
    }

    // lock them out of re-entering presale 2
    unchecked { presale2Claimed[msg.sender] = true; }
  }

  /*
   * For minting pets publicly for ethereum.
   */
  function mintSale(uint8 sigV, bytes32 sigR, bytes32 sigS, uint256 amount) public payable {
    require(saleActivated(), "TooEarly");
    require(amount <= mintsLeft, "ExceedsSupply");
    require(salePrice * amount == msg.value, "BadPrice");
    require(verify(msg.sender, sigV, sigR, sigS) == true, "BadSignature");

    // mint their tokens
    for(uint i; i < amount;) {
      // reduce the total pop after minting
      _safeMint(msg.sender, MINTS_MAX - mintsLeft + 1);
      unchecked { mintsLeft--; }
      unchecked { i++; }
    }
  }

  /*
   * @dev ERC721 -- see _beforeTokenTransfer
   * @dev Locks transfers at times - See _validateTokenTransferability
   */
  function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override(ERC721, ERC721Pausable) {
    super._beforeTokenTransfer(from, to, tokenId);
    _validateTokenTransferability(from);
  }

  function _validateTokenTransferability(address from) internal view {
    require(!soulbound || from == address(0), "Soulbound");
  }

  /**
   * @dev See {IERC721-setApprovalForAll}.
   */
  function setApprovalForAll(address operator, bool approved) public virtual override {
      require(!soulbound, "Soulbound");
      _setApprovalForAll(_msgSender(), operator, approved);
  }

  /*
   * Rarible/Foundation Royalties Protocol
   */
  function getFeeRecipients(uint256 id) public view override returns (address payable[] memory) {
    require(_exists(id), "DNE");
    address payable[] memory result = new address payable[](1);
    result[0] = royaltySplitter;
    return result;
  }

  /*
   * Rarible/Foundation Royalties Protocol
   */
  function getFeeBps(uint256 id) public view override returns (uint[] memory) {
    require(_exists(id), "DNE");
    uint[] memory result = new uint[](1);
    result[0] = bps;
    return result;
  }

  /*
   * ERC2981 Royalties Standard
   */
  function royaltyInfo(uint256, uint256 _value, bytes calldata _data) external view override returns (address _receiver, uint256 _royaltyAmount, bytes memory _royaltyPaymentData) {
    return (royaltySplitter, _value / (bps / 100), _data);
  }

  /*
   * Generates the hash representation of the struct Unit for EIP-712 usage
   */
  function hashUnit(Unit memory unitobj) private pure returns (bytes32) {
    return keccak256(abi.encodePacked(
      "\x19\x01",
      DOMAIN_SEPARATOR,
      keccak256(abi.encode(
        UNIT_TYPEHASH,
        keccak256(bytes(unitobj.logIn))
      ))
    ));
  }

  /*
   * EIP-712 signature check verification
   */
  function verify(
    address signer,
    uint8 sigV,
    bytes32 sigR,
    bytes32 sigS
  ) private pure returns (bool) {
    Unit memory msgObj = Unit({
      logIn: "Sign this message to login!"
    });

    return signer == ecrecover(hashUnit(msgObj), sigV, sigR, sigS);
  }

  function checkPresale1MerkleProof(bytes32[] calldata merkleProof, uint256 amount) internal view returns (bool){
    bytes32 leaf = keccak256(abi.encodePacked(msg.sender, amount));
    require(MerkleProof.verify(merkleProof, presale1Root, leaf), "BadProof");
    return true;
  }

  function checkPresale2MerkleProof(bytes32[] calldata merkleProof) internal view returns (bool) {
    bytes32 leaf = keccak256(abi.encodePacked(msg.sender));
    require(MerkleProof.verify(merkleProof, presale2Root, leaf), "BadProof");
    return true;
  }

  /*
   * @dev For returning ERC20s we dont know what to do with
   *      if people have issues they can contact owner/devs
   *      and we can send back their tokens.
   */
  function recoverERC20s(IERC20 token, address to, uint256 amount) external onlyAdmin {
    token.approve(address(this), amount);
    token.transferFrom(address(this), to, amount);
  }

  function tokenID2str(uint256 _i) internal pure returns (string memory str) {
    // unused case unless there is a token ID of 0. we don't have one.
    // if (_i == 0) {
    //   return "0";
    // }

    uint256 j = _i;
    uint256 length;
    while (j != 0) {
      length++;
      j /= 10;
    }
    bytes memory bstr = new bytes(length);
    uint256 k = length;
    j = _i;
    while (j != 0) {
      bstr[--k] = bytes1(uint8(48 + j % 10));
      j /= 10;
    }
    str = string(bstr);
  }
}


RaribleV1Royalties.sol 30 lines
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/utils/introspection/ERC165.sol";

/**
 * Implements Rarible Royalties V1 Schema
 * @dev https://docs.rarible.com/asset/creating-an-asset/royalties-schema
 */
abstract contract RaribleV1Royalties is ERC165 {

  event SecondarySaleFees(uint256 tokenId, address[] recipients, uint[] bps);

  /*
   * bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f
   * bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb
   *
   * => 0x0ebd4c7f ^ 0xb9c4d9fb == 0xb7799584
   */
  bytes4 private constant _INTERFACE_ID_FEES = 0xb7799584;

  function getFeeRecipients(uint256 id) public view virtual returns (address payable[] memory);
  function getFeeBps(uint256 id) public view virtual returns (uint[] memory);

  function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
    return interfaceId == _INTERFACE_ID_FEES
      || super.supportsInterface(interfaceId);
  }
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.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
     * ====
     *
     * [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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}
Pausable.sol 91 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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);
}
ERC721.sol 447 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

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

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

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

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}
AccessControl.sol 235 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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 be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev 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);
}
IAccessControl.sol 88 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}
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);
}
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);
}
MerkleProof.sol 65 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Trees proofs.
 *
 * The proofs can be generated using the JavaScript library
 * https://github.com/miguelmota/merkletreejs[merkletreejs].
 * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
 *
 * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the merkle tree could be reinterpreted as a leaf value.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     *
     * _Available since v4.4._
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            bytes32 proofElement = proof[i];
            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = _efficientHash(computedHash, proofElement);
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = _efficientHash(proofElement, computedHash);
            }
        }
        return computedHash;
    }

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}
ERC721Burnable.sol 26 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Burnable.sol)

pragma solidity ^0.8.0;

import "../ERC721.sol";
import "../../../utils/Context.sol";

/**
 * @title ERC721 Burnable Token
 * @dev ERC721 Token that can be irreversibly burned (destroyed).
 */
abstract contract ERC721Burnable is Context, ERC721 {
    /**
     * @dev Burns `tokenId`. See {ERC721-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) public virtual {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
        _burn(tokenId);
    }
}
ERC721Pausable.sol 33 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Pausable.sol)

pragma solidity ^0.8.0;

import "../ERC721.sol";
import "../../../security/Pausable.sol";

/**
 * @dev ERC721 token with pausable token transfers, minting and burning.
 *
 * Useful for scenarios such as preventing trades until the end of an evaluation
 * period, or having an emergency switch for freezing all token transfers in the
 * event of a large bug.
 */
abstract contract ERC721Pausable is ERC721, Pausable {
    /**
     * @dev See {ERC721-_beforeTokenTransfer}.
     *
     * Requirements:
     *
     * - the contract must not be paused.
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, tokenId);

        require(!paused(), "ERC721Pausable: token transfer while paused");
    }
}
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);
}

Read Contract

ADMIN_ROLE 0x75b238fc → bytes32
DEFAULT_ADMIN_ROLE 0xa217fddf → bytes32
MINTS_MAX 0x3ded8502 → uint256
apiBaseURL 0xa1394c94 → string
balanceOf 0x70a08231 → uint256
bps 0x68237329 → uint256
frozen 0x054f7d9c → bool
getApproved 0x081812fc → address
getFeeBps 0x0ebd4c7f → uint256[]
getFeeRecipients 0xb9c4d9fb → address[]
getRoleAdmin 0x248a9ca3 → bytes32
hasRole 0x91d14854 → bool
isApprovedForAll 0xe985e9c5 → bool
mintsLeft 0x9d5561e1 → uint256
name 0x06fdde03 → string
ownerOf 0x6352211e → address
paused 0x5c975abb → bool
paymentSplitter 0xed4a6b0c → address
presale1Activated 0xfa4020cb → bool
presale1ActivationTime 0x0cba99f3 → uint256
presale1Claimed 0x17a038f4 → bool
presale2Activated 0x9a37f52c → bool
presale2ActivationTime 0x6c94b65f → uint256
presale2Claimed 0x421456ed → bool
presalePrice 0x000e7fa8 → uint256
provenanceHash 0xc6ab67a3 → string
royaltyInfo 0xc155531d → address, uint256, bytes
royaltySplitter 0x411d8f2f → address
saleActivated 0xdc9b125d → bool
saleActivationTime 0xca6ce643 → uint256
salePrice 0xf51f96dd → uint256
soulbound 0x0fad0f51 → bool
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string

Write Contract 30 functions

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

approve 0x095ea7b3
address to
uint256 tokenId
burn 0x42966c68
uint256 tokenId
freezeMetadata 0xd111515d
No parameters
grantRole 0x2f2ff15d
bytes32 role
address account
mintOwner 0xdbe7db3b
address[] addresses
mintPresale1 0x895b6042
uint256 maxMints
uint8 sigV
bytes32 sigR
bytes32 sigS
bytes32[] merkleProof
uint256 amount
mintPresale2 0xcea95c95
uint8 sigV
bytes32 sigR
bytes32 sigS
bytes32[] merkleProof
uint256 amount
mintSale 0x7c94f2da
uint8 sigV
bytes32 sigR
bytes32 sigS
uint256 amount
pause 0x8456cb59
No parameters
recoverERC20s 0x50f418ef
address token
address to
uint256 amount
renounceRole 0x36568abe
bytes32 role
address account
revokeRole 0xd547741f
bytes32 role
address account
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setAPIBaseURL 0xb49c2b49
string url
setApprovalForAll 0xa22cb465
address operator
bool approved
setPaymentSplitter 0x6b29b79f
address newAddress
setPresale1ActivationTime 0x6fb6ece7
uint256 timestampInSeconds
setPresale1MerkleRoot 0xb76ef627
bytes32 newRoot
setPresale2ActivationTime 0x87e45c1e
uint256 timestampInSeconds
setPresale2MerkleRoot 0xf1559c88
bytes32 newRoot
setPresalePrice 0x3549345e
uint256 price
setProvenanceHash 0x10969523
string hash
setRoyaltySplitter 0x7c7bd02b
address newAddress
uint256 newBps
setSaleActivationTime 0xfc3483b4
uint256 timestampInSeconds
setSalePrice 0x1919fed7
uint256 price
setSoulbound 0xdf30e54b
bool bound
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
unpause 0x3f4ba83a
No parameters
withdraw 0x3ccfd60b
No parameters

Recent Transactions

No transactions found for this address