Address Contract Verified
Address
0x83d062769d78deD9B051E69c80fA6CC091dbF27B
Balance
0 ETH
Nonce
1
Code Size
13385 bytes
Creator
0xF336D979...2f52 at tx 0x19dd27b5...a54782
Indexed Transactions
0
Contract Bytecode
13385 bytes
0x60806040526004361061036f5760003560e01c806368428a1b116101c6578063ab26320e116100f7578063db2e21bc11610095578063ed9a5bbb1161006f578063ed9a5bbb146109d2578063f2fde38b146109f2578063f4a0a52814610a12578063f5aa406d14610a3257600080fd5b8063db2e21bc14610944578063db4bec4414610959578063e985e9c51461098957600080fd5b8063c87b56dd116100d1578063c87b56dd146108d0578063d44e3573146108f0578063d7e2875c14610910578063d96a094a1461093157600080fd5b8063ab26320e1461087b578063b88d4fde1461089b578063b89fe999146108bb57600080fd5b806389b0649b1161016457806395d89b411161013e57806395d89b4114610810578063996517cf146108255780639e6a1d7d1461083b578063a22cb4651461085b57600080fd5b806389b0649b146107bd5780638da5cb5b146107d25780638ea5220f146107f057600080fd5b8063715018a6116101a0578063715018a61461073857806371efdc211461074d57806375796f761461077d578063819b25ba1461079d57600080fd5b806368428a1b146106e45780636c0360eb1461070357806370a082311461071857600080fd5b80633ad7f56c116102a057806357a8e3fe1161023e5780636352211e116102185780636352211e14610681578063646d7a7f146106a157806368124a6a146106bb5780636817c76c146106ce57600080fd5b806357a8e3fe14610621578063591e194b146106415780635c4e7e061461066157600080fd5b80634a7d80b31161027a5780634a7d80b3146105995780634f6ccce7146105c157806353135ca0146105e157806355f804b31461060157600080fd5b80633ad7f56c146105435780633ccfd60b1461056457806342842e0e1461057957600080fd5b806318160ddd1161030d57806323b872dd116102e757806323b872dd146104d85780632f745c59146104f85780633100a53514610518578063386bfc981461052d57600080fd5b806318160ddd1461047f57806319d1997a146104a25780631f53ac02146104b857600080fd5b806308e992871161034957806308e992871461040a57806309499f531461042c578063095ea7b31461044c5780630983061c1461046c57600080fd5b806301ffc9a71461037b57806306fdde03146103b0578063081812fc146103d257600080fd5b3661037657005b600080fd5b34801561038757600080fd5b5061039b610396366004612f3c565b610a52565b60405190151581526020015b60405180910390f35b3480156103bc57600080fd5b506103c5610abf565b6040516103a7919061313c565b3480156103de57600080fd5b506103f26103ed366004612f24565b610b51565b6040516001600160a01b0390911681526020016103a7565b34801561041657600080fd5b5061042a610425366004612f0a565b610b95565b005b34801561043857600080fd5b5061042a610447366004612eab565b610c16565b34801561045857600080fd5b5061042a610467366004612edf565b610c4e565b61042a61047a366004613032565b610cdc565b34801561048b57600080fd5b50610494610f59565b6040519081526020016103a7565b3480156104ae57600080fd5b50610494600b5481565b3480156104c457600080fd5b5061042a6104d3366004612d7f565b610f78565b3480156104e457600080fd5b5061042a6104f3366004612def565b610ff0565b34801561050457600080fd5b50610494610513366004612edf565b610ffb565b34801561052457600080fd5b5061042a6110f7565b34801561053957600080fd5b5061049460135481565b34801561054f57600080fd5b50600d5461039b906301000000900460ff1681565b34801561057057600080fd5b5061042a611183565b34801561058557600080fd5b5061042a610594366004612def565b61126a565b3480156105a557600080fd5b50600d546103f29064010000000090046001600160a01b031681565b3480156105cd57600080fd5b506104946105dc366004612f24565b611285565b3480156105ed57600080fd5b50600d5461039b9062010000900460ff1681565b34801561060d57600080fd5b5061042a61061c366004612f74565b61132f565b34801561062d57600080fd5b50600f546103f2906001600160a01b031681565b34801561064d57600080fd5b5061042a61065c366004612f0a565b61139d565b34801561066d57600080fd5b5061042a61067c366004612f24565b61141c565b34801561068d57600080fd5b506103f261069c366004612f24565b61148d565b3480156106ad57600080fd5b50600d5461039b9060ff1681565b61042a6106c9366004612fb9565b61149f565b3480156106da57600080fd5b50610494600a5481565b3480156106f057600080fd5b50600d5461039b90610100900460ff1681565b34801561070f57600080fd5b506103c56116bb565b34801561072457600080fd5b50610494610733366004612d7f565b611749565b34801561074457600080fd5b5061042a611797565b34801561075957600080fd5b5061039b610768366004612f24565b60126020526000908152604090205460ff1681565b34801561078957600080fd5b5061042a610798366004612d7f565b6117cd565b3480156107a957600080fd5b5061042a6107b8366004612f24565b611856565b3480156107c957600080fd5b5061042a6118b9565b3480156107de57600080fd5b506007546001600160a01b03166103f2565b3480156107fc57600080fd5b50600e546103f2906001600160a01b031681565b34801561081c57600080fd5b506103c561193d565b34801561083157600080fd5b5061049460095481565b34801561084757600080fd5b5061042a610856366004612f24565b61194c565b34801561086757600080fd5b5061042a610876366004612eab565b6119ab565b34801561088757600080fd5b5061042a610896366004612f24565b611a41565b3480156108a757600080fd5b5061042a6108b6366004612e2f565b611b24565b3480156108c757600080fd5b5061042a611b5e565b3480156108dc57600080fd5b506103c56108eb366004612f24565b611be4565b3480156108fc57600080fd5b5061042a61090b366004612f24565b611caf565b34801561091c57600080fd5b50600f5461039b90600160a01b900460ff1681565b61042a61093f366004612f24565b611da8565b34801561095057600080fd5b5061042a611fa2565b34801561096557600080fd5b5061039b610974366004612d7f565b60146020526000908152604090205460ff1681565b34801561099557600080fd5b5061039b6109a4366004612db7565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b3480156109de57600080fd5b5061042a6109ed366004612d7f565b612008565b3480156109fe57600080fd5b5061042a610a0d366004612d7f565b6120f0565b348015610a1e57600080fd5b5061042a610a2d366004612f24565b612188565b348015610a3e57600080fd5b5061042a610a4d366004612f24565b6121e7565b60006001600160e01b031982166380ac58cd60e01b1480610a8357506001600160e01b03198216635b5e139f60e01b145b80610a9e57506001600160e01b0319821663780e9d6360e01b145b80610ab957506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060018054610ace9061333c565b80601f0160208091040260200160405190810160405280929190818152602001828054610afa9061333c565b8015610b475780601f10610b1c57610100808354040283529160200191610b47565b820191906000526020600020905b815481529060010190602001808311610b2a57829003601f168201915b5050505050905090565b6000610b5c82612259565b610b79576040516333d1c03960e21b815260040160405180910390fd5b506000908152600560205260409020546001600160a01b031690565b6007546001600160a01b03163314610bc85760405162461bcd60e51b8152600401610bbf9061321c565b60405180910390fd5b600d805460ff191682151590811790915560405160ff909116151581527f2a5bfbb68782e57b3242e612145304c845af3404e2d328a12dd2e7c078cd0117906020015b60405180910390a150565b6007546001600160a01b03163314610c405760405162461bcd60e51b8152600401610bbf9061321c565b610c4a828261228d565b5050565b6000610c598261148d565b9050806001600160a01b0316836001600160a01b03161415610c8e5760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b03821614801590610cae5750610cac81336109a4565b155b15610ccc576040516367d9dca160e11b815260040160405180910390fd5b610cd78383836122e9565b505050565b600d5462010000900460ff16610d4a5760405162461bcd60e51b815260206004820152602d60248201527f44726f7073706163653a3a70726573616c654275793a2050726573616c65206960448201526c39903737ba1020b1ba34bb329760991b6064820152608401610bbf565b33600f546040516331a9108f60e11b8152600481018590526001600160a01b039283169290911690636352211e9060240160206040518083038186803b158015610d9357600080fd5b505afa158015610da7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcb9190612d9b565b6001600160a01b031614610e305760405162461bcd60e51b815260206004820152602660248201527f44726f7073706163653a3a70726573616c654275793a20696e76616c6964207460448201526534b1b5b2ba1760d11b6064820152608401610bbf565b60008281526012602052604090205460ff1615610ea35760405162461bcd60e51b815260206004820152602b60248201527f44726f7073706163653a3a70726573616c654275793a205469636b657420616c60448201526a3932b0b23c903ab9b2b21760a91b6064820152608401610bbf565b600954811115610ec55760405162461bcd60e51b8152600401610bbf90613251565b600a54610ed29082612345565b341015610ef15760405162461bcd60e51b8152600401610bbf906131d0565b6000828152601260205260409020805460ff19166001179055610f1381612351565b60408051338152602081018490529081018290527fb77d41b776d1d5cc75b500402614335da616afa8aa95b49325e22db7f1ca86cc906060015b60405180910390a15050565b6000546001600160801b03600160801b82048116918116919091031690565b6007546001600160a01b03163314610fa25760405162461bcd60e51b8152600401610bbf9061321c565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527f268c00f4ec08b34fdde24b52e47a09d62f3f3837eb3b8ac7206cefb3bb5e534590602001610c0b565b610cd78383836123be565b600061100683611749565b8210611025576040516306ed618760e11b815260040160405180910390fd5b600080546001600160801b03169080805b838110156110f157600081815260036020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff16158015928201929092529061109d57506110e9565b80516001600160a01b0316156110b257805192505b876001600160a01b0316836001600160a01b031614156110e757868414156110e057509350610ab992505050565b6001909301925b505b600101611036565b50600080fd5b6007546001600160a01b031633146111215760405162461bcd60e51b8152600401610bbf9061321c565b600d805460ff610100808304821615810261ff001990931692909217928390556040517f5a454f976028c400c4159ac85c61452441fcf06b9888c7c780c5980e3c3123dd936111799390049091161515815260200190565b60405180910390a1565b6007546001600160a01b031633146111ad5760405162461bcd60e51b8152600401610bbf9061321c565b600e5460105447916001600160a01b0316906108fc906111dc90612710906111d6908690612345565b906125db565b6040518115909202916000818181858888f19350505050158015611204573d6000803e3d6000fd5b50600d60049054906101000a90046001600160a01b03166001600160a01b03166108fc6112426127106111d66011548661234590919063ffffffff16565b6040518115909202916000818181858888f19350505050158015610c4a573d6000803e3d6000fd5b610cd783838360405180602001604052806000815250611b24565b600080546001600160801b031681805b8281101561131557600081815260036020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff1615159181018290529061130c57858314156113055750949350505050565b6001909201915b50600101611295565b506040516329c8c00760e21b815260040160405180910390fd5b6007546001600160a01b031633146113595760405162461bcd60e51b8152600401610bbf9061321c565b805161136c90600c906020840190612c5c565b507f5411e8ebf1636d9e83d5fc4900bf80cbac82e8790da2a4c94db4895e889eedf6600c604051610c0b919061314f565b6007546001600160a01b031633146113c75760405162461bcd60e51b8152600401610bbf9061321c565b600f805460ff60a01b1916600160a01b8315158102919091179182905560405160ff9190920416151581527fc6e0fb794d60d245727554ed563b17ec5cd901c15ee395b10535ce370b1bdccd90602001610c0b565b6007546001600160a01b031633146114465760405162461bcd60e51b8152600401610bbf9061321c565b601081905561145761271082612246565b6011556010546040519081527fd20ab7c161b1f8ebfab00e747660c0fa31ae9123063e580b5be0aeab18623db290602001610c0b565b6000611498826125e7565b5192915050565b600d546301000000900460ff1661151e5760405162461bcd60e51b815260206004820152603960248201527f44726f70537061636553616c653a3a77686974656c6973744275793a2057686960448201527f74656c69737420427579206973206e6f74204163746976652e000000000000006064820152608401610bbf565b6009548311156115405760405162461bcd60e51b8152600401610bbf90613251565b600a5461154d9084612345565b34101561156c5760405162461bcd60e51b8152600401610bbf906131d0565b611577338383612709565b6115dc5760405162461bcd60e51b815260206004820152603060248201527f44726f7073706163653a3a77686974656c6973744275793a205573657220697360448201526f081b9bdd081dda1a5d195b1a5cdd195960821b6064820152608401610bbf565b600f54600160a01b900460ff161561166a573360009081526014602052604090205460ff161561165f5760405162461bcd60e51b815260206004820152602860248201527f44726f7073706163653a3a77686974656c6973744275793a20416c72656164796044820152670818db185a5b595960c21b6064820152608401610bbf565b61166a33600161228d565b61167383612351565b7f8714612a507e7fcd9f26d997e561a61611f4bad945c787b8865dc23823ef037b33604080516001600160a01b039092168252602082018690520160405180910390a1505050565b600c80546116c89061333c565b80601f01602080910402602001604051908101604052809291908181526020018280546116f49061333c565b80156117415780601f1061171657610100808354040283529160200191611741565b820191906000526020600020905b81548152906001019060200180831161172457829003601f168201915b505050505081565b60006001600160a01b038216611772576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600460205260409020546001600160401b031690565b6007546001600160a01b031633146117c15760405162461bcd60e51b8152600401610bbf9061321c565b6117cb600061278f565b565b6007546001600160a01b031633146117f75760405162461bcd60e51b8152600401610bbf9061321c565b600d8054640100000000600160c01b0319166401000000006001600160a01b038481168202929092179283905560405192041681527fb470355146314037ce5186813b4b7c65bff2b87f98d44ff063570d0e22d65ba390602001610c0b565b6007546001600160a01b031633146118805760405162461bcd60e51b8152600401610bbf9061321c565b61188981612351565b6040518181527fdb7b64a879507c32bda4d0cf22dee29ed875c7157ecbbc10fe11bf14fab06d1290602001610c0b565b6007546001600160a01b031633146118e35760405162461bcd60e51b8152600401610bbf9061321c565b600d805460ff62010000808304821615810262ff00001990931692909217928390556040517f38822fae85453c65b78e1b7d02e45cae5eb0d7961e34226fb29c49dab9d3a357936111799390049091161515815260200190565b606060028054610ace9061333c565b6007546001600160a01b031633146119765760405162461bcd60e51b8152600401610bbf9061321c565b60098190556040518181527f9ae30a041b5f2244849dc754c675b09aef4ad230b48995476fd6e6415d1fe8ab90602001610c0b565b6001600160a01b0382163314156119d55760405163b06307db60e01b815260040160405180910390fd5b3360008181526006602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6007546001600160a01b03163314611a6b5760405162461bcd60e51b8152600401610bbf9061321c565b60008181526012602052604090205460ff16611adc5760405162461bcd60e51b815260206004820152602a60248201527f44726f7073706163653a3a636c6561725469636b65743a205469636b657420696044820152691cc81b9bdd081d5cd95960b21b6064820152608401610bbf565b60008181526012602052604090819020805460ff19169055517f256e63760868166c3f047c49d3e1614c1ca6c620d715c552c54ddb4ba428719c90610c0b9083815260200190565b611b2f8484846123be565b611b3b848484846127e1565b611b58576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b6007546001600160a01b03163314611b885760405162461bcd60e51b8152600401610bbf9061321c565b600d805460ff6301000000808304821615810263ff0000001990931692909217928390556040517ffabb6e4b24bd8ac3a08555e569d13590c5006dc61e4aae65e74296d3df6759ed936111799390049091161515815260200190565b6060611bef82612259565b611c535760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610bbf565b6000600c8054611c629061333c565b905011611c7e5760405180602001604052806000815250610ab9565b600c611c89836128f0565b604051602001611c9a92919061307f565b60405160208183030381529060405292915050565b6007546001600160a01b03163314611cd95760405162461bcd60e51b8152600401610bbf9061321c565b611ce1610f59565b600b541015611d735760405162461bcd60e51b815260206004820152605260248201527f44726f70737061636553616c653a3a6368616e6765537570706c794c696d697460448201527f3a20537570706c79204c696d69742063616e277420626520726564756365642060648201527162656c6f7720746f74616c20737570706c7960701b608482015260a401610bbf565b600b8190556040518181527f178f2d92de18f124251b08e25bacba56eda0716625c1e799fc6c8ed1ee7d1d0790602001610c0b565b600d54610100900460ff16611e0b5760405162461bcd60e51b815260206004820152602360248201527f44726f7073706163653a3a6275793a2053616c65206973206e6f7420616374696044820152623b329760e91b6064820152608401610bbf565b600954811115611e7a5760405162461bcd60e51b815260206004820152603460248201527f44726f7073706163653a3a6275793a20546f6f206d616e7920746f6b656e73206044820152733337b91037b732903a3930b739b0b1ba34b7b71760611b6064820152608401610bbf565b600a54611e879082612345565b341015611ee45760405162461bcd60e51b815260206004820152602560248201527f44726f7073706163653a3a6275793a20496e73756666696369656e742070617960448201526436b2b73a1760d91b6064820152608401610bbf565b600d5460ff16611f6357323314611f635760405162461bcd60e51b815260206004820152603760248201527f44726f7073706163653a3a6275793a20536d61727420636f6e7472616374732060448201527f617265206e6f7420616c6c6f77656420746f206275792e0000000000000000006064820152608401610bbf565b611f6c81612351565b60408051338152602081018390527fe3d4187f6ca4248660cc0ac8b8056515bac4a8132be2eca31d6d0cc170722a7e9101610c0b565b6007546001600160a01b03163314611fcc5760405162461bcd60e51b8152600401610bbf9061321c565b6007546040516001600160a01b03909116904780156108fc02916000818181858888f19350505050158015612005573d6000803e3d6000fd5b50565b6007546001600160a01b031633146120325760405162461bcd60e51b8152600401610bbf9061321c565b6001600160a01b0381166120a25760405162461bcd60e51b815260206004820152603160248201527f44726f70537061636553616c653a3a7365745469636b6574416464726573733a6044820152701024b73b30b634b21030b2323932b9b99760791b6064820152608401610bbf565b600f80546001600160a01b0319166001600160a01b0383169081179091556040519081527f4846b8d14a603fbd3567c63384f41a947d787c004e59ce39ee755d0485ae5ed890602001610c0b565b6007546001600160a01b0316331461211a5760405162461bcd60e51b8152600401610bbf9061321c565b6001600160a01b03811661217f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610bbf565b6120058161278f565b6007546001600160a01b031633146121b25760405162461bcd60e51b8152600401610bbf9061321c565b600a8190556040518181527f25b1f9f6b6e61dfca5575239769e4450ed2e49176670837f5d1a82a9a2fc693f90602001610c0b565b6007546001600160a01b031633146122115760405162461bcd60e51b8152600401610bbf9061321c565b60138190556040518181527f6be426d58d2fb0cea1f78182904380aac426a50029637dc9e9d2e40bc44ac05090602001610c0b565b600061225282846132f9565b9392505050565b600080546001600160801b031682108015610ab9575050600090815260036020526040902054600160e01b900460ff161590565b6001600160a01b038216600081815260146020908152604091829020805460ff19168515159081179091558251938452908301527f9df634e89ddfd6892a56594ccd1a1971304a02d24cb197afdd540194c0b653a29101610f4d565b60008281526005602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600061225282846132da565b600b5461236682612360610f59565b90612a09565b11156123b45760405162461bcd60e51b815260206004820152601760248201527f4e6f7420656e6f75676820746f6b656e73206c6566742e0000000000000000006044820152606401610bbf565b6120053382612a15565b60006123c9826125e7565b80519091506000906001600160a01b0316336001600160a01b031614806123f7575081516123f790336109a4565b8061241257503361240784610b51565b6001600160a01b0316145b90508061243257604051632ce44b5f60e11b815260040160405180910390fd5b846001600160a01b031682600001516001600160a01b0316146124675760405162a1148160e81b815260040160405180910390fd5b6001600160a01b03841661248e57604051633a954ecd60e21b815260040160405180910390fd5b61249e60008484600001516122e9565b6001600160a01b038581166000908152600460209081526040808320805467ffffffffffffffff198082166001600160401b0392831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600390945282852080546001600160e01b031916909417600160a01b429092169190910217909255908601808352912054909116612591576000546001600160801b031681101561259157825160008281526003602090815260409091208054918601516001600160401b0316600160a01b026001600160e01b03199092166001600160a01b03909316929092171790555b5082846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b5050505050565b600061225282846132c6565b60408051606081018252600080825260208201819052918101829052905482906001600160801b03168110156126f057600081815260036020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff161515918101829052906126ee5780516001600160a01b031615612685579392505050565b5060001901600081815260036020908152604091829020825160608101845290546001600160a01b038116808352600160a01b82046001600160401b031693830193909352600160e01b900460ff16151592810192909252156126e9579392505050565b612685565b505b604051636f96cda160e11b815260040160405180910390fd5b6040516bffffffffffffffffffffffff19606085901b1660208201526000908190603401604051602081830303815290604052805190602001209050612786848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506013549150849050612a2f565b95945050505050565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006001600160a01b0384163b156128e457604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906128259033908990889088906004016130ff565b602060405180830381600087803b15801561283f57600080fd5b505af192505050801561286f575060408051601f3d908101601f1916820190925261286c91810190612f58565b60015b6128ca573d80801561289d576040519150601f19603f3d011682016040523d82523d6000602084013e6128a2565b606091505b5080516128c2576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506128e8565b5060015b949350505050565b6060816129145750506040805180820190915260018152600360fc1b602082015290565b8160005b811561293e578061292881613377565b91506129379050600a836132c6565b9150612918565b6000816001600160401b0381111561296657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612990576020820181803683370190505b5090505b84156128e8576129a56001836132f9565b91506129b2600a86613392565b6129bd9060306132ae565b60f81b8183815181106129e057634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350612a02600a866132c6565b9450612994565b600061225282846132ae565b610c4a828260405180602001604052806000815250612a45565b600082612a3c8584612a52565b14949350505050565b610cd78383836001612ad4565b600081815b8451811015612acc576000858281518110612a8257634e487b7160e01b600052603260045260246000fd5b60200260200101519050808311612aa85760008381526020829052604090209250612ab9565b600081815260208490526040902092505b5080612ac481613377565b915050612a57565b509392505050565b6000546001600160801b03166001600160a01b038516612b0657604051622e076360e81b815260040160405180910390fd5b83612b245760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038516600081815260046020908152604080832080546001600160801b031981166001600160401b038083168c0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168c018116909202179091558584526003909252822080546001600160e01b031916909317600160a01b42909216919091021790915581905b85811015612c365760405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4838015612c0c5750612c0a60008884886127e1565b155b15612c2a576040516368d2bf6b60e11b815260040160405180910390fd5b60019182019101612bb5565b50600080546001600160801b0319166001600160801b03929092169190911790556125d4565b828054612c689061333c565b90600052602060002090601f016020900481019282612c8a5760008555612cd0565b82601f10612ca357805160ff1916838001178555612cd0565b82800160010185558215612cd0579182015b82811115612cd0578251825591602001919060010190612cb5565b50612cdc929150612ce0565b5090565b5b80821115612cdc5760008155600101612ce1565b60006001600160401b0380841115612d0f57612d0f6133d2565b604051601f8501601f19908116603f01168101908282118183101715612d3757612d376133d2565b81604052809350858152868686011115612d5057600080fd5b858560208301376000602087830101525050509392505050565b80358015158114612d7a57600080fd5b919050565b600060208284031215612d90578081fd5b8135612252816133e8565b600060208284031215612dac578081fd5b8151612252816133e8565b60008060408385031215612dc9578081fd5b8235612dd4816133e8565b91506020830135612de4816133e8565b809150509250929050565b600080600060608486031215612e03578081fd5b8335612e0e816133e8565b92506020840135612e1e816133e8565b929592945050506040919091013590565b60008060008060808587031215612e44578081fd5b8435612e4f816133e8565b93506020850135612e5f816133e8565b92506040850135915060608501356001600160401b03811115612e80578182fd5b8501601f81018713612e90578182fd5b612e9f87823560208401612cf5565b91505092959194509250565b60008060408385031215612ebd578182fd5b8235612ec8816133e8565b9150612ed660208401612d6a565b90509250929050565b60008060408385031215612ef1578182fd5b8235612efc816133e8565b946020939093013593505050565b600060208284031215612f1b578081fd5b61225282612d6a565b600060208284031215612f35578081fd5b5035919050565b600060208284031215612f4d578081fd5b8135612252816133fd565b600060208284031215612f69578081fd5b8151612252816133fd565b600060208284031215612f85578081fd5b81356001600160401b03811115612f9a578182fd5b8201601f81018413612faa578182fd5b6128e884823560208401612cf5565b600080600060408486031215612fcd578081fd5b8335925060208401356001600160401b0380821115612fea578283fd5b818601915086601f830112612ffd578283fd5b81358181111561300b578384fd5b8760208260051b850101111561301f578384fd5b6020830194508093505050509250925092565b60008060408385031215613044578182fd5b50508035926020909101359150565b6000815180845261306b816020860160208601613310565b601f01601f19169290920160200192915050565b600080845461308d8161333c565b600182811680156130a557600181146130b6576130e2565b60ff198416875282870194506130e2565b8886526020808720875b858110156130d95781548a8201529084019082016130c0565b50505082870194505b5050505083516130f6818360208801613310565b01949350505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061313290830184613053565b9695505050505050565b6020815260006122526020830184613053565b600060208083528184546131628161333c565b808487015260406001808416600081146131835760018114613197576131c2565b60ff198516898401526060890195506131c2565b898852868820885b858110156131ba5781548b820186015290830190880161319f565b8a0184019650505b509398975050505050505050565b6020808252602c908201527f44726f7073706163653a3a70726573616c654275793a20496e7375666669636960408201526b32b73a103830bcb6b2b73a1760a11b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252603b908201527f44726f7073706163653a3a70726573616c654275793a20546f6f206d616e792060408201527f746f6b656e7320666f72206f6e65207472616e73616374696f6e2e0000000000606082015260800190565b600082198211156132c1576132c16133a6565b500190565b6000826132d5576132d56133bc565b500490565b60008160001904831182151516156132f4576132f46133a6565b500290565b60008282101561330b5761330b6133a6565b500390565b60005b8381101561332b578181015183820152602001613313565b83811115611b585750506000910152565b600181811c9082168061335057607f821691505b6020821081141561337157634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561338b5761338b6133a6565b5060010190565b6000826133a1576133a16133bc565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461200557600080fd5b6001600160e01b03198116811461200557600080fdfea2646970667358221220050b68bb2a190b51cdd1a2613f72938ce2abcab797b92cdb64fd40620ac32df364736f6c63430008040033
Verified Source Code Full Match
Compiler: v0.8.4+commit.c7e474f2
EVM: istanbul
Optimization: Yes (200 runs)
DropspaceSale.sol 233 lines
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;
import "./IDropspaceSale.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "erc721a/contracts/ERC721A.sol";
contract DropspaceSale is IDropspaceSale, ERC721A, Ownable {
using SafeMath for uint256;
using Strings for uint256;
uint256 MAX = 2**256 - 1;
uint256 public override mintLimit;
uint256 public override mintPrice;
uint256 public override supplyLimit;
string public override baseURI;
bool public override smartContractAllowance = false;
bool public override saleActive;
bool public override presaleActive;
bool public override whitelistSaleActive;
address payable public override withdrawalWallet;
address payable public override devWallet;
address public override ticketAddress;
bool public override whitelistBuyOnce;
uint256 devSaleShare;
uint256 ownerSaleShare;
mapping(uint256 => bool) public override usedTickets;
bytes32 public override whitelistRoot;
mapping(address => bool) public override whitelistClaimed;
constructor(
uint256 _supplyLimit,
uint256 _mintLimit,
uint256 _mintPrice,
uint256 _devSaleShare,
address payable _withdrawalWallet,
address payable _devWallet,
address _ticketAddress,
string memory _name,
string memory _ticker,
string memory _baseURI
) ERC721A(_name, _ticker) {
supplyLimit = _supplyLimit;
mintLimit = _mintLimit;
mintPrice = _mintPrice;
withdrawalWallet = _withdrawalWallet;
devWallet = _devWallet;
ticketAddress = _ticketAddress;
baseURI = _baseURI;
devSaleShare = _devSaleShare;
ownerSaleShare = uint256(10000).sub(devSaleShare);
}
modifier onlyWithdrawalWallet() {
require(address(withdrawalWallet) == _msgSender(),
"DropspaceSale: caller is not the withdrawal wallet");
_;
}
function setWhitelistBuyOnce(bool _whitelistBuyOnce) external onlyOwner override {
whitelistBuyOnce = _whitelistBuyOnce;
emit WhitelistBuyOnceChanged(whitelistBuyOnce);
}
function emergencyWithdraw() external onlyOwner override {
payable(owner()).transfer(address(this).balance);
}
function changeSupplyLimit(uint256 _supplyLimit) external onlyOwner override {
require(supplyLimit >= totalSupply(), "DropspaceSale::changeSupplyLimit: Supply Limit can't be reduced below total supply");
supplyLimit = _supplyLimit;
emit SupplyLimitChanged(_supplyLimit);
}
function setMintPrice(uint256 _mintPrice) external onlyOwner override {
mintPrice = _mintPrice;
emit MintPriceChanged(_mintPrice);
}
function setWhitelistClaimStatus(address _user, bool _status) public onlyOwner override {
_setWhitelistClaimStatus(_user, _status);
}
function _setWhitelistClaimStatus(address _user, bool _status) internal {
whitelistClaimed[_user] = _status;
emit WhitelistClaimStatusChanged(_user, _status);
}
function setWhitelistRoot(bytes32 _whitelistRoot) external onlyOwner override {
whitelistRoot = _whitelistRoot;
emit WhitelistRootChanged(whitelistRoot);
}
function setDevSaleShare(uint256 _devSaleShare) external override onlyOwner {
devSaleShare = _devSaleShare;
ownerSaleShare = uint256(10000).sub(devSaleShare);
emit DevShareSaleChanged(devSaleShare);
}
function toggleSaleActive() external onlyOwner override {
saleActive = !saleActive;
emit ToggleSaleState(saleActive);
}
function toggleWhitelistSaleActive() external onlyOwner override {
whitelistSaleActive = !whitelistSaleActive;
emit ToggleWhitelistSaleState(whitelistSaleActive);
}
function setBaseURI(string memory _baseURI) external onlyOwner override {
baseURI = _baseURI;
emit BaseURIChanged(baseURI);
}
function setSmartContractAllowance(bool _smartContractAllowance) external onlyOwner override {
smartContractAllowance = _smartContractAllowance;
emit SmartContractAllowanceChanged(smartContractAllowance);
}
function setWithdrawalWallet(address payable _withdrawalWallet) external onlyOwner override {
withdrawalWallet = _withdrawalWallet;
emit WithdrawalWalletChanged(withdrawalWallet);
}
function setDevWallet(address payable _devWallet) external onlyOwner override {
devWallet = _devWallet;
emit DevWalletChanged(devWallet);
}
function setMintLimit(uint256 _mintLimit) external onlyOwner override {
mintLimit = _mintLimit;
emit MintLimitChanged(mintLimit);
}
function withdraw() external onlyOwner override {
uint256 contractBalance = address(this).balance;
devWallet.transfer(contractBalance.mul(devSaleShare).div(10000));
withdrawalWallet.transfer(contractBalance.mul(ownerSaleShare).div(10000));
}
function reserve(uint256 _amount) external onlyOwner override {
_mint(_amount);
emit Reserve(_amount);
}
function buy(uint256 _amount) external override payable {
require(saleActive, "Dropspace::buy: Sale is not active.");
require(_amount <= mintLimit, "Dropspace::buy: Too many tokens for one transaction.");
require(msg.value >= mintPrice.mul(_amount), "Dropspace::buy: Insufficient payment.");
if (!smartContractAllowance) {
require(tx.origin == _msgSender(), "Dropspace::buy: Smart contracts are not allowed to buy.");
}
_mint(_amount);
emit Buy(_msgSender(), _amount);
}
function _mint(uint256 _amount) internal {
require(totalSupply().add(_amount) <= supplyLimit, "Not enough tokens left.");
_safeMint(_msgSender(), _amount);
}
function tokenURI(uint256 _tokenId) public view override returns(string memory) {
require(_exists(_tokenId), "ERC721Metadata: URI query for nonexistent token");
return bytes(baseURI).length > 0 ?
string(abi.encodePacked(baseURI, _tokenId.toString())) : "";
}
function togglePresaleActive() external onlyOwner override {
presaleActive = !presaleActive;
emit TogglePresaleState(presaleActive);
}
function setTicketAddress(address _ticketAddress) external onlyOwner override {
require(_ticketAddress != address(0), "DropSpaceSale::setTicketAddress: Invalid address.");
ticketAddress = _ticketAddress;
emit TicketAddressChanged(_ticketAddress);
}
function presaleBuy(uint256 _ticketId, uint _amount) external payable override {
require(presaleActive, "Dropspace::presaleBuy: Presale is not Active.");
require(IERC721(ticketAddress).ownerOf(_ticketId) == _msgSender(), "Dropspace::presaleBuy: invalid ticket.");
require(!usedTickets[_ticketId], "Dropspace::presaleBuy: Ticket already used.");
require(_amount <= mintLimit, "Dropspace::presaleBuy: Too many tokens for one transaction.");
require(msg.value >= mintPrice.mul(_amount), "Dropspace::presaleBuy: Insufficient payment.");
usedTickets[_ticketId] = true;
_mint(_amount);
emit PresaleBuy(_msgSender(), _ticketId, _amount);
}
function _verifyWhitelist(address _user, bytes32[] calldata _merkleProof) internal view returns(bool) {
bytes32 leaf = keccak256(abi.encodePacked(_user));
return MerkleProof.verify(_merkleProof, whitelistRoot, leaf);
}
function whitelistBuy(uint256 _amount, bytes32[] calldata _merkleProof) external payable override {
require(whitelistSaleActive, "DropSpaceSale::whitelistBuy: Whitelist Buy is not Active.");
require(_amount <= mintLimit, "Dropspace::presaleBuy: Too many tokens for one transaction.");
require(msg.value >= mintPrice.mul(_amount), "Dropspace::presaleBuy: Insufficient payment.");
require(_verifyWhitelist(_msgSender(), _merkleProof), "Dropspace::whitelistBuy: User is not whitelisted");
if (whitelistBuyOnce) {
require(!whitelistClaimed[_msgSender()], "Dropspace::whitelistBuy: Already claimed");
_setWhitelistClaimStatus(_msgSender(), true);
}
_mint(_amount);
emit WhitelistBuy(_msgSender(), _amount);
}
function clearTicket(uint256 _ticketId) external override onlyOwner{
require(usedTickets[_ticketId], "Dropspace::clearTicket: Ticket is not used");
usedTickets[_ticketId] = false;
emit TicketCleared(_ticketId);
}
receive() external override payable {}
}
IDropspaceSale.sol 75 lines
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.4;
interface IDropspaceSale {
// OWNER ONLY
function togglePresaleActive() external;
function toggleWhitelistSaleActive() external;
function toggleSaleActive() external;
function setBaseURI(string memory _baseURI) external;
function setWithdrawalWallet(address payable _withdrawalWallet) external;
function setDevWallet(address payable _devWallet) external;
function setDevSaleShare(uint256 _devSaleShare) external;
function setMintLimit(uint256 _mintLimit) external;
function setSmartContractAllowance(bool _smartContractAllowance) external;
function setTicketAddress(address _ticketAddress) external;
function setWhitelistClaimStatus(address _user, bool _status) external;
function changeSupplyLimit(uint256 _supplyLimit) external;
function emergencyWithdraw() external;
function setMintPrice(uint256 _mintPrice) external;
function setWhitelistBuyOnce(bool _whitelistBuyOnce) external;
function setWhitelistRoot(bytes32 _whitelistRoot) external;
function reserve(uint256 _amount) external;
function withdraw() external;
function clearTicket(uint256 _ticketId) external;
// EXTERNAL
function buy(uint256 _amount) external payable;
function presaleBuy(uint256 _ticketId, uint256 _amount) external payable;
function whitelistBuy(uint256 _amount, bytes32[] calldata _merkleProof) external payable;
// VIEW
function supplyLimit() view external returns(uint256);
function mintPrice() view external returns(uint256);
function mintLimit() view external returns(uint256);
function baseURI() view external returns(string memory);
function saleActive() view external returns(bool);
function presaleActive() view external returns(bool);
function whitelistSaleActive() view external returns(bool);
function smartContractAllowance() view external returns(bool);
function devWallet() view external returns(address payable);
function withdrawalWallet() view external returns(address payable);
function ticketAddress() view external returns(address);
function whitelistRoot() view external returns (bytes32);
function usedTickets(uint256 _ticketId) view external returns(bool);
function whitelistClaimed(address _user) view external returns(bool);
function whitelistBuyOnce() view external returns(bool);
// EVENTS
event Reserve(uint256 _amount);
event Mint(address indexed _user, uint256 indexed _tokenId, string _tokenURI);
event ToggleSaleState(bool _state);
event BaseURIChanged(string _baseURI);
event WithdrawalWalletChanged(address payable _newWithdrawalWallet);
event DevWalletChanged(address payable _newDevWallet);
event DevShareSaleChanged(uint256 _devSaleShare);
event MintLimitChanged(uint256 _newMintLimit);
event MintPriceChanged(uint256 _mintPrice);
event SmartContractAllowanceChanged(bool _newSmartContractAllowance);
event TogglePresaleState(bool _preSaleState);
event TicketAddressChanged(address _ticketAddress);
event PresaleBuy(address _user, uint256 _ticketId, uint256 _amount);
event WhitelistBuy(address _user, uint256 _amount);
event Buy(address _user, uint256 _amount);
event WhitelistClaimStatusChanged(address _user, bool _status);
event ToggleWhitelistSaleState(bool _whitelistSaleActive);
event SupplyLimitChanged(uint256 _supplyLimit);
event TicketCleared(uint256 _ticketId);
event WhitelistRootChanged(bytes32 _whitelistRoot);
event WhitelistBuyOnceChanged(bool _whitelistBuyOnce);
receive() external payable;
}
ERC721A.sol 628 lines
// SPDX-License-Identifier: MIT
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import '@openzeppelin/contracts/utils/Context.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import '@openzeppelin/contracts/utils/introspection/ERC165.sol';
error ApprovalCallerNotOwnerNorApproved();
error ApprovalQueryForNonexistentToken();
error ApproveToCaller();
error ApprovalToCurrentOwner();
error BalanceQueryForZeroAddress();
error MintedQueryForZeroAddress();
error BurnedQueryForZeroAddress();
error MintToZeroAddress();
error MintZeroQuantity();
error OwnerIndexOutOfBounds();
error OwnerQueryForNonexistentToken();
error TokenIndexOutOfBounds();
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 and Enumerable extension. Built to optimize for lower gas during batch mints.
*
* Assumes serials are sequentially minted starting at 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**128 - 1 (max value of uint128).
*/
contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
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;
}
// Compiler will pack the following
// _currentIndex and _burnCounter into a single 256bit word.
// The tokenId of the next token to be minted.
uint128 internal _currentIndex;
// The number of tokens burned.
uint128 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_;
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
// Counter underflow is impossible as _burnCounter cannot be incremented
// more than _currentIndex times
unchecked {
return _currentIndex - _burnCounter;
}
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
* This read function is O(totalSupply). If calling from a separate contract, be sure to test gas first.
* It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case.
*/
function tokenByIndex(uint256 index) public view override returns (uint256) {
uint256 numMintedSoFar = _currentIndex;
uint256 tokenIdsIdx;
// Counter overflow is impossible as the loop breaks when
// uint256 i is equal to another uint256 numMintedSoFar.
unchecked {
for (uint256 i; i < numMintedSoFar; i++) {
TokenOwnership memory ownership = _ownerships[i];
if (!ownership.burned) {
if (tokenIdsIdx == index) {
return i;
}
tokenIdsIdx++;
}
}
}
revert TokenIndexOutOfBounds();
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
* This read function is O(totalSupply). If calling from a separate contract, be sure to test gas first.
* It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) {
if (index >= balanceOf(owner)) revert OwnerIndexOutOfBounds();
uint256 numMintedSoFar = _currentIndex;
uint256 tokenIdsIdx;
address currOwnershipAddr;
// Counter overflow is impossible as the loop breaks when
// uint256 i is equal to another uint256 numMintedSoFar.
unchecked {
for (uint256 i; i < numMintedSoFar; i++) {
TokenOwnership memory ownership = _ownerships[i];
if (ownership.burned) {
continue;
}
if (ownership.addr != address(0)) {
currOwnershipAddr = ownership.addr;
}
if (currOwnershipAddr == owner) {
if (tokenIdsIdx == index) {
return i;
}
tokenIdsIdx++;
}
}
}
// Execution should never reach this point.
revert();
}
/**
* @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 ||
interfaceId == type(IERC721Enumerable).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);
}
function _numberMinted(address owner) internal view returns (uint256) {
if (owner == address(0)) revert MintedQueryForZeroAddress();
return uint256(_addressData[owner].numberMinted);
}
function _numberBurned(address owner) internal view returns (uint256) {
if (owner == address(0)) revert BurnedQueryForZeroAddress();
return uint256(_addressData[owner].numberBurned);
}
/**
* 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 (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 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 (!_checkOnERC721Received(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 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 > 3.4e38 (2**128) - 1
// updatedIndex overflows if _currentIndex + quantity > 3.4e38 (2**128) - 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;
for (uint256 i; i < quantity; i++) {
emit Transfer(address(0), to, updatedIndex);
if (safe && !_checkOnERC721Received(address(0), to, updatedIndex, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
updatedIndex++;
}
_currentIndex = uint128(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);
bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
isApprovedForAll(prevOwnership.addr, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();
if (to == address(0)) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, prevOwnership.addr);
// 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**128.
unchecked {
_addressData[from].balance -= 1;
_addressData[to].balance += 1;
_ownerships[tokenId].addr = to;
_ownerships[tokenId].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;
if (_ownerships[nextTokenId].addr == address(0)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId < _currentIndex) {
_ownerships[nextTokenId].addr = prevOwnership.addr;
_ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @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 {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
_beforeTokenTransfers(prevOwnership.addr, address(0), tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, prevOwnership.addr);
// 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**128.
unchecked {
_addressData[prevOwnership.addr].balance -= 1;
_addressData[prevOwnership.addr].numberBurned += 1;
// Keep track of who burned the token, and the timestamp of burning.
_ownerships[tokenId].addr = prevOwnership.addr;
_ownerships[tokenId].startTimestamp = uint64(block.timestamp);
_ownerships[tokenId].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;
if (_ownerships[nextTokenId].addr == address(0)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId < _currentIndex) {
_ownerships[nextTokenId].addr = prevOwnership.addr;
_ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(prevOwnership.addr, address(0), tokenId);
_afterTokenTransfers(prevOwnership.addr, 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 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(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @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 {}
}
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);
}
}
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev 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);
}
}
SafeMath.sol 227 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
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 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);
}
MerkleProof.sol 60 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.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.
*/
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 Merklee 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)
}
}
}
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);
}
IERC721Enumerable.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
Read Contract
balanceOf 0x70a08231 → uint256
baseURI 0x6c0360eb → string
devWallet 0x8ea5220f → address
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
mintLimit 0x996517cf → uint256
mintPrice 0x6817c76c → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
presaleActive 0x53135ca0 → bool
saleActive 0x68428a1b → bool
smartContractAllowance 0x646d7a7f → bool
supplyLimit 0x19d1997a → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
ticketAddress 0x57a8e3fe → address
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
usedTickets 0x71efdc21 → bool
whitelistBuyOnce 0xd7e2875c → bool
whitelistClaimed 0xdb4bec44 → bool
whitelistRoot 0x386bfc98 → bytes32
whitelistSaleActive 0x3ad7f56c → bool
withdrawalWallet 0x4a7d80b3 → address
Write Contract 29 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
buy 0xd96a094a
uint256 _amount
changeSupplyLimit 0xd44e3573
uint256 _supplyLimit
clearTicket 0xab26320e
uint256 _ticketId
emergencyWithdraw 0xdb2e21bc
No parameters
presaleBuy 0x0983061c
uint256 _ticketId
uint256 _amount
renounceOwnership 0x715018a6
No parameters
reserve 0x819b25ba
uint256 _amount
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string _baseURI
setDevSaleShare 0x5c4e7e06
uint256 _devSaleShare
setDevWallet 0x1f53ac02
address _devWallet
setMintLimit 0x9e6a1d7d
uint256 _mintLimit
setMintPrice 0xf4a0a528
uint256 _mintPrice
setSmartContractAllowance 0x08e99287
bool _smartContractAllowance
setTicketAddress 0xed9a5bbb
address _ticketAddress
setWhitelistBuyOnce 0x591e194b
bool _whitelistBuyOnce
setWhitelistClaimStatus 0x09499f53
address _user
bool _status
setWhitelistRoot 0xf5aa406d
bytes32 _whitelistRoot
setWithdrawalWallet 0x75796f76
address _withdrawalWallet
togglePresaleActive 0x89b0649b
No parameters
toggleSaleActive 0x3100a535
No parameters
toggleWhitelistSaleActive 0xb89fe999
No parameters
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
whitelistBuy 0x68124a6a
uint256 _amount
bytes32[] _merkleProof
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address