Address Contract Partially Verified
Address
0xF220dB48F0d3ca8a9833E0353e7497dbceAe7aC6
Balance
0 ETH
Nonce
1
Code Size
17164 bytes
Creator
0x8D53ca00...4Bb8 at tx 0x5e89578a...e91cee
Indexed Transactions
0
Contract Bytecode
17164 bytes
0x6080604052600436106103f95760003560e01c80638d32acc41161020d578063bcac525311610128578063dee816e6116100bb578063e8a3d4851161008a578063ef81b4d41161006f578063ef81b4d414610b3b578063f2fde38b14610b5b578063f85a936c14610b7b57600080fd5b8063e8a3d48514610add578063e985e9c514610af257600080fd5b8063dee816e614610a89578063e47f600614610a9f578063e6c3819c14610ab2578063e74497f314610ac857600080fd5b8063c87b56dd116100f7578063c87b56dd14610a09578063cd5d497414610a29578063d338143814610a49578063d4b70b8d14610a6957600080fd5b8063bcac5253146109b0578063bd34fc57146109c6578063c0e2224a1461053a578063c5373376146109dc57600080fd5b8063a6d5575c116101a0578063b4576cd11161016f578063b4576cd11461094a578063b5545a3c14610965578063b88d4fde1461097a578063ba06645a1461099a57600080fd5b8063a6d5575c146108ea578063ab20745f1461090a578063ae4384f114610920578063b35c0b021461093557600080fd5b806395d89b41116101dc57806395d89b411461088a57806398d5fdca1461089f5780639c123661146108b4578063a22cb465146108ca57600080fd5b80638d32acc41461080c5780638da5cb5b1461081f5780638f7be8f21461083d578063938e3d7b1461086a57600080fd5b80634371f733116103185780635e1760c1116102ab5780636c7d5f001161027a578063715018a61161025f578063715018a6146107c2578063853828b6146107d757806389885049146107ec57600080fd5b80636c7d5f001461078257806370a08231146107a257600080fd5b80635e1760c1146106f857806360869d9b1461070e5780636301dccf1461072e5780636352211e1461076257600080fd5b80634f6ccce7116102e75780634f6ccce71461068f57806355f804b3146106af57806358646196146106cf5780635ab5189c146106e557600080fd5b80634371f7331461061057806344bed146146106265780634da470b2146106535780634dbf4fb71461066f57600080fd5b806318160ddd116103905780632f4a23091161035f5780632f4a2309146105a45780632f745c59146105ba5780633354fe34146105da57806342842e0e146105f057600080fd5b806318160ddd146105255780632267d4e71461053a57806323b872dd1461054f5780632b4519fb1461056f57600080fd5b8063081812fc116103cc578063081812fc1461048f578063095ea7b3146104c75780630ed6ff45146104e9578063163e1e611461050557600080fd5b806301be98ea146103fe57806301ffc9a714610427578063063bbe161461045757806306fdde031461046d575b600080fd5b34801561040a57600080fd5b5061041460035481565b6040519081526020015b60405180910390f35b34801561043357600080fd5b50610447610442366004613b72565b610b91565b604051901515815260200161041e565b34801561046357600080fd5b5061041460015481565b34801561047957600080fd5b50610482610bed565b60405161041e9190613c05565b34801561049b57600080fd5b506104af6104aa366004613c18565b610c7f565b6040516001600160a01b03909116815260200161041e565b3480156104d357600080fd5b506104e76104e2366004613c4d565b610d2a565b005b3480156104f557600080fd5b506104146703782dace9d9000081565b34801561051157600080fd5b506104e7610520366004613c77565b610e5b565b34801561053157600080fd5b50600f54610414565b34801561054657600080fd5b50610414600281565b34801561055b57600080fd5b506104e761056a366004613cec565b610fed565b34801561057b57600080fd5b5061058f61058a366004613c4d565b611074565b6040805192835260208301919091520161041e565b3480156105b057600080fd5b5061041460145481565b3480156105c657600080fd5b506104146105d5366004613c4d565b6110b0565b3480156105e657600080fd5b5061041460135481565b3480156105fc57600080fd5b506104e761060b366004613cec565b611158565b34801561061c57600080fd5b50610414601a5481565b34801561063257600080fd5b50610414610641366004613d28565b60176020526000908152604090205481565b34801561065f57600080fd5b506104146706f05b59d3b2000081565b34801561067b57600080fd5b506104e761068a366004613d43565b611173565b34801561069b57600080fd5b506104146106aa366004613c18565b61124e565b3480156106bb57600080fd5b506104e76106ca366004613d65565b6112f2565b3480156106db57600080fd5b5061041460155481565b6104e76106f3366004613e9f565b611358565b34801561070457600080fd5b5061041460045481565b34801561071a57600080fd5b506104e7610729366004613c18565b6115a9565b34801561073a57600080fd5b506104147f940a52669dc9fded2f965dea80d65bf40e8f29bcf1a4a3258a2c387da1b99cd981565b34801561076e57600080fd5b506104af61077d366004613c18565b611608565b34801561078e57600080fd5b506104e761079d366004613d43565b611693565b3480156107ae57600080fd5b506104146107bd366004613d28565b61176e565b3480156107ce57600080fd5b506104e7611808565b3480156107e357600080fd5b506104e761186e565b3480156107f857600080fd5b50610414610807366004613d28565b61196d565b6104e761081a366004613e9f565b611a72565b34801561082b57600080fd5b506000546001600160a01b03166104af565b34801561084957600080fd5b50610414610858366004613d28565b60186020526000908152604090205481565b34801561087657600080fd5b506104e7610885366004613d65565b611ccd565b34801561089657600080fd5b50610482611d33565b3480156108ab57600080fd5b50610414611d42565b3480156108c057600080fd5b50610414601c5481565b3480156108d657600080fd5b506104e76108e5366004613eef565b611de3565b3480156108f657600080fd5b506104e7610905366004613c18565b611df2565b34801561091657600080fd5b5061041460025481565b34801561092c57600080fd5b50610447611e51565b34801561094157600080fd5b50610447611e69565b34801561095657600080fd5b506104146658d15e1762800081565b34801561097157600080fd5b506104e7611e9d565b34801561098657600080fd5b506104e7610995366004613f2b565b611fe6565b3480156109a657600080fd5b5061041461070881565b3480156109bc57600080fd5b50610414601b5481565b3480156109d257600080fd5b50610414601d5481565b3480156109e857600080fd5b506104146109f7366004613d28565b60166020526000908152604090205481565b348015610a1557600080fd5b50610482610a24366004613c18565b612074565b348015610a3557600080fd5b506104af610a44366004613f93565b61215d565b348015610a5557600080fd5b506104e7610a64366004613d28565b6121e5565b348015610a7557600080fd5b506104e7610a84366004613c18565b612279565b348015610a9557600080fd5b50610414613cc381565b6104e7610aad366004613e9f565b6122d8565b348015610abe57600080fd5b5061041460055481565b348015610ad457600080fd5b506104476125dc565b348015610ae957600080fd5b50610482612610565b348015610afe57600080fd5b50610447610b0d366004613fdc565b6001600160a01b039182166000908152600c6020908152604080832093909416825291909152205460ff1690565b348015610b4757600080fd5b506006546104af906001600160a01b031681565b348015610b6757600080fd5b506104e7610b76366004613d28565b61261f565b348015610b8757600080fd5b50610414610fa081565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f780e9d63000000000000000000000000000000000000000000000000000000001480610be75750610be7826126fe565b92915050565b606060078054610bfc9061400f565b80601f0160208091040260200160405190810160405280929190818152602001828054610c289061400f565b8015610c755780601f10610c4a57610100808354040283529160200191610c75565b820191906000526020600020905b815481529060010190602001808311610c5857829003601f168201915b5050505050905090565b6000818152600960205260408120546001600160a01b0316610d0e5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e000000000000000000000000000000000000000060648201526084015b60405180910390fd5b506000908152600b60205260409020546001600160a01b031690565b6000610d3582611608565b9050806001600160a01b0316836001600160a01b031603610dbe5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152608401610d05565b336001600160a01b0382161480610dda5750610dda8133610b0d565b610e4c5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610d05565b610e5683836127e1565b505050565b6000546001600160a01b03163314610eb55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d05565b613cc382829050601c54601b54601a54610ecf9190614091565b610ed99190614091565b610ee39190614091565b1115610f315760405162461bcd60e51b815260206004820152601660248201527f45786365656420746f74616c206d6178206c696d6974000000000000000000006044820152606401610d05565b601354601d54610f42908390614091565b1115610f905760405162461bcd60e51b815260206004820152601560248201527f4578636565642067696674206d6178206c696d697400000000000000000000006044820152606401610d05565b601d54610f9e908290614091565b601d5560005b81811015610e5657610fdb838383818110610fc157610fc16140a9565b9050602002016020810190610fd69190613d28565b612867565b80610fe5816140d8565b915050610fa4565b610ff73382612889565b6110695760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610d05565b610e5683838361298d565b6019602052816000526040600020818154811061109057600080fd5b600091825260209091206002909102018054600190910154909250905082565b60006110bb8361176e565b821061112f5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201527f74206f6620626f756e64730000000000000000000000000000000000000000006064820152608401610d05565b506001600160a01b03919091166000908152600d60209081526040808320938352929052205490565b610e5683838360405180602001604052806000815250611fe6565b6000546001600160a01b031633146111cd5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d05565b818110156112435760405162461bcd60e51b815260206004820152602860248201527f456e642074696d652073686f756c64206265206c61746572207468616e20737460448201527f6172742074696d650000000000000000000000000000000000000000000000006064820152608401610d05565b600391909155600455565b6000611259600f5490565b82106112cd5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201527f7574206f6620626f756e647300000000000000000000000000000000000000006064820152608401610d05565b600f82815481106112e0576112e06140a9565b90600052602060002001549050919050565b6000546001600160a01b0316331461134c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d05565b610e5660128383613a8d565b611360611e51565b6113ac5760405162461bcd60e51b815260206004820152601c60248201527f5075626c69632053616c65206973206e6f7420616374697661746564000000006044820152606401610d05565b6006548390839083906001600160a01b03166113ca3385858561215d565b6001600160a01b0316146114205760405162461bcd60e51b815260206004820152601c60248201527f57686974656c6973743a20496e76616c6964207369676e6174757265000000006044820152606401610d05565b613cc3601354601c54601b54601a546114399190614091565b6114439190614091565b61144d9190614091565b1061149a5760405162461bcd60e51b815260206004820152601660248201527f4578636565642073616c6573206d6178206c696d6974000000000000000000006044820152606401610d05565b6015543410156114ec5760405162461bcd60e51b815260206004820152601060248201527f496e73756666696369656e7420455448000000000000000000000000000000006044820152606401610d05565b3360009081526018602052604090205460029061150a906001614091565b11156115585760405162461bcd60e51b815260206004820152601a60248201527f457863656564206d6178206d696e7420706572206d696e7465720000000000006044820152606401610d05565b336000908152601860205260408120805460019290611578908490614091565b925050819055506001601c60008282546115929190614091565b909155506115a1905033612867565b505050505050565b6000546001600160a01b031633146116035760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d05565b600555565b6000818152600960205260408120546001600160a01b031680610be75760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e00000000000000000000000000000000000000000000006064820152608401610d05565b6000546001600160a01b031633146116ed5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d05565b818110156117635760405162461bcd60e51b815260206004820152602860248201527f456e642074696d652073686f756c64206265206c61746572207468616e20737460448201527f6172742074696d650000000000000000000000000000000000000000000000006064820152608401610d05565b600191909155600255565b60006001600160a01b0382166117ec5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f2061646472657373000000000000000000000000000000000000000000006064820152608401610d05565b506001600160a01b03166000908152600a602052604090205490565b6000546001600160a01b031633146118625760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d05565b61186c6000612b7d565b565b6000546001600160a01b031633146118c85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d05565b6000471161193e5760405162461bcd60e51b815260206004820152602260248201527f5769746864726177626c653a204e6f20616d6f756e7420746f2077697468647260448201527f61770000000000000000000000000000000000000000000000000000000000006064820152608401610d05565b60405133904780156108fc02916000818181858888f1935050505015801561196a573d6000803e3d6000fd5b50565b6001600160a01b038116600090815260196020908152604080832080548251818502810185019093528083528493849084015b828210156119e6578382906000526020600020906002020160405180604001604052908160008201548152602001600182015481525050815260200190600101906119a0565b5050505090506000805b8251811015611a6a57828181518110611a0b57611a0b6140a9565b602002602001015160200151601454611a249190614110565b838281518110611a3657611a366140a9565b602002602001015160000151611a4c919061414d565b611a569083614091565b915080611a62816140d8565b9150506119f0565b509392505050565b611a7a611e69565b611ac65760405162461bcd60e51b815260206004820152601d60248201527f507269766174652053616c65206973206e6f74206163746976617465640000006044820152606401610d05565b6006548390839083906001600160a01b0316611ae43385858561215d565b6001600160a01b031614611b3a5760405162461bcd60e51b815260206004820152601c60248201527f57686974656c6973743a20496e76616c6964207369676e6174757265000000006044820152606401610d05565b6000611b44611d42565b9050613cc3601354601c54601b54601a54611b5f9190614091565b611b699190614091565b611b739190614091565b10611bc05760405162461bcd60e51b815260206004820152601660248201527f4578636565642073616c6573206d6178206c696d6974000000000000000000006044820152606401610d05565b336000908152601760205260409020548790611bdd906001614091565b1115611c2b5760405162461bcd60e51b815260206004820152601660248201527f457863656564207369676e6564207175616e74697479000000000000000000006044820152606401610d05565b80341015611c7b5760405162461bcd60e51b815260206004820152601060248201527f496e73756666696369656e7420455448000000000000000000000000000000006044820152606401610d05565b336000908152601760205260408120805460019290611c9b908490614091565b925050819055506001601b6000828254611cb59190614091565b90915550611cc4905033612867565b50505050505050565b6000546001600160a01b03163314611d275760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d05565b610e5660118383613a8d565b606060088054610bfc9061400f565b6000611d4c6125dc565b15611daf57600061070860015442611d64919061414d565b611d6e9190614193565b9050600a8110611d86576703782dace9d90000611da9565b611d976658d15e1762800082614110565b611da9906706f05b59d3b2000061414d565b91505090565b611db7611e69565b15611ddc5760646014546046611dcd9190614110565b611dd79190614193565b905090565b5060145490565b611dee338383612be5565b5050565b6000546001600160a01b03163314611e4c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d05565b601555565b600080600554118015611dd757505060055442101590565b600080600354118015611e7e57506000600454115b8015611e8c57506003544210155b8015611dd757505060045442111590565b611ea56125dc565b1580611eb55750610fa0601a5410155b611f015760405162461bcd60e51b815260206004820152601060248201527f4441207374696c6c206f6e676f696e67000000000000000000000000000000006044820152606401610d05565b600554421115611f535760405162461bcd60e51b815260206004820152601260248201527f526566756e642074696d652070617373656400000000000000000000000000006044820152606401610d05565b6000611f5e3361196d565b905080471015611fb05760405162461bcd60e51b815260206004820152601260248201527f4e6f7420656e6f7567682062616c616e636500000000000000000000000000006044820152606401610d05565b611fb933612cd1565b604051339082156108fc029083906000818181858888f19350505050158015611dee573d6000803e3d6000fd5b611ff03383612889565b6120625760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610d05565b61206e84848484612d50565b50505050565b6000818152600960205260409020546060906001600160a01b03166121015760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006064820152608401610d05565b600061210b612dd9565b9050600081511161212b5760405180602001604052806000815250612156565b8061213584612de8565b6040516020016121469291906141a7565b6040516020818303038152906040525b9392505050565b604080517f940a52669dc9fded2f965dea80d65bf40e8f29bcf1a4a3258a2c387da1b99cd960208201526001600160a01b03861691810191909152606081018490526080810183905260009081906121cd9060a00160405160208183030381529060405280519060200120612f1d565b90506121d98184612f86565b9150505b949350505050565b6000546001600160a01b0316331461223f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d05565b600680547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6000546001600160a01b031633146122d35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d05565b601355565b6122e06125dc565b61232c5760405162461bcd60e51b815260206004820152601860248201527f44412053616c65206973206e6f742061637469766174656400000000000000006044820152606401610d05565b6006548390839083906001600160a01b031661234a3385858561215d565b6001600160a01b0316146123a05760405162461bcd60e51b815260206004820152601c60248201527f57686974656c6973743a20496e76616c6964207369676e6174757265000000006044820152606401610d05565b60006123aa611d42565b9050613cc3601354601c54601b54601a546123c59190614091565b6123cf9190614091565b6123d99190614091565b106124265760405162461bcd60e51b815260206004820152601660248201527f4578636565642073616c6573206d6178206c696d6974000000000000000000006044820152606401610d05565b610fa0601a5460016124389190614091565b11156124865760405162461bcd60e51b815260206004820152600e60248201527f44412071756f7461206c696d69740000000000000000000000000000000000006044820152606401610d05565b336000908152601660205260409020546002906124a4906001614091565b11156124f25760405162461bcd60e51b815260206004820152601a60248201527f457863656564206d6178206d696e7420706572206d696e7465720000000000006044820152606401610d05565b803410156125425760405162461bcd60e51b815260206004820152601060248201527f496e73756666696369656e7420455448000000000000000000000000000000006044820152606401610d05565b336000908152601660205260408120805460019290612562908490614091565b925050819055506001601a600082825461257c9190614091565b9091555050336000818152601960209081526040808320815180830190925234825260018284018181528254808301845583875294909520925160029094029092019283559251910155906125d090612867565b50601455505050505050565b6000806001541180156125f157506000600254115b80156125ff57506001544210155b8015611dd757505060025442111590565b606060118054610bfc9061400f565b6000546001600160a01b031633146126795760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d05565b6001600160a01b0381166126f55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610d05565b61196a81612b7d565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd00000000000000000000000000000000000000000000000000000000148061279157507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b80610be757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610be7565b6000818152600b6020526040902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038416908117909155819061282e82611608565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000612872600f5490565b61287d906001614091565b9050611dee8282612fa2565b6000818152600960205260408120546001600160a01b03166129135760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e00000000000000000000000000000000000000006064820152608401610d05565b600061291e83611608565b9050806001600160a01b0316846001600160a01b031614806129595750836001600160a01b031661294e84610c7f565b6001600160a01b0316145b806121dd57506001600160a01b038082166000908152600c602090815260408083209388168352929052205460ff166121dd565b826001600160a01b03166129a082611608565b6001600160a01b031614612a1c5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610d05565b6001600160a01b038216612a975760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610d05565b612aa2838383612fbc565b612aad6000826127e1565b6001600160a01b0383166000908152600a60205260408120805460019290612ad690849061414d565b90915550506001600160a01b0382166000908152600a60205260408120805460019290612b04908490614091565b909155505060008181526009602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b816001600160a01b0316836001600160a01b031603612c465760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610d05565b6001600160a01b038381166000818152600c602090815260408083209487168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b038116600090815260196020526040902080545b8015610e565781805480612d0257612d026141d6565b60008281526020812060027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9093019283020181815560010155905580612d4881614205565b915050612cec565b612d5b84848461298d565b612d6784848484613074565b61206e5760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610d05565b606060128054610bfc9061400f565b606081600003612e2b57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115612e555780612e3f816140d8565b9150612e4e9050600a83614193565b9150612e2f565b60008167ffffffffffffffff811115612e7057612e70613dc5565b6040519080825280601f01601f191660200182016040528015612e9a576020820181803683370190505b5090505b84156121dd57612eaf60018361414d565b9150612ebc600a8661423a565b612ec7906030614091565b60f81b818381518110612edc57612edc6140a9565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612f16600a86614193565b9450612e9e565b6000610be7612f2a613230565b836040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000806000612f958585613357565b91509150611a6a816133c5565b611dee8282604051806020016040528060008152506135b1565b6001600160a01b0383166130175761301281600f80546000838152601060205260408120829055600182018355919091527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac8020155565b61303a565b816001600160a01b0316836001600160a01b03161461303a5761303a838261363a565b6001600160a01b03821661305157610e56816136d7565b826001600160a01b0316826001600160a01b031614610e5657610e568282613786565b60006001600160a01b0384163b15613228576040517f150b7a020000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063150b7a02906130d190339089908890889060040161424e565b6020604051808303816000875af192505050801561312a575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526131279181019061428a565b60015b6131dd573d808015613158576040519150601f19603f3d011682016040523d82523d6000602084013e61315d565b606091505b5080516000036131d55760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610d05565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a02000000000000000000000000000000000000000000000000000000001490506121dd565b5060016121dd565b6000306001600160a01b037f000000000000000000000000f220db48f0d3ca8a9833e0353e7497dbceae7ac61614801561328957507f000000000000000000000000000000000000000000000000000000000000000146145b156132b357507f0bce4c67803d1f3b04b0c2477f3d40cac1b4920532e4098cc191c015d59fb2da90565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527fbe4e87885b307384b958a8a4b9d3dffc318aaa18f2904a7bd982193b41f54cf5828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b600080825160410361338d5760208301516040840151606085015160001a613381878285856137ca565b945094505050506133be565b82516040036133b657602083015160408401516133ab8683836138d5565b9350935050506133be565b506000905060025b9250929050565b60008160048111156133d9576133d96142a7565b036133e15750565b60018160048111156133f5576133f56142a7565b036134425760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610d05565b6002816004811115613456576134566142a7565b036134a35760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610d05565b60038160048111156134b7576134b76142a7565b0361352a5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610d05565b600481600481111561353e5761353e6142a7565b0361196a5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610d05565b6135bb8383613927565b6135c86000848484613074565b610e565760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610d05565b600060016136478461176e565b613651919061414d565b6000838152600e60205260409020549091508082146136a4576001600160a01b0384166000908152600d602090815260408083208584528252808320548484528184208190558352600e90915290208190555b506000918252600e602090815260408084208490556001600160a01b039094168352600d81528383209183525290812055565b600f546000906136e99060019061414d565b600083815260106020526040812054600f8054939450909284908110613711576137116140a9565b9060005260206000200154905080600f8381548110613732576137326140a9565b600091825260208083209091019290925582815260109091526040808220849055858252812055600f80548061376a5761376a6141d6565b6001900381819060005260206000200160009055905550505050565b60006137918361176e565b6001600160a01b039093166000908152600d602090815260408083208684528252808320859055938252600e9052919091209190915550565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561380157506000905060036138cc565b8460ff16601b1415801561381957508460ff16601c14155b1561382a57506000905060046138cc565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561387e573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001519150506001600160a01b0381166138c5576000600192509250506138cc565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83168161390b60ff86901c601b614091565b9050613919878288856137ca565b935093505050935093915050565b6001600160a01b03821661397d5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610d05565b6000818152600960205260409020546001600160a01b0316156139e25760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610d05565b6139ee60008383612fbc565b6001600160a01b0382166000908152600a60205260408120805460019290613a17908490614091565b909155505060008181526009602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054613a999061400f565b90600052602060002090601f016020900481019282613abb5760008555613b1f565b82601f10613af2578280017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00823516178555613b1f565b82800160010185558215613b1f579182015b82811115613b1f578235825591602001919060010190613b04565b50613b2b929150613b2f565b5090565b5b80821115613b2b5760008155600101613b30565b7fffffffff000000000000000000000000000000000000000000000000000000008116811461196a57600080fd5b600060208284031215613b8457600080fd5b813561215681613b44565b60005b83811015613baa578181015183820152602001613b92565b8381111561206e5750506000910152565b60008151808452613bd3816020860160208601613b8f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006121566020830184613bbb565b600060208284031215613c2a57600080fd5b5035919050565b80356001600160a01b0381168114613c4857600080fd5b919050565b60008060408385031215613c6057600080fd5b613c6983613c31565b946020939093013593505050565b60008060208385031215613c8a57600080fd5b823567ffffffffffffffff80821115613ca257600080fd5b818501915085601f830112613cb657600080fd5b813581811115613cc557600080fd5b8660208260051b8501011115613cda57600080fd5b60209290920196919550909350505050565b600080600060608486031215613d0157600080fd5b613d0a84613c31565b9250613d1860208501613c31565b9150604084013590509250925092565b600060208284031215613d3a57600080fd5b61215682613c31565b60008060408385031215613d5657600080fd5b50508035926020909101359150565b60008060208385031215613d7857600080fd5b823567ffffffffffffffff80821115613d9057600080fd5b818501915085601f830112613da457600080fd5b813581811115613db357600080fd5b866020828501011115613cda57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112613e0557600080fd5b813567ffffffffffffffff80821115613e2057613e20613dc5565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715613e6657613e66613dc5565b81604052838152866020858801011115613e7f57600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600060608486031215613eb457600080fd5b8335925060208401359150604084013567ffffffffffffffff811115613ed957600080fd5b613ee586828701613df4565b9150509250925092565b60008060408385031215613f0257600080fd5b613f0b83613c31565b915060208301358015158114613f2057600080fd5b809150509250929050565b60008060008060808587031215613f4157600080fd5b613f4a85613c31565b9350613f5860208601613c31565b925060408501359150606085013567ffffffffffffffff811115613f7b57600080fd5b613f8787828801613df4565b91505092959194509250565b60008060008060808587031215613fa957600080fd5b613fb285613c31565b93506020850135925060408501359150606085013567ffffffffffffffff811115613f7b57600080fd5b60008060408385031215613fef57600080fd5b613ff883613c31565b915061400660208401613c31565b90509250929050565b600181811c9082168061402357607f821691505b60208210810361405c577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082198211156140a4576140a4614062565b500190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361410957614109614062565b5060010190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561414857614148614062565b500290565b60008282101561415f5761415f614062565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826141a2576141a2614164565b500490565b600083516141b9818460208801613b8f565b8351908301906141cd818360208801613b8f565b01949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008161421457614214614062565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b60008261424957614249614164565b500690565b60006001600160a01b038087168352808616602084015250836040830152608060608301526142806080830184613bbb565b9695505050505050565b60006020828403121561429c57600080fd5b815161215681613b44565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fdfea2646970667358221220d249927705a786d06bbc085a5e198959c67feba7b5aa886c20e4c1d9048e940364736f6c634300080d0033
Verified Source Code Partial Match
Compiler: v0.8.13+commit.abaa5c0e
EVM: london
Optimization: Yes (10000 runs)
Whitelist.sol 47 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
contract Whitelist is Ownable, EIP712 {
bytes32 public constant WHITELIST_TYPEHASH =
keccak256("Whitelist(address buyer,uint256 signedQty,uint256 nonce)");
address public whitelistSigner;
modifier isSenderWhitelisted(
uint256 _signedQty,
uint256 _nonce,
bytes memory _signature
) {
require(
getSigner(msg.sender, _signedQty, _nonce, _signature) ==
whitelistSigner,
"Whitelist: Invalid signature"
);
_;
}
constructor(string memory name, string memory version)
EIP712(name, version)
{}
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);
}
}
Karafuru3d.sol 254 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./PrivateSalesActivation.sol";
import "./PublicSalesActivation.sol";
import "./DASalesActivation.sol";
import "./Whitelist.sol";
import "./ERC721Opensea.sol";
import "./Withdrawable.sol";
contract KaraGacha is
Ownable,
EIP712,
DASalesActivation,
PrivateSalesActivation,
PublicSalesActivation,
Whitelist,
ERC721Opensea,
Withdrawable
{
uint256 public constant TOTAL_MAX_QTY = 15555;
uint256 public GIFT_MAX_QTY = 5655;
uint256 public constant DASALES_MAX_QTY = 4000;
uint256 public constant DA_MAX_QTY_PER_MINTER = 2;
uint256 public constant PUBLIC_MAX_QTY_PER_MINTER = 2;
uint256 public constant DA_SALES_START_PRICE = 0.5 ether;
uint256 public DA_LAST_PRICE = DA_SALES_START_PRICE;
uint256 public constant priceDropDuration = 1800;
uint256 public constant priceDropAmount = 0.025 ether;
uint256 public constant priceDropFloor = 0.25 ether;
uint256 public fPublicSalesPrice = DA_SALES_START_PRICE;
mapping(address => uint256) public DASalesMinterToTokenQty;
mapping(address => uint256) public privateSalesMinterToTokenQty;
mapping(address => uint256) public publicSalesMinterToTokenQty;
// mapping(address => uint256) public DAAddressIdToPrice;
struct TokenBatchPriceData {
uint256 pricePaid;
uint256 qtyMinted;
}
mapping(address => TokenBatchPriceData[]) public userToTokenBatchPriceData;
uint256 public DASalesMintedQty = 0;
uint256 public privateSalesMintedQty = 0;
uint256 public publicSalesMintedQty = 0;
uint256 public giftedQty = 0;
constructor()
ERC721("Karafuru Gachapon", "KARA-GACHA")
Whitelist("Karafuru 3D", "1")
{}
// function refundAll() external {
// require(
// !isDASalesActivated() || DASalesMintedQty >= DASALES_MAX_QTY,
// "DA still ongoing"
// );
// require(block.timestamp <= publicSalesStartTime, "Refund time passed");
// uint256 refundValue = DAAddressIdToPrice[msg.sender] - DA_LAST_PRICE;
// DAAddressIdToPrice[msg.sender] = DA_LAST_PRICE;
// payable(msg.sender).transfer(refundValue);
// }
function claimRefund() external {
require(
!isDASalesActivated() || DASalesMintedQty >= DASALES_MAX_QTY,
"DA still ongoing"
);
require(block.timestamp <= publicSalesStartTime, "Refund time passed");
uint256 _claimableAmount = claimableAmount(msg.sender);
require(
address(this).balance >= _claimableAmount,
"Not enough balance"
);
_removeAuctionPurchaseHistory(msg.sender);
payable(msg.sender).transfer(_claimableAmount);
}
function _removeAuctionPurchaseHistory(address buyer) internal {
TokenBatchPriceData[] storage histories = userToTokenBatchPriceData[
buyer
];
for (uint256 i = histories.length; i > 0; i--) {
histories.pop();
}
}
function claimableAmount(address buyer) public view returns (uint256) {
TokenBatchPriceData[] memory histories = userToTokenBatchPriceData[
buyer
];
uint256 _claimableAmount = 0;
for (uint256 i; i < histories.length; i++) {
_claimableAmount +=
histories[i].pricePaid -
(DA_LAST_PRICE * histories[i].qtyMinted);
}
return _claimableAmount;
}
function getPrice() public view returns (uint256) {
if (isDASalesActivated()) {
uint256 dropCount = (block.timestamp - DASalesStartTime) /
priceDropDuration;
return
dropCount < 10
? DA_SALES_START_PRICE - dropCount * priceDropAmount
: priceDropFloor;
} else if (isPrivateSalesActivated()) {
return (DA_LAST_PRICE * 70) / 100;
}
return DA_LAST_PRICE;
}
function mint(address sender) internal {
uint256 newTokenId = totalSupply() + 1;
_safeMint(sender, newTokenId);
}
function DASalesMint(
uint256 _signedQty,
uint256 _nonce,
bytes memory _signature
)
external
payable
isDASalesActive
isSenderWhitelisted(_signedQty, _nonce, _signature)
{
uint256 price = getPrice();
require(
DASalesMintedQty +
privateSalesMintedQty +
publicSalesMintedQty +
GIFT_MAX_QTY <
TOTAL_MAX_QTY,
"Exceed sales max limit"
);
require(DASalesMintedQty + 1 <= DASALES_MAX_QTY, "DA quota limit");
require(
DASalesMinterToTokenQty[msg.sender] + 1 <= DA_MAX_QTY_PER_MINTER,
"Exceed max mint per minter"
);
require(msg.value >= price, "Insufficient ETH");
DASalesMinterToTokenQty[msg.sender] += 1;
DASalesMintedQty += 1;
// DAAddressIdToPrice[msg.sender] = msg.value;
TokenBatchPriceData[] storage histories = userToTokenBatchPriceData[
msg.sender
];
histories.push(TokenBatchPriceData(msg.value, 1));
mint(msg.sender);
DA_LAST_PRICE = price;
}
function privateSalesMint(
uint256 _signedQty,
uint256 _nonce,
bytes memory _signature
)
external
payable
isPrivateSalesActive
isSenderWhitelisted(_signedQty, _nonce, _signature)
{
uint256 price = getPrice();
require(
DASalesMintedQty +
privateSalesMintedQty +
publicSalesMintedQty +
GIFT_MAX_QTY <
TOTAL_MAX_QTY,
"Exceed sales max limit"
);
require(
privateSalesMinterToTokenQty[msg.sender] + 1 <= _signedQty,
"Exceed signed quantity"
);
require(msg.value >= price, "Insufficient ETH");
privateSalesMinterToTokenQty[msg.sender] += 1;
privateSalesMintedQty += 1;
mint(msg.sender);
}
function publicSalesMint(
uint256 _signedQty,
uint256 _nonce,
bytes memory _signature
)
external
payable
isPublicSalesActive
isSenderWhitelisted(_signedQty, _nonce, _signature)
{
require(
DASalesMintedQty +
privateSalesMintedQty +
publicSalesMintedQty +
GIFT_MAX_QTY <
TOTAL_MAX_QTY,
"Exceed sales max limit"
);
require(msg.value >= fPublicSalesPrice, "Insufficient ETH");
require(
publicSalesMinterToTokenQty[msg.sender] + 1 <=
PUBLIC_MAX_QTY_PER_MINTER,
"Exceed max mint per minter"
);
publicSalesMinterToTokenQty[msg.sender] += 1;
publicSalesMintedQty += 1;
mint(msg.sender);
}
function gift(address[] calldata receivers) external onlyOwner {
require(
DASalesMintedQty +
privateSalesMintedQty +
publicSalesMintedQty +
receivers.length <=
TOTAL_MAX_QTY,
"Exceed total max limit"
);
require(
giftedQty + receivers.length <= GIFT_MAX_QTY,
"Exceed gift max limit"
);
giftedQty = giftedQty + receivers.length;
for (uint256 i = 0; i < receivers.length; i++) {
mint(receivers[i]);
}
}
function changeGiftAmount(uint256 giftAmount) external onlyOwner {
GIFT_MAX_QTY = giftAmount;
}
function changeFPublicSalesprice(uint256 price) external onlyOwner {
fPublicSalesPrice = price;
}
}
Withdrawable.sol 13 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts/access/Ownable.sol";
contract Withdrawable is Ownable {
constructor() {}
function withdrawAll() external onlyOwner {
require(address(this).balance > 0, "Withdrawble: No amount to withdraw");
payable(msg.sender).transfer(address(this).balance);
}
}
ERC721Opensea.sol 32 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
abstract contract ERC721Opensea is Ownable, ERC721Enumerable {
string private _contractURI;
string private _tokenBaseURI;
constructor() {}
function setContractURI(string calldata URI) external onlyOwner {
_contractURI = URI;
}
// To support Opensea contract-level metadata
// https://docs.opensea.io/docs/contract-level-metadata
function contractURI() public view returns (string memory) {
return _contractURI;
}
function setBaseURI(string calldata URI) external onlyOwner {
_tokenBaseURI = URI;
}
// To support Opensea token metadata
// https://docs.opensea.io/docs/metadata-standards
function _baseURI() internal view override(ERC721) returns (string memory) {
return _tokenBaseURI;
}
}
DASalesActivation.sol 38 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts/access/Ownable.sol";
contract DASalesActivation is Ownable {
uint256 public DASalesStartTime;
uint256 public DASalesEndTime;
modifier isDASalesActive() {
require(isDASalesActivated(), "DA Sale is not activated");
_;
}
constructor() {}
function isDASalesActivated() public view returns (bool) {
return
DASalesStartTime > 0 &&
DASalesEndTime > 0 &&
block.timestamp >= DASalesStartTime &&
block.timestamp <= DASalesEndTime;
}
// 1652796000 : Tue May 17 2022 14:00:00 GMT+0000
// 1652839200 : Wed May 18 2022 02:00:00 GMT+0000
function setDASalesTime(uint256 _startTime, uint256 _endTime)
external
onlyOwner
{
require(
_endTime >= _startTime,
"End time should be later than start time"
);
DASalesStartTime = _startTime;
DASalesEndTime = _endTime;
}
}
PublicSalesActivation.sol 25 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts/access/Ownable.sol";
contract PublicSalesActivation is Ownable {
uint256 public publicSalesStartTime;
modifier isPublicSalesActive() {
require(isPublicSalesActivated(), "Public Sale is not activated");
_;
}
constructor() {}
function isPublicSalesActivated() public view returns (bool) {
return
publicSalesStartTime > 0 && block.timestamp >= publicSalesStartTime;
}
// 1652882400 : Wed May 18 2022 14:00:00 GMT+0000
function setPublicSalesTime(uint256 _startTime) external onlyOwner {
publicSalesStartTime = _startTime;
}
}
PrivateSalesActivation.sol 38 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts/access/Ownable.sol";
contract PrivateSalesActivation is Ownable {
uint256 public privateSalesStartTime;
uint256 public privateSalesEndTime;
modifier isPrivateSalesActive() {
require(isPrivateSalesActivated(), "Private Sale is not activated");
_;
}
constructor() {}
function isPrivateSalesActivated() public view returns (bool) {
return
privateSalesStartTime > 0 &&
privateSalesEndTime > 0 &&
block.timestamp >= privateSalesStartTime &&
block.timestamp <= privateSalesEndTime;
}
// 1652839200 : Wed May 18 2022 02:00:00 GMT+0000
// 1652882400 : Wed May 18 2022 14:00:00 GMT+0000
function setPrivateSalesTime(uint256 _startTime, uint256 _endTime)
external
onlyOwner
{
require(
_endTime >= _startTime,
"End time should be later than start time"
);
privateSalesStartTime = _startTime;
privateSalesEndTime = _endTime;
}
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
Ownable.sol 76 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
ERC721.sol 447 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/ERC721.sol)
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 {
_setApprovalForAll(_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);
_afterTokenTransfer(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);
_afterTokenTransfer(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 from incorrect owner");
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);
_afterTokenTransfer(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 Approve `operator` to operate on all of `owner` tokens
*
* Emits a {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @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 {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
ECDSA.sol 230 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @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 = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 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 Message, created from `s`. 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(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @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 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
draft-EIP712.sol 104 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)
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;
address private immutable _CACHED_THIS;
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);
_CACHED_THIS = address(this);
_TYPE_HASH = typeHash;
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() internal view returns (bytes32) {
if (address(this) == _CACHED_THIS && 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 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
ERC721Enumerable.sol 163 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol)
pragma solidity ^0.8.0;
import "../ERC721.sol";
import "./IERC721Enumerable.sol";
/**
* @dev This implements an optional extension of {ERC721} defined in the EIP that adds
* enumerability of all the token ids in the contract as well as all token ids owned by each
* account.
*/
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
// Mapping from owner to list of owned token IDs
mapping(address => mapping(uint256 => uint256)) private _ownedTokens;
// Mapping from token ID to index of the owner tokens list
mapping(uint256 => uint256) private _ownedTokensIndex;
// Array with all token ids, used for enumeration
uint256[] private _allTokens;
// Mapping from token id to position in the allTokens array
mapping(uint256 => uint256) private _allTokensIndex;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
return _ownedTokens[owner][index];
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _allTokens.length;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
return _allTokens[index];
}
/**
* @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` cannot be the zero address.
* - `to` cannot be the zero address.
*
* 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 override {
super._beforeTokenTransfer(from, to, tokenId);
if (from == address(0)) {
_addTokenToAllTokensEnumeration(tokenId);
} else if (from != to) {
_removeTokenFromOwnerEnumeration(from, tokenId);
}
if (to == address(0)) {
_removeTokenFromAllTokensEnumeration(tokenId);
} else if (to != from) {
_addTokenToOwnerEnumeration(to, tokenId);
}
}
/**
* @dev Private function to add a token to this extension's ownership-tracking data structures.
* @param to address representing the new owner of the given token ID
* @param tokenId uint256 ID of the token to be added to the tokens list of the given address
*/
function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
uint256 length = ERC721.balanceOf(to);
_ownedTokens[to][length] = tokenId;
_ownedTokensIndex[tokenId] = length;
}
/**
* @dev Private function to add a token to this extension's token tracking data structures.
* @param tokenId uint256 ID of the token to be added to the tokens list
*/
function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
_allTokensIndex[tokenId] = _allTokens.length;
_allTokens.push(tokenId);
}
/**
* @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
* while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
* gas optimizations e.g. when performing a transfer operation (avoiding double writes).
* This has O(1) time complexity, but alters the order of the _ownedTokens array.
* @param from address representing the previous owner of the given token ID
* @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
*/
function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
uint256 tokenIndex = _ownedTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary
if (tokenIndex != lastTokenIndex) {
uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
_ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
}
// This also deletes the contents at the last position of the array
delete _ownedTokensIndex[tokenId];
delete _ownedTokens[from][lastTokenIndex];
}
/**
* @dev Private function to remove a token from this extension's token tracking data structures.
* This has O(1) time complexity, but alters the order of the _allTokens array.
* @param tokenId uint256 ID of the token to be removed from the tokens list
*/
function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
// To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
// then delete the last slot (swap and pop).
uint256 lastTokenIndex = _allTokens.length - 1;
uint256 tokenIndex = _allTokensIndex[tokenId];
// When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
// rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
// an 'if' statement (like in _removeTokenFromOwnerEnumeration)
uint256 lastTokenId = _allTokens[lastTokenIndex];
_allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
_allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
// This also deletes the contents at the last position of the array
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
IERC721Enumerable.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
Read Contract
DASALES_MAX_QTY 0xf85a936c → uint256
DASalesEndTime 0xab20745f → uint256
DASalesMintedQty 0x4371f733 → uint256
DASalesMinterToTokenQty 0xc5373376 → uint256
DASalesStartTime 0x063bbe16 → uint256
DA_LAST_PRICE 0x2f4a2309 → uint256
DA_MAX_QTY_PER_MINTER 0xc0e2224a → uint256
DA_SALES_START_PRICE 0x4da470b2 → uint256
GIFT_MAX_QTY 0x3354fe34 → uint256
PUBLIC_MAX_QTY_PER_MINTER 0x2267d4e7 → uint256
TOTAL_MAX_QTY 0xdee816e6 → uint256
WHITELIST_TYPEHASH 0x6301dccf → bytes32
balanceOf 0x70a08231 → uint256
claimableAmount 0x89885049 → uint256
contractURI 0xe8a3d485 → string
fPublicSalesPrice 0x58646196 → uint256
getApproved 0x081812fc → address
getPrice 0x98d5fdca → uint256
getSigner 0xcd5d4974 → address
giftedQty 0xbd34fc57 → uint256
isApprovedForAll 0xe985e9c5 → bool
isDASalesActivated 0xe74497f3 → bool
isPrivateSalesActivated 0xb35c0b02 → bool
isPublicSalesActivated 0xae4384f1 → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
priceDropAmount 0xb4576cd1 → uint256
priceDropDuration 0xba06645a → uint256
priceDropFloor 0x0ed6ff45 → uint256
privateSalesEndTime 0x5e1760c1 → uint256
privateSalesMintedQty 0xbcac5253 → uint256
privateSalesMinterToTokenQty 0x44bed146 → uint256
privateSalesStartTime 0x01be98ea → uint256
publicSalesMintedQty 0x9c123661 → uint256
publicSalesMinterToTokenQty 0x8f7be8f2 → uint256
publicSalesStartTime 0xe6c3819c → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
userToTokenBatchPriceData 0x2b4519fb → uint256, uint256
whitelistSigner 0xef81b4d4 → address
Write Contract 21 functions
These functions modify contract state and require a wallet transaction to execute.
DASalesMint 0xe47f6006
uint256 _signedQty
uint256 _nonce
bytes _signature
approve 0x095ea7b3
address to
uint256 tokenId
changeFPublicSalesprice 0xa6d5575c
uint256 price
changeGiftAmount 0xd4b70b8d
uint256 giftAmount
claimRefund 0xb5545a3c
No parameters
gift 0x163e1e61
address[] receivers
privateSalesMint 0x8d32acc4
uint256 _signedQty
uint256 _nonce
bytes _signature
publicSalesMint 0x5ab5189c
uint256 _signedQty
uint256 _nonce
bytes _signature
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
setContractURI 0x938e3d7b
string URI
setDASalesTime 0x6c7d5f00
uint256 _startTime
uint256 _endTime
setPrivateSalesTime 0x4dbf4fb7
uint256 _startTime
uint256 _endTime
setPublicSalesTime 0x60869d9b
uint256 _startTime
setWhitelistSigner 0xd3381438
address _address
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdrawAll 0x853828b6
No parameters
Recent Transactions
No transactions found for this address