Address Contract Partially Verified
Address
0x26b1DBF69c45F48d3Cc2216CF258a96ac7026d12
Balance
0 ETH
Nonce
1
Code Size
9434 bytes
Creator
0x63dEC0C1...08D8 at tx 0x776f01de...6e97e0
Indexed Transactions
0 (1 on-chain, 1.5% indexed)
Contract Bytecode
9434 bytes
0x60806040526004361061023b5760003560e01c8063729ad39e1161012e578063cbce4c97116100ab578063e97800cb1161006f578063e97800cb14610670578063e985e9c514610690578063f2fde38b146106d9578063f4da1846146106f9578063f8604f111461071957600080fd5b8063cbce4c97146105da578063cef11729146105fa578063d5abeb011461061a578063dc33e68114610630578063dc8e92ea1461065057600080fd5b8063b88d4fde116100f2578063b88d4fde14610536578063bbb8974414610556578063bc951b9114610584578063c4ae3168146105a5578063c87b56dd146105ba57600080fd5b8063729ad39e146104b05780638da5cb5b146104d057806395d89b41146104ee578063a0712d6814610503578063a22cb4651461051657600080fd5b806342842e0e116101bc5780636352211e116101805780636352211e1461041b57806368570bd61461043b5780636f8b44b01461045b57806370a082311461047b578063715018a61461049b57600080fd5b806342842e0e1461038157806342966c68146103a157806344a0d68a146103c157806355f804b3146103e15780635c975abb1461040157600080fd5b806318160ddd1161020357806318160ddd1461031557806323b872dd1461032e578063269bbebd1461034e5780633ccfd60b1461036457806341827f131461036c57600080fd5b806301ffc9a71461024057806306fdde0314610275578063081812fc14610297578063095ea7b3146102cf57806313faede6146102f1575b600080fd5b34801561024c57600080fd5b5061026061025b36600461212c565b610739565b60405190151581526020015b60405180910390f35b34801561028157600080fd5b5061028a61078b565b60405161026c9190612283565b3480156102a357600080fd5b506102b76102b23660046121d2565b61081d565b6040516001600160a01b03909116815260200161026c565b3480156102db57600080fd5b506102ef6102ea366004611fd4565b610861565b005b3480156102fd57600080fd5b50610307600d5481565b60405190815260200161026c565b34801561032157600080fd5b5060015460005403610307565b34801561033a57600080fd5b506102ef610349366004611ee1565b6108ef565b34801561035a57600080fd5b50610307600e5481565b6102ef6108fa565b34801561037857600080fd5b5061028a610a22565b34801561038d57600080fd5b506102ef61039c366004611ee1565b610ab0565b3480156103ad57600080fd5b506102ef6103bc3660046121d2565b610acb565b3480156103cd57600080fd5b506102ef6103dc3660046121d2565b610b01565b3480156103ed57600080fd5b506102ef6103fc366004612166565b610b30565b34801561040d57600080fd5b50600f546102609060ff1681565b34801561042757600080fd5b506102b76104363660046121d2565b610b71565b34801561044757600080fd5b506102ef610456366004611e93565b610b83565b34801561046757600080fd5b506102ef6104763660046121d2565b610bcf565b34801561048757600080fd5b50610307610496366004611e93565b610bfe565b3480156104a757600080fd5b506102ef610c4c565b3480156104bc57600080fd5b506102ef6104cb366004611ffe565b610c82565b3480156104dc57600080fd5b506008546001600160a01b03166102b7565b3480156104fa57600080fd5b5061028a610cf4565b6102ef6105113660046121d2565b610d03565b34801561052257600080fd5b506102ef610531366004611f98565b610fb1565b34801561054257600080fd5b506102ef610551366004611f1d565b611047565b34801561056257600080fd5b50600b546105719061ffff1681565b60405161ffff909116815260200161026c565b34801561059057600080fd5b50600b546105719062010000900461ffff1681565b3480156105b157600080fd5b506102ef611092565b3480156105c657600080fd5b5061028a6105d53660046121d2565b6110d0565b3480156105e657600080fd5b506102ef6105f5366004611fd4565b61119b565b34801561060657600080fd5b506102ef6106153660046121ae565b6111cf565b34801561062657600080fd5b50610307600c5481565b34801561063c57600080fd5b5061030761064b366004611e93565b611219565b34801561065c57600080fd5b506102ef61066b3660046120a1565b611247565b34801561067c57600080fd5b506102ef61068b3660046121ae565b6112b1565b34801561069c57600080fd5b506102606106ab366004611eae565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b3480156106e557600080fd5b506102ef6106f4366004611e93565b6112f3565b34801561070557600080fd5b506102ef610714366004611fd4565b61138b565b34801561072557600080fd5b506102ef6107343660046121d2565b6113fe565b60006001600160e01b031982166380ac58cd60e01b148061076a57506001600160e01b03198216635b5e139f60e01b145b8061078557506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606002805461079a906123ac565b80601f01602080910402602001604051908101604052809291908181526020018280546107c6906123ac565b80156108135780601f106107e857610100808354040283529160200191610813565b820191906000526020600020905b8154815290600101906020018083116107f657829003601f168201915b5050505050905090565b60006108288261142d565b610845576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b600061086c82610b71565b9050806001600160a01b0316836001600160a01b031614156108a15760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b038216148015906108c157506108bf81336106ab565b155b156108df576040516367d9dca160e11b815260040160405180910390fd5b6108ea838383611458565b505050565b6108ea8383836114b4565b6008546001600160a01b0316331461092d5760405162461bcd60e51b815260040161092490612296565b60405180910390fd5b476000606461093d83600a61234a565b6109479190612336565b6040519091506000907316c7fbd3d3f4d212624ba005d25b4e7bcd1a65c79083908381818185875af1925050503d80600081146109a0576040519150601f19603f3d011682016040523d82523d6000602084013e6109a5565b606091505b50509050806109b357600080fd5b6040516000907359787884c7c6878e68c8a2c8a8c2bd274154e0e69047908381818185875af1925050503d8060008114610a09576040519150601f19603f3d011682016040523d82523d6000602084013e610a0e565b606091505b5050905080610a1c57600080fd5b50505050565b600a8054610a2f906123ac565b80601f0160208091040260200160405190810160405280929190818152602001828054610a5b906123ac565b8015610aa85780601f10610a7d57610100808354040283529160200191610aa8565b820191906000526020600020905b815481529060010190602001808311610a8b57829003601f168201915b505050505081565b6108ea83838360405180602001604052806000815250611047565b6008546001600160a01b03163314610af55760405162461bcd60e51b815260040161092490612296565b610afe81611690565b50565b6008546001600160a01b03163314610b2b5760405162461bcd60e51b815260040161092490612296565b600d55565b6008546001600160a01b03163314610b5a5760405162461bcd60e51b815260040161092490612296565b8051610b6d90600a906020840190611d87565b5050565b6000610b7c8261169b565b5192915050565b6008546001600160a01b03163314610bad5760405162461bcd60e51b815260040161092490612296565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b6008546001600160a01b03163314610bf95760405162461bcd60e51b815260040161092490612296565b600c55565b60006001600160a01b038216610c27576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b6008546001600160a01b03163314610c765760405162461bcd60e51b815260040161092490612296565b610c8060006117b5565b565b6008546001600160a01b03163314610cac5760405162461bcd60e51b815260040161092490612296565b60005b8151811015610b6d576000828281518110610ccc57610ccc612442565b60200260200101519050610ce18160016113f4565b5080610cec816123e7565b915050610caf565b60606003805461079a906123ac565b6008546001600160a01b03163314610fa7576000610d2033610bfe565b600f5490915060ff1615610d3357600080fd5b60008211610d8f5760405162461bcd60e51b8152602060048201526024808201527f4d696e7420616d6f756e742073686f756c6420626520677265617465722074686044820152630616e20360e41b6064820152608401610924565b600b5461ffff16821115610df55760405162461bcd60e51b815260206004820152602760248201527f536f72727920796f752063616e74206d696e74207468697320616d6f756e74206044820152666174206f6e636560c81b6064820152608401610924565b600c5482610e066001546000540390565b610e10919061231e565b1115610e535760405162461bcd60e51b815260206004820152601260248201527145786365656473204d617820537570706c7960701b6044820152606401610924565b600b5462010000900461ffff16610e6a838361231e565b1115610eb85760405162461bcd60e51b815260206004820152601860248201527f536f72727920796f752063616e74206d696e74206d6f726500000000000000006044820152606401610924565b600e54600154600054031115610f1d5781600d54610ed6919061234a565b341015610f185760405162461bcd60e51b815260206004820152601060248201526f496e7375666669656e742066756e647360801b6044820152606401610924565b610fa5565b6000610f2c6001546000540390565b600e54610f399190612369565b905080831115610fa3576000610f4f8285612369565b905080600d54610f5f919061234a565b341015610fa15760405162461bcd60e51b815260206004820152601060248201526f496e7375666669656e742066756e647360801b6044820152606401610924565b505b505b505b610afe33826113f4565b6001600160a01b038216331415610fdb5760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6110528484846114b4565b6001600160a01b0383163b15158015611074575061107284848484611807565b155b15610a1c576040516368d2bf6b60e11b815260040160405180910390fd5b6008546001600160a01b031633146110bc5760405162461bcd60e51b815260040161092490612296565b600f805460ff19811660ff90911615179055565b60606110db8261142d565b61113f5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610924565b60006111496118ff565b905060008151116111695760405180602001604052806000815250611194565b806111738461190e565b604051602001611184929190612217565b6040516020818303038152906040525b9392505050565b6008546001600160a01b031633146111c55760405162461bcd60e51b815260040161092490612296565b610b6d82826113f4565b6008546001600160a01b031633146111f95760405162461bcd60e51b815260040161092490612296565b600b805461ffff909216620100000263ffff000019909216919091179055565b6001600160a01b038116600090815260056020526040812054600160401b90046001600160401b0316610785565b6008546001600160a01b031633146112715760405162461bcd60e51b815260040161092490612296565b60005b8151811015610b6d5761129f82828151811061129257611292612442565b6020026020010151611690565b806112a9816123e7565b915050611274565b6008546001600160a01b031633146112db5760405162461bcd60e51b815260040161092490612296565b600b805461ffff191661ffff92909216919091179055565b6008546001600160a01b0316331461131d5760405162461bcd60e51b815260040161092490612296565b6001600160a01b0381166113825760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610924565b610afe816117b5565b6009546001600160a01b031633146113f45760405162461bcd60e51b815260206004820152602660248201527f536f72727920796f7520646f6e742068617665207065726d697373696f6e20746044820152651bc81b5a5b9d60d21b6064820152608401610924565b610b6d8282611a0b565b6008546001600160a01b031633146114285760405162461bcd60e51b815260040161092490612296565b600e55565b6000805482108015610785575050600090815260046020526040902054600160e01b900460ff161590565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60006114bf8261169b565b9050836001600160a01b031681600001516001600160a01b0316146114f65760405162a1148160e81b815260040160405180910390fd5b6000336001600160a01b0386161480611514575061151485336106ab565b8061152f5750336115248461081d565b6001600160a01b0316145b90508061154f57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03841661157657604051633a954ecd60e21b815260040160405180910390fd5b61158260008487611458565b6001600160a01b038581166000908152600560209081526040808320805467ffffffffffffffff198082166001600160401b0392831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600490945282852080546001600160e01b031916909417600160a01b4290921691909102178355870180845292208054919390911661165657600054821461165657805460208601516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038a16171781555b50505082846001600160a01b0316866001600160a01b031660008051602061248583398151915260405160405180910390a45b5050505050565b610afe816000611a25565b60408051606081018252600080825260208201819052918101919091528160005481101561179c57600081815260046020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff1615159181018290529061179a5780516001600160a01b031615611731579392505050565b5060001901600081815260046020908152604091829020825160608101845290546001600160a01b038116808352600160a01b82046001600160401b031693830193909352600160e01b900460ff1615159281019290925215611795579392505050565b611731565b505b604051636f96cda160e11b815260040160405180910390fd5b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a029061183c903390899088908890600401612246565b602060405180830381600087803b15801561185657600080fd5b505af1925050508015611886575060408051601f3d908101601f1916820190925261188391810190612149565b60015b6118e1573d8080156118b4576040519150601f19603f3d011682016040523d82523d6000602084013e6118b9565b606091505b5080516118d9576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b6060600a805461079a906123ac565b6060816119325750506040805180820190915260018152600360fc1b602082015290565b8160005b811561195c5780611946816123e7565b91506119559050600a83612336565b9150611936565b6000816001600160401b0381111561197657611976612458565b6040519080825280601f01601f1916602001820160405280156119a0576020820181803683370190505b5090505b84156118f7576119b5600183612369565b91506119c2600a86612402565b6119cd90603061231e565b60f81b8183815181106119e2576119e2612442565b60200101906001600160f81b031916908160001a905350611a04600a86612336565b94506119a4565b610b6d828260405180602001604052806000815250611bd8565b6000611a308361169b565b80519091508215611a96576000336001600160a01b0383161480611a595750611a5982336106ab565b80611a74575033611a698661081d565b6001600160a01b0316145b905080611a9457604051632ce44b5f60e11b815260040160405180910390fd5b505b611aa260008583611458565b6001600160a01b0380821660008181526005602090815260408083208054600160801b6000196001600160401b0380841691909101811667ffffffffffffffff198416811783900482166001908101831690930277ffffffffffffffff0000000000000000ffffffffffffffff19909416179290921783558b86526004909452828520805460ff60e01b1942909316600160a01b026001600160e01b03199091169097179690961716600160e01b178555918901808452922080549194909116611ba0576000548214611ba057805460208701516001600160401b0316600160a01b026001600160e01b03199091166001600160a01b038716171781555b5050604051869250600091506001600160a01b03841690600080516020612485833981519152908390a4505060018054810190555050565b6108ea83838360016000546001600160a01b038516611c0957604051622e076360e81b815260040160405180910390fd5b83611c275760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038516600081815260056020908152604080832080546fffffffffffffffffffffffffffffffff1981166001600160401b038083168c018116918217600160401b67ffffffffffffffff1990941690921783900481168c01811690920217909155858452600490925290912080546001600160e01b031916909217600160a01b429092169190910217905580808501838015611cd357506001600160a01b0387163b15155b15611d4a575b60405182906001600160a01b03891690600090600080516020612485833981519152908290a4611d126000888480600101955088611807565b611d2f576040516368d2bf6b60e11b815260040160405180910390fd5b80821415611cd9578260005414611d4557600080fd5b611d7e565b5b6040516001830192906001600160a01b03891690600090600080516020612485833981519152908290a480821415611d4b575b50600055611689565b828054611d93906123ac565b90600052602060002090601f016020900481019282611db55760008555611dfb565b82601f10611dce57805160ff1916838001178555611dfb565b82800160010185558215611dfb579182015b82811115611dfb578251825591602001919060010190611de0565b50611e07929150611e0b565b5090565b5b80821115611e075760008155600101611e0c565b60006001600160401b03831115611e3957611e39612458565b611e4c601f8401601f19166020016122cb565b9050828152838383011115611e6057600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b0381168114611e8e57600080fd5b919050565b600060208284031215611ea557600080fd5b61119482611e77565b60008060408385031215611ec157600080fd5b611eca83611e77565b9150611ed860208401611e77565b90509250929050565b600080600060608486031215611ef657600080fd5b611eff84611e77565b9250611f0d60208501611e77565b9150604084013590509250925092565b60008060008060808587031215611f3357600080fd5b611f3c85611e77565b9350611f4a60208601611e77565b92506040850135915060608501356001600160401b03811115611f6c57600080fd5b8501601f81018713611f7d57600080fd5b611f8c87823560208401611e20565b91505092959194509250565b60008060408385031215611fab57600080fd5b611fb483611e77565b915060208301358015158114611fc957600080fd5b809150509250929050565b60008060408385031215611fe757600080fd5b611ff083611e77565b946020939093013593505050565b6000602080838503121561201157600080fd5b82356001600160401b0381111561202757600080fd5b8301601f8101851361203857600080fd5b803561204b612046826122fb565b6122cb565b80828252848201915084840188868560051b870101111561206b57600080fd5b600094505b838510156120955761208181611e77565b835260019490940193918501918501612070565b50979650505050505050565b600060208083850312156120b457600080fd5b82356001600160401b038111156120ca57600080fd5b8301601f810185136120db57600080fd5b80356120e9612046826122fb565b80828252848201915084840188868560051b870101111561210957600080fd5b600094505b8385101561209557803583526001949094019391850191850161210e565b60006020828403121561213e57600080fd5b81356111948161246e565b60006020828403121561215b57600080fd5b81516111948161246e565b60006020828403121561217857600080fd5b81356001600160401b0381111561218e57600080fd5b8201601f8101841361219f57600080fd5b6118f784823560208401611e20565b6000602082840312156121c057600080fd5b813561ffff8116811461119457600080fd5b6000602082840312156121e457600080fd5b5035919050565b60008151808452612203816020860160208601612380565b601f01601f19169290920160200192915050565b60008351612229818460208801612380565b83519083019061223d818360208801612380565b01949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612279908301846121eb565b9695505050505050565b60208152600061119460208301846121eb565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b604051601f8201601f191681016001600160401b03811182821017156122f3576122f3612458565b604052919050565b60006001600160401b0382111561231457612314612458565b5060051b60200190565b6000821982111561233157612331612416565b500190565b6000826123455761234561242c565b500490565b600081600019048311821515161561236457612364612416565b500290565b60008282101561237b5761237b612416565b500390565b60005b8381101561239b578181015183820152602001612383565b83811115610a1c5750506000910152565b600181811c908216806123c057607f821691505b602082108114156123e157634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156123fb576123fb612416565b5060010190565b6000826124115761241161242c565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114610afe57600080fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212203875366d67a95c667b782ebfc0c13ffa5dc503acadf5b70d1847d5ba3bc3661664736f6c63430008070033
Verified Source Code Partial Match
Compiler: v0.8.7+commit.e28d00a7
EVM: london
Optimization: Yes (200 runs)
Slimies.sol 1489 lines
// File: @openzeppelin/contracts/utils/Strings.sol
// 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);
}
}
// File: @openzeppelin/contracts/utils/Context.sol
// 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;
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// File: @openzeppelin/contracts/utils/Address.sol
// 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);
}
}
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// 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);
}
// File: @openzeppelin/contracts/utils/introspection/ERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
/**
* @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;
}
}
// File: @openzeppelin/contracts/token/ERC721/IERC721.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
// File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
/**
* @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);
}
// File: https://github.com/chiru-labs/ERC721A/blob/main/contracts/ERC721A.sol
// Creator: Chiru Labs
pragma solidity ^0.8.4;
error ApprovalCallerNotOwnerNorApproved();
error ApprovalQueryForNonexistentToken();
error ApproveToCaller();
error ApprovalToCurrentOwner();
error BalanceQueryForZeroAddress();
error MintToZeroAddress();
error MintZeroQuantity();
error OwnerQueryForNonexistentToken();
error TransferCallerNotOwnerNorApproved();
error TransferFromIncorrectOwner();
error TransferToNonERC721ReceiverImplementer();
error TransferToZeroAddress();
error URIQueryForNonexistentToken();
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension. Built to optimize for lower gas during batch mints.
*
* Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..).
*
* Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
*
* Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
*/
contract ERC721A is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Compiler will pack this into a single 256bit word.
struct TokenOwnership {
// The address of the owner.
address addr;
// Keeps track of the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
}
// Compiler will pack this into a single 256bit word.
struct AddressData {
// Realistically, 2**64-1 is more than enough.
uint64 balance;
// Keeps track of mint count with minimal overhead for tokenomics.
uint64 numberMinted;
// Keeps track of burn count with minimal overhead for tokenomics.
uint64 numberBurned;
// For miscellaneous variable(s) pertaining to the address
// (e.g. number of whitelist mint slots used).
// If there are multiple variables, please pack them into a uint64.
uint64 aux;
}
// The tokenId of the next token to be minted.
uint256 internal _currentIndex;
// The number of tokens burned.
uint256 internal _burnCounter;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned. See _ownershipOf implementation for details.
mapping(uint256 => TokenOwnership) internal _ownerships;
// Mapping owner address to address data
mapping(address => AddressData) private _addressData;
// 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;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
}
/**
* To change the starting tokenId, please override this function.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens.
*/
function totalSupply() public view returns (uint256) {
// Counter underflow is impossible as _burnCounter cannot be incremented
// more than _currentIndex - _startTokenId() times
unchecked {
return _currentIndex - _burnCounter - _startTokenId();
}
}
/**
* Returns the total amount of tokens minted in the contract.
*/
function _totalMinted() internal view returns (uint256) {
// Counter underflow is impossible as _currentIndex does not decrement,
// and it is initialized to _startTokenId()
unchecked {
return _currentIndex - _startTokenId();
}
}
/**
* @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 override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return uint256(_addressData[owner].balance);
}
/**
* Returns the number of tokens minted by `owner`.
*/
function _numberMinted(address owner) internal view returns (uint256) {
return uint256(_addressData[owner].numberMinted);
}
/**
* Returns the number of tokens burned by or on behalf of `owner`.
*/
function _numberBurned(address owner) internal view returns (uint256) {
return uint256(_addressData[owner].numberBurned);
}
/**
* Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
*/
function _getAux(address owner) internal view returns (uint64) {
return _addressData[owner].aux;
}
/**
* Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
* If there are multiple variables, please pack them into a uint64.
*/
function _setAux(address owner, uint64 aux) internal {
_addressData[owner].aux = aux;
}
/**
* Gas spent here starts off proportional to the maximum mint batch size.
* It gradually moves to O(1) as tokens get transferred around in the collection over time.
*/
function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr && curr < _currentIndex) {
TokenOwnership memory ownership = _ownerships[curr];
if (!ownership.burned) {
if (ownership.addr != address(0)) {
return ownership;
}
// Invariant:
// There will always be an ownership that has an address and is not burned
// before an ownership that does not have an address and is not burned.
// Hence, curr will not underflow.
while (true) {
curr--;
ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
}
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view override returns (address) {
return _ownershipOf(tokenId).addr;
}
/**
* @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) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
string memory baseURI = _baseURI();
return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : '';
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return '';
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public override {
address owner = ERC721A.ownerOf(tokenId);
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_approve(to, tokenId, owner);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
if (operator == _msgSender()) revert ApproveToCaller();
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
_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 {
_transfer(from, to, tokenId);
if (to.isContract() && !_checkContractOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
/**
* @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`),
*/
function _exists(uint256 tokenId) internal view returns (bool) {
return _startTokenId() <= tokenId && tokenId < _currentIndex &&
!_ownerships[tokenId].burned;
}
function _safeMint(address to, uint256 quantity) internal {
_safeMint(to, quantity, '');
}
/**
* @dev Safely mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
_mint(to, quantity, _data, true);
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event.
*/
function _mint(
address to,
uint256 quantity,
bytes memory _data,
bool safe
) internal {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
// updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
unchecked {
_addressData[to].balance += uint64(quantity);
_addressData[to].numberMinted += uint64(quantity);
_ownerships[startTokenId].addr = to;
_ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
uint256 updatedIndex = startTokenId;
uint256 end = updatedIndex + quantity;
if (safe && to.isContract()) {
do {
emit Transfer(address(0), to, updatedIndex);
if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
} while (updatedIndex != end);
// Reentrancy protection
if (_currentIndex != startTokenId) revert();
} else {
do {
emit Transfer(address(0), to, updatedIndex++);
} while (updatedIndex != end);
}
_currentIndex = updatedIndex;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* 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
) private {
TokenOwnership memory prevOwnership = _ownershipOf(tokenId);
if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();
bool isApprovedOrOwner = (_msgSender() == from ||
isApprovedForAll(from, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
if (to == address(0)) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, from);
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as tokenId would have to be 2**256.
unchecked {
_addressData[from].balance -= 1;
_addressData[to].balance += 1;
TokenOwnership storage currSlot = _ownerships[tokenId];
currSlot.addr = to;
currSlot.startTimestamp = uint64(block.timestamp);
// If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
// Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
uint256 nextTokenId = tokenId + 1;
TokenOwnership storage nextSlot = _ownerships[nextTokenId];
if (nextSlot.addr == address(0)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId != _currentIndex) {
nextSlot.addr = from;
nextSlot.startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev This is equivalent to _burn(tokenId, false)
*/
function _burn(uint256 tokenId) internal virtual {
_burn(tokenId, false);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
TokenOwnership memory prevOwnership = _ownershipOf(tokenId);
address from = prevOwnership.addr;
if (approvalCheck) {
bool isApprovedOrOwner = (_msgSender() == from ||
isApprovedForAll(from, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
}
_beforeTokenTransfers(from, address(0), tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, from);
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as tokenId would have to be 2**256.
unchecked {
AddressData storage addressData = _addressData[from];
addressData.balance -= 1;
addressData.numberBurned += 1;
// Keep track of who burned the token, and the timestamp of burning.
TokenOwnership storage currSlot = _ownerships[tokenId];
currSlot.addr = from;
currSlot.startTimestamp = uint64(block.timestamp);
currSlot.burned = true;
// If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it.
// Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
uint256 nextTokenId = tokenId + 1;
TokenOwnership storage nextSlot = _ownerships[nextTokenId];
if (nextSlot.addr == address(0)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId != _currentIndex) {
nextSlot.addr = from;
nextSlot.startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(from, address(0), tokenId);
_afterTokenTransfers(from, address(0), tokenId, 1);
// Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
unchecked {
_burnCounter++;
}
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(
address to,
uint256 tokenId,
address owner
) private {
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target 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 _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
/**
* @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
* And also called before burning one token.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* 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, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes
* minting.
* And also called after one token has been burned.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
* transferred to `to`.
* - When `from` is zero, `tokenId` has been minted for `to`.
* - When `to` is zero, `tokenId` has been burned by `from`.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
}
// File: contracts/slimies.sol
pragma solidity ^0.8.7;
contract Slimies is ERC721A, Ownable {
using Strings for uint256;
address breedingContract;
string public baseApiURI;
//General Settings
uint16 public maxMintAmountPerTransaction = 10;
uint16 public maxMintAmountPerWallet = 10;
//Inventory
uint256 public maxSupply = 3333;
//Prices
uint256 public cost = 0.01 ether;
uint256 public freeLimit = 1111;
//Utility
bool public paused = false;
constructor(string memory _baseUrl) ERC721A("Slimies", "Slimies") {
baseApiURI = _baseUrl;
}
function setFreeLimit(uint256 _limit) public onlyOwner{
freeLimit = _limit;
}
//This function will be used to extend the project with more capabilities
function setBreedingContractAddress(address _bAddress) public onlyOwner {
breedingContract = _bAddress;
}
//this function can be called only from the extending contract
function mintExternal(address _address, uint256 _mintAmount) external {
require(
msg.sender == breedingContract,
"Sorry you dont have permission to mint"
);
_safeMint(_address, _mintAmount);
}
function numberMinted(address owner) public view returns (uint256) {
return _numberMinted(owner);
}
// public
function mint(uint256 _mintAmount) public payable {
if (msg.sender != owner()) {
uint256 ownerTokenCount = balanceOf(msg.sender);
require(!paused);
require(_mintAmount > 0, "Mint amount should be greater than 0");
require(
_mintAmount <= maxMintAmountPerTransaction,
"Sorry you cant mint this amount at once"
);
require(
totalSupply() + _mintAmount <= maxSupply,
"Exceeds Max Supply"
);
require(
(ownerTokenCount + _mintAmount) <= maxMintAmountPerWallet,
"Sorry you cant mint more"
);
if(totalSupply() > freeLimit){
//not free
require(msg.value >= cost * _mintAmount, "Insuffient funds");
}else{
uint256 a = freeLimit - totalSupply();
if(_mintAmount > a){
uint256 c = _mintAmount - a;
//pay only for A
require(msg.value >= cost * c, "Insuffient funds");
}
}
}
_mintLoop(msg.sender, _mintAmount);
}
function gift(address _to, uint256 _mintAmount) public onlyOwner {
_mintLoop(_to, _mintAmount);
}
function airdrop(address[] memory _airdropAddresses) public onlyOwner {
for (uint256 i = 0; i < _airdropAddresses.length; i++) {
address to = _airdropAddresses[i];
_mintLoop(to, 1);
}
}
function _baseURI() internal view virtual override returns (string memory) {
return baseApiURI;
}
function tokenURI(uint256 tokenId)
public
view
virtual
override
returns (string memory)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
string memory currentBaseURI = _baseURI();
return
bytes(currentBaseURI).length > 0
? string(abi.encodePacked(currentBaseURI, tokenId.toString()))
: "";
}
function setCost(uint256 _newCost) public onlyOwner {
cost = _newCost;
}
//Burning functions
function batchBurn(uint256[] memory _nftIds) public onlyOwner {
for(uint256 i = 0; i < _nftIds.length; i++){
_burn(_nftIds[i]);
}
}
function burn(uint256 _nftId) public onlyOwner{
_burn(_nftId);
}
function setmaxMintAmountPerTransaction(uint16 _amount) public onlyOwner {
maxMintAmountPerTransaction = _amount;
}
function setMaxMintAmountPerWallet(uint16 _amount) public onlyOwner {
maxMintAmountPerWallet = _amount;
}
function setMaxSupply(uint256 _supply) public onlyOwner {
maxSupply = _supply;
}
function setBaseURI(string memory _newBaseURI) public onlyOwner {
baseApiURI = _newBaseURI;
}
function togglePause() public onlyOwner {
paused = !paused;
}
function _mintLoop(address _receiver, uint256 _mintAmount) internal {
_safeMint(_receiver, _mintAmount);
}
function withdraw() public payable onlyOwner {
uint256 balance = address(this).balance;
uint256 share1 = (balance * 10) / 100;
(bool dev, ) = payable(
0x16c7Fbd3D3f4d212624ba005D25B4e7Bcd1A65c7
).call{value: share1}("");
require(dev);
(bool os, ) = payable(0x59787884c7c6878e68C8A2C8a8C2BD274154E0e6).call{v...
// [truncated — 50067 bytes total]
Read Contract
balanceOf 0x70a08231 → uint256
baseApiURI 0x41827f13 → string
cost 0x13faede6 → uint256
freeLimit 0x269bbebd → uint256
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
maxMintAmountPerTransaction 0xbbb89744 → uint16
maxMintAmountPerWallet 0xbc951b91 → uint16
maxSupply 0xd5abeb01 → uint256
name 0x06fdde03 → string
numberMinted 0xdc33e681 → uint256
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
paused 0x5c975abb → bool
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
Write Contract 22 functions
These functions modify contract state and require a wallet transaction to execute.
airdrop 0x729ad39e
address[] _airdropAddresses
approve 0x095ea7b3
address to
uint256 tokenId
batchBurn 0xdc8e92ea
uint256[] _nftIds
burn 0x42966c68
uint256 _nftId
gift 0xcbce4c97
address _to
uint256 _mintAmount
mint 0xa0712d68
uint256 _mintAmount
mintExternal 0xf4da1846
address _address
uint256 _mintAmount
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string _newBaseURI
setBreedingContractAddress 0x68570bd6
address _bAddress
setCost 0x44a0d68a
uint256 _newCost
setFreeLimit 0xf8604f11
uint256 _limit
setMaxMintAmountPerWallet 0xcef11729
uint16 _amount
setMaxSupply 0x6f8b44b0
uint256 _supply
setmaxMintAmountPerTransaction 0xe97800cb
uint16 _amount
togglePause 0xc4ae3168
No parameters
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
This address has 1 on-chain transactions, but only 1.5% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →