Address Contract Partially Verified
Address
0xDAEeCd365BcEc74656Bd4068879dB469e815641d
Balance
0 ETH
Nonce
1
Code Size
10336 bytes
Creator
0x1340910B...7210 at tx 0x39749479...22c554
Indexed Transactions
0 (1 on-chain, 1.3% indexed)
Contract Bytecode
10336 bytes
0x6080604052600436106102305760003560e01c8063715018a61161012e578063bd34fc57116100ab578063d5d82fac1161006f578063d5d82fac14610673578063dee816e614610689578063e985e9c51461069f578063ef81b4d4146106bf578063f2fde38b146106df57600080fd5b8063bd34fc57146105dd578063c87b56dd146105f3578063cd5d497414610613578063d26ea6c014610633578063d33814381461065357600080fd5b806395d89b41116100f257806395d89b4114610560578063a0712d6814610575578063a22cb46514610588578063b19960e6146105a8578063b88d4fde146105bd57600080fd5b8063715018a6146104d0578063853828b6146104e557806388aadd41146104fa5780638d859f3e146105275780638da5cb5b1461054257600080fd5b80632e49d78b116101bc5780635f717202116101805780635f717202146104345780636301dccf146104495780636352211e1461047d5780636548b7ae1461049d57806370a08231146104b057600080fd5b80632e49d78b146103a95780633354fe34146103c95780633f5632b0146103de57806342842e0e146103f457806355f804b31461041457600080fd5b8063163e1e6111610203578063163e1e61146102e657806318160ddd146103065780631a939bce14610329578063200d2ed21461035657806323b872dd1461038957600080fd5b806301ffc9a71461023557806306fdde031461026a578063081812fc1461028c578063095ea7b3146102c4575b600080fd5b34801561024157600080fd5b50610255610250366004612148565b6106ff565b60405190151581526020015b60405180910390f35b34801561027657600080fd5b5061027f610751565b60405161026191906121bd565b34801561029857600080fd5b506102ac6102a73660046121d0565b6107e3565b6040516001600160a01b039091168152602001610261565b3480156102d057600080fd5b506102e46102df3660046121fe565b61087d565b005b3480156102f257600080fd5b506102e461030136600461222a565b610993565b34801561031257600080fd5b5061031b610a8a565b604051908152602001610261565b34801561033557600080fd5b5061031b61034436600461229f565b600c6020526000908152604090205481565b34801561036257600080fd5b50600e5461037790600160a01b900460ff1681565b60405160ff9091168152602001610261565b34801561039557600080fd5b506102e46103a43660046122bc565b610aae565b3480156103b557600080fd5b506102e46103c43660046122fd565b610adf565b3480156103d557600080fd5b5061031b60a081565b3480156103ea57600080fd5b5061031b600a5481565b34801561040057600080fd5b506102e461040f3660046122bc565b610b29565b34801561042057600080fd5b506102e461042f366004612320565b610b44565b34801561044057600080fd5b5061031b610b7a565b34801561045557600080fd5b5061031b7f940a52669dc9fded2f965dea80d65bf40e8f29bcf1a4a3258a2c387da1b99cd981565b34801561048957600080fd5b506102ac6104983660046121d0565b610b8a565b6102e46104ab366004612423565b610c01565b3480156104bc57600080fd5b5061031b6104cb36600461229f565b610dca565b3480156104dc57600080fd5b506102e4610e51565b3480156104f157600080fd5b506102e4610e87565b34801561050657600080fd5b5061031b61051536600461229f565b600d6020526000908152604090205481565b34801561053357600080fd5b5061031b66c3663566a5800081565b34801561054e57600080fd5b506000546001600160a01b03166102ac565b34801561056c57600080fd5b5061027f610f19565b6102e46105833660046121d0565b610f28565b34801561059457600080fd5b506102e46105a336600461247d565b6110dc565b3480156105b457600080fd5b5061031b601481565b3480156105c957600080fd5b506102e46105d83660046124bb565b6111a1565b3480156105e957600080fd5b5061031b600b5481565b3480156105ff57600080fd5b5061027f61060e3660046121d0565b6111d3565b34801561061f57600080fd5b506102ac61062e36600461250f565b6112ae565b34801561063f57600080fd5b506102e461064e36600461229f565b611336565b34801561065f57600080fd5b506102e461066e36600461229f565b611382565b34801561067f57600080fd5b5061031b60095481565b34801561069557600080fd5b5061031b613e8081565b3480156106ab57600080fd5b506102556106ba36600461255a565b6113ce565b3480156106cb57600080fd5b506007546102ac906001600160a01b031681565b3480156106eb57600080fd5b506102e46106fa36600461229f565b61149c565b60006001600160e01b031982166380ac58cd60e01b148061073057506001600160e01b03198216635b5e139f60e01b145b8061074b57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606001805461076090612588565b80601f016020809104026020016040519081016040528092919081815260200182805461078c90612588565b80156107d95780601f106107ae576101008083540402835291602001916107d9565b820191906000526020600020905b8154815290600101906020018083116107bc57829003601f168201915b5050505050905090565b6000818152600360205260408120546001600160a01b03166108615760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600560205260409020546001600160a01b031690565b600061088882610b8a565b9050806001600160a01b0316836001600160a01b031614156108f65760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610858565b336001600160a01b0382161480610912575061091281336113ce565b6109845760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610858565b61098e8383611534565b505050565b6000546001600160a01b031633146109bd5760405162461bcd60e51b8152600401610858906125c3565b600b5460a0906109ce90839061260e565b1115610a055760405162461bcd60e51b8152600401610858906020808252600490820152634d41584760e01b604082015260600190565b6000610a0f610a8a565b905082829050600b6000828254610a26919061260e565b90915550600090505b82811015610a8457610a72848483818110610a4c57610a4c612626565b9050602002016020810190610a61919061229f565b610a6a8461263c565b9350836115a2565b80610a7c8161263c565b915050610a2f565b50505050565b6000600b54600a54600954610a9f919061260e565b610aa9919061260e565b905090565b610ab833826116e4565b610ad45760405162461bcd60e51b815260040161085890612657565b61098e8383836117b3565b6000546001600160a01b03163314610b095760405162461bcd60e51b8152600401610858906125c3565b600e805460ff909216600160a01b0260ff60a01b19909216919091179055565b61098e838383604051806020016040528060008152506111a1565b6000546001600160a01b03163314610b6e5760405162461bcd60e51b8152600401610858906125c3565b61098e60088383612099565b610b8760a0613e806126a8565b81565b6000818152600360205260408120546001600160a01b03168061074b5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610858565b600e54600160a01b900460ff16600114610c465760405162461bcd60e51b815260040161085890602080825260049082015263434c4f5360e01b604082015260600190565b610c5360a0613e806126a8565b84600a54600954610c64919061260e565b610c6e919061260e565b1115610ca55760405162461bcd60e51b8152600401610858906020808252600490820152631350561360e21b604082015260600190565b6007546001600160a01b0316610cbd338585856112ae565b6001600160a01b031614610cfc5760405162461bcd60e51b81526004016108589060208082526004908201526329a4a3a760e11b604082015260600190565b336000908152600c60205260409020548390610d1990869061260e565b1115610d505760405162461bcd60e51b8152600401610858906020808252600490820152634d41585360e01b604082015260600190565b6000610d5a610a8a565b90508460096000828254610d6e919061260e565b9091555050336000908152600c602052604081208054879290610d9290849061260e565b90915550600090505b85811015610dc257610db033610a6a8461263c565b80610dba8161263c565b915050610d9b565b505050505050565b60006001600160a01b038216610e355760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610858565b506001600160a01b031660009081526004602052604090205490565b6000546001600160a01b03163314610e7b5760405162461bcd60e51b8152600401610858906125c3565b610e856000611953565b565b6000546001600160a01b03163314610eb15760405162461bcd60e51b8152600401610858906125c3565b60004711610eea5760405162461bcd60e51b8152600401610858906020808252600490820152635a45524f60e01b604082015260600190565b60405133904780156108fc02916000818181858888f19350505050158015610f16573d6000803e3d6000fd5b50565b60606002805461076090612588565b600e54600160a01b900460ff16600214610f6d5760405162461bcd60e51b815260040161085890602080825260049082015263434c4f5360e01b604082015260600190565b610f7a60a0613e806126a8565b81600a54600954610f8b919061260e565b610f95919061260e565b1115610fcc5760405162461bcd60e51b8152600401610858906020808252600490820152631350561360e21b604082015260600190565b336000908152600d6020526040902054601490610fea90839061260e565b11156110215760405162461bcd60e51b81526004016108589060208082526004908201526304d4158560e41b604082015260600190565b6110328166c3663566a580006126bf565b34101561106a5760405162461bcd60e51b8152600401610858906020808252600490820152630a68aa8960e31b604082015260600190565b6000611074610a8a565b905081600a6000828254611088919061260e565b9091555050336000908152600d6020526040812080548492906110ac90849061260e565b90915550600090505b8281101561098e576110ca33610a6a8461263c565b806110d48161263c565b9150506110b5565b6001600160a01b0382163314156111355760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610858565b3360008181526006602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6111ab33836116e4565b6111c75760405162461bcd60e51b815260040161085890612657565b610a84848484846119a3565b6000818152600360205260409020546060906001600160a01b03166112525760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610858565b600061125c6119d6565b9050600081511161127c57604051806020016040528060008152506112a7565b80611286846119e5565b6040516020016112979291906126de565b6040516020818303038152906040525b9392505050565b604080517f940a52669dc9fded2f965dea80d65bf40e8f29bcf1a4a3258a2c387da1b99cd960208201526001600160a01b038616918101919091526060810184905260808101839052600090819061131e9060a00160405160208183030381529060405280519060200120611ae3565b905061132a8184611b31565b9150505b949350505050565b6000546001600160a01b031633146113605760405162461bcd60e51b8152600401610858906125c3565b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146113ac5760405162461bcd60e51b8152600401610858906125c3565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b600e5460405163c455279160e01b81526001600160a01b03848116600483015260009281169190841690829063c45527919060240160206040518083038186803b15801561141b57600080fd5b505afa15801561142f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611453919061270d565b6001600160a01b0316141561146c57600191505061074b565b50506001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b6000546001600160a01b031633146114c65760405162461bcd60e51b8152600401610858906125c3565b6001600160a01b03811661152b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610858565b610f1681611953565b600081815260056020526040902080546001600160a01b0319166001600160a01b038416908117909155819061156982610b8a565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6001600160a01b0382166115f85760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610858565b6000818152600360205260409020546001600160a01b03161561165d5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610858565b6001600160a01b038216600090815260046020526040812080546001929061168690849061260e565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000818152600360205260408120546001600160a01b031661175d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610858565b600061176883610b8a565b9050806001600160a01b0316846001600160a01b031614806117a35750836001600160a01b0316611798846107e3565b6001600160a01b0316145b8061132e575061132e81856113ce565b826001600160a01b03166117c682610b8a565b6001600160a01b03161461182e5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610858565b6001600160a01b0382166118905760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610858565b61189b600082611534565b6001600160a01b03831660009081526004602052604081208054600192906118c49084906126a8565b90915550506001600160a01b03821660009081526004602052604081208054600192906118f290849061260e565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6119ae8484846117b3565b6119ba84848484611b55565b610a845760405162461bcd60e51b81526004016108589061272a565b60606008805461076090612588565b606081611a095750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611a335780611a1d8161263c565b9150611a2c9050600a83612792565b9150611a0d565b60008167ffffffffffffffff811115611a4e57611a4e612380565b6040519080825280601f01601f191660200182016040528015611a78576020820181803683370190505b5090505b841561132e57611a8d6001836126a8565b9150611a9a600a866127a6565b611aa590603061260e565b60f81b818381518110611aba57611aba612626565b60200101906001600160f81b031916908160001a905350611adc600a86612792565b9450611a7c565b600061074b611af0611c5f565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000806000611b408585611d52565b91509150611b4d81611dc2565b509392505050565b60006001600160a01b0384163b15611c5757604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611b999033908990889088906004016127ba565b602060405180830381600087803b158015611bb357600080fd5b505af1925050508015611be3575060408051601f3d908101601f19168201909252611be0918101906127f7565b60015b611c3d573d808015611c11576040519150601f19603f3d011682016040523d82523d6000602084013e611c16565b606091505b508051611c355760405162461bcd60e51b81526004016108589061272a565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061132e565b50600161132e565b60007f0000000000000000000000000000000000000000000000000000000000000001461415611cae57507f209eb13204557c3503e5697614a61dcff4daa8d2ff2a5ddfa8ccdf961368722990565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f7a3778d0c17d7964e88f23b35cfbac640120b993ca1f55ebe8ebee35f0a91ddc828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b600080825160411415611d895760208301516040840151606085015160001a611d7d87828585611f7d565b94509450505050611dbb565b825160401415611db35760208301516040840151611da886838361206a565b935093505050611dbb565b506000905060025b9250929050565b6000816004811115611dd657611dd6612814565b1415611ddf5750565b6001816004811115611df357611df3612814565b1415611e415760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610858565b6002816004811115611e5557611e55612814565b1415611ea35760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610858565b6003816004811115611eb757611eb7612814565b1415611f105760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610858565b6004816004811115611f2457611f24612814565b1415610f165760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610858565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611fb45750600090506003612061565b8460ff16601b14158015611fcc57508460ff16601c14155b15611fdd5750600090506004612061565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612031573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661205a57600060019250925050612061565b9150600090505b94509492505050565b6000806001600160ff1b03831660ff84901c601b0161208b87828885611f7d565b935093505050935093915050565b8280546120a590612588565b90600052602060002090601f0160209004810192826120c7576000855561210d565b82601f106120e05782800160ff1982351617855561210d565b8280016001018555821561210d579182015b8281111561210d5782358255916020019190600101906120f2565b5061211992915061211d565b5090565b5b80821115612119576000815560010161211e565b6001600160e01b031981168114610f1657600080fd5b60006020828403121561215a57600080fd5b81356112a781612132565b60005b83811015612180578181015183820152602001612168565b83811115610a845750506000910152565b600081518084526121a9816020860160208601612165565b601f01601f19169290920160200192915050565b6020815260006112a76020830184612191565b6000602082840312156121e257600080fd5b5035919050565b6001600160a01b0381168114610f1657600080fd5b6000806040838503121561221157600080fd5b823561221c816121e9565b946020939093013593505050565b6000806020838503121561223d57600080fd5b823567ffffffffffffffff8082111561225557600080fd5b818501915085601f83011261226957600080fd5b81358181111561227857600080fd5b8660208260051b850101111561228d57600080fd5b60209290920196919550909350505050565b6000602082840312156122b157600080fd5b81356112a7816121e9565b6000806000606084860312156122d157600080fd5b83356122dc816121e9565b925060208401356122ec816121e9565b929592945050506040919091013590565b60006020828403121561230f57600080fd5b813560ff811681146112a757600080fd5b6000806020838503121561233357600080fd5b823567ffffffffffffffff8082111561234b57600080fd5b818501915085601f83011261235f57600080fd5b81358181111561236e57600080fd5b86602082850101111561228d57600080fd5b634e487b7160e01b600052604160045260246000fd5b600082601f8301126123a757600080fd5b813567ffffffffffffffff808211156123c2576123c2612380565b604051601f8301601f19908116603f011681019082821181831017156123ea576123ea612380565b8160405283815286602085880101111561240357600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561243957600080fd5b843593506020850135925060408501359150606085013567ffffffffffffffff81111561246557600080fd5b61247187828801612396565b91505092959194509250565b6000806040838503121561249057600080fd5b823561249b816121e9565b9150602083013580151581146124b057600080fd5b809150509250929050565b600080600080608085870312156124d157600080fd5b84356124dc816121e9565b935060208501356124ec816121e9565b925060408501359150606085013567ffffffffffffffff81111561246557600080fd5b6000806000806080858703121561252557600080fd5b8435612530816121e9565b93506020850135925060408501359150606085013567ffffffffffffffff81111561246557600080fd5b6000806040838503121561256d57600080fd5b8235612578816121e9565b915060208301356124b0816121e9565b600181811c9082168061259c57607f821691505b602082108114156125bd57634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008219821115612621576126216125f8565b500190565b634e487b7160e01b600052603260045260246000fd5b6000600019821415612650576126506125f8565b5060010190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6000828210156126ba576126ba6125f8565b500390565b60008160001904831182151516156126d9576126d96125f8565b500290565b600083516126f0818460208801612165565b835190830190612704818360208801612165565b01949350505050565b60006020828403121561271f57600080fd5b81516112a7816121e9565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b6000826127a1576127a161277c565b500490565b6000826127b5576127b561277c565b500690565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906127ed90830184612191565b9695505050505050565b60006020828403121561280957600080fd5b81516112a781612132565b634e487b7160e01b600052602160045260246000fdfea2646970667358221220b2f83ea8952403e62f10ce410d610e70d9dde2cbf55c53708991b2d4dcb8f9a264736f6c63430008090033
Verified Source Code Partial Match
Compiler: v0.8.9+commit.e5eed63a
EVM: london
Optimization: Yes (200 runs)
MASAC.sol 147 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
contract OwnableDelegateProxy {}
contract ProxyRegistry {
mapping(address => OwnableDelegateProxy) public proxies;
}
contract MASAC is Ownable, ERC721, EIP712 {
bytes32 public constant WHITELIST_TYPEHASH =
keccak256("Whitelist(address buyer,uint256 signedQty,uint256 nonce)");
address public whitelistSigner;
uint256 public constant TOTAL_MAX_QTY = 16000;
uint256 public constant GIFT_MAX_QTY = 160;
uint256 public constant TOTAL_MINT_MAX_QTY = TOTAL_MAX_QTY - GIFT_MAX_QTY;
uint256 public constant PRICE = 0.055 ether;
uint256 public constant MAX_MINT_PER_WALLET = 20;
string private _tokenBaseURI;
uint256 public claimedQty = 0;
uint256 public mintedQty = 0;
uint256 public giftedQty = 0;
mapping(address => uint256) public claimerToTokenQty;
mapping(address => uint256) public minterToTokenQty;
address proxyRegistryAddress;
uint8 public status = 0; // 0: closed, 1: claim phase, 2: public mint phase
constructor()
ERC721("Mutant Anatomy Science Ape Club", "MASAC")
EIP712("MASAC", "1")
{}
function setWhitelistSigner(address _address) external onlyOwner {
whitelistSigner = _address;
}
function getSigner(
address _buyer,
uint256 _signedQty,
uint256 _nonce,
bytes memory _signature
) public view returns (address) {
bytes32 digest = _hashTypedDataV4(
keccak256(
abi.encode(WHITELIST_TYPEHASH, _buyer, _signedQty, _nonce)
)
);
return ECDSA.recover(digest, _signature);
}
function totalSupply() public view returns (uint256) {
return claimedQty + mintedQty + giftedQty;
}
function claim(
uint256 _mintQty,
uint256 _signedQty,
uint256 _nonce,
bytes memory _signature
) external payable {
require(status == 1, "CLOS");
require(claimedQty + mintedQty + _mintQty <= TOTAL_MINT_MAX_QTY, "MAXL");
require(
getSigner(msg.sender, _signedQty, _nonce, _signature) ==
whitelistSigner,
"SIGN"
);
require(claimerToTokenQty[msg.sender] + _mintQty <= _signedQty, "MAXS");
uint256 totalSupplyBefore = totalSupply();
claimedQty += _mintQty;
claimerToTokenQty[msg.sender] += _mintQty;
for (uint256 i = 0; i < _mintQty; i++) {
_mint(msg.sender, ++totalSupplyBefore);
}
}
function mint(uint256 _mintQty) external payable {
require(status == 2, "CLOS");
require(claimedQty + mintedQty + _mintQty <= TOTAL_MINT_MAX_QTY, "MAXL");
require(
minterToTokenQty[msg.sender] + _mintQty <= MAX_MINT_PER_WALLET,
"MAXP"
);
require(msg.value >= PRICE * _mintQty, "SETH");
uint256 totalSupplyBefore = totalSupply();
mintedQty += _mintQty;
minterToTokenQty[msg.sender] += _mintQty;
for (uint256 i = 0; i < _mintQty; i++) {
_mint(msg.sender, ++totalSupplyBefore);
}
}
function gift(address[] calldata receivers) external onlyOwner {
require(giftedQty + receivers.length <= GIFT_MAX_QTY, "MAXG");
uint256 totalSupplyBefore = totalSupply();
giftedQty += receivers.length;
for (uint256 i = 0; i < receivers.length; i++) {
_mint(receivers[i], ++totalSupplyBefore);
}
}
function withdrawAll() external onlyOwner {
require(address(this).balance > 0, "ZERO");
payable(msg.sender).transfer(address(this).balance);
}
function setStatus(uint8 _code) external onlyOwner {
status = _code;
}
// rinkeby: 0xf57b2c51ded3a29e6891aba85459d600256cf317
// mainnet: 0xa5409ec958c83c3f309868babaca7c86dcb077c1
function setProxyRegistryAddress(address proxyAddress) external onlyOwner {
proxyRegistryAddress = proxyAddress;
}
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
function setBaseURI(string calldata URI) external onlyOwner {
_tokenBaseURI = URI;
}
function _baseURI() internal view override(ERC721) returns (string memory) {
return _tokenBaseURI;
}
}
Address.sol 216 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 23 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Strings.sol 66 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
Ownable.sol 71 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
ERC721.sol 411 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata extension, but not including the Enumerable extension, which is available separately as
* {ERC721Enumerable}.
*/
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to owner address
mapping(uint256 => address) private _owners;
// Mapping owner address to token count
mapping(address => uint256) private _balances;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
/**
* @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: balance query for the zero address");
return _balances[owner];
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _owners[tokenId];
require(owner != address(0), "ERC721: owner query for nonexistent token");
return owner;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
string memory baseURI = _baseURI();
return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(operator != _msgSender(), "ERC721: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* `_data` is additional data, it has no specified format and it is sent in call to `to`.
*
* This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
* implement alternative mechanisms to perform token transfer, such as signature-based.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeTransfer(
address from,
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
* and stop existing when they are burned (`_burn`).
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return _owners[tokenId] != address(0);
}
/**
* @dev Returns whether `spender` is allowed to manage `tokenId`.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
require(_exists(tokenId), "ERC721: operator query for nonexistent token");
address owner = ERC721.ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
/**
* @dev Safely mints `tokenId` and transfers it to `to`.
*
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function _safeMint(address to, uint256 tokenId) internal virtual {
_safeMint(to, tokenId, "");
}
/**
* @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
* forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
*/
function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Mints `tokenId` and transfers it to `to`.
*
* WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
*
* Requirements:
*
* - `tokenId` must not exist.
* - `to` cannot be the zero address.
*
* Emits a {Transfer} event.
*/
function _mint(address to, uint256 tokenId) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId);
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
// Clear approvals
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
* As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
require(to != address(0), "ERC721: transfer to the zero address");
_beforeTokenTransfer(from, to, tokenId);
// Clear approvals from the previous owner
_approve(address(0), tokenId);
_balances[from] -= 1;
_balances[to] += 1;
_owners[tokenId] = to;
emit Transfer(from, to, tokenId);
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, ``from``'s `tokenId` will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
IERC721.sol 142 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
ECDSA.sol 219 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s;
uint8 v;
assembly {
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 27)
}
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}
ERC165.sol 28 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
draft-EIP712.sol 101 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./ECDSA.sol";
/**
* @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
*
* The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
* thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
* they need in their contracts using a combination of `abi.encode` and `keccak256`.
*
* This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as efficient as possible while still properly updating
* the chain id to protect against replay attacks on an eventual fork of the chain.
*
* NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
* https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
*
* _Available since v3.4._
*/
abstract contract EIP712 {
/* solhint-disable var-name-mixedcase */
// Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
// invalidate the cached domain separator if the chain id changes.
bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
uint256 private immutable _CACHED_CHAIN_ID;
bytes32 private immutable _HASHED_NAME;
bytes32 private immutable _HASHED_VERSION;
bytes32 private immutable _TYPE_HASH;
/* solhint-enable var-name-mixedcase */
/**
* @dev Initializes the domain separator and parameter caches.
*
* The meaning of `name` and `version` is specified in
* https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
*
* - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
* - `version`: the current major version of the signing domain.
*
* NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
* contract upgrade].
*/
constructor(string memory name, string memory version) {
bytes32 hashedName = keccak256(bytes(name));
bytes32 hashedVersion = keccak256(bytes(version));
bytes32 typeHash = keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
);
_HASHED_NAME = hashedName;
_HASHED_VERSION = hashedVersion;
_CACHED_CHAIN_ID = block.chainid;
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
_TYPE_HASH = typeHash;
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() internal view returns (bytes32) {
if (block.chainid == _CACHED_CHAIN_ID) {
return _CACHED_DOMAIN_SEPARATOR;
} else {
return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
}
}
function _buildDomainSeparator(
bytes32 typeHash,
bytes32 nameHash,
bytes32 versionHash
) private view returns (bytes32) {
return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
}
/**
* @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
* function returns the hash of the fully encoded EIP712 message for this domain.
*
* This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
*
* ```solidity
* bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
* keccak256("Mail(address to,string contents)"),
* mailTo,
* keccak256(bytes(mailContents))
* )));
* address signer = ECDSA.recover(digest, signature);
* ```
*/
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
}
}
IERC721Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
Read Contract
GIFT_MAX_QTY 0x3354fe34 → uint256
MAX_MINT_PER_WALLET 0xb19960e6 → uint256
PRICE 0x8d859f3e → uint256
TOTAL_MAX_QTY 0xdee816e6 → uint256
TOTAL_MINT_MAX_QTY 0x5f717202 → uint256
WHITELIST_TYPEHASH 0x6301dccf → bytes32
balanceOf 0x70a08231 → uint256
claimedQty 0xd5d82fac → uint256
claimerToTokenQty 0x1a939bce → uint256
getApproved 0x081812fc → address
getSigner 0xcd5d4974 → address
giftedQty 0xbd34fc57 → uint256
isApprovedForAll 0xe985e9c5 → bool
mintedQty 0x3f5632b0 → uint256
minterToTokenQty 0x88aadd41 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
status 0x200d2ed2 → uint8
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
whitelistSigner 0xef81b4d4 → address
Write Contract 15 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
claim 0x6548b7ae
uint256 _mintQty
uint256 _signedQty
uint256 _nonce
bytes _signature
gift 0x163e1e61
address[] receivers
mint 0xa0712d68
uint256 _mintQty
renounceOwnership 0x715018a6
No parameters
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setBaseURI 0x55f804b3
string URI
setProxyRegistryAddress 0xd26ea6c0
address proxyAddress
setStatus 0x2e49d78b
uint8 _code
setWhitelistSigner 0xd3381438
address _address
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdrawAll 0x853828b6
No parameters
Recent Transactions
This address has 1 on-chain transactions, but only 1.3% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →