Address Contract Verified
Address
0xF2aECeE06841F0Cc984aB8d7dE5B1e9106890FDC
Balance
0 ETH
Nonce
1
Code Size
17379 bytes
Creator
0xBEA75e45...2bc6 at tx 0xc27fdbbd...a9e20d
Indexed Transactions
0
Contract Bytecode
17379 bytes
0x6080604052600436106102245760003560e01c806386ee745d11610123578063afb82916116100ab578063e71503221161006f578063e715032214610709578063e8a3d48514610729578063e9703d251461073e578063e985e9c5146107e9578063f242432a1461082457600080fd5b8063afb8291614610651578063b24f2d3914610671578063bd85b0391461069c578063ce805642146106c9578063d37c353b146106e957600080fd5b80639bcf7a15116100f25780639bcf7a15146105a45780639fc4d68f146105c4578063a05112fc146105e4578063a22cb46514610604578063ac9650d81461062457600080fd5b806386ee745d1461051c5780638da5cb5b14610551578063938e3d7b1461056f57806395d89b411461058f57600080fd5b80632eb2c2d6116101b15780634e1273f4116101755780634e1273f414610463578063600dd5ea1461049057806363b45e2d146104b05780636f4f2837146104c55780637cb351f6146104e557600080fd5b80632eb2c2d6146103ac57806332df1279146103cc5780633b1475a7146103ec578063492e224b146104015780634cc157df1461042157600080fd5b80630e89341c116101f85780630e89341c146102f857806313af4035146103185780632419f51b1461033a57806327db5f081461035a5780632a55205a1461036d57600080fd5b8062fdd58e1461022957806301ffc9a71461027457806306fdde03146102a4578063079fe40e146102c6575b600080fd5b34801561023557600080fd5b506102616102443660046133da565b600260209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b34801561028057600080fd5b5061029461028f36600461341a565b610844565b604051901515815260200161026b565b3480156102b057600080fd5b506102b96108b1565b60405161026b919061348f565b3480156102d257600080fd5b50600b546001600160a01b03165b6040516001600160a01b03909116815260200161026b565b34801561030457600080fd5b506102b96103133660046134a2565b61093f565b34801561032457600080fd5b506103386103333660046134bb565b6109ae565b005b34801561034657600080fd5b506102616103553660046134a2565b6109e7565b6103386103683660046135bd565b610a55565b34801561037957600080fd5b5061038d61038836600461365e565b610c67565b604080516001600160a01b03909316835260208301919091520161026b565b3480156103b857600080fd5b506103386103c7366004613714565b610ca4565b3480156103d857600080fd5b506103386103e73660046137cb565b610d33565b3480156103f857600080fd5b50600c54610261565b34801561040d57600080fd5b5061029461041c3660046134a2565b610f95565b34801561042d57600080fd5b5061044161043c3660046134a2565b610fbb565b604080516001600160a01b03909316835261ffff90911660208301520161026b565b34801561046f57600080fd5b5061048361047e36600461381a565b611026565b60405161026b919061391f565b34801561049c57600080fd5b506103386104ab3660046133da565b61115c565b3480156104bc57600080fd5b50600954610261565b3480156104d157600080fd5b506103386104e03660046134bb565b61118e565b3480156104f157600080fd5b50610505610500366004613932565b6111bb565b60408051921515835260208301919091520161026b565b34801561052857600080fd5b5061053c610537366004613992565b6113d3565b6040805192835260208301919091520161026b565b34801561055d57600080fd5b506006546001600160a01b03166102e0565b34801561057b57600080fd5b5061033861058a3660046139be565b611425565b34801561059b57600080fd5b506102b9611452565b3480156105b057600080fd5b506103386105bf366004613a06565b61145f565b3480156105d057600080fd5b506102b96105df366004613a7c565b611493565b3480156105f057600080fd5b506102b96105ff3660046134a2565b611614565b34801561061057600080fd5b5061033861061f366004613ac7565b61162d565b34801561063057600080fd5b5061064461063f366004613afe565b6116e6565b60405161026b9190613b72565b34801561065d57600080fd5b5061033861066c366004613bd4565b6117da565b34801561067d57600080fd5b506007546001600160a01b03811690600160a01b900461ffff16610441565b3480156106a857600080fd5b506102616106b73660046134a2565b60126020526000908152604090205481565b3480156106d557600080fd5b506102b96106e4366004613a7c565b6119d7565b3480156106f557600080fd5b50610261610704366004613c37565b611a7a565b34801561071557600080fd5b506102b9610724366004613cb0565b611b12565b34801561073557600080fd5b506102b9611b87565b34801561074a57600080fd5b506107a56107593660046134a2565b600e60205260009081526040902080546001820154600283015460038401546004850154600586015460068701546007909701549596949593949293919290916001600160a01b031688565b604080519889526020890197909752958701949094526060860192909252608085015260a084015260c08301526001600160a01b031660e08201526101000161026b565b3480156107f557600080fd5b50610294610804366004613d0b565b600360209081526000928352604080842090915290825290205460ff1681565b34801561083057600080fd5b5061033861083f366004613d35565b611b94565b60006301ffc9a760e01b6001600160e01b0319831614806108755750636cdb3d1360e11b6001600160e01b03198316145b8061089057506303a24d0760e21b6001600160e01b03198316145b806108ab57506001600160e01b0319821663152a902d60e11b145b92915050565b600080546108be90613d99565b80601f01602080910402602001604051908101604052809291908181526020018280546108ea90613d99565b80156109375780601f1061090c57610100808354040283529160200191610937565b820191906000526020600020905b81548152906001019060200180831161091a57829003601f168201915b505050505081565b6060600061094c83611c1c565b509050600061095a84611d21565b905061096582610f95565b15610993578060405160200161097b9190613dce565b60405160208183030381529060405292505050919050565b8061099d85611e82565b60405160200161097b929190613df3565b6109b6611f87565b6109db5760405162461bcd60e51b81526004016109d290613e22565b60405180910390fd5b6109e481611fb4565b50565b60006109f260095490565b8210610a305760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b60448201526064016109d2565b60098281548110610a4357610a43613e4a565b90600052602060002001549050919050565b610a6486888787878787612006565b6000868152600e60209081526040808320815161010081018352815481526001820154818501526002820154818401526003820154606082015260048201546080820152600582015460a0820152600682015460c08201526007909101546001600160a01b031660e0820152898452600f909252822054909180610aea8a338b896111bb565b915091506000866020013560001480610b05575060a0850151155b9050610b158b338c8c8c866117da565b828015610b26575060008760200135115b15610b55576000848152601160209081526040808320600886901c845290915290208054600160ff85161b1790555b8985604001818151610b679190613e76565b905250600084815260106020908152604080832033845282528083204290558d8352600e8252808320885181559188015160018301558701516002820155606087015160038201556080870151600482015560a0870151600582015560c0870151600682015560e0870151600790910180546001600160a01b0319166001600160a01b03909216919091179055610c00908b8b8b612095565b610c0b8c8c8c612155565b8a6001600160a01b038d16336001600160a01b03167fff097c7d8b1957a4ff09ef1361b5fb54dcede3941ba836d0beb9d10bec725de68d604051610c5191815260200190565b60405180910390a4505050505050505050505050565b600080600080610c7686610fbb565b90945084925061ffff169050612710610c8f8287613e8e565b610c999190613ec3565b925050509250929050565b6001600160a01b038516331480610cde57506001600160a01b038516600090815260036020908152604080832033845290915290205460ff165b610d1f5760405162461bcd60e51b81526020600482015260126024820152710853d5d3915497d3d497d054141493d5915160721b60448201526064016109d2565b610d2c8585858585612170565b5050505050565b610d3b611f87565b610d575760405162461bcd60e51b81526004016109d290613e22565b6000838152600e602090815260408083208151610100810183528154815260018201548185015260028201548184019081526003830154606083015260048301546080830152600583015460a0830152600683015460c08301526007909201546001600160a01b031660e0820152878552600f90935292205491519091908315610e1e575060003360405160609190911b6bffffffffffffffffffffffff191660208201524360348201526054016040516020818303038152906040528051906020012091505b8460200135811115610e675760405162461bcd60e51b81526020600482015260126024820152711b585e081cdd5c1c1b1e4818db185a5b595960721b60448201526064016109d2565b6000604051806101000160405280876000013581526020018760200135815260200183815260200187606001358152602001876080013581526020018760a0013581526020018760c0013581526020018760e0016020810190610eca91906134bb565b6001600160a01b039081169091526000898152600e6020908152604080832085518155858301516001820155858201516002820155606086015160038201556080860151600482015560a0860151600582015560c0860151600682015560e0860151600790910180546001600160a01b0319169190951617909355600f90528190208590555190915087907f108e373025a2f7dad2e968ca6ce56d87eab1a9c17dc49817fee9e3da0dc9f8a190610f849089908990613ed7565b60405180910390a250505050505050565b6000818152600d602052604081208054829190610fb190613d99565b9050119050919050565b6000818152600860209081526040808320815180830190925280546001600160a01b031680835260019091015492820192909252829115611002578051602082015161101c565b6007546001600160a01b03811690600160a01b900461ffff165b9250925050915091565b6060815183511461106b5760405162461bcd60e51b815260206004820152600f60248201526e0988a9c8ea890be9a92a69a82a8869608b1b60448201526064016109d2565b600083516001600160401b03811115611086576110866134ee565b6040519080825280602002602001820160405280156110af578160200160208202803683370190505b50905060005b845181101561115457600260008683815181106110d4576110d4613e4a565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600085838151811061111057611110613e4a565b602002602001015181526020019081526020016000205482828151811061113957611139613e4a565b602090810291909101015261114d81613f45565b90506110b5565b509392505050565b611164611f87565b6111805760405162461bcd60e51b81526004016109d290613e22565b61118a8282612368565b5050565b611196611f87565b6111b25760405162461bcd60e51b81526004016109d290613e22565b6109e48161240e565b6000848152600e60209081526040808320815161010081018352815481526001820154938101939093526002810154918301919091526003810154606083015260048101546080830152600581015460a08301819052600682015460c08401526007909101546001600160a01b031660e0830152829190156113c9576112c06112448580613f60565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050505060a08301516040516bffffffffffffffffffffffff1960608b901b16602080830191909152880135603482015260540160405160208183030381529060405280519060200120612458565b9093509150826113055760405162461bcd60e51b815260206004820152601060248201526f1b9bdd081a5b88185b1b1bdddb1a5cdd60821b60448201526064016109d2565b6000878152600f6020908152604080832054835260118252808320600886901c8452909152902054600160ff84161b16156113725760405162461bcd60e51b815260206004820152600d60248201526c1c1c9bdbd98818db185a5b5959609a1b60448201526064016109d2565b6020840135158015906113885750836020013585115b156113c95760405162461bcd60e51b815260206004820152601160248201527024b73b30b634b21038ba3c90383937b7b360791b60448201526064016109d2565b5094509492505050565b6000828152600f60209081526040808320548352601082528083206001600160a01b0385168452825280832054858452600e9092529091206004015481018181101561141e57506000195b9250929050565b61142d611f87565b6114495760405162461bcd60e51b81526004016109d290613e22565b6109e481612526565b600180546108be90613d99565b611467611f87565b6114835760405162461bcd60e51b81526004016109d290613e22565b61148e838383612608565b505050565b6000838152600d60205260408120805460609291906114b190613d99565b80601f01602080910402602001604051908101604052809291908181526020018280546114dd90613d99565b801561152a5780601f106114ff5761010080835404028352916020019161152a565b820191906000526020600020905b81548152906001019060200180831161150d57829003601f168201915b505050505090508051600014156115775760405162461bcd60e51b8152602060048201526011602482015270139bdd1a1a5b99c81d1bc81c995d99585b607a1b60448201526064016109d2565b6000808280602001905181019061158e9190613fa9565b9150915061159d828787611b12565b935080848787466040516020016115b79493929190614034565b604051602081830303815290604052805190602001201461160a5760405162461bcd60e51b815260206004820152600d60248201526c496e636f7272656374206b657960981b60448201526064016109d2565b5050509392505050565b600d60205260009081526040902080546108be90613d99565b336001600160a01b0383168114156116785760405162461bcd60e51b815260206004820152600e60248201526d20a8282927ab24a723afa9a2a62360911b60448201526064016109d2565b6001600160a01b03818116600081815260036020908152604080832094881680845294825291829020805460ff191687151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3191015b60405180910390a3505050565b6060816001600160401b03811115611700576117006134ee565b60405190808252806020026020018201604052801561173357816020015b606081526020019060019003908161171e5790505b50905060005b828110156117d3576117a33085858481811061175757611757613e4a565b9050602002810190611769919061405d565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506126c992505050565b8282815181106117b5576117b5613e4a565b602002602001018190525080806117cb90613f45565b915050611739565b5092915050565b6000868152600e6020908152604091829020825161010081018452815481526001820154928101929092526002810154928201929092526003820154606082015260048201546080820152600582015460a0820152600682015460c08201526007909101546001600160a01b0390811660e0830181905290851614158061186557508060c001518314155b156118b25760405162461bcd60e51b815260206004820152601960248201527f496e76616c6964207072696365206f722063757272656e63790000000000000060448201526064016109d2565b8415806118ca57508180156118ca5750806060015185115b1561190a5760405162461bcd60e51b815260206004820152601060248201526f496e76616c6964207175616e7469747960801b60448201526064016109d2565b806020015185826040015161191f9190613e76565b11156119625760405162461bcd60e51b815260206004820152601260248201527165786365656473206d617820737570706c7960701b60448201526064016109d2565b60008061196f89896113d3565b91509150428360000151118061198e5750811580159061198e57508042105b156119cc5760405162461bcd60e51b815260206004820152600e60248201526d18d85b9d0818db185a5b481e595d60921b60448201526064016109d2565b505050505050505050565b60606119e1611f87565b6119fd5760405162461bcd60e51b81526004016109d290613e22565b6000611a08856109e7565b9050611a15818585611493565b9150611a3081604051806020016040528060008152506126f5565b611a3a8183612714565b847f6df1d8db2a036436ffe0b2d1833f2c5f1e624818dfce2578c0faa4b83ef9998d83604051611a6a919061348f565b60405180910390a2509392505050565b60008115611afb57600080611a91848601866140a3565b915091508151600014158015611aa657508015155b15611af857611af888600c54611abc9190613e76565b86868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506126f592505050565b50505b611b088686868686612733565b9695505050505050565b8251604080518083016020019091528181529060005b81811015611b7e576000858583604051602001611b47939291906140e7565b60408051601f19818403018152919052805160209182012088840182015118858401820152611b77915082613e76565b9050611b28565b50509392505050565b600580546108be90613d99565b6001600160a01b038516331480611bce57506001600160a01b038516600090815260036020908152604080832033845290915290205460ff165b611c0f5760405162461bcd60e51b81526020600482015260126024820152710853d5d3915497d3d497d054141493d5915160721b60448201526064016109d2565b610d2c8585858585612848565b6000806000611c2a60095490565b905060006009805480602002602001604051908101604052809291908181526020018280548015611c7a57602002820191906000526020600020905b815481526020019060010190808311611c66575b5050505050905060005b82811015611ce657818181518110611c9e57611c9e613e4a565b6020026020010151861015611cd457809350818181518110611cc257611cc2613e4a565b60200260200101519450505050915091565b611cdf600182613e76565b9050611c84565b5060405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a59081d1bdad95b9259608a1b60448201526064016109d2565b60606000611d2e60095490565b905060006009805480602002602001604051908101604052809291908181526020018280548015611d7e57602002820191906000526020600020905b815481526020019060010190808311611d6a575b5050505050905060005b82811015611ce657818181518110611da257611da2613e4a565b6020026020010151851015611e7057600a6000838381518110611dc757611dc7613e4a565b602002602001015181526020019081526020016000208054611de890613d99565b80601f0160208091040260200160405190810160405280929190818152602001828054611e1490613d99565b8015611e615780601f10611e3657610100808354040283529160200191611e61565b820191906000526020600020905b815481529060010190602001808311611e4457829003601f168201915b50505050509350505050919050565b611e7b600182613e76565b9050611d88565b606081611ea65750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611ed05780611eba81613f45565b9150611ec99050600a83613ec3565b9150611eaa565b6000816001600160401b03811115611eea57611eea6134ee565b6040519080825280601f01601f191660200182016040528015611f14576020820181803683370190505b5090505b8415611f7f57611f296001836140f9565b9150611f36600a86614110565b611f41906030613e76565b60f81b818381518110611f5657611f56613e4a565b60200101906001600160f81b031916908160001a905350611f78600a86613ec3565b9450611f18565b949350505050565b6000611f9b6006546001600160a01b031690565b6001600160a01b0316336001600160a01b031614905090565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d7690600090a35050565b33321461203b5760405162461bcd60e51b81526020600482015260036024820152621093d560ea1b60448201526064016109d2565b600c54871061208c5760405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f756768206d696e74656420746f6b656e73000000000000000060448201526064016109d2565b50505050505050565b8061209f5761214f565b60006120ab8285613e8e565b90506001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561211a5780341461211a5760405162461bcd60e51b815260206004820152601660248201527526bab9ba1039b2b732103a37ba30b610383934b1b29760511b60448201526064016109d2565b60006001600160a01b03861615612131578561213e565b600b546001600160a01b03165b905061214c843383856129a0565b50505b50505050565b61148e838383604051806020016040528060008152506129ea565b81518351146121b35760405162461bcd60e51b815260206004820152600f60248201526e0988a9c8ea890be9a92a69a82a8869608b1b60448201526064016109d2565b6001600160a01b0384166121d95760405162461bcd60e51b81526004016109d290614124565b336121e8818787878787612ab4565b60005b845181101561230257600085828151811061220857612208613e4a565b60200260200101519050600085838151811061222657612226613e4a565b6020908102919091018101516001600160a01b038b16600090815260028352604080822086835290935291909120549091508181101561229b5760405162461bcd60e51b815260206004820152601060248201526f125394d551919250d251539517d0905360821b60448201526064016109d2565b6001600160a01b03808b16600090815260026020818152604080842088855282528084208787039055938d168352908152828220868352905290812080548492906122e7908490613e76565b92505081905550505050806122fb90613f45565b90506121eb565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb878760405161235292919061414a565b60405180910390a461214c818787878787612bce565b6127108111156123ac5760405162461bcd60e51b815260206004820152600f60248201526e45786365656473206d61782062707360881b60448201526064016109d2565b600780546001600160a01b0384166001600160b01b03199091168117600160a01b61ffff851602179091556040518281527f90d7ec04bcb8978719414f82e52e4cb651db41d0e6f8cea6118c2191e6183adb9060200160405180910390a25050565b600b80546001600160a01b0319166001600160a01b0383169081179091556040517f299d17e95023f496e0ffc4909cff1a61f74bb5eb18de6f900f4155bfa1b3b33390600090a250565b6000808281805b875181101561251a57612473600283613e8e565b9150600088828151811061248957612489613e4a565b602002602001015190508084116124cb576040805160208101869052908101829052606001604051602081830303815290604052805190602001209350612507565b60408051602081018390529081018590526060016040516020818303038152906040528051906020012093506001836125049190613e76565b92505b508061251281613f45565b91505061245f565b50941495939450505050565b60006005805461253590613d99565b80601f016020809104026020016040519081016040528092919081815260200182805461256190613d99565b80156125ae5780601f10612583576101008083540402835291602001916125ae565b820191906000526020600020905b81548152906001019060200180831161259157829003601f168201915b505085519394506125ca93600593506020870192509050613325565b507fc9c7c3fe08b88b4df9d4d47ef47d2c43d55c025a0ba88ca442580ed9e7348a1681836040516125fc929190614178565b60405180910390a15050565b61271081111561264c5760405162461bcd60e51b815260206004820152600f60248201526e45786365656473206d61782062707360881b60448201526064016109d2565b6040805180820182526001600160a01b038481168083526020808401868152600089815260088352869020945185546001600160a01b031916941693909317845591516001909301929092559151838152909185917f7365cf4122f072a3365c20d54eff9b38d73c096c28e1892ec8f5b0e403a0f12d91016116d9565b60606126ee838360405180606001604052806027815260200161438760279139612d31565b9392505050565b6000828152600d60209081526040909120825161148e92840190613325565b6000828152600a60209081526040909120825161148e92840190613325565b600061273d611f87565b6127595760405162461bcd60e51b81526004016109d290613e22565b856127995760405162461bcd60e51b815260206004820152601060248201526f4d696e74696e67203020746f6b656e7360801b60448201526064016109d2565b6000600c5490506127e1818888888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612e0492505050565b600c919091559150807f2a0365091ef1a40953c670dce28177e37520648a6fdc91506bffac0ab045570d60016128178a84613e76565b61282191906140f9565b888888886040516128369594939291906141c6565b60405180910390a25095945050505050565b6001600160a01b03841661286e5760405162461bcd60e51b81526004016109d290614124565b3361288d81878761287e88612e71565b61288788612e71565b87612ab4565b6001600160a01b0386166000908152600260209081526040808320878452909152902054838110156128f45760405162461bcd60e51b815260206004820152601060248201526f125394d551919250d251539517d0905360821b60448201526064016109d2565b6001600160a01b0380881660009081526002602081815260408084208a855282528084208987039055938a16835290815282822088835290529081208054869290612940908490613e76565b909155505060408051868152602081018690526001600160a01b03808916928a821692918616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461208c828888888888612ebc565b806129aa5761214f565b6001600160a01b03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156129de576129d98282612fa8565b61214f565b61214f8484848461304b565b6001600160a01b038416612a105760405162461bcd60e51b81526004016109d290614124565b33612a218160008761287e88612e71565b6001600160a01b038516600090815260026020908152604080832087845290915281208054859290612a54908490613e76565b909155505060408051858152602081018590526001600160a01b0380881692600092918516917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4610d2c81600087878787612ebc565b612ac286868686868661214c565b6001600160a01b038516612b495760005b8351811015612b4757828181518110612aee57612aee613e4a565b602002602001015160126000868481518110612b0c57612b0c613e4a565b602002602001015181526020019081526020016000206000828254612b319190613e76565b90915550612b40905081613f45565b9050612ad3565b505b6001600160a01b03841661214c5760005b835181101561208c57828181518110612b7557612b75613e4a565b602002602001015160126000868481518110612b9357612b93613e4a565b602002602001015181526020019081526020016000206000828254612bb891906140f9565b90915550612bc7905081613f45565b9050612b5a565b6001600160a01b0384163b1561214c5760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190612c1290899089908890889088906004016141ff565b602060405180830381600087803b158015612c2c57600080fd5b505af1925050508015612c5c575060408051601f3d908101601f19168201909252612c5991810190614251565b60015b612cdf57612c6861426e565b806308c379a01415612ca25750612c7d61428a565b80612c885750612ca4565b8060405162461bcd60e51b81526004016109d2919061348f565b505b60405162461bcd60e51b815260206004820152601060248201526f10a2a92198989a9aa922a1a2a4ab22a960811b60448201526064016109d2565b6001600160e01b0319811663bc197c8160e01b1461208c5760405162461bcd60e51b815260206004820152600f60248201526e1513d2d15394d7d491529150d51151608a1b60448201526064016109d2565b60606001600160a01b0384163b612d995760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016109d2565b600080856001600160a01b031685604051612db49190614313565b600060405180830381855af49150503d8060008114612def576040519150601f19603f3d011682016040523d82523d6000602084013e612df4565b606091505b5091509150611b088282866130a4565b600080612e118486613e76565b60098054600181019091557f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018190556000818152600a602090815260409091208551929450849350612e68929091860190613325565b50935093915050565b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110612eab57612eab613e4a565b602090810291909101015292915050565b6001600160a01b0384163b1561214c5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190612f00908990899088908890889060040161432f565b602060405180830381600087803b158015612f1a57600080fd5b505af1925050508015612f4a575060408051601f3d908101601f19168201909252612f4791810190614251565b60015b612f5657612c6861426e565b6001600160e01b0319811663f23a6e6160e01b1461208c5760405162461bcd60e51b815260206004820152600f60248201526e1513d2d15394d7d491529150d51151608a1b60448201526064016109d2565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612ff5576040519150601f19603f3d011682016040523d82523d6000602084013e612ffa565b606091505b505090508061148e5760405162461bcd60e51b815260206004820152601c60248201527f6e617469766520746f6b656e207472616e73666572206661696c65640000000060448201526064016109d2565b816001600160a01b0316836001600160a01b0316141561306a5761214f565b6001600160a01b03831630141561308f576129d96001600160a01b03851683836130dd565b61214f6001600160a01b038516848484613140565b606083156130b35750816126ee565b8251156130c35782518084602001fd5b8160405162461bcd60e51b81526004016109d2919061348f565b6040516001600160a01b03831660248201526044810182905261148e90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613178565b6040516001600160a01b038085166024830152831660448201526064810182905261214f9085906323b872dd60e01b90608401613109565b60006131cd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661324a9092919063ffffffff16565b80519091501561148e57808060200190518101906131eb9190614369565b61148e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109d2565b6060611f7f8484600085856001600160a01b0385163b6132ac5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109d2565b600080866001600160a01b031685876040516132c89190614313565b60006040518083038185875af1925050503d8060008114613305576040519150601f19603f3d011682016040523d82523d6000602084013e61330a565b606091505b509150915061331a8282866130a4565b979650505050505050565b82805461333190613d99565b90600052602060002090601f0160209004810192826133535760008555613399565b82601f1061336c57805160ff1916838001178555613399565b82800160010185558215613399579182015b8281111561339957825182559160200191906001019061337e565b506133a59291506133a9565b5090565b5b808211156133a557600081556001016133aa565b80356001600160a01b03811681146133d557600080fd5b919050565b600080604083850312156133ed57600080fd5b6133f6836133be565b946020939093013593505050565b6001600160e01b0319811681146109e457600080fd5b60006020828403121561342c57600080fd5b81356126ee81613404565b60005b8381101561345257818101518382015260200161343a565b8381111561214f5750506000910152565b6000815180845261347b816020860160208601613437565b601f01601f19169290920160200192915050565b6020815260006126ee6020830184613463565b6000602082840312156134b457600080fd5b5035919050565b6000602082840312156134cd57600080fd5b6126ee826133be565b6000604082840312156134e857600080fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b601f8201601f191681016001600160401b0381118282101715613529576135296134ee565b6040525050565b60006001600160401b03821115613549576135496134ee565b50601f01601f191660200190565b600061356283613530565b60405161356f8282613504565b80925084815285858501111561358457600080fd5b8484602083013760006020868301015250509392505050565b600082601f8301126135ae57600080fd5b6126ee83833560208501613557565b600080600080600080600060e0888a0312156135d857600080fd5b6135e1886133be565b965060208801359550604088013594506135fd606089016133be565b93506080880135925060a08801356001600160401b038082111561362057600080fd5b61362c8b838c016134d6565b935060c08a013591508082111561364257600080fd5b5061364f8a828b0161359d565b91505092959891949750929550565b6000806040838503121561367157600080fd5b50508035926020909101359150565b60006001600160401b03821115613699576136996134ee565b5060051b60200190565b600082601f8301126136b457600080fd5b813560206136c182613680565b6040516136ce8282613504565b83815260059390931b85018201928281019150868411156136ee57600080fd5b8286015b8481101561370957803583529183019183016136f2565b509695505050505050565b600080600080600060a0868803121561372c57600080fd5b613735866133be565b9450613743602087016133be565b935060408601356001600160401b038082111561375f57600080fd5b61376b89838a016136a3565b9450606088013591508082111561378157600080fd5b61378d89838a016136a3565b935060808801359150808211156137a357600080fd5b506137b08882890161359d565b9150509295509295909350565b80151581146109e457600080fd5b60008060008385036101408112156137e257600080fd5b84359350610100601f19820112156137f957600080fd5b5060208401915061012084013561380f816137bd565b809150509250925092565b6000806040838503121561382d57600080fd5b82356001600160401b038082111561384457600080fd5b818501915085601f83011261385857600080fd5b8135602061386582613680565b6040516138728282613504565b83815260059390931b850182019282810191508984111561389257600080fd5b948201945b838610156138b7576138a8866133be565b82529482019490820190613897565b965050860135925050808211156138cd57600080fd5b506138da858286016136a3565b9150509250929050565b600081518084526020808501945080840160005b83811015613914578151875295820195908201906001016138f8565b509495945050505050565b6020815260006126ee60208301846138e4565b6000806000806080858703121561394857600080fd5b84359350613958602086016133be565b92506040850135915060608501356001600160401b0381111561397a57600080fd5b613986878288016134d6565b91505092959194509250565b600080604083850312156139a557600080fd5b823591506139b5602084016133be565b90509250929050565b6000602082840312156139d057600080fd5b81356001600160401b038111156139e657600080fd5b8201601f810184136139f757600080fd5b611f7f84823560208401613557565b600080600060608486031215613a1b57600080fd5b83359250613a2b602085016133be565b9150604084013590509250925092565b60008083601f840112613a4d57600080fd5b5081356001600160401b03811115613a6457600080fd5b60208301915083602082850101111561141e57600080fd5b600080600060408486031215613a9157600080fd5b8335925060208401356001600160401b03811115613aae57600080fd5b613aba86828701613a3b565b9497909650939450505050565b60008060408385031215613ada57600080fd5b613ae3836133be565b91506020830135613af3816137bd565b809150509250929050565b60008060208385031215613b1157600080fd5b82356001600160401b0380821115613b2857600080fd5b818501915085601f830112613b3c57600080fd5b813581811115613b4b57600080fd5b8660208260051b8501011115613b6057600080fd5b60209290920196919550909350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015613bc757603f19888603018452613bb5858351613463565b94509285019290850190600101613b99565b5092979650505050505050565b60008060008060008060c08789031215613bed57600080fd5b86359550613bfd602088016133be565b945060408701359350613c12606088016133be565b92506080870135915060a0870135613c29816137bd565b809150509295509295509295565b600080600080600060608688031215613c4f57600080fd5b8535945060208601356001600160401b0380821115613c6d57600080fd5b613c7989838a01613a3b565b90965094506040880135915080821115613c9257600080fd5b50613c9f88828901613a3b565b969995985093965092949392505050565b600080600060408486031215613cc557600080fd5b83356001600160401b0380821115613cdc57600080fd5b613ce88783880161359d565b94506020860135915080821115613cfe57600080fd5b50613aba86828701613a3b565b60008060408385031215613d1e57600080fd5b613d27836133be565b91506139b5602084016133be565b600080600080600060a08688031215613d4d57600080fd5b613d56866133be565b9450613d64602087016133be565b9350604086013592506060860135915060808601356001600160401b03811115613d8d57600080fd5b6137b08882890161359d565b600181811c90821680613dad57607f821691505b602082108114156134e857634e487b7160e01b600052602260045260246000fd5b60008251613de0818460208701613437565b600360fc1b920191825250600101919050565b60008351613e05818460208801613437565b835190830190613e19818360208801613437565b01949350505050565b6020808252600e908201526d139bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008219821115613e8957613e89613e60565b500190565b6000816000190483118215151615613ea857613ea8613e60565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613ed257613ed2613ead565b500490565b823581526020808401359082015260408084013590820152606080840135908201526080808401359082015260a0808401359082015260c0808401359082015261012081016001600160a01b03613f3060e086016133be565b1660e083015291151561010090910152919050565b6000600019821415613f5957613f59613e60565b5060010190565b6000808335601e19843603018112613f7757600080fd5b8301803591506001600160401b03821115613f9157600080fd5b6020019150600581901b360382131561141e57600080fd5b60008060408385031215613fbc57600080fd5b82516001600160401b03811115613fd257600080fd5b8301601f81018513613fe357600080fd5b8051613fee81613530565b604051613ffb8282613504565b82815287602084860101111561401057600080fd5b614021836020830160208701613437565b6020969096015195979596505050505050565b60008551614046818460208a01613437565b820184868237909301918252506020019392505050565b6000808335601e1984360301811261407457600080fd5b8301803591506001600160401b0382111561408e57600080fd5b60200191503681900382131561141e57600080fd5b600080604083850312156140b657600080fd5b82356001600160401b038111156140cc57600080fd5b6140d88582860161359d565b95602094909401359450505050565b82848237909101908152602001919050565b60008282101561410b5761410b613e60565b500390565b60008261411f5761411f613ead565b500690565b6020808252600c908201526b2a27afad22a927afa0a2222960a11b604082015260600190565b60408152600061415d60408301856138e4565b828103602084015261416f81856138e4565b95945050505050565b60408152600061418b6040830185613463565b828103602084015261416f8185613463565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8581526060602082015260006141e060608301868861419d565b82810360408401526141f381858761419d565b98975050505050505050565b6001600160a01b0386811682528516602082015260a06040820181905260009061422b908301866138e4565b828103606084015261423d81866138e4565b905082810360808401526141f38185613463565b60006020828403121561426357600080fd5b81516126ee81613404565b600060033d11156142875760046000803e5060005160e01c5b90565b600060443d10156142985790565b6040516003193d81016004833e81513d6001600160401b0381602484011181841117156142c757505050505090565b82850191508151818111156142df5750505050505090565b843d87010160208285010111156142f95750505050505090565b61430860208286010187613504565b509095945050505050565b60008251614325818460208701613437565b9190910192915050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061331a90830184613463565b60006020828403121561437b57600080fd5b81516126ee816137bd56fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212207fcf6c6c1970a1b6b0a70992239f98dd3420df9a0e4e551d42b9eb76acfb1c0f64736f6c63430008090033
Verified Source Code Full Match
Compiler: v0.8.9+commit.e5eed63a
EVM: london
Optimization: Yes (200 runs)
OBYCLabs.sol 39 lines
// SPDX-License-Identifier: Apache-2.0
/******************************************
* Amendeded by OBYC Labs Development *
* Author: devAlex.eth *
******************************************/
// _ _ _ _ _ _ _ _
// (c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c)
// / ._. \ / ._. \ / ._. \ / ._. \
// __\( Y )/__ __\( Y )/__ __\( Y )/__ __\( Y )/__
// (_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)
// || O || || B || || Y || || C ||
// _.' `-' '._ _.' `-' '._ _.' `-' '._ _.' `-' '._
// (.-./`-'\.-.)(.-./`-'\.-.)(.-./`-'\.-.)(.-./`-'\.-.)
// `-' `-' `-' `-' `-' `-' `-' `-'
pragma solidity ^0.8.0;
import "@thirdweb-dev/contracts/base/ERC1155Drop.sol";
contract OBYCLabs is ERC1155Drop {
constructor(
string memory _name,
string memory _symbol,
address _royaltyRecipient,
uint128 _royaltyBps,
address _primarySaleRecipient
)
ERC1155Drop(
_name,
_symbol,
_royaltyRecipient,
_royaltyBps,
_primarySaleRecipient
)
{}
}
ERC1155.sol 310 lines
// SPDX-License-Identifier: Apache 2.0
pragma solidity ^0.8.0;
import "./interface/IERC1155.sol";
import "./interface/IERC1155Metadata.sol";
import "./interface/IERC1155Receiver.sol";
contract ERC1155 is IERC1155, IERC1155Metadata {
/*//////////////////////////////////////////////////////////////
State variables
//////////////////////////////////////////////////////////////*/
string public name;
string public symbol;
/*//////////////////////////////////////////////////////////////
Mappings
//////////////////////////////////////////////////////////////*/
mapping(address => mapping(uint256 => uint256)) public balanceOf;
mapping(address => mapping(address => bool)) public isApprovedForAll;
mapping(uint256 => string) internal _uri;
/*//////////////////////////////////////////////////////////////
Constructor
//////////////////////////////////////////////////////////////*/
constructor(string memory _name, string memory _symbol) {
name = _name;
symbol = _symbol;
}
/*//////////////////////////////////////////////////////////////
View functions
//////////////////////////////////////////////////////////////*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return
interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165
interfaceId == 0xd9b67a26 || // ERC165 Interface ID for ERC1155
interfaceId == 0x0e89341c; // ERC165 Interface ID for ERC1155MetadataURI
}
function uri(uint256 tokenId) public view virtual override returns (string memory) {
return _uri[tokenId];
}
function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
virtual
override
returns (uint256[] memory)
{
require(accounts.length == ids.length, "LENGTH_MISMATCH");
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf[accounts[i]][ids[i]];
}
return batchBalances;
}
/*//////////////////////////////////////////////////////////////
ERC1155 logic
//////////////////////////////////////////////////////////////*/
function setApprovalForAll(address operator, bool approved) public virtual override {
address owner = msg.sender;
require(owner != operator, "APPROVING_SELF");
isApprovedForAll[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(from == msg.sender || isApprovedForAll[from][msg.sender], "!OWNER_OR_APPROVED");
_safeTransferFrom(from, to, id, amount, data);
}
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public virtual override {
require(from == msg.sender || isApprovedForAll[from][msg.sender], "!OWNER_OR_APPROVED");
_safeBatchTransferFrom(from, to, ids, amounts, data);
}
/*//////////////////////////////////////////////////////////////
Internal logic
//////////////////////////////////////////////////////////////*/
function _safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "TO_ZERO_ADDR");
address operator = msg.sender;
_beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);
uint256 fromBalance = balanceOf[from][id];
require(fromBalance >= amount, "INSUFFICIENT_BAL");
unchecked {
balanceOf[from][id] = fromBalance - amount;
}
balanceOf[to][id] += amount;
emit TransferSingle(operator, from, to, id, amount);
_doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
}
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(ids.length == amounts.length, "LENGTH_MISMATCH");
require(to != address(0), "TO_ZERO_ADDR");
address operator = msg.sender;
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = balanceOf[from][id];
require(fromBalance >= amount, "INSUFFICIENT_BAL");
unchecked {
balanceOf[from][id] = fromBalance - amount;
}
balanceOf[to][id] += amount;
}
emit TransferBatch(operator, from, to, ids, amounts);
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
}
function _setTokenURI(uint256 tokenId, string memory newuri) internal virtual {
_uri[tokenId] = newuri;
}
function _mint(
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "TO_ZERO_ADDR");
address operator = msg.sender;
_beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data);
balanceOf[to][id] += amount;
emit TransferSingle(operator, address(0), to, id, amount);
_doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
}
function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "TO_ZERO_ADDR");
require(ids.length == amounts.length, "LENGTH_MISMATCH");
address operator = msg.sender;
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; i++) {
balanceOf[to][ids[i]] += amounts[i];
}
emit TransferBatch(operator, address(0), to, ids, amounts);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
function _burn(
address from,
uint256 id,
uint256 amount
) internal virtual {
require(from != address(0), "FROM_ZERO_ADDR");
address operator = msg.sender;
_beforeTokenTransfer(operator, from, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");
uint256 fromBalance = balanceOf[from][id];
require(fromBalance >= amount, "INSUFFICIENT_BAL");
unchecked {
balanceOf[from][id] = fromBalance - amount;
}
emit TransferSingle(operator, from, address(0), id, amount);
}
function _burnBatch(
address from,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(from != address(0), "FROM_ZERO_ADDR");
require(ids.length == amounts.length, "LENGTH_MISMATCH");
address operator = msg.sender;
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = balanceOf[from][id];
require(fromBalance >= amount, "INSUFFICIENT_BAL");
unchecked {
balanceOf[from][id] = fromBalance - amount;
}
}
emit TransferBatch(operator, from, address(0), ids, amounts);
}
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
function _doSafeTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) private {
if (to.code.length > 0) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
if (response != IERC1155Receiver.onERC1155Received.selector) {
revert("TOKENS_REJECTED");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("!ERC1155RECEIVER");
}
}
}
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) private {
if (to.code.length > 0) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
revert("TOKENS_REJECTED");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("!ERC1155RECEIVER");
}
}
}
function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
uint256[] memory array = new uint256[](1);
array[0] = element;
return array;
}
}
TWAddress.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library TWAddress {
/**
* @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.
*
* [EIP1884](https://eips.ethereum.org/EIPS/eip-1884) 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);
}
}
}
}
TWBitMaps.sol 55 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/structs/BitMaps.sol)
pragma solidity ^0.8.0;
/**
* @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential.
* Largely inspired by Uniswap's [merkle-distributor](https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol).
*/
library TWBitMaps {
struct BitMap {
mapping(uint256 => uint256) _data;
}
/**
* @dev Returns whether the bit at `index` is set.
*/
function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {
uint256 bucket = index >> 8;
uint256 mask = 1 << (index & 0xff);
return bitmap._data[bucket] & mask != 0;
}
/**
* @dev Sets the bit at `index` to the boolean `value`.
*/
function setTo(
BitMap storage bitmap,
uint256 index,
bool value
) internal {
if (value) {
set(bitmap, index);
} else {
unset(bitmap, index);
}
}
/**
* @dev Sets the bit at `index`.
*/
function set(BitMap storage bitmap, uint256 index) internal {
uint256 bucket = index >> 8;
uint256 mask = 1 << (index & 0xff);
bitmap._data[bucket] |= mask;
}
/**
* @dev Unsets the bit at `index`.
*/
function unset(BitMap storage bitmap, uint256 index) internal {
uint256 bucket = index >> 8;
uint256 mask = 1 << (index & 0xff);
bitmap._data[bucket] &= ~mask;
}
}
TWStrings.sol 67 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library TWStrings {
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);
}
}
MerkleProof.sol 50 lines
// SPDX-License-Identifier: MIT
// Modified from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.3.0/contracts/utils/cryptography/MerkleProof.sol
// Copied from https://github.com/ensdomains/governance/blob/master/contracts/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.
*
* Source: https://github.com/ensdomains/governance/blob/master/contracts/MerkleProof.sol
*/
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, uint256) {
bytes32 computedHash = leaf;
uint256 index = 0;
for (uint256 i = 0; i < proof.length; i++) {
index *= 2;
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
} else {
// Hash(current element of the proof + current computed hash)
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
index += 1;
}
}
// Check if the computed hash (root) is equal to the provided root
return (computedHash == root, index);
}
}
ERC1155Drop.sol 281 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import { ERC1155 } from "../eip/ERC1155.sol";
import "../extension/ContractMetadata.sol";
import "../extension/Multicall.sol";
import "../extension/Ownable.sol";
import "../extension/Royalty.sol";
import "../extension/BatchMintMetadata.sol";
import "../extension/PrimarySale.sol";
import "../extension/DropSinglePhase1155.sol";
import "../extension/LazyMint.sol";
import "../extension/DelayedReveal.sol";
import "../lib/CurrencyTransferLib.sol";
import "../lib/TWStrings.sol";
/**
* BASE: ERC1155Base
* EXTENSION: DropSinglePhase1155
*
* The `ERC1155Base` smart contract implements the ERC1155 NFT standard.
* It includes the following additions to standard ERC1155 logic:
*
* - Contract metadata for royalty support on platforms such as OpenSea that use
* off-chain information to distribute roaylties.
*
* - Ownership of the contract, with the ability to restrict certain functions to
* only be called by the contract's owner.
*
* - Multicall capability to perform multiple actions atomically
*
* - EIP 2981 compliance for royalty support on NFT marketplaces.
*
* The `drop` mechanism in the `DropSinglePhase1155` extension is a distribution mechanism for lazy minted tokens. It lets
* you set restrictions such as a price to charge, an allowlist etc. when an address atttempts to mint lazy minted tokens.
*
* The `ERC721Drop` contract lets you lazy mint tokens, and distribute those lazy minted tokens via the drop mechanism.
*/
contract ERC1155Drop is
ERC1155,
ContractMetadata,
Ownable,
Royalty,
Multicall,
BatchMintMetadata,
PrimarySale,
LazyMint,
DelayedReveal,
DropSinglePhase1155
{
using TWStrings for uint256;
/*//////////////////////////////////////////////////////////////
Mappings
//////////////////////////////////////////////////////////////*/
/**
* @notice Returns the total supply of NFTs of a given tokenId
* @dev Mapping from tokenId => total circulating supply of NFTs of that tokenId.
*/
mapping(uint256 => uint256) public totalSupply;
/*///////////////////////////////////////////////////////////////
Constructor
//////////////////////////////////////////////////////////////*/
constructor(
string memory _name,
string memory _symbol,
address _royaltyRecipient,
uint128 _royaltyBps,
address _primarySaleRecipient
) ERC1155(_name, _symbol) {
_setupOwner(msg.sender);
_setupDefaultRoyaltyInfo(_royaltyRecipient, _royaltyBps);
_setupPrimarySaleRecipient(_primarySaleRecipient);
}
/*///////////////////////////////////////////////////////////////
Overriden metadata logic
//////////////////////////////////////////////////////////////*/
/**
* @notice Returns the metadata URI for an NFT.
* @dev See `BatchMintMetadata` for handling of metadata in this contract.
*
* @param _tokenId The tokenId of an NFT.
*/
function uri(uint256 _tokenId) public view virtual override returns (string memory) {
(uint256 batchId, ) = getBatchId(_tokenId);
string memory batchUri = getBaseURI(_tokenId);
if (isEncryptedBatch(batchId)) {
return string(abi.encodePacked(batchUri, "0"));
} else {
return string(abi.encodePacked(batchUri, _tokenId.toString()));
}
}
/*///////////////////////////////////////////////////////////////
Delayed reveal logic
//////////////////////////////////////////////////////////////*/
/**
* @notice Lets an authorized address reveal a batch of delayed reveal NFTs.
*
* @param _index The ID for the batch of delayed-reveal NFTs to reveal.
* @param _key The key with which the base URI for the relevant batch of NFTs was encrypted.
*/
function reveal(uint256 _index, bytes calldata _key) public virtual override returns (string memory revealedURI) {
require(_canReveal(), "Not authorized");
uint256 batchId = getBatchIdAtIndex(_index);
revealedURI = getRevealURI(batchId, _key);
_setEncryptedData(batchId, "");
_setBaseURI(batchId, revealedURI);
emit TokenURIRevealed(_index, revealedURI);
}
/*///////////////////////////////////////////////////////////////
Overriden lazy minting logic
//////////////////////////////////////////////////////////////*/
/**
* @notice Lets an authorized address lazy mint a given amount of NFTs.
*
* @param _amount The number of NFTs to lazy mint.
* @param _baseURIForTokens The placeholder base URI for the 'n' number of NFTs being lazy minted, where the
* metadata for each of those NFTs is `${baseURIForTokens}/${tokenId}`.
* @param _data The encrypted base URI + provenance hash for the batch of NFTs being lazy minted.
* @return batchId A unique integer identifier for the batch of NFTs lazy minted together.
*/
function lazyMint(
uint256 _amount,
string calldata _baseURIForTokens,
bytes calldata _data
) public virtual override returns (uint256 batchId) {
if (_data.length > 0) {
(bytes memory encryptedURI, bytes32 provenanceHash) = abi.decode(_data, (bytes, bytes32));
if (encryptedURI.length != 0 && provenanceHash != "") {
_setEncryptedData(nextTokenIdToLazyMint + _amount, _data);
}
}
return LazyMint.lazyMint(_amount, _baseURIForTokens, _data);
}
/// @notice The tokenId assigned to the next new NFT to be lazy minted.
function nextTokenIdToMint() public view virtual returns (uint256) {
return nextTokenIdToLazyMint;
}
/*//////////////////////////////////////////////////////////////
ERC165 Logic
//////////////////////////////////////////////////////////////*/
/// @notice Returns whether this contract supports the given interface.
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, IERC165) returns (bool) {
return
interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165
interfaceId == 0xd9b67a26 || // ERC165 Interface ID for ERC1155
interfaceId == 0x0e89341c || // ERC165 Interface ID for ERC1155MetadataURI
interfaceId == type(IERC2981).interfaceId; // ERC165 ID for ERC2981
}
/*///////////////////////////////////////////////////////////////
Internal functions
//////////////////////////////////////////////////////////////*/
/// @dev Runs before every `claim` function call.
function _beforeClaim(
uint256 _tokenId,
address,
uint256,
address,
uint256,
AllowlistProof calldata,
bytes memory
) internal view virtual override {
require(msg.sender == tx.origin, "BOT");
if (_tokenId >= nextTokenIdToLazyMint) {
revert("Not enough minted tokens");
}
}
/// @dev Collects and distributes the primary sale value of NFTs being claimed.
function collectPriceOnClaim(
address _primarySaleRecipient,
uint256 _quantityToClaim,
address _currency,
uint256 _pricePerToken
) internal virtual override {
if (_pricePerToken == 0) {
return;
}
uint256 totalPrice = _quantityToClaim * _pricePerToken;
if (_currency == CurrencyTransferLib.NATIVE_TOKEN) {
if (msg.value != totalPrice) {
revert("Must send total price.");
}
}
address saleRecipient = _primarySaleRecipient == address(0) ? primarySaleRecipient() : _primarySaleRecipient;
CurrencyTransferLib.transferCurrency(_currency, msg.sender, saleRecipient, totalPrice);
}
/// @dev Transfers the NFTs being claimed.
function transferTokensOnClaim(
address _to,
uint256 _tokenId,
uint256 _quantityBeingClaimed
) internal virtual override {
_mint(_to, _tokenId, _quantityBeingClaimed, "");
}
/// @dev Runs before every token transfer / mint / burn.
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual override {
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
if (from == address(0)) {
for (uint256 i = 0; i < ids.length; ++i) {
totalSupply[ids[i]] += amounts[i];
}
}
if (to == address(0)) {
for (uint256 i = 0; i < ids.length; ++i) {
totalSupply[ids[i]] -= amounts[i];
}
}
}
/// @dev Checks whether primary sale recipient can be set in the given execution context.
function _canSetPrimarySaleRecipient() internal view virtual override returns (bool) {
return msg.sender == owner();
}
/// @dev Checks whether owner can be set in the given execution context.
function _canSetOwner() internal view virtual override returns (bool) {
return msg.sender == owner();
}
/// @dev Checks whether royalty info can be set in the given execution context.
function _canSetRoyaltyInfo() internal view virtual override returns (bool) {
return msg.sender == owner();
}
/// @dev Checks whether contract metadata can be set in the given execution context.
function _canSetContractURI() internal view virtual override returns (bool) {
return msg.sender == owner();
}
/// @dev Checks whether platform fee info can be set in the given execution context.
function _canSetClaimConditions() internal view virtual override returns (bool) {
return msg.sender == owner();
}
/// @dev Returns whether lazy minting can be done in the given execution context.
function _canLazyMint() internal view virtual override returns (bool) {
return msg.sender == owner();
}
/// @dev Checks whether NFTs can be revealed in the given execution context.
function _canReveal() internal view virtual returns (bool) {
return msg.sender == owner();
}
}
IWETH.sol 10 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
interface IWETH {
function deposit() external payable;
function withdraw(uint256 amount) external;
function transfer(address to, uint256 value) external returns (bool);
}
Ownable.sol 53 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "./interface/IOwnable.sol";
/**
* @title Ownable
* @notice Thirdweb's `Ownable` is a contract extension to be used with any base contract. It exposes functions for setting and reading
* who the 'owner' of the inheriting smart contract is, and lets the inheriting contract perform conditional logic that uses
* information about who the contract's owner is.
*/
abstract contract Ownable is IOwnable {
/// @dev Owner of the contract (purpose: OpenSea compatibility)
address private _owner;
/// @dev Reverts if caller is not the owner.
modifier onlyOwner() {
if (msg.sender != _owner) {
revert("Not authorized");
}
_;
}
/**
* @notice Returns the owner of the contract.
*/
function owner() public view override returns (address) {
return _owner;
}
/**
* @notice Lets an authorized wallet set a new owner for the contract.
* @param _newOwner The address to set as the new owner of the contract.
*/
function setOwner(address _newOwner) external override {
if (!_canSetOwner()) {
revert("Not authorized");
}
_setupOwner(_newOwner);
}
/// @dev Lets a contract admin set a new owner for the contract. The new owner must be a contract admin.
function _setupOwner(address _newOwner) internal {
address _prevOwner = _owner;
_owner = _newOwner;
emit OwnerUpdated(_prevOwner, _newOwner);
}
/// @dev Returns whether owner can be set in the given execution context.
function _canSetOwner() internal view virtual returns (bool);
}
Royalty.sol 134 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "./interface/IRoyalty.sol";
/**
* @title Royalty
* @notice Thirdweb's `Royalty` is a contract extension to be used with any base contract. It exposes functions for setting and reading
* the recipient of royalty fee and the royalty fee basis points, and lets the inheriting contract perform conditional logic
* that uses information about royalty fees, if desired.
*
* @dev The `Royalty` contract is ERC2981 compliant.
*/
abstract contract Royalty is IRoyalty {
/// @dev The (default) address that receives all royalty value.
address private royaltyRecipient;
/// @dev The (default) % of a sale to take as royalty (in basis points).
uint16 private royaltyBps;
/// @dev Token ID => royalty recipient and bps for token
mapping(uint256 => RoyaltyInfo) private royaltyInfoForToken;
/**
* @notice View royalty info for a given token and sale price.
* @dev Returns royalty amount and recipient for `tokenId` and `salePrice`.
* @param tokenId The tokenID of the NFT for which to query royalty info.
* @param salePrice Sale price of the token.
*
* @return receiver Address of royalty recipient account.
* @return royaltyAmount Royalty amount calculated at current royaltyBps value.
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
virtual
override
returns (address receiver, uint256 royaltyAmount)
{
(address recipient, uint256 bps) = getRoyaltyInfoForToken(tokenId);
receiver = recipient;
royaltyAmount = (salePrice * bps) / 10_000;
}
/**
* @notice View royalty info for a given token.
* @dev Returns royalty recipient and bps for `_tokenId`.
* @param _tokenId The tokenID of the NFT for which to query royalty info.
*/
function getRoyaltyInfoForToken(uint256 _tokenId) public view override returns (address, uint16) {
RoyaltyInfo memory royaltyForToken = royaltyInfoForToken[_tokenId];
return
royaltyForToken.recipient == address(0)
? (royaltyRecipient, uint16(royaltyBps))
: (royaltyForToken.recipient, uint16(royaltyForToken.bps));
}
/**
* @notice Returns the defualt royalty recipient and BPS for this contract's NFTs.
*/
function getDefaultRoyaltyInfo() external view override returns (address, uint16) {
return (royaltyRecipient, uint16(royaltyBps));
}
/**
* @notice Updates default royalty recipient and bps.
* @dev Caller should be authorized to set royalty info.
* See {_canSetRoyaltyInfo}.
* Emits {DefaultRoyalty Event}; See {_setupDefaultRoyaltyInfo}.
*
* @param _royaltyRecipient Address to be set as default royalty recipient.
* @param _royaltyBps Updated royalty bps.
*/
function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) external override {
if (!_canSetRoyaltyInfo()) {
revert("Not authorized");
}
_setupDefaultRoyaltyInfo(_royaltyRecipient, _royaltyBps);
}
/// @dev Lets a contract admin update the default royalty recipient and bps.
function _setupDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) internal {
if (_royaltyBps > 10_000) {
revert("Exceeds max bps");
}
royaltyRecipient = _royaltyRecipient;
royaltyBps = uint16(_royaltyBps);
emit DefaultRoyalty(_royaltyRecipient, _royaltyBps);
}
/**
* @notice Updates default royalty recipient and bps for a particular token.
* @dev Sets royalty info for `_tokenId`. Caller should be authorized to set royalty info.
* See {_canSetRoyaltyInfo}.
* Emits {RoyaltyForToken Event}; See {_setupRoyaltyInfoForToken}.
*
* @param _recipient Address to be set as royalty recipient for given token Id.
* @param _bps Updated royalty bps for the token Id.
*/
function setRoyaltyInfoForToken(
uint256 _tokenId,
address _recipient,
uint256 _bps
) external override {
if (!_canSetRoyaltyInfo()) {
revert("Not authorized");
}
_setupRoyaltyInfoForToken(_tokenId, _recipient, _bps);
}
/// @dev Lets a contract admin set the royalty recipient and bps for a particular token Id.
function _setupRoyaltyInfoForToken(
uint256 _tokenId,
address _recipient,
uint256 _bps
) internal {
if (_bps > 10_000) {
revert("Exceeds max bps");
}
royaltyInfoForToken[_tokenId] = RoyaltyInfo({ recipient: _recipient, bps: _bps });
emit RoyaltyForToken(_tokenId, _recipient, _bps);
}
/// @dev Returns whether royalty info can be set in the given execution context.
function _canSetRoyaltyInfo() internal view virtual returns (bool);
}
LazyMint.sol 50 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "./interface/ILazyMint.sol";
import "./BatchMintMetadata.sol";
/**
* The `LazyMint` is a contract extension for any base NFT contract. It lets you 'lazy mint' any number of NFTs
* at once. Here, 'lazy mint' means defining the metadata for particular tokenIds of your NFT contract, without actually
* minting a non-zero balance of NFTs of those tokenIds.
*/
abstract contract LazyMint is ILazyMint, BatchMintMetadata {
/// @notice The tokenId assigned to the next new NFT to be lazy minted.
uint256 internal nextTokenIdToLazyMint;
/**
* @notice Lets an authorized address lazy mint a given amount of NFTs.
*
* @param _amount The number of NFTs to lazy mint.
* @param _baseURIForTokens The base URI for the 'n' number of NFTs being lazy minted, where the metadata for each
* of those NFTs is `${baseURIForTokens}/${tokenId}`.
* @param _data Additional bytes data to be used at the discretion of the consumer of the contract.
* @return batchId A unique integer identifier for the batch of NFTs lazy minted together.
*/
function lazyMint(
uint256 _amount,
string calldata _baseURIForTokens,
bytes calldata _data
) public virtual override returns (uint256 batchId) {
if (!_canLazyMint()) {
revert("Not authorized");
}
if (_amount == 0) {
revert("Minting 0 tokens");
}
uint256 startId = nextTokenIdToLazyMint;
(nextTokenIdToLazyMint, batchId) = _batchMintMetadata(startId, _amount, _baseURIForTokens);
emit TokensLazyMinted(startId, startId + _amount - 1, _baseURIForTokens, _data);
return batchId;
}
/// @dev Returns whether lazy minting can be performed in the given execution context.
function _canLazyMint() internal view virtual returns (bool);
}
Multicall.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol)
pragma solidity ^0.8.0;
import "../lib/TWAddress.sol";
import "./interface/IMulticall.sol";
/**
* @dev Provides a function to batch together multiple calls in a single external call.
*
* _Available since v4.1._
*/
contract Multicall is IMulticall {
/**
* @notice Receives and executes a batch of function calls on this contract.
* @dev Receives and executes a batch of function calls on this contract.
*
* @param data The bytes data that makes up the batch of function calls to execute.
* @return results The bytes data that makes up the result of the batch of function calls executed.
*/
function multicall(bytes[] calldata data) external virtual override returns (bytes[] memory results) {
results = new bytes[](data.length);
for (uint256 i = 0; i < data.length; i++) {
results[i] = TWAddress.functionDelegateCall(address(this), data[i]);
}
return results;
}
}
IERC20.sol 28 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
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
* [EIP](https://eips.ethereum.org/EIPS/eip-165).
*
* 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
* [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 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
PrimarySale.sol 45 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "./interface/IPrimarySale.sol";
/**
* @title Primary Sale
* @notice Thirdweb's `PrimarySale` is a contract extension to be used with any base contract. It exposes functions for setting and reading
* the recipient of primary sales, and lets the inheriting contract perform conditional logic that uses information about
* primary sales, if desired.
*/
abstract contract PrimarySale is IPrimarySale {
/// @dev The address that receives all primary sales value.
address private recipient;
/// @dev Returns primary sale recipient address.
function primarySaleRecipient() public view override returns (address) {
return recipient;
}
/**
* @notice Updates primary sale recipient.
* @dev Caller should be authorized to set primary sales info.
* See {_canSetPrimarySaleRecipient}.
* Emits {PrimarySaleRecipientUpdated Event}; See {_setupPrimarySaleRecipient}.
*
* @param _saleRecipient Address to be set as new recipient of primary sales.
*/
function setPrimarySaleRecipient(address _saleRecipient) external override {
if (!_canSetPrimarySaleRecipient()) {
revert("Not authorized");
}
_setupPrimarySaleRecipient(_saleRecipient);
}
/// @dev Lets a contract admin set the recipient for all primary sales.
function _setupPrimarySaleRecipient(address _saleRecipient) internal {
recipient = _saleRecipient;
emit PrimarySaleRecipientUpdated(_saleRecipient);
}
/// @dev Returns whether primary sale recipient can be set in the given execution context.
function _canSetPrimarySaleRecipient() internal view virtual returns (bool);
}
IERC1155.sol 138 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/**
@title ERC-1155 Multi Token Standard
@dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md
Note: The ERC-165 identifier for this interface is 0xd9b67a26.
*/
interface IERC1155 {
/**
@dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).
The `_operator` argument MUST be msg.sender.
The `_from` argument MUST be the address of the holder whose balance is decreased.
The `_to` argument MUST be the address of the recipient whose balance is increased.
The `_id` argument MUST be the token type being transferred.
The `_value` argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by.
When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).
*/
event TransferSingle(
address indexed _operator,
address indexed _from,
address indexed _to,
uint256 _id,
uint256 _value
);
/**
@dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).
The `_operator` argument MUST be msg.sender.
The `_from` argument MUST be the address of the holder whose balance is decreased.
The `_to` argument MUST be the address of the recipient whose balance is increased.
The `_ids` argument MUST be the list of tokens being transferred.
The `_values` argument MUST be the list of number of tokens (matching the list and order of tokens specified in _ids) the holder balance is decreased by and match what the recipient balance is increased by.
When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).
*/
event TransferBatch(
address indexed _operator,
address indexed _from,
address indexed _to,
uint256[] _ids,
uint256[] _values
);
/**
@dev MUST emit when approval for a second party/operator address to manage all tokens for an owner address is enabled or disabled (absense of an event assumes disabled).
*/
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
/**
@dev MUST emit when the URI is updated for a token ID.
URIs are defined in RFC 3986.
The URI MUST point a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema".
*/
event URI(string _value, uint256 indexed _id);
/**
@notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).
@dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
MUST revert if `_to` is the zero address.
MUST revert if balance of holder for token `_id` is lower than the `_value` sent.
MUST revert on any other error.
MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard).
After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
@param _from Source address
@param _to Target address
@param _id ID of the token type
@param _value Transfer amount
@param _data Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`
*/
function safeTransferFrom(
address _from,
address _to,
uint256 _id,
uint256 _value,
bytes calldata _data
) external;
/**
@notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call).
@dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
MUST revert if `_to` is the zero address.
MUST revert if length of `_ids` is not the same as length of `_values`.
MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient.
MUST revert on any other error.
MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard).
Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc).
After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
@param _from Source address
@param _to Target address
@param _ids IDs of each token type (order and length must match _values array)
@param _values Transfer amounts per token type (order and length must match _ids array)
@param _data Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to`
*/
function safeBatchTransferFrom(
address _from,
address _to,
uint256[] calldata _ids,
uint256[] calldata _values,
bytes calldata _data
) external;
/**
@notice Get the balance of an account's Tokens.
@param _owner The address of the token holder
@param _id ID of the Token
@return The _owner's balance of the Token type requested
*/
function balanceOf(address _owner, uint256 _id) external view returns (uint256);
/**
@notice Get the balance of multiple account/token pairs
@param _owners The addresses of the token holders
@param _ids ID of the Tokens
@return The _owner's balance of the Token types requested (i.e. balance for each (owner, id) pair)
*/
function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids)
external
view
returns (uint256[] memory);
/**
@notice Enable or disable approval for a third party ("operator") to manage all of the caller's tokens.
@dev MUST emit the ApprovalForAll event on success.
@param _operator Address to add to the set of authorized operators
@param _approved True if the operator is approved, false to revoke approval
*/
function setApprovalForAll(address _operator, bool _approved) external;
/**
@notice Queries the approval status of an operator for a given owner.
@param _owner The owner of the Tokens
@param _operator Address of authorized operator
@return True if the operator is approved, false if not
*/
function isApprovedForAll(address _owner, address _operator) external view returns (bool);
}
IERC2981.sol 23 lines
// SPDX-License-Identifier: Apache 2.0
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*
* _Available since v4.5._
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be payed in that same unit of exchange.
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}
DelayedReveal.sol 98 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "./interface/IDelayedReveal.sol";
/**
* @title Delayed Reveal
* @notice Thirdweb's `DelayedReveal` is a contract extension for base NFT contracts. It lets you create batches of
* 'delayed-reveal' NFTs. You can learn more about the usage of delayed reveal NFTs here - https://blog.thirdweb.com/delayed-reveal-nfts
*/
abstract contract DelayedReveal is IDelayedReveal {
/// @dev Mapping from tokenId of a batch of tokens => to delayed reveal data.
mapping(uint256 => bytes) public encryptedData;
/// @dev Sets the delayed reveal data for a batchId.
function _setEncryptedData(uint256 _batchId, bytes memory _encryptedData) internal {
encryptedData[_batchId] = _encryptedData;
}
/**
* @notice Returns revealed URI for a batch of NFTs.
* @dev Reveal encrypted base URI for `_batchId` with caller/admin's `_key` used for encryption.
* Reverts if there's no encrypted URI for `_batchId`.
* See {encryptDecrypt}.
*
* @param _batchId ID of the batch for which URI is being revealed.
* @param _key Secure key used by caller/admin for encryption of baseURI.
*
* @return revealedURI Decrypted base URI.
*/
function getRevealURI(uint256 _batchId, bytes calldata _key) public view returns (string memory revealedURI) {
bytes memory data = encryptedData[_batchId];
if (data.length == 0) {
revert("Nothing to reveal");
}
(bytes memory encryptedURI, bytes32 provenanceHash) = abi.decode(data, (bytes, bytes32));
revealedURI = string(encryptDecrypt(encryptedURI, _key));
require(keccak256(abi.encodePacked(revealedURI, _key, block.chainid)) == provenanceHash, "Incorrect key");
}
/**
* @notice Encrypt/decrypt data on chain.
* @dev Encrypt/decrypt given `data` with `key`. Uses inline assembly.
* See: https://ethereum.stackexchange.com/questions/69825/decrypt-message-on-chain
*
* @param data Bytes of data to encrypt/decrypt.
* @param key Secure key used by caller for encryption/decryption.
*
* @return result Output after encryption/decryption of given data.
*/
function encryptDecrypt(bytes memory data, bytes calldata key) public pure override returns (bytes memory result) {
// Store data length on stack for later use
uint256 length = data.length;
// solhint-disable-next-line no-inline-assembly
assembly {
// Set result to free memory pointer
result := mload(0x40)
// Increase free memory pointer by lenght + 32
mstore(0x40, add(add(result, length), 32))
// Set result length
mstore(result, length)
}
// Iterate over the data stepping by 32 bytes
for (uint256 i = 0; i < length; i += 32) {
// Generate hash of the key and offset
bytes32 hash = keccak256(abi.encodePacked(key, i));
bytes32 chunk;
// solhint-disable-next-line no-inline-assembly
assembly {
// Read 32-bytes data chunk
chunk := mload(add(data, add(i, 32)))
}
// XOR the chunk with hash
chunk ^= hash;
// solhint-disable-next-line no-inline-assembly
assembly {
// Write 32-byte encrypted chunk
mstore(add(result, add(i, 32)), chunk)
}
}
}
/**
* @notice Returns whether the relvant batch of NFTs is subject to a delayed reveal.
* @dev Returns `true` if `_batchId`'s base URI is encrypted.
* @param _batchId ID of a batch of NFTs.
*/
function isEncryptedBatch(uint256 _batchId) public view returns (bool) {
return encryptedData[_batchId].length > 0;
}
}
CurrencyTransferLib.sol 102 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
// Helper interfaces
import { IWETH } from "../interfaces/IWETH.sol";
import "../openzeppelin-presets/token/ERC20/utils/SafeERC20.sol";
library CurrencyTransferLib {
using SafeERC20 for IERC20;
/// @dev The address interpreted as native token of the chain.
address public constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
/// @dev Transfers a given amount of currency.
function transferCurrency(
address _currency,
address _from,
address _to,
uint256 _amount
) internal {
if (_amount == 0) {
return;
}
if (_currency == NATIVE_TOKEN) {
safeTransferNativeToken(_to, _amount);
} else {
safeTransferERC20(_currency, _from, _to, _amount);
}
}
/// @dev Transfers a given amount of currency. (With native token wrapping)
function transferCurrencyWithWrapper(
address _currency,
address _from,
address _to,
uint256 _amount,
address _nativeTokenWrapper
) internal {
if (_amount == 0) {
return;
}
if (_currency == NATIVE_TOKEN) {
if (_from == address(this)) {
// withdraw from weth then transfer withdrawn native token to recipient
IWETH(_nativeTokenWrapper).withdraw(_amount);
safeTransferNativeTokenWithWrapper(_to, _amount, _nativeTokenWrapper);
} else if (_to == address(this)) {
// store native currency in weth
require(_amount == msg.value, "msg.value != amount");
IWETH(_nativeTokenWrapper).deposit{ value: _amount }();
} else {
safeTransferNativeTokenWithWrapper(_to, _amount, _nativeTokenWrapper);
}
} else {
safeTransferERC20(_currency, _from, _to, _amount);
}
}
/// @dev Transfer `amount` of ERC20 token from `from` to `to`.
function safeTransferERC20(
address _currency,
address _from,
address _to,
uint256 _amount
) internal {
if (_from == _to) {
return;
}
if (_from == address(this)) {
IERC20(_currency).safeTransfer(_to, _amount);
} else {
IERC20(_currency).safeTransferFrom(_from, _to, _amount);
}
}
/// @dev Transfers `amount` of native token to `to`.
function safeTransferNativeToken(address to, uint256 value) internal {
// solhint-disable avoid-low-level-calls
// slither-disable-next-line low-level-calls
(bool success, ) = to.call{ value: value }("");
require(success, "native token transfer failed");
}
/// @dev Transfers `amount` of native token to `to`. (With native token wrapping)
function safeTransferNativeTokenWithWrapper(
address to,
uint256 value,
address _nativeTokenWrapper
) internal {
// solhint-disable avoid-low-level-calls
// slither-disable-next-line low-level-calls
(bool success, ) = to.call{ value: value }("");
if (!success) {
IWETH(_nativeTokenWrapper).deposit{ value: value }();
IERC20(_nativeTokenWrapper).safeTransfer(to, value);
}
}
}
ContractMetadata.sol 43 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "./interface/IContractMetadata.sol";
/**
* @title Contract Metadata
* @notice Thirdweb's `ContractMetadata` is a contract extension for any base contracts. It lets you set a metadata URI
* for you contract.
* Additionally, `ContractMetadata` is necessary for NFT contracts that want royalties to get distributed on OpenSea.
*/
abstract contract ContractMetadata is IContractMetadata {
/// @notice Returns the contract metadata URI.
string public override contractURI;
/**
* @notice Lets a contract admin set the URI for contract-level metadata.
* @dev Caller should be authorized to setup contractURI, e.g. contract admin.
* See {_canSetContractURI}.
* Emits {ContractURIUpdated Event}.
*
* @param _uri keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
*/
function setContractURI(string memory _uri) external override {
if (!_canSetContractURI()) {
revert("Not authorized");
}
_setupContractURI(_uri);
}
/// @dev Lets a contract admin set the URI for contract-level metadata.
function _setupContractURI(string memory _uri) internal {
string memory prevURI = contractURI;
contractURI = _uri;
emit ContractURIUpdated(prevURI, _uri);
}
/// @dev Returns whether contract metadata can be set in the given execution context.
function _canSetContractURI() internal view virtual returns (bool);
}
BatchMintMetadata.sol 87 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/**
* @title Batch-mint Metadata
* @notice The `BatchMintMetadata` is a contract extension for any base NFT contract. It lets the smart contract
* using this extension set metadata for `n` number of NFTs all at once. This is enabled by storing a single
* base URI for a batch of `n` NFTs, where the metadata for each NFT in a relevant batch is `baseURI/tokenId`.
*/
contract BatchMintMetadata {
/// @dev Largest tokenId of each batch of tokens with the same baseURI.
uint256[] private batchIds;
/// @dev Mapping from id of a batch of tokens => to base URI for the respective batch of tokens.
mapping(uint256 => string) private baseURI;
/**
* @notice Returns the count of batches of NFTs.
* @dev Each batch of tokens has an in ID and an associated `baseURI`.
* See {batchIds}.
*/
function getBaseURICount() public view returns (uint256) {
return batchIds.length;
}
/**
* @notice Returns the ID for the batch of tokens the given tokenId belongs to.
* @dev See {getBaseURICount}.
* @param _index ID of a token.
*/
function getBatchIdAtIndex(uint256 _index) public view returns (uint256) {
if (_index >= getBaseURICount()) {
revert("Invalid index");
}
return batchIds[_index];
}
/// @dev Returns the id for the batch of tokens the given tokenId belongs to.
function getBatchId(uint256 _tokenId) internal view returns (uint256 batchId, uint256 index) {
uint256 numOfTokenBatches = getBaseURICount();
uint256[] memory indices = batchIds;
for (uint256 i = 0; i < numOfTokenBatches; i += 1) {
if (_tokenId < indices[i]) {
index = i;
batchId = indices[i];
return (batchId, index);
}
}
revert("Invalid tokenId");
}
/// @dev Returns the baseURI for a token. The intended metadata URI for the token is baseURI + tokenId.
function getBaseURI(uint256 _tokenId) internal view returns (string memory) {
uint256 numOfTokenBatches = getBaseURICount();
uint256[] memory indices = batchIds;
for (uint256 i = 0; i < numOfTokenBatches; i += 1) {
if (_tokenId < indices[i]) {
return baseURI[indices[i]];
}
}
revert("Invalid tokenId");
}
/// @dev Sets the base URI for the batch of tokens with the given batchId.
function _setBaseURI(uint256 _batchId, string memory _baseURI) internal {
baseURI[_batchId] = _baseURI;
}
/// @dev Mints a batch of tokenIds and associates a common baseURI to all those Ids.
function _batchMintMetadata(
uint256 _startId,
uint256 _amountToMint,
string memory _baseURIForTokens
) internal returns (uint256 nextTokenIdToMint, uint256 batchId) {
batchId = _startId + _amountToMint;
nextTokenIdToMint = batchId;
batchIds.push(batchId);
baseURI[batchId] = _baseURIForTokens;
}
}
IOwnable.sol 19 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/**
* Thirdweb's `Ownable` is a contract extension to be used with any base contract. It exposes functions for setting and reading
* who the 'owner' of the inheriting smart contract is, and lets the inheriting contract perform conditional logic that uses
* information about who the contract's owner is.
*/
interface IOwnable {
/// @dev Returns the owner of the contract.
function owner() external view returns (address);
/// @dev Lets a module admin set a new owner for the contract. The new owner must be a module admin.
function setOwner(address _newOwner) external;
/// @dev Emitted when a new Owner is set.
event OwnerUpdated(address indexed prevOwner, address indexed newOwner);
}
IRoyalty.sol 41 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "../../eip/interface/IERC2981.sol";
/**
* Thirdweb's `Royalty` is a contract extension to be used with any base contract. It exposes functions for setting and reading
* the recipient of royalty fee and the royalty fee basis points, and lets the inheriting contract perform conditional logic
* that uses information about royalty fees, if desired.
*
* The `Royalty` contract is ERC2981 compliant.
*/
interface IRoyalty is IERC2981 {
struct RoyaltyInfo {
address recipient;
uint256 bps;
}
/// @dev Returns the royalty recipient and fee bps.
function getDefaultRoyaltyInfo() external view returns (address, uint16);
/// @dev Lets a module admin update the royalty bps and recipient.
function setDefaultRoyaltyInfo(address _royaltyRecipient, uint256 _royaltyBps) external;
/// @dev Lets a module admin set the royalty recipient for a particular token Id.
function setRoyaltyInfoForToken(
uint256 tokenId,
address recipient,
uint256 bps
) external;
/// @dev Returns the royalty recipient for a particular token Id.
function getRoyaltyInfoForToken(uint256 tokenId) external view returns (address, uint16);
/// @dev Emitted when royalty info is updated.
event DefaultRoyalty(address indexed newRoyaltyRecipient, uint256 newRoyaltyBps);
/// @dev Emitted when royalty recipient for tokenId is set
event RoyaltyForToken(uint256 indexed tokenId, address indexed royaltyRecipient, uint256 royaltyBps);
}
DropSinglePhase1155.sol 276 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "./interface/IDropSinglePhase1155.sol";
import "../lib/MerkleProof.sol";
import "../lib/TWBitMaps.sol";
abstract contract DropSinglePhase1155 is IDropSinglePhase1155 {
using TWBitMaps for TWBitMaps.BitMap;
/*///////////////////////////////////////////////////////////////
Mappings
//////////////////////////////////////////////////////////////*/
/// @dev Mapping from tokenId => active claim condition for the tokenId.
mapping(uint256 => ClaimCondition) public claimCondition;
/// @dev Mapping from tokenId => active claim condition's UID.
mapping(uint256 => bytes32) private conditionId;
/**
* @dev Map from an account and uid for a claim condition, to the last timestamp
* at which the account claimed tokens under that claim condition.
*/
mapping(bytes32 => mapping(address => uint256)) private lastClaimTimestamp;
/**
* @dev Map from a claim condition uid to whether an address in an allowlist
* has already claimed tokens i.e. used their place in the allowlist.
*/
mapping(bytes32 => TWBitMaps.BitMap) private usedAllowlistSpot;
/*///////////////////////////////////////////////////////////////
Drop logic
//////////////////////////////////////////////////////////////*/
/// @dev Lets an account claim tokens.
function claim(
address _receiver,
uint256 _tokenId,
uint256 _quantity,
address _currency,
uint256 _pricePerToken,
AllowlistProof calldata _allowlistProof,
bytes memory _data
) public payable virtual override {
_beforeClaim(_tokenId, _receiver, _quantity, _currency, _pricePerToken, _allowlistProof, _data);
ClaimCondition memory condition = claimCondition[_tokenId];
bytes32 activeConditionId = conditionId[_tokenId];
/**
* We make allowlist checks (i.e. verifyClaimMerkleProof) before verifying the claim's general
* validity (i.e. verifyClaim) because we give precedence to the check of allow list quantity
* restriction over the check of the general claim condition's quantityLimitPerTransaction
* restriction.
*/
// Verify inclusion in allowlist.
(bool validMerkleProof, uint256 merkleProofIndex) = verifyClaimMerkleProof(
_tokenId,
_dropMsgSender(),
_quantity,
_allowlistProof
);
// Verify claim validity. If not valid, revert.
// when there's allowlist present --> verifyClaimMerkleProof will verify the maxQuantityInAllowlist value with hashed leaf in the allowlist
// when there's no allowlist, this check is true --> verifyClaim will check for _quantity being equal/less than the limit
bool toVerifyMaxQuantityPerTransaction = _allowlistProof.maxQuantityInAllowlist == 0 ||
condition.merkleRoot == bytes32(0);
verifyClaim(
_tokenId,
_dropMsgSender(),
_quantity,
_currency,
_pricePerToken,
toVerifyMaxQuantityPerTransaction
);
if (validMerkleProof && _allowlistProof.maxQuantityInAllowlist > 0) {
/**
* Mark the claimer's use of their position in the allowlist. A spot in an allowlist
* can be used only once.
*/
usedAllowlistSpot[activeConditionId].set(merkleProofIndex);
}
// Update contract state.
condition.supplyClaimed += _quantity;
lastClaimTimestamp[activeConditionId][_dropMsgSender()] = block.timestamp;
claimCondition[_tokenId] = condition;
// If there's a price, collect price.
collectPriceOnClaim(address(0), _quantity, _currency, _pricePerToken);
// Mint the relevant NFTs to claimer.
transferTokensOnClaim(_receiver, _tokenId, _quantity);
emit TokensClaimed(_dropMsgSender(), _receiver, _tokenId, _quantity);
_afterClaim(_tokenId, _receiver, _quantity, _currency, _pricePerToken, _allowlistProof, _data);
}
/// @dev Lets a contract admin set claim conditions.
function setClaimConditions(
uint256 _tokenId,
ClaimCondition calldata _condition,
bool _resetClaimEligibility
) external override {
if (!_canSetClaimConditions()) {
revert("Not authorized");
}
ClaimCondition memory condition = claimCondition[_tokenId];
bytes32 targetConditionId = conditionId[_tokenId];
uint256 supplyClaimedAlready = condition.supplyClaimed;
if (_resetClaimEligibility) {
supplyClaimedAlready = 0;
targetConditionId = keccak256(abi.encodePacked(_dropMsgSender(), block.number));
}
if (supplyClaimedAlready > _condition.maxClaimableSupply) {
revert("max supply claimed");
}
ClaimCondition memory updatedCondition = ClaimCondition({
startTimestamp: _condition.startTimestamp,
maxClaimableSupply: _condition.maxClaimableSupply,
supplyClaimed: supplyClaimedAlready,
quantityLimitPerTransaction: _condition.quantityLimitPerTransaction,
waitTimeInSecondsBetweenClaims: _condition.waitTimeInSecondsBetweenClaims,
merkleRoot: _condition.merkleRoot,
pricePerToken: _condition.pricePerToken,
currency: _condition.currency
});
claimCondition[_tokenId] = updatedCondition;
conditionId[_tokenId] = targetConditionId;
emit ClaimConditionUpdated(_tokenId, _condition, _resetClaimEligibility);
}
/// @dev Checks a request to claim NFTs against the active claim condition's criteria.
function verifyClaim(
uint256 _tokenId,
address _claimer,
uint256 _quantity,
address _currency,
uint256 _pricePerToken,
bool verifyMaxQuantityPerTransaction
) public view {
ClaimCondition memory currentClaimPhase = claimCondition[_tokenId];
if (_currency != currentClaimPhase.currency || _pricePerToken != currentClaimPhase.pricePerToken) {
revert("Invalid price or currency");
}
// If we're checking for an allowlist quantity restriction, ignore the general quantity restriction.
if (
_quantity == 0 ||
(verifyMaxQuantityPerTransaction && _quantity > currentClaimPhase.quantityLimitPerTransaction)
) {
revert("Invalid quantity");
}
if (currentClaimPhase.supplyClaimed + _quantity > currentClaimPhase.maxClaimableSupply) {
revert("exceeds max supply");
}
(uint256 lastClaimedAt, uint256 nextValidClaimTimestamp) = getClaimTimestamp(_tokenId, _claimer);
if (
currentClaimPhase.startTimestamp > block.timestamp ||
(lastClaimedAt != 0 && block.timestamp < nextValidClaimTimestamp)
) {
revert("cant claim yet");
}
}
/// @dev Checks whether a claimer meets the claim condition's allowlist criteria.
function verifyClaimMerkleProof(
uint256 _tokenId,
address _claimer,
uint256 _quantity,
AllowlistProof calldata _allowlistProof
) public view returns (bool validMerkleProof, uint256 merkleProofIndex) {
ClaimCondition memory currentClaimPhase = claimCondition[_tokenId];
if (currentClaimPhase.merkleRoot != bytes32(0)) {
(validMerkleProof, merkleProofIndex) = MerkleProof.verify(
_allowlistProof.proof,
currentClaimPhase.merkleRoot,
keccak256(abi.encodePacked(_claimer, _allowlistProof.maxQuantityInAllowlist))
);
if (!validMerkleProof) {
revert("not in allowlist");
}
if (usedAllowlistSpot[conditionId[_tokenId]].get(merkleProofIndex)) {
revert("proof claimed");
}
if (_allowlistProof.maxQuantityInAllowlist != 0 && _quantity > _allowlistProof.maxQuantityInAllowlist) {
revert("Invalid qty proof");
}
}
}
/// @dev Returns the timestamp for when a claimer is eligible for claiming NFTs again.
function getClaimTimestamp(uint256 _tokenId, address _claimer)
public
view
returns (uint256 lastClaimedAt, uint256 nextValidClaimTimestamp)
{
lastClaimedAt = lastClaimTimestamp[conditionId[_tokenId]][_claimer];
unchecked {
nextValidClaimTimestamp = lastClaimedAt + claimCondition[_tokenId].waitTimeInSecondsBetweenClaims;
if (nextValidClaimTimestamp < lastClaimedAt) {
nextValidClaimTimestamp = type(uint256).max;
}
}
}
/*////////////////////////////////////////////////////////////////////
Optional hooks that can be implemented in the derived contract
///////////////////////////////////////////////////////////////////*/
/// @dev Exposes the ability to override the msg sender.
function _dropMsgSender() internal virtual returns (address) {
return msg.sender;
}
/// @dev Runs before every `claim` function call.
function _beforeClaim(
uint256 _tokenId,
address _receiver,
uint256 _quantity,
address _currency,
uint256 _pricePerToken,
AllowlistProof calldata _allowlistProof,
bytes memory _data
) internal virtual {}
/// @dev Runs after every `claim` function call.
function _afterClaim(
uint256 _tokenId,
address _receiver,
uint256 _quantity,
address _currency,
uint256 _pricePerToken,
AllowlistProof calldata _allowlistProof,
bytes memory _data
) internal virtual {}
/// @dev Collects and distributes the primary sale value of NFTs being claimed.
function collectPriceOnClaim(
address _primarySaleRecipient,
uint256 _quantityToClaim,
address _currency,
uint256 _pricePerToken
) internal virtual;
/// @dev Transfers the NFTs being claimed.
function transferTokensOnClaim(
address _to,
uint256 _tokenId,
uint256 _quantityBeingClaimed
) internal virtual;
function _canSetClaimConditions() internal view virtual returns (bool);
}
ILazyMint.sol 31 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/**
* Thirdweb's `LazyMint` is a contract extension for any base NFT contract. It lets you 'lazy mint' any number of NFTs
* at once. Here, 'lazy mint' means defining the metadata for particular tokenIds of your NFT contract, without actually
* minting a non-zero balance of NFTs of those tokenIds.
*/
interface ILazyMint {
/// @dev Emitted when tokens are lazy minted.
event TokensLazyMinted(uint256 indexed startTokenId, uint256 endTokenId, string baseURI, bytes encryptedBaseURI);
/**
* @notice Lazy mints a given amount of NFTs.
*
* @param amount The number of NFTs to lazy mint.
*
* @param baseURIForTokens The base URI for the 'n' number of NFTs being lazy minted, where the metadata for each
* of those NFTs is `${baseURIForTokens}/${tokenId}`.
*
* @param extraData Additional bytes data to be used at the discretion of the consumer of the contract.
*
* @return batchId A unique integer identifier for the batch of NFTs lazy minted together.
*/
function lazyMint(
uint256 amount,
string calldata baseURIForTokens,
bytes calldata extraData
) external returns (uint256 batchId);
}
IERC1155Metadata.sol 15 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/**
Note: The ERC-165 identifier for this interface is 0x0e89341c.
*/
interface IERC1155Metadata {
/**
@notice A distinct Uniform Resource Identifier (URI) for a given token.
@dev URIs are defined in RFC 3986.
The URI may point to a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema".
@return URI string
*/
function uri(uint256 _id) external view returns (string memory);
}
IERC1155Receiver.sol 58 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev _Available since v3.1._
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
IMulticall.sol 16 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides a function to batch together multiple calls in a single external call.
*
* _Available since v4.1._
*/
interface IMulticall {
/**
* @dev Receives and executes a batch of function calls on this contract.
*/
function multicall(bytes[] calldata data) external returns (bytes[] memory results);
}
IPrimarySale.sol 19 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/**
* Thirdweb's `Primary` is a contract extension to be used with any base contract. It exposes functions for setting and reading
* the recipient of primary sales, and lets the inheriting contract perform conditional logic that uses information about
* primary sales, if desired.
*/
interface IPrimarySale {
/// @dev The adress that receives all primary sales value.
function primarySaleRecipient() external view returns (address);
/// @dev Lets a module admin set the default recipient of all primary sales.
function setPrimarySaleRecipient(address _saleRecipient) external;
/// @dev Emitted when a new sale recipient is set.
event PrimarySaleRecipientUpdated(address indexed recipient);
}
IDelayedReveal.sol 31 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/**
* Thirdweb's `DelayedReveal` is a contract extension for base NFT contracts. It lets you create batches of
* 'delayed-reveal' NFTs. You can learn more about the usage of delayed reveal NFTs here - https://blog.thirdweb.com/delayed-reveal-nfts
*/
interface IDelayedReveal {
/// @dev Emitted when tokens are revealed.
event TokenURIRevealed(uint256 indexed index, string revealedURI);
/**
* @notice Reveals a batch of delayed reveal NFTs.
*
* @param identifier The ID for the batch of delayed-reveal NFTs to reveal.
*
* @param key The key with which the base URI for the relevant batch of NFTs was encrypted.
*/
function reveal(uint256 identifier, bytes calldata key) external returns (string memory revealedURI);
/**
* @notice Performs XOR encryption/decryption.
*
* @param data The data to encrypt. In the case of delayed-reveal NFTs, this is the "revealed" state
* base URI of the relevant batch of NFTs.
*
* @param key The key with which to encrypt data
*/
function encryptDecrypt(bytes memory data, bytes calldata key) external pure returns (bytes memory result);
}
IClaimCondition.sol 52 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "../../lib/TWBitMaps.sol";
/**
* Thirdweb's 'Drop' contracts are distribution mechanisms for tokens.
*
* A contract admin (i.e. a holder of `DEFAULT_ADMIN_ROLE`) can set a series of claim conditions,
* ordered by their respective `startTimestamp`. A claim condition defines criteria under which
* accounts can mint tokens. Claim conditions can be overwritten or added to by the contract admin.
* At any moment, there is only one active claim condition.
*/
interface IClaimCondition {
/**
* @notice The criteria that make up a claim condition.
*
* @param startTimestamp The unix timestamp after which the claim condition applies.
* The same claim condition applies until the `startTimestamp`
* of the next claim condition.
*
* @param maxClaimableSupply The maximum total number of tokens that can be claimed under
* the claim condition.
*
* @param supplyClaimed At any given point, the number of tokens that have been claimed
* under the claim condition.
*
* @param quantityLimitPerTransaction The maximum number of tokens that can be claimed in a single
* transaction.
*
* @param waitTimeInSecondsBetweenClaims The least number of seconds an account must wait after claiming
* tokens, to be able to claim tokens again.
*
* @param merkleRoot The allowlist of addresses that can claim tokens under the claim
* condition.
*
* @param pricePerToken The price required to pay per token claimed.
*
* @param currency The currency in which the `pricePerToken` must be paid.
*/
struct ClaimCondition {
uint256 startTimestamp;
uint256 maxClaimableSupply;
uint256 supplyClaimed;
uint256 quantityLimitPerTransaction;
uint256 waitTimeInSecondsBetweenClaims;
bytes32 merkleRoot;
uint256 pricePerToken;
address currency;
}
}
IContractMetadata.sol 23 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
/**
* Thirdweb's `ContractMetadata` is a contract extension for any base contracts. It lets you set a metadata URI
* for you contract.
*
* Additionally, `ContractMetadata` is necessary for NFT contracts that want royalties to get distributed on OpenSea.
*/
interface IContractMetadata {
/// @dev Returns the metadata URI of the contract.
function contractURI() external view returns (string memory);
/**
* @dev Sets contract URI for the storefront-level metadata of the contract.
* Only module admin can call this function.
*/
function setContractURI(string calldata _uri) external;
/// @dev Emitted when the contract URI is updated.
event ContractURIUpdated(string prevURI, string newURI);
}
IDropSinglePhase1155.sol 60 lines
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "./IClaimCondition.sol";
interface IDropSinglePhase1155 is IClaimCondition {
struct AllowlistProof {
bytes32[] proof;
uint256 maxQuantityInAllowlist;
}
/// @dev Emitted when tokens are claimed via `claim`.
event TokensClaimed(
address indexed claimer,
address indexed receiver,
uint256 indexed tokenId,
uint256 quantityClaimed
);
/// @dev Emitted when the contract's claim conditions are updated.
event ClaimConditionUpdated(uint256 indexed tokenId, ClaimCondition condition, bool resetEligibility);
/**
* @notice Lets an account claim a given quantity of NFTs.
*
* @param tokenId The tokenId of the NFT to claim.
* @param receiver The receiver of the NFT to claim.
* @param quantity The quantity of the NFT to claim.
* @param currency The currency in which to pay for the claim.
* @param pricePerToken The price per token to pay for the claim.
* @param allowlistProof The proof of the claimer's inclusion in the merkle root allowlist
* of the claim conditions that apply.
* @param data Arbitrary bytes data that can be leveraged in the implementation of this interface.
*/
function claim(
address receiver,
uint256 tokenId,
uint256 quantity,
address currency,
uint256 pricePerToken,
AllowlistProof calldata allowlistProof,
bytes memory data
) external payable;
/**
* @notice Lets a contract admin (account with `DEFAULT_ADMIN_ROLE`) set claim conditions.
*
* @param phase Claim condition to set.
*
* @param resetClaimEligibility Whether to reset `limitLastClaimTimestamp` and `limitMerkleProofClaim` values when setting new
* claim conditions.
*
* @param tokenId The tokenId for which to set the relevant claim condition.
*/
function setClaimConditions(
uint256 tokenId,
ClaimCondition calldata phase,
bool resetClaimEligibility
) external;
}
SafeERC20.sol 99 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../../../../eip/interface/IERC20.sol";
import "../../../../lib/TWAddress.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using TWAddress for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
Read Contract
balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
claimCondition 0xe9703d25 → uint256, uint256, uint256, uint256, uint256, bytes32, uint256, address
contractURI 0xe8a3d485 → string
encryptDecrypt 0xe7150322 → bytes
encryptedData 0xa05112fc → bytes
getBaseURICount 0x63b45e2d → uint256
getBatchIdAtIndex 0x2419f51b → uint256
getClaimTimestamp 0x86ee745d → uint256, uint256
getDefaultRoyaltyInfo 0xb24f2d39 → address, uint16
getRevealURI 0x9fc4d68f → string
getRoyaltyInfoForToken 0x4cc157df → address, uint16
isApprovedForAll 0xe985e9c5 → bool
isEncryptedBatch 0x492e224b → bool
name 0x06fdde03 → string
nextTokenIdToMint 0x3b1475a7 → uint256
owner 0x8da5cb5b → address
primarySaleRecipient 0x079fe40e → address
royaltyInfo 0x2a55205a → address, uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
totalSupply 0xbd85b039 → uint256
uri 0x0e89341c → string
verifyClaim 0xafb82916
verifyClaimMerkleProof 0x1826f399 → bool, uint256
Write Contract 13 functions
These functions modify contract state and require a wallet transaction to execute.
claim 0xb177e857
address _receiver
uint256 _tokenId
uint256 _quantity
address _currency
uint256 _pricePerToken
tuple _allowlistProof
bytes _data
lazyMint 0xd37c353b
uint256 _amount
string _baseURIForTokens
bytes _data
returns: uint256
multicall 0xac9650d8
bytes[] data
returns: bytes[]
reveal 0xce805642
uint256 _index
bytes _key
returns: string
safeBatchTransferFrom 0x2eb2c2d6
address from
address to
uint256[] ids
uint256[] amounts
bytes data
safeTransferFrom 0xf242432a
address from
address to
uint256 id
uint256 amount
bytes data
setApprovalForAll 0xa22cb465
address operator
bool approved
setClaimConditions 0x6a17779b
uint256 _tokenId
tuple _condition
bool _resetClaimEligibility
setContractURI 0x938e3d7b
string _uri
setDefaultRoyaltyInfo 0x600dd5ea
address _royaltyRecipient
uint256 _royaltyBps
setOwner 0x13af4035
address _newOwner
setPrimarySaleRecipient 0x6f4f2837
address _saleRecipient
setRoyaltyInfoForToken 0x9bcf7a15
uint256 _tokenId
address _recipient
uint256 _bps
Token Balances (1)
View Transfers →Recent Transactions
No transactions found for this address