Address Contract Partially Verified
Address
0xf776e9A9642DBeb9ee7de20c25224E4A0BFCC03b
Balance
0 ETH
Nonce
1
Code Size
18409 bytes
Creator
0xb80f023c...653e at tx 0xe04c2bbd...93cfc7
Indexed Transactions
0
Contract Bytecode
18409 bytes
0x6080604052600436106103765760003560e01c806370a08231116101cf578063a8b8042811610101578063d1f8e7731161009a578063f17e48ec1161006c578063f17e48ec14610af7578063f2fde38b14610b17578063f854c89814610b37578063fc784d4914610b6457005b8063d1f8e77314610a6e578063d48e638a146108e1578063e02f8e1f14610a8e578063e985e9c514610aae57005b8063b88d4fde116100d3578063b88d4fde146109fb578063bc8d4cd614610a0e578063c32a50f914610a2e578063c87b56dd14610a4e57005b8063a8b804281461096e578063afb0a3691461098e578063b481630d146109bb578063b61d0c63146109db57005b80638f868a16116101735780639e2b8488116101455780639e2b8488146108e15780639e4c01411461090c578063a05f41a41461092e578063a22cb4651461094e57005b80638f868a161461088457806391b7f5ed1461089757806395d89b41146108b757806398d5fdca146108cc57005b80638101090d116101ac5780638101090d146107e15780638822048e146108015780638c746d8b146108315780638da5cb5b1461086657005b806370a082311461078c578063715018a6146107ac57806374f32b3e146107c157005b806340c10f19116102a857806355f804b31161024c57806369ba1a751161021e57806369ba1a751461071757806369ff1a81146107375780636c0360eb146107575780636f8b44b01461076c57005b806355f804b3146106a457806357a9d3bc146106c45780636352211e146106e4578063666c00aa1461070457005b806342842e0e1161028557806342842e0e1461061c578063495d81511461062f5780634c0f38c21461065f578063521b52a41461067457005b806340c10f19146105a557806341f43434146105da5780634209a2e1146105fc57005b8063118aa48b1161031a57806323922f86116102ec57806323922f861461052257806323b872dd1461054257806331a365de146105555780633b035df61461057557005b8063118aa48b146104c2578063126fe62d146104d757806318160ddd146104f7578063200d2ed21461050c57005b806306fdde031161035357806306fdde0314610428578063081812fc1461044a578063093abc8614610482578063095ea7b3146104af57005b806301ffc9a71461037f578063038bddfa146103b4578063057c2c6a146103ef57005b3661037d57005b005b34801561038b57600080fd5b5061039f61039a366004613c1f565b610b84565b60405190151581526020015b60405180910390f35b3480156103c057600080fd5b506103e16103cf366004613c3c565b60116020526000908152604090205481565b6040519081526020016103ab565b3480156103fb57600080fd5b5061039f61040a366004613c6c565b6001600160a01b031660009081526019602052604090205460ff1690565b34801561043457600080fd5b5061043d610bd6565b6040516103ab9190613cdf565b34801561045657600080fd5b5061046a610465366004613c3c565b610c68565b6040516001600160a01b0390911681526020016103ab565b34801561048e57600080fd5b506103e161049d366004613c3c565b6000908152600b602052604090205490565b61037d6104bd366004613cf2565b610cac565b3480156104ce57600080fd5b5061037d610db2565b3480156104e357600080fd5b5061037d6104f2366004613c6c565b611212565b34801561050357600080fd5b506103e1611272565b34801561051857600080fd5b506103e1600d5481565b34801561052e57600080fd5b5061037d61053d366004613d2a565b611280565b61037d610550366004613d5a565b61132a565b34801561056157600080fd5b5061037d610570366004613d96565b6114bf565b34801561058157600080fd5b5061039f610590366004613c3c565b6000908152601a602052604090205460ff1690565b3480156105b157600080fd5b506105c56105c0366004613cf2565b611516565b604080519283526020830191909152016103ab565b3480156105e657600080fd5b5061046a6daaeb6d7670e522a718067333cd4e81565b34801561060857600080fd5b5061037d610617366004613c3c565b61181a565b61037d61062a366004613d5a565b611849565b34801561063b57600080fd5b5061039f61064a366004613c3c565b601a6020526000908152604090205460ff1681565b34801561066b57600080fd5b50600c546103e1565b34801561068057600080fd5b5061039f61068f366004613c6c565b600a6020526000908152604090205460ff1681565b3480156106b057600080fd5b5061037d6106bf366004613e6c565b6119d3565b3480156106d057600080fd5b506103e16106df366004613cf2565b611a4c565b3480156106f057600080fd5b5061046a6106ff366004613c3c565b611a74565b61037d610712366004613ef8565b611a7f565b34801561072357600080fd5b5061037d610732366004613c3c565b61213f565b34801561074357600080fd5b5061037d610752366004613c6c565b61216e565b34801561076357600080fd5b5061043d6121d4565b34801561077857600080fd5b5061037d610787366004613c3c565b612262565b34801561079857600080fd5b506103e16107a7366004613c6c565b612291565b3480156107b857600080fd5b5061037d6122df565b3480156107cd57600080fd5b5061039f6107dc366004613f5e565b612315565b3480156107ed57600080fd5b5061037d6107fc366004614041565b612374565b34801561080d57600080fd5b5061039f61081c366004613c6c565b60196020526000908152604090205460ff1681565b34801561083d57600080fd5b506105c561084c366004613c3c565b600090815260166020526040902080546001909101549091565b34801561087257600080fd5b506008546001600160a01b031661046a565b61037d610892366004614075565b612593565b3480156108a357600080fd5b5061037d6108b2366004613c3c565b612916565b3480156108c357600080fd5b5061043d612945565b3480156108d857600080fd5b50600e546103e1565b3480156108ed57600080fd5b5061046a6108fc366004613c3c565b50600f546001600160a01b031690565b34801561091857600080fd5b506103e1610927366004613c3c565b5060105490565b34801561093a57600080fd5b5061037d610949366004613c6c565b612954565b34801561095a57600080fd5b5061037d6109693660046140c0565b6129a0565b34801561097a57600080fd5b5061037d6109893660046140c0565b612a9c565b34801561099a57600080fd5b506103e16109a9366004613c3c565b60146020526000908152604090205481565b3480156109c757600080fd5b5061037d6109d63660046140ec565b612b61565b3480156109e757600080fd5b506103e16109f6366004613cf2565b612bc5565b61037d610a09366004614118565b612c02565b348015610a1a57600080fd5b5061037d610a29366004614193565b612d93565b348015610a3a57600080fd5b5061037d610a49366004613c3c565b612e25565b348015610a5a57600080fd5b5061043d610a69366004613c3c565b612e54565b348015610a7a57600080fd5b5061037d610a89366004613c3c565b612f1f565b348015610a9a57600080fd5b5061037d610aa9366004613c3c565b612f65565b348015610aba57600080fd5b5061039f610ac93660046141d9565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b348015610b0357600080fd5b5061037d610b12366004613cf2565b612fcd565b348015610b2357600080fd5b5061037d610b32366004613c6c565b613095565b348015610b4357600080fd5b506103e1610b52366004613c3c565b60126020526000908152604090205481565b348015610b7057600080fd5b5061037d610b7f36600461420c565b613130565b60006301ffc9a760e01b6001600160e01b031983161480610bb557506380ac58cd60e01b6001600160e01b03198316145b80610bd05750635b5e139f60e01b6001600160e01b03198316145b92915050565b606060028054610be59061422e565b80601f0160208091040260200160405190810160405280929190818152602001828054610c119061422e565b8015610c5e5780601f10610c3357610100808354040283529160200191610c5e565b820191906000526020600020905b815481529060010190602001808311610c4157829003601f168201915b5050505050905090565b6000610c738261316c565b610c90576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b816daaeb6d7670e522a718067333cd4e3b15610d6b57604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015610d1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d3e9190614268565b610d6b57604051633b79c77360e21b81526001600160a01b03821660048201526024015b60405180910390fd5b6001600160a01b03831660009081526019602052604090205460ff16610da35760405162461bcd60e51b8152600401610d6290614285565b610dad83836131a1565b505050565b333214610dd15760405162461bcd60e51b8152600401610d62906142bc565b33600090815260176020908152604080832060038452909152808220546002835291205411610e305760405162461bcd60e51b815260206004820152600b60248201526a63616e277420636c61696d60a81b6044820152606401610d62565b600360005260166020527ff06d282f967055cb1eee17e04aa005b9682a620f4bbcfaee55ba78607a3d87ae54421015610e7b5760405162461bcd60e51b8152600401610d62906142d9565b600360005260166020527ff06d282f967055cb1eee17e04aa005b9682a620f4bbcfaee55ba78607a3d87af544210610ec55760405162461bcd60e51b8152600401610d6290614307565b33600090815260176020908152604080832060038452909152808220546002835290822054610ef49190614345565b600c5460026000908152601160205260008051602061473483398151915254929350918291610f2e91610f289060646131b1565b906131bd565b600054909150610f3e33856131c9565b60006001600054610f4f9190614345565b9050815b81811161111d576001600081905260126020527f71a67924699a20698523213e55fe499d539379d7769cd5567e2c45d583f815a354610f919161435c565b600160005260116020526000805160206147948339815191525411610fb957600294506110aa565b600260005260126020527f8e1fee8c88a9e04123b21e90cae2727a7715bf522a1e46eb5934ccd05203a6b254610ff090600161435c565b60026000526011602052600080516020614734833981519152541161101857600194506110aa565b6064611022611272565b87601354611030919061435c565b61103a919061435c565b82601354611048919061435c565b423261105c6008546001600160a01b031690565b604051602001611070959493929190614374565b6040516020818303038152906040528051906020012060001c61109391906143b9565b94508484106110a557600194506110aa565b600294505b60008581526012602052604081208054916110c4836143cd565b909155505060008181526014602052604081208690556015805460018101825591527f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec4750185905580611115816143cd565b915050610f53565b50336000908152601760209081526040808320600384529091528120805487929061114990849061435c565b90915550506004600090815260126020526000805160206147548339815191528054879290611179908490614345565b90915550506005600090815260126020527f45429b9195d4ec5c0cf6c69e9c21a4ca0ea773b702c2de5735f85d2631f2674680548792906111bb90849061435c565b90915550506040517f1792056aee2ac57eeca1667413b6b31a2ae948a883ac44b1333f251fcfe45144906111f790849084903390601590614426565b60405180910390a161120b60156000613b52565b5050505050565b6008546001600160a01b0316331461123c5760405162461bcd60e51b8152600401610d6290614453565b6001600160a01b03166000908152600a60209081526040808320805460ff19908116909155601990925290912080549091169055565b600154600054036000190190565b336000908152600a602052604090205460ff166112af5760405162461bcd60e51b8152600401610d6290614488565b6000828152601a602052604090205481151560ff90911615150361130a5760405162461bcd60e51b81526020600482015260126024820152711cdd185d1d5cc8185b1c9958591e481cd95d60721b6044820152606401610d62565b6000918252601a6020526040909120805460ff1916911515919091179055565b826daaeb6d7670e522a718067333cd4e3b1561145057336001600160a01b038216036113be573360009081526019602052604090205460ff1661137f5760405162461bcd60e51b8152600401610d6290614285565b6000828152601a602052604090205460ff16156113ae5760405162461bcd60e51b8152600401610d62906144af565b6113b98484846131e3565b6114b9565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa15801561140d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114319190614268565b61145057604051633b79c77360e21b8152336004820152602401610d62565b3360009081526019602052604090205460ff1661147f5760405162461bcd60e51b8152600401610d6290614285565b6000828152601a602052604090205460ff16156114ae5760405162461bcd60e51b8152600401610d62906144af565b6114b98484846131e3565b50505050565b6008546001600160a01b031633146114e95760405162461bcd60e51b8152600401610d6290614453565b6000918252600b602090815260408084209490945560189052919020805460ff1916911515919091179055565b336000908152600a6020526040812054819060ff166115475760405162461bcd60e51b8152600401610d6290614488565b82611550611272565b61155a919061435c565b600c54101561159e5760405162461bcd60e51b815260206004820152601060248201526f657863656564696e6720737570706c7960801b6044820152606401610d62565b6000546115ab85856131c9565b600060016000546115bc9190614345565b600c54600260009081526011602052600080516020614734833981519152549293509182916115f091610f289060646131b1565b9050835b8381116117be576001600081905260126020527f71a67924699a20698523213e55fe499d539379d7769cd5567e2c45d583f815a3546116329161435c565b60016000526011602052600080516020614794833981519152541161165a576002925061174b565b600260005260126020527f8e1fee8c88a9e04123b21e90cae2727a7715bf522a1e46eb5934ccd05203a6b25461169190600161435c565b6002600052601160205260008051602061473483398151915254116116b9576001925061174b565b60646116c3611272565b896013546116d1919061435c565b6116db919061435c565b826013546116e9919061435c565b42326116fd6008546001600160a01b031690565b604051602001611711959493929190614374565b6040516020818303038152906040528051906020012060001c61173491906143b9565b9250828210611746576001925061174b565b600292505b6000838152601260205260408120805491611765836143cd565b909155505060008181526014602052604081208490556015805460018101825591527f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec47501839055806117b6816143cd565b9150506115f4565b507ff211e5fddaaec6aa0c1783f48763e1358d822b2b483652026f1c4100d2b79d198484898b60156040516117f79594939291906144de565b60405180910390a161180b60156000613b52565b509193509150505b9250929050565b6008546001600160a01b031633146118445760405162461bcd60e51b8152600401610d6290614453565b601055565b826daaeb6d7670e522a718067333cd4e3b1561196a57336001600160a01b038216036118d8573360009081526019602052604090205460ff1661189e5760405162461bcd60e51b8152600401610d6290614285565b6000828152601a602052604090205460ff16156118cd5760405162461bcd60e51b8152600401610d62906144af565b6113b9848484613373565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015611927573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061194b9190614268565b61196a57604051633b79c77360e21b8152336004820152602401610d62565b3360009081526019602052604090205460ff166119995760405162461bcd60e51b8152600401610d6290614285565b6000828152601a602052604090205460ff16156119c85760405162461bcd60e51b8152600401610d62906144af565b6114b9848484613373565b6008546001600160a01b031633146119fd5760405162461bcd60e51b8152600401610d6290614453565b8051611a10906009906020840190613b70565b507f01e56a02aca7f26a28165a040851ba78f30282b55ca81c63a804cdc1e2dcea726009604051611a419190614511565b60405180910390a150565b6001600160a01b03919091166000908152601760209081526040808320938352929052205490565b6000610bd08261338e565b333214611a9e5760405162461bcd60e51b8152600401610d62906142bc565b600081815260166020526040902054421015611acc5760405162461bcd60e51b8152600401610d62906142d9565b6000818152601660205260409020600101544210611afc5760405162461bcd60e51b8152600401610d6290614307565b60008181526018602052604090205460ff1615611b4b5760405162461bcd60e51b815260206004820152600d60248201526c6e6f2076616c6964207479706560981b6044820152606401610d62565b600082611b59576000611b6e565b83611b643384611a4c565b611b6e919061435c565b9050600d54600103611ba357611b873387878486612315565b611ba35760405162461bcd60e51b8152600401610d6290614488565b600d54600003611be95760405162461bcd60e51b81526020600482015260116024820152701cd85b195cc81b9bdd081cdd185c9d1959607a1b6044820152606401610d62565b83611bf2611272565b611bfc919061435c565b6004600052601260205260008051602061475483398151915254600c54611c239190614345565b1015611c5b5760405162461bcd60e51b81526020600482015260076024820152661cdbdb191bdd5d60ca1b6044820152606401610d62565b83611c64611272565b611c6e919061435c565b601160205260008051602061473483398151915254600160005260008051602061479483398151915254611ca2919061435c565b1015611cde5760405162461bcd60e51b815260206004820152600b60248201526a0d8d2dad2e840e4cac2c6d60ab1b6044820152606401610d62565b600e54600c54600260009081526011602052600080516020614734833981519152549092349290918491611d1791610f289060646131b1565b9050611d2388836145b8565b915082821115611d5f5760405162461bcd60e51b815260206004820152600760248201526609c8ca8406260760cb1b6044820152606401610d62565b600054611d6c338a6131c9565b60006001600054611d7d9190614345565b9050815b818111611f4b576001600081905260126020527f71a67924699a20698523213e55fe499d539379d7769cd5567e2c45d583f815a354611dbf9161435c565b600160005260116020526000805160206147948339815191525411611de75760029650611ed8565b600260005260126020527f8e1fee8c88a9e04123b21e90cae2727a7715bf522a1e46eb5934ccd05203a6b254611e1e90600161435c565b600260005260116020526000805160206147348339815191525411611e465760019650611ed8565b6064611e50611272565b8c601354611e5e919061435c565b611e68919061435c565b82601354611e76919061435c565b4232611e8a6008546001600160a01b031690565b604051602001611e9e959493929190614374565b6040516020818303038152906040528051906020012060001c611ec191906143b9565b9650868410611ed35760019650611ed8565b600296505b6000878152601260205260408120805491611ef2836143cd565b909155505060008181526014602052604081208890556015805460018101825591527f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec4750187905580611f43816143cd565b915050611d81565b503360009081526017602090815260408083208b8452909152902054611f72908b9061435c565b3360009081526017602090815260408083208c845290915280822092909255600f54915190916001600160a01b03169086908381818185875af1925050503d8060008114611fdc576040519150601f19603f3d011682016040523d82523d6000602084013e611fe1565b606091505b505090508061202a5760405162461bcd60e51b81526020600482015260156024820152740eadcc2c4d8ca40e8de40e4cac6cad2ecca40cae8d605b1b6044820152606401610d62565b60006120368688614345565b11156120d057336120478688614345565b604051600081818185875af1925050503d8060008114612083576040519150601f19603f3d011682016040523d82523d6000602084013e612088565b606091505b505080915050806120d05760405162461bcd60e51b81526020600482015260126024820152710eadcc2c4d8ca40e8de40e6cadcc840cae8d60731b6044820152606401610d62565b600e54600f546040517fcaf4d10f77a1e37f464f6b74bd3d60d54e92ee3fc9b6151ff0910774cde689d09261211c9287928792918b916001600160a01b039091169033906015906145d7565b60405180910390a161213060156000613b52565b50505050505050505050505050565b6008546001600160a01b031633146121695760405162461bcd60e51b8152600401610d6290614453565b600d55565b6008546001600160a01b031633146121985760405162461bcd60e51b8152600401610d6290614453565b6001600160a01b03166000908152600a602090815260408083208054600160ff1991821681179092556019909352922080549091169091179055565b600980546121e19061422e565b80601f016020809104026020016040519081016040528092919081815260200182805461220d9061422e565b801561225a5780601f1061222f5761010080835404028352916020019161225a565b820191906000526020600020905b81548152906001019060200180831161223d57829003601f168201915b505050505081565b6008546001600160a01b0316331461228c5760405162461bcd60e51b8152600401610d6290614453565b600c55565b60006001600160a01b0382166122ba576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b6008546001600160a01b031633146123095760405162461bcd60e51b8152600401610d6290614453565b612313600061341a565b565b600061236a6123248785612bc5565b8686808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250888152600b6020526040902054925061346c915050565b9695505050505050565b80516005146123c55760405162461bcd60e51b815260206004820152601b60248201527f6e656564203520636f6d6d6f6e206e66747320746f20637261667400000000006044820152606401610d62565b600360005260126020527f0f36ad39aee03e7108cc48f54934702a5f0d4066f10344cebf8198978d86976a546123fc90600161435c565b600360005260116020527f9bfbaa59f8e10e7868f8b402de9d605a390c45ddaebd8c9de3c6f31e733c87ff5410156124805760405162461bcd60e51b815260206004820152602160248201527f4d617820737570706c79207265616368656420666f72206372616674207261726044820152606560f81b6064820152608401610d62565b600061248b82613481565b9050806124e95760405162461bcd60e51b815260206004820152602660248201527f4f6e65206f72206d6f726520746f6b656e206964206973206e6f742076616c6960448201526564207479706560d01b6064820152608401610d62565b600080546124f890600161435c565b90506125053360016131c9565b600081815260146020908152604082206002905560038252601290527f0f36ad39aee03e7108cc48f54934702a5f0d4066f10344cebf8198978d86976a80549161254e836143cd565b91905055507f815a6b801d6f526f9c991ab39f19a3d9d45e21169f8ad53b728ca266d578e6bb81843360405161258693929190614627565b60405180910390a1505050565b3332146125b25760405162461bcd60e51b8152600401610d62906142bc565b6002600081905260166020527fcaff291fe014adc6b72a172705750b4cabe8f8667664d2924a166caab2885648544210156125ff5760405162461bcd60e51b8152600401610d62906142d9565b600081815260166020526040902060010154421061262f5760405162461bcd60e51b8152600401610d6290614307565b60008261263c3384611a4c565b612646919061435c565b90506126553386868486612315565b6126715760405162461bcd60e51b8152600401610d6290614488565b6004600052601260205260008051602061475483398151915254600c5410156126c65760405162461bcd60e51b81526020600482015260076024820152661cdbdb191bdd5d60ca1b6044820152606401610d62565b600e5434906126d585826145b8565b9050818111156127115760405162461bcd60e51b815260206004820152600760248201526609c8ca8406260760cb1b6044820152606401610d62565b600460009081526012602052600080516020614754833981519152805487929061273c90849061435c565b9091555050600f546040516000916001600160a01b03169083908381818185875af1925050503d806000811461278e576040519150601f19603f3d011682016040523d82523d6000602084013e612793565b606091505b50509050806127dc5760405162461bcd60e51b81526020600482015260156024820152740eadcc2c4d8ca40e8de40e4cac6cad2ecca40cae8d605b1b6044820152606401610d62565b60006127e88385614345565b111561288257336127f98385614345565b604051600081818185875af1925050503d8060008114612835576040519150601f19603f3d011682016040523d82523d6000602084013e61283a565b606091505b505080915050806128825760405162461bcd60e51b81526020600482015260126024820152710eadcc2c4d8ca40e8de40e6cadcc840cae8d60731b6044820152606401610d62565b336000908152601760209081526040808320888452909152812080548892906128ac90849061435c565b9091555050600e54600f5460408051928352602083018590526001600160a01b039091168282015233606083015260808201889052517f9592d3701341da076dc734011f1448f436d27721edd662a432632e455e6873d89181900360a00190a15050505050505050565b6008546001600160a01b031633146129405760405162461bcd60e51b8152600401610d6290614453565b600e55565b606060038054610be59061422e565b6008546001600160a01b0316331461297e5760405162461bcd60e51b8152600401610d6290614453565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b816daaeb6d7670e522a718067333cd4e3b15612a5a57604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015612a0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a329190614268565b612a5a57604051633b79c77360e21b81526001600160a01b0382166004820152602401610d62565b6001600160a01b03831660009081526019602052604090205460ff16612a925760405162461bcd60e51b8152600401610d6290614285565b610dad83836134f4565b6008546001600160a01b03163314612ac65760405162461bcd60e51b8152600401610d6290614453565b6001600160a01b03821660009081526019602052604090205481151560ff909116151503612b365760405162461bcd60e51b815260206004820152601c60248201527f58616e616c616e643a2073746174757320616c726561647920736574000000006044820152606401610d62565b6001600160a01b03919091166000908152601960205260409020805460ff1916911515919091179055565b6008546001600160a01b03163314612b8b5760405162461bcd60e51b8152600401610d6290614453565b6040805160608101825293845260208085019384526000858301818152938152601690915220925183559051600183015551600290910155565b604080516001600160a01b038416602082015290810182905260009060600160405160208183030381529060405280519060200120905092915050565b836daaeb6d7670e522a718067333cd4e3b15612d2957336001600160a01b03821603612c97573360009081526019602052604090205460ff16612c575760405162461bcd60e51b8152600401610d6290614285565b6000838152601a602052604090205460ff1615612c865760405162461bcd60e51b8152600401610d62906144af565b612c9285858585613560565b61120b565b604051633185c44d60e21b81523060048201523360248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa158015612ce6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d0a9190614268565b612d2957604051633b79c77360e21b8152336004820152602401610d62565b3360009081526019602052604090205460ff16612d585760405162461bcd60e51b8152600401610d6290614285565b6000838152601a602052604090205460ff1615612d875760405162461bcd60e51b8152600401610d62906144af565b61120b85858585613560565b336000908152600a602052604090205460ff16612dc25760405162461bcd60e51b8152600401610d6290614488565b60005b8251811015610dad5781601a6000858481518110612de557612de561468a565b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083151502179055508080612e1d906143cd565b915050612dc5565b6008546001600160a01b03163314612e4f5760405162461bcd60e51b8152600401610d6290614453565b601355565b6060612e5f8261316c565b612ec35760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610d62565b6000612ecd6135a4565b90506000815111612eed5760405180602001604052806000815250612f18565b80612ef7846135b3565b604051602001612f089291906146a0565b6040516020818303038152906040525b9392505050565b6008546001600160a01b03163314612f495760405162461bcd60e51b8152600401610d6290614453565b6004600052601260205260008051602061475483398151915255565b336000908152600a602052604090205460ff16612f945760405162461bcd60e51b8152600401610d6290614488565b612f9d816136b3565b6040518181527fb90306ad06b2a6ff86ddc9327db583062895ef6540e62dc50add009db5b356eb90602001611a41565b336000908152600a602052604090205460ff16612ffc5760405162461bcd60e51b8152600401610d6290614488565b600061300782611a74565b6001600160a01b03811660009081526007602090815260408083203384528252808320805460ff19166001179055858352601a90915290205490915060ff161561308a576000828152601a60205260409020805460ff1916905561306c81848461132a565b6000828152601a60205260409020805460ff19166001179055505050565b610dad81848461132a565b6008546001600160a01b031633146130bf5760405162461bcd60e51b8152600401610d6290614453565b6001600160a01b0381166131245760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610d62565b61312d8161341a565b50565b6008546001600160a01b0316331461315a5760405162461bcd60e51b8152600401610d6290614453565b60009182526011602052604090912055565b600081600111158015613180575060005482105b8015610bd0575050600090815260046020526040902054600160e01b161590565b6131ad828260016136be565b5050565b6000612f1882846145b8565b6000612f1882846146cf565b6131ad828260405180602001604052806000815250613765565b60006131ee8261338e565b9050836001600160a01b0316816001600160a01b0316146132215760405162a1148160e81b815260040160405180910390fd5b6000828152600660205260409020805461324d8187335b6001600160a01b039081169116811491141790565b6132785761325b8633610ac9565b61327857604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661329f57604051633a954ecd60e21b815260040160405180910390fd5b80156132aa57600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b8416900361333c5760018401600081815260046020526040812054900361333a57600054811461333a5760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b031660008051602061477483398151915260405160405180910390a4505050505050565b610dad83838360405180602001604052806000815250612c02565b600081600111613401575060008181526004602052604081205490600160e01b8216900361340157806000036133fc5760005482106133e057604051636f96cda160e11b815260040160405180910390fd5b5b506000190160008181526004602052604090205480156133e1575b919050565b604051636f96cda160e11b815260040160405180910390fd5b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006134798383866137cb565b949350505050565b60016000805b83518110156134ed578381815181106134a2576134a261468a565b6020026020010151915060146000838152602001908152602001600020546001146134d057600092506134ed565b6134db8260016137e1565b806134e5816143cd565b915050613487565b5050919050565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61356b84848461132a565b6001600160a01b0383163b156114b95761358784848484613919565b6114b9576040516368d2bf6b60e11b815260040160405180910390fd5b606060098054610be59061422e565b6060816000036135da5750506040805180820190915260018152600360fc1b602082015290565b8160005b811561360457806135ee816143cd565b91506135fd9050600a836146cf565b91506135de565b6000816001600160401b0381111561361e5761361e613dcf565b6040519080825280601f01601f191660200182016040528015613648576020820181803683370190505b5090505b84156134795761365d600183614345565b915061366a600a866143b9565b61367590603061435c565b60f81b81838151811061368a5761368a61468a565b60200101906001600160f81b031916908160001a9053506136ac600a866146cf565b945061364c565b61312d8160006137e1565b60006136c983611a74565b9050811561370857336001600160a01b03821614613708576136eb8133610ac9565b613708576040516367d9dca160e11b815260040160405180910390fd5b60008381526006602052604080822080546001600160a01b0319166001600160a01b0388811691821790925591518693918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050565b61376f8383613a04565b6001600160a01b0383163b15610dad576000548281035b6137996000868380600101945086613919565b6137b6576040516368d2bf6b60e11b815260040160405180910390fd5b81811061378657816000541461120b57600080fd5b6000826137d88584613ade565b14949350505050565b60006137ec8361338e565b90508060008061380a86600090815260066020526040902080549091565b91509150841561384a5761381f818433613238565b61384a5761382d8333610ac9565b61384a57604051632ce44b5f60e11b815260040160405180910390fd5b801561385557600082555b6001600160a01b038316600081815260056020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260046020526040812091909155600160e11b851690036138e3576001860160008181526004602052604081205490036138e15760005481146138e15760008181526004602052604090208590555b505b60405186906000906001600160a01b03861690600080516020614774833981519152908390a45050600180548101905550505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a029061394e9033908990889088906004016146e3565b6020604051808303816000875af1925050508015613989575060408051601f3d908101601f1916820190925261398691810190614716565b60015b6139e7573d8080156139b7576040519150601f19603f3d011682016040523d82523d6000602084013e6139bc565b606091505b5080516000036139df576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b6000805490829003613a295760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083906000805160206147748339815191528180a4600183015b818114613ab45780836000600080516020614774833981519152600080a4600101613a8e565b5081600003613ad557604051622e076360e81b815260040160405180910390fd5b60005550505050565b600081815b8451811015613b4a576000858281518110613b0057613b0061468a565b60200260200101519050808311613b265760008381526020829052604090209250613b37565b600081815260208490526040902092505b5080613b42816143cd565b915050613ae3565b509392505050565b508054600082559060005260206000209081019061312d9190613bf4565b828054613b7c9061422e565b90600052602060002090601f016020900481019282613b9e5760008555613be4565b82601f10613bb757805160ff1916838001178555613be4565b82800160010185558215613be4579182015b82811115613be4578251825591602001919060010190613bc9565b50613bf0929150613bf4565b5090565b5b80821115613bf05760008155600101613bf5565b6001600160e01b03198116811461312d57600080fd5b600060208284031215613c3157600080fd5b8135612f1881613c09565b600060208284031215613c4e57600080fd5b5035919050565b80356001600160a01b03811681146133fc57600080fd5b600060208284031215613c7e57600080fd5b612f1882613c55565b60005b83811015613ca2578181015183820152602001613c8a565b838111156114b95750506000910152565b60008151808452613ccb816020860160208601613c87565b601f01601f19169290920160200192915050565b602081526000612f186020830184613cb3565b60008060408385031215613d0557600080fd5b613d0e83613c55565b946020939093013593505050565b801515811461312d57600080fd5b60008060408385031215613d3d57600080fd5b823591506020830135613d4f81613d1c565b809150509250929050565b600080600060608486031215613d6f57600080fd5b613d7884613c55565b9250613d8660208501613c55565b9150604084013590509250925092565b600080600060608486031215613dab57600080fd5b83359250602084013591506040840135613dc481613d1c565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613e0d57613e0d613dcf565b604052919050565b60006001600160401b03831115613e2e57613e2e613dcf565b613e41601f8401601f1916602001613de5565b9050828152838383011115613e5557600080fd5b828260208301376000602084830101529392505050565b600060208284031215613e7e57600080fd5b81356001600160401b03811115613e9457600080fd5b8201601f81018413613ea557600080fd5b61347984823560208401613e15565b60008083601f840112613ec657600080fd5b5081356001600160401b03811115613edd57600080fd5b6020830191508360208260051b850101111561181357600080fd5b600080600080600060808688031215613f1057600080fd5b85356001600160401b03811115613f2657600080fd5b613f3288828901613eb4565b909650945050602086013592506040860135613f4d81613d1c565b949793965091946060013592915050565b600080600080600060808688031215613f7657600080fd5b613f7f86613c55565b945060208601356001600160401b03811115613f9a57600080fd5b613fa688828901613eb4565b9699909850959660408101359660609091013595509350505050565b600082601f830112613fd357600080fd5b813560206001600160401b03821115613fee57613fee613dcf565b8160051b613ffd828201613de5565b928352848101820192828101908785111561401757600080fd5b83870192505b848310156140365782358252918301919083019061401d565b979650505050505050565b60006020828403121561405357600080fd5b81356001600160401b0381111561406957600080fd5b61347984828501613fc2565b60008060006040848603121561408a57600080fd5b83356001600160401b038111156140a057600080fd5b6140ac86828701613eb4565b909790965060209590950135949350505050565b600080604083850312156140d357600080fd5b6140dc83613c55565b91506020830135613d4f81613d1c565b60008060006060848603121561410157600080fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561412e57600080fd5b61413785613c55565b935061414560208601613c55565b92506040850135915060608501356001600160401b0381111561416757600080fd5b8501601f8101871361417857600080fd5b61418787823560208401613e15565b91505092959194509250565b600080604083850312156141a657600080fd5b82356001600160401b038111156141bc57600080fd5b6141c885828601613fc2565b9250506020830135613d4f81613d1c565b600080604083850312156141ec57600080fd5b6141f583613c55565b915061420360208401613c55565b90509250929050565b6000806040838503121561421f57600080fd5b50508035926020909101359150565b600181811c9082168061424257607f821691505b60208210810361426257634e487b7160e01b600052602260045260246000fd5b50919050565b60006020828403121561427a57600080fd5b8151612f1881613d1c565b6020808252601c908201527f4552433732313a207472616e73666572206e6f7420616c6c6f77656400000000604082015260600190565b60208082526003908201526231303160e81b604082015260600190565b6020808252601490820152731cd85b19481b9bdd081cdd185c9d1959081e595d60621b604082015260600190565b6020808252600e908201526d1cd85b19481a185cc8195b99195960921b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000828210156143575761435761432f565b500390565b6000821982111561436f5761436f61432f565b500190565b948552602085019390935260408401919091526001600160a01b03908116606084015216608082015260a00190565b634e487b7160e01b600052601260045260246000fd5b6000826143c8576143c86143a3565b500690565b6000600182016143df576143df61432f565b5060010190565b6000815480845260208085019450836000528060002060005b8381101561441b578154875295820195600191820191016143ff565b509495945050505050565b84815283602082015260018060a01b038316604082015260806060820152600061236a60808301846143e6565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c6e6f7420617574686f72697a6560981b604082015260600190565b602080825260159082015274115490cdcc8c4e88139195081a5cc81b1bd8dad959605a1b604082015260600190565b85815284602082015283604082015260018060a01b038316606082015260a06080820152600061403660a08301846143e6565b600060208083526000845481600182811c91508083168061453357607f831692505b858310810361455057634e487b7160e01b85526022600452602485fd5b87860183815260200181801561456d576001811461457e576145a9565b60ff198616825287820196506145a9565b60008b81526020902060005b868110156145a35781548482015290850190890161458a565b83019750505b50949998505050505050505050565b60008160001904831182151516156145d2576145d261432f565b500290565b878152866020820152856040820152846060820152600060018060a01b03808616608084015280851660a08401525060e060c083015261461a60e08301846143e6565b9998505050505050505050565b6000606082018583526020606081850152818651808452608086019150828801935060005b818110156146685784518352938301939183019160010161464c565b50506001600160a01b0395909516604094909401939093525091949350505050565b634e487b7160e01b600052603260045260246000fd5b600083516146b2818460208801613c87565b8351908301906146c6818360208801613c87565b01949350505050565b6000826146de576146de6143a3565b500490565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061236a90830184613cb3565b60006020828403121561472857600080fd5b8151612f1881613c0956fe08037d7b151cc412d25674a4e66b334d9ae9d2e5517a7feaae5cdb828bf1c628b4fcd034df3d20faa1c133b66d862ce92732727d40916b48ffb4020cb00fe053ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef17bc176d2408558f6e4111feebc3cab4e16b63e967be91cde721f4c8a488b552a2646970667358221220af0ce3025bf233a8284e4bc8d1d8c4db4c59a8d888c7cb63690f314c5086355364736f6c634300080d0033
Verified Source Code Partial Match
Compiler: v0.8.13+commit.abaa5c0e
EVM: london
Optimization: Yes (200 runs)
Collection.sol 2684 lines
/**
*Submitted for verification at Etherscan.io on 2022-11-20
*/
// File: contracts\IERC721A.sol
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs
pragma solidity ^0.8.4;
/**
* @dev Interface of ERC721A.
*/
interface IERC721A {
/**
* The caller must own the token or be an approved operator.
*/
error ApprovalCallerNotOwnerNorApproved();
/**
* The token does not exist.
*/
error ApprovalQueryForNonexistentToken();
/**
* Cannot query the balance for the zero address.
*/
error BalanceQueryForZeroAddress();
/**
* Cannot mint to the zero address.
*/
error MintToZeroAddress();
/**
* The quantity of tokens minted must be more than zero.
*/
error MintZeroQuantity();
/**
* The token does not exist.
*/
error OwnerQueryForNonexistentToken();
/**
* The caller must own the token or be an approved operator.
*/
error TransferCallerNotOwnerNorApproved();
/**
* The token must be owned by `from`.
*/
error TransferFromIncorrectOwner();
/**
* Cannot safely transfer to a contract that does not implement the
* ERC721Receiver interface.
*/
error TransferToNonERC721ReceiverImplementer();
/**
* Cannot transfer to the zero address.
*/
error TransferToZeroAddress();
/**
* The token does not exist.
*/
error URIQueryForNonexistentToken();
/**
* The `quantity` minted with ERC2309 exceeds the safety limit.
*/
error MintERC2309QuantityExceedsLimit();
/**
* The `extraData` cannot be set on an unintialized ownership slot.
*/
error OwnershipNotInitializedForExtraData();
// =============================================================
// STRUCTS
// =============================================================
struct TokenOwnership {
// The address of the owner.
address addr;
// Stores the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
// Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.
uint24 extraData;
}
// =============================================================
// TOKEN COUNTERS
// =============================================================
/**
* @dev Returns the total number of tokens in existence.
* Burned tokens will reduce the count.
* To get the total number of tokens minted, please see {_totalMinted}.
*/
function totalSupply() external view returns (uint256);
// =============================================================
// IERC165
// =============================================================
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
// =============================================================
// IERC721
// =============================================================
/**
* @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,
bytes calldata data
) external payable;
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external payable;
/**
* @dev Transfers `tokenId` 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 payable;
/**
* @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 payable;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom}
* for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
// =============================================================
// IERC721Metadata
// =============================================================
/**
* @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);
// =============================================================
// IERC2309
// =============================================================
/**
* @dev Emitted when tokens in `fromTokenId` to `toTokenId`
* (inclusive) is transferred from `from` to `to`, as defined in the
* [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.
*
* See {_mintERC2309} for more details.
*/
event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}
// File: contracts\ERC721A.sol
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs
pragma solidity ^0.8.4;
/**
* @dev Interface of ERC721 token receiver.
*/
interface ERC721A__IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
/**
* @title ERC721A
*
* @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)
* Non-Fungible Token Standard, including the Metadata extension.
* Optimized for lower gas during batch mints.
*
* Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)
* starting from `_startTokenId()`.
*
* Assumptions:
*
* - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
* - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
*/
contract ERC721A is IERC721A {
// Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
struct TokenApprovalRef {
address value;
}
// =============================================================
// CONSTANTS
// =============================================================
// Mask of an entry in packed address data.
uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;
// The bit position of `numberMinted` in packed address data.
uint256 private constant _BITPOS_NUMBER_MINTED = 64;
// The bit position of `numberBurned` in packed address data.
uint256 private constant _BITPOS_NUMBER_BURNED = 128;
// The bit position of `aux` in packed address data.
uint256 private constant _BITPOS_AUX = 192;
// Mask of all 256 bits in packed address data except the 64 bits for `aux`.
uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;
// The bit position of `startTimestamp` in packed ownership.
uint256 private constant _BITPOS_START_TIMESTAMP = 160;
// The bit mask of the `burned` bit in packed ownership.
uint256 private constant _BITMASK_BURNED = 1 << 224;
// The bit position of the `nextInitialized` bit in packed ownership.
uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;
// The bit mask of the `nextInitialized` bit in packed ownership.
uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;
// The bit position of `extraData` in packed ownership.
uint256 private constant _BITPOS_EXTRA_DATA = 232;
// Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;
// The mask of the lower 160 bits for addresses.
uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;
// The maximum `quantity` that can be minted with {_mintERC2309}.
// This limit is to prevent overflows on the address data entries.
// For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}
// is required to cause an overflow, which is unrealistic.
uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;
// The `Transfer` event signature is given by:
// `keccak256(bytes("Transfer(address,address,uint256)"))`.
bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;
// =============================================================
// STORAGE
// =============================================================
// The next token ID to be minted.
uint256 internal _currentIndex;
// The number of tokens burned.
uint256 private _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 {_packedOwnershipOf} implementation for details.
//
// Bits Layout:
// - [0..159] `addr`
// - [160..223] `startTimestamp`
// - [224] `burned`
// - [225] `nextInitialized`
// - [232..255] `extraData`
mapping(uint256 => uint256) private _packedOwnerships;
// Mapping owner address to address data.
//
// Bits Layout:
// - [0..63] `balance`
// - [64..127] `numberMinted`
// - [128..191] `numberBurned`
// - [192..255] `aux`
mapping(address => uint256) private _packedAddressData;
// Mapping from token ID to approved address.
mapping(uint256 => TokenApprovalRef) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) internal _operatorApprovals;
// =============================================================
// CONSTRUCTOR
// =============================================================
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
}
// =============================================================
// TOKEN COUNTING OPERATIONS
// =============================================================
/**
* @dev Returns the starting token ID.
* To change the starting token ID, please override this function.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 1;
}
/**
* @dev Returns the next token ID to be minted.
*/
function _nextTokenId() internal view virtual returns (uint256) {
return _currentIndex;
}
/**
* @dev Returns the total number of tokens in existence.
* Burned tokens will reduce the count.
* To get the total number of tokens minted, please see {_totalMinted}.
*/
function totalSupply() public view virtual override returns (uint256) {
// Counter underflow is impossible as _burnCounter cannot be incremented
// more than `_currentIndex - _startTokenId()` times.
unchecked {
return _currentIndex - _burnCounter - _startTokenId();
}
}
/**
* @dev Returns the total amount of tokens minted in the contract.
*/
function _totalMinted() internal view virtual returns (uint256) {
// Counter underflow is impossible as `_currentIndex` does not decrement,
// and it is initialized to `_startTokenId()`.
unchecked {
return _currentIndex - _startTokenId();
}
}
/**
* @dev Returns the total number of tokens burned.
*/
function _totalBurned() internal view virtual returns (uint256) {
return _burnCounter;
}
// =============================================================
// ADDRESS DATA OPERATIONS
// =============================================================
/**
* @dev Returns the number of tokens in `owner`'s account.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens minted by `owner`.
*/
function _numberMinted(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens burned by or on behalf of `owner`.
*/
function _numberBurned(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
*/
function _getAux(address owner) internal view returns (uint64) {
return uint64(_packedAddressData[owner] >> _BITPOS_AUX);
}
/**
* Sets the auxiliary 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 virtual {
uint256 packed = _packedAddressData[owner];
uint256 auxCasted;
// Cast `aux` with assembly to avoid redundant masking.
assembly {
auxCasted := aux
}
packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);
_packedAddressData[owner] = packed;
}
// =============================================================
// IERC165
// =============================================================
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30000 gas.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
// The interface IDs are constants representing the first 4 bytes
// of the XOR of all function selectors in the interface.
// See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)
// (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)
return
interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
}
// =============================================================
// IERC721Metadata
// =============================================================
/**
* @dev Returns the token collection name.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the token collection symbol.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
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, _toString(tokenId))) : '';
}
/**
* @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, it can be overridden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return '';
}
// =============================================================
// OWNERSHIPS OPERATIONS
// =============================================================
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
return address(uint160(_packedOwnershipOf(tokenId)));
}
/**
* @dev Gas spent here starts off proportional to the maximum mint batch size.
* It gradually moves to O(1) as tokens get transferred around over time.
*/
function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnershipOf(tokenId));
}
/**
* @dev Returns the unpacked `TokenOwnership` struct at `index`.
*/
function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnerships[index]);
}
/**
* @dev Initializes the ownership slot minted at `index` for efficiency purposes.
*/
function _initializeOwnershipAt(uint256 index) internal virtual {
if (_packedOwnerships[index] == 0) {
_packedOwnerships[index] = _packedOwnershipOf(index);
}
}
/**
* Returns the packed ownership data of `tokenId`.
*/
function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) {
if (_startTokenId() <= tokenId) {
packed = _packedOwnerships[tokenId];
// If not burned.
if (packed & _BITMASK_BURNED == 0) {
// If the data at the starting slot does not exist, start the scan.
if (packed == 0) {
if (tokenId >= _currentIndex) revert OwnerQueryForNonexistentToken();
// Invariant:
// There will always be an initialized ownership slot
// (i.e. `ownership.addr != address(0) && ownership.burned == false`)
// before an unintialized ownership slot
// (i.e. `ownership.addr == address(0) && ownership.burned == false`)
// Hence, `tokenId` will not underflow.
//
// We can directly compare the packed value.
// If the address is zero, packed will be zero.
for (;;) {
unchecked {
packed = _packedOwnerships[--tokenId];
}
if (packed == 0) continue;
return packed;
}
}
// Otherwise, the data exists and is not burned. We can skip the scan.
// This is possible because we have already achieved the target condition.
// This saves 2143 gas on transfers of initialized tokens.
return packed;
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* @dev Returns the unpacked `TokenOwnership` struct from `packed`.
*/
function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
ownership.addr = address(uint160(packed));
ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);
ownership.burned = packed & _BITMASK_BURNED != 0;
ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);
}
/**
* @dev Packs ownership data into a single uint256.
*/
function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
assembly {
// Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
owner := and(owner, _BITMASK_ADDRESS)
// `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
}
}
/**
* @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
*/
function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
// For branchless setting of the `nextInitialized` flag.
assembly {
// `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
}
}
// =============================================================
// APPROVAL OPERATIONS
// =============================================================
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account. See {ERC721A-_approve}.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
*/
function approve(address to, uint256 tokenId) public payable virtual override {
_approve(to, tokenId, true);
}
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId].value;
}
/**
* @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) public virtual override {
_operatorApprovals[_msgSenderERC721A()][operator] = approved;
emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
}
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @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. See {_mint}.
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return
_startTokenId() <= tokenId &&
tokenId < _currentIndex && // If within bounds,
_packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.
}
/**
* @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.
*/
function _isSenderApprovedOrOwner(
address approvedAddress,
address owner,
address msgSender
) private pure returns (bool result) {
assembly {
// Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
owner := and(owner, _BITMASK_ADDRESS)
// Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
msgSender := and(msgSender, _BITMASK_ADDRESS)
// `msgSender == owner || msgSender == approvedAddress`.
result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))
}
}
/**
* @dev Returns the storage slot and value for the approved address of `tokenId`.
*/
function _getApprovedSlotAndAddress(uint256 tokenId)
private
view
returns (uint256 approvedAddressSlot, address approvedAddress)
{
TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];
// The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.
assembly {
approvedAddressSlot := tokenApproval.slot
approvedAddress := sload(approvedAddressSlot)
}
}
// =============================================================
// TRANSFER OPERATIONS
// =============================================================
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* 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
) public payable virtual override {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
if (to == address(0)) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// 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 {
// We can directly increment and decrement the balances.
--_packedAddressData[from]; // Updates: `balance -= 1`.
++_packedAddressData[to]; // Updates: `balance += 1`.
// Updates:
// - `address` to the next owner.
// - `startTimestamp` to the timestamp of transfering.
// - `burned` to `false`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] = _packOwnershipData(
to,
_BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)
);
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != _currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public payable virtual override {
safeTransferFrom(from, to, tokenId, '');
}
/**
* @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 memory _data
) public payable virtual override {
transferFrom(from, to, tokenId);
if (to.code.length != 0)
if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
/**
* @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 {}
/**
* @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
*
* `from` - Previous owner of the given token ID.
* `to` - Target address that will receive the token.
* `tokenId` - Token ID to be transferred.
* `_data` - Optional data to send along with the call.
*
* Returns whether the call correctly returned the expected magic value.
*/
function _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (
bytes4 retval
) {
return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
// =============================================================
// MINT OPERATIONS
// =============================================================
/**
* @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 for each mint.
*/
function _mint(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// `balance` and `numberMinted` have a maximum limit of 2**64.
// `tokenId` has a maximum limit of 2**256.
unchecked {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
_packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[startTokenId] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
uint256 toMasked;
uint256 end = startTokenId + quantity;
// Use assembly to loop and emit the `Transfer` event for gas savings.
// The duplicated `log4` removes an extra check and reduces stack juggling.
// The assembly, together with the surrounding Solidity code, have been
// delicately arranged to nudge the compiler into producing optimized opcodes.
assembly {
// Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
toMasked := and(to, _BITMASK_ADDRESS)
// Emit the `Transfer` event.
log4(
0, // Start of data (0, since no data).
0, // End of data (0, since no data).
_TRANSFER_EVENT_SIGNATURE, // Signature.
0, // `address(0)`.
toMasked, // `to`.
startTokenId // `tokenId`.
)
// The `iszero(eq(,))` check ensures that large values of `quantity`
// that overflows uint256 will make the loop run out of gas.
// The compiler will optimize the `iszero` away for performance.
for {
let tokenId := add(startTokenId, 1)
} iszero(eq(tokenId, end)) {
tokenId := add(tokenId, 1)
} {
// Emit the `Transfer` event. Similar to above.
log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
}
}
if (toMasked == 0) revert MintToZeroAddress();
_currentIndex = end;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* This function is intended for efficient minting only during contract creation.
*
* It emits only one {ConsecutiveTransfer} as defined in
* [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
* instead of a sequence of {Transfer} event(s).
*
* Calling this function outside of contract creation WILL make your contract
* non-compliant with the ERC721 standard.
* For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
* {ConsecutiveTransfer} event is only permissible during contract creation.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {ConsecutiveTransfer} event.
*/
function _mintERC2309(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are unrealistic due to the above check for `quantity` to be below the limit.
unchecked {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
_packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[startTokenId] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);
_currentIndex = startTokenId + quantity;
}
_afterTokenTransfers(address(0), to, startTokenId, 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.
*
* See {_mint}.
*
* Emits a {Transfer} event for each mint.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal virtual {
_mint(to, quantity);
unchecked {
if (to.code.length != 0) {
uint256 end = _currentIndex;
uint256 index = end - quantity;
do {
if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
} while (index < end);
// Reentrancy protection.
if (_currentIndex != end) revert();
}
}
}
/**
* @dev Equivalent to `_safeMint(to, quantity, '')`.
*/
function _safeMint(address to, uint256 quantity) internal virtual {
_safeMint(to, quantity, '');
}
// =============================================================
// APPROVAL OPERATIONS
// =============================================================
/**
* @dev Equivalent to `_approve(to, tokenId, false)`.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_approve(to, tokenId, false);
}
/**
* @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:
*
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function _approve(
address to,
uint256 tokenId,
bool approvalCheck
) internal virtual {
address owner = ownerOf(tokenId);
if (approvalCheck)
if (_msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_tokenApprovals[tokenId].value = to;
emit Approval(owner, to, tokenId);
}
// =============================================================
// BURN OPERATIONS
// =============================================================
/**
* @dev 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 {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
address from = address(uint160(prevOwnershipPacked));
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
if (approvalCheck) {
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
}
_beforeTokenTransfers(from, address(0), tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// 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 {
// Updates:
// - `balance -= 1`.
// - `numberBurned += 1`.
//
// We can directly decrement the balance, and increment the number burned.
// This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.
_packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;
// Updates:
// - `address` to the last owner.
// - `startTimestamp` to the timestamp of burning.
// - `burned` to `true`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] = _packOwnershipData(
from,
(_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)
);
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != _currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
emit Transfer(from, address(0), tokenId);
_afterTokenTransfers(from, address(0), tokenId, 1);
// Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
unchecked {
_burnCounter++;
}
}
// =============================================================
// EXTRA DATA OPERATIONS
// =============================================================
/**
* @dev Directly sets the extra data for the ownership data `index`.
*/
function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {
uint256 packed = _packedOwnerships[index];
if (packed == 0) revert OwnershipNotInitializedForExtraData();
uint256 extraDataCasted;
// Cast `extraData` with assembly to avoid redundant masking.
assembly {
extraDataCasted := extraData
}
packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);
_packedOwnerships[index] = packed;
}
/**
* @dev Called during each token transfer to set the 24bit `extraData` field.
* Intended to be overridden by the cosumer contract.
*
* `previousExtraData` - the value of `extraData` before transfer.
*
* 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 _extraData(
address from,
address to,
uint24 previousExtraData
) internal view virtual returns (uint24) {}
/**
* @dev Returns the next extra data for the packed ownership data.
* The...
// [truncated — 97942 bytes total]
Read Contract
OPERATOR_FILTER_REGISTRY 0x41f43434 → address
_allowAddress 0x521b52a4 → bool
_leaf 0xb61d0c63 → bytes32
balanceOf 0x70a08231 → uint256
baseURI 0x6c0360eb → string
getApproved 0x081812fc → address
getAuthor 0x9e2b8488 → address
getCreator 0xd48e638a → address
getIsTransferAllowed 0x057c2c6a → bool
getLocked 0x3b035df6 → bool
getMaxSupply 0x4c0f38c2 → uint256
getPrice 0x98d5fdca → uint256
getRootHash 0x093abc86 → bytes32
getRoyaltyFee 0x9e4c0141 → uint256
getSaleDetails 0x8c746d8b → uint256, uint256
getUserBoughtCount 0x57a9d3bc → uint256
isApprovedForAll 0xe985e9c5 → bool
isTransferAllowed 0x8822048e → bool
isWhitelisted 0x74f32b3e → bool
mintedPerRarity 0xf854c898 → uint256
name 0x06fdde03 → string
nftLock 0x495d8151 → bool
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
status 0x200d2ed2 → uint256
supplyPerRarity 0x038bddfa → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenRarity 0xafb0a369 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
Write Contract 30 functions
These functions modify contract state and require a wallet transaction to execute.
addAllowAddress 0x69ff1a81
address _add
adminTransfer 0xf17e48ec
address to
uint256 tokenId
approve 0x095ea7b3
address operator
uint256 tokenId
burnAdmin 0xe02f8e1f
uint256 tokenId
buyDeemoNFT 0x666c00aa
bytes32[] proof
uint256 limit
bool isLimit
uint256 whiteListType
claimDeemoNFT 0x118aa48b
No parameters
craftDeemo 0x8101090d
uint256[] tokenIds
lockNFTBulk 0xbc8d4cd6
uint256[] tokenIds
bool status
mint 0x40c10f19
address to_
uint256 countNFTs_
returns: uint256, uint256
preOrderDeemoNFT 0x8f868a16
bytes32[] proof
uint256 limit
removeAllowAddress 0x126fe62d
address _add
renounceOwnership 0x715018a6
No parameters
resetReserveSupply 0xd1f8e773
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
setAuthor 0xa05f41a4
address _add
setBaseURI 0x55f804b3
string baseURI_
setMaxSupply 0x6f8b44b0
uint256 supply
setPrice 0x91b7f5ed
uint256 price
setRoyalty 0x4209a2e1
uint256 _amount
setSaleDetails 0xb481630d
uint256 _startTime
uint256 _endTime
uint256 whitelistType
setSeed 0xc32a50f9
uint256 _seed
setStatus 0x69ba1a75
uint256 _status
setSupply 0xfc784d49
uint256 rarity
uint256 supply
setTransferAllowed 0xa8b80428
address _add
bool status
setWhitelistRoot 0x31a365de
bytes32 _root
uint256 whitelistType
bool isReserve
setlockStatusNFT 0x23922f86
uint256 tokenId
bool status
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address