Address Contract Verified
Address
0x1d07d213a6Fb329BFA1ef1a15239dFaAd2219f73
Balance
0 ETH
Nonce
1
Code Size
10642 bytes
Creator
0x8b289C45...5FA1 at tx 0x25927833...ce4849
Indexed Transactions
0
Contract Bytecode
10642 bytes
0x60806040526004361061026a5760003560e01c80637cb6475911610153578063b88d4fde116100cb578063e6d37b881161007f578063f26a981611610064578063f26a98161461070d578063f2fde38b1461072d578063fe60d12c1461074d57600080fd5b8063e6d37b88146106b1578063e985e9c5146106c457600080fd5b8063cbc21b08116100b0578063cbc21b0814610666578063d547cfb714610686578063d5abeb011461069b57600080fd5b8063b88d4fde14610626578063c87b56dd1461064657600080fd5b806391b7f5ed116101225780639da3f8fd116101075780639da3f8fd146105b2578063a22cb465146105d9578063a41c979c146105f957600080fd5b806391b7f5ed1461057d57806395d89b411461059d57600080fd5b80637cb64759146105095780637de55fe11461052957806385b27c85146105495780638da5cb5b1461055f57600080fd5b80632eb4a7ab116101e65780634f6ccce7116101b55780636352211e1161019a5780636352211e146104b457806370a08231146104d4578063715018a6146104f457600080fd5b80634f6ccce71461047457806355f804b31461049457600080fd5b80632eb4a7ab146104095780632f745c591461041f5780633ccfd60b1461043f57806342842e0e1461045457600080fd5b806318160ddd1161023d5780632a55205a116102225780632a55205a1461038a5780632d6e71b6146103c95780632e49d78b146103e957600080fd5b806318160ddd1461032057806323b872dd1461036a57600080fd5b806301ffc9a71461026f57806306fdde03146102a4578063081812fc146102c6578063095ea7b3146102fe575b600080fd5b34801561027b57600080fd5b5061028f61028a3660046125a3565b610763565b60405190151581526020015b60405180910390f35b3480156102b057600080fd5b506102b9610834565b60405161029b91906127ad565b3480156102d257600080fd5b506102e66102e136600461258a565b6108c6565b6040516001600160a01b03909116815260200161029b565b34801561030a57600080fd5b5061031e610319366004612560565b610923565b005b34801561032c57600080fd5b5061035c6000546001600160801b0370010000000000000000000000000000000082048116918116919091031690565b60405190815260200161029b565b34801561037657600080fd5b5061031e61038536600461246c565b6109e3565b34801561039657600080fd5b506103aa6103a5366004612626565b6109ee565b604080516001600160a01b03909316835260208301919091520161029b565b3480156103d557600080fd5b5061031e6103e436600461258a565b610a65565b3480156103f557600080fd5b5061031e6104043660046126cb565b610ab2565b34801561041557600080fd5b5061035c60105481565b34801561042b57600080fd5b5061035c61043a366004612560565b610b33565b34801561044b57600080fd5b5061031e610c49565b34801561046057600080fd5b5061031e61046f36600461246c565b610d16565b34801561048057600080fd5b5061035c61048f36600461258a565b610d31565b3480156104a057600080fd5b5061031e6104af3660046125dd565b610df5565b3480156104c057600080fd5b506102e66104cf36600461258a565b610e54565b3480156104e057600080fd5b5061035c6104ef36600461241e565b610e66565b34801561050057600080fd5b5061031e610ece565b34801561051557600080fd5b5061031e61052436600461258a565b610f20565b34801561053557600080fd5b5061031e610544366004612560565b610f6d565b34801561055557600080fd5b5061035c600b5481565b34801561056b57600080fd5b506007546001600160a01b03166102e6565b34801561058957600080fd5b5061031e61059836600461258a565b611029565b3480156105a957600080fd5b506102b9611076565b3480156105be57600080fd5b50600d546105cc9060ff1681565b60405161029b9190612785565b3480156105e557600080fd5b5061031e6105f4366004612524565b611085565b34801561060557600080fd5b5061035c61061436600461241e565b60116020526000908152604090205481565b34801561063257600080fd5b5061031e6106413660046124a8565b611134565b34801561065257600080fd5b506102b961066136600461258a565b61116e565b34801561067257600080fd5b5061031e61068136600461258a565b61120c565b34801561069257600080fd5b506102b9611259565b3480156106a757600080fd5b5061035c600a5481565b61031e6106bf366004612648565b6112e7565b3480156106d057600080fd5b5061028f6106df366004612439565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b34801561071957600080fd5b5061031e61072836600461258a565b611576565b34801561073957600080fd5b5061031e61074836600461241e565b6115c3565b34801561075957600080fd5b5061035c60095481565b60006001600160e01b031982167f80ac58cd0000000000000000000000000000000000000000000000000000000014806107c657506001600160e01b031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b806107fa57506001600160e01b031982167f780e9d6300000000000000000000000000000000000000000000000000000000145b8061082e57507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b6060600180546108439061284e565b80601f016020809104026020016040519081016040528092919081815260200182805461086f9061284e565b80156108bc5780601f10610891576101008083540402835291602001916108bc565b820191906000526020600020905b81548152906001019060200180831161089f57829003601f168201915b5050505050905090565b60006108d182611693565b610907576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506000908152600560205260409020546001600160a01b031690565b600061092e82610e54565b9050806001600160a01b0316836001600160a01b0316141561097c576040517f943f7b8c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336001600160a01b0382161480159061099c575061099a81336106df565b155b156109d3576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109de8383836116c7565b505050565b6109de838383611730565b6000806109fa84611693565b610a4b5760405162461bcd60e51b815260206004820152601160248201527f4e6f6e6578697374656e7420746f6b656e00000000000000000000000000000060448201526064015b60405180910390fd5b30600f5484610a5a91906127d8565b915091509250929050565b6007546001600160a01b03163314610aad5760405162461bcd60e51b8152602060048201819052602482015260008051602061293d8339815191526044820152606401610a42565b600955565b6007546001600160a01b03163314610afa5760405162461bcd60e51b8152602060048201819052602482015260008051602061293d8339815191526044820152606401610a42565b8060ff166002811115610b0f57610b0f6128e4565b600d805460ff19166001836002811115610b2b57610b2b6128e4565b021790555050565b6000610b3e83610e66565b8210610b76576040517f0ddac30e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080546001600160801b03169080805b83811015610c4357600081815260036020908152604091829020825160608101845290546001600160a01b0381168252600160a01b810467ffffffffffffffff1692820192909252600160e01b90910460ff161580159282019290925290610bef5750610c3b565b80516001600160a01b031615610c0457805192505b876001600160a01b0316836001600160a01b03161415610c395786841415610c325750935061082e92505050565b6001909301925b505b600101610b87565b50600080fd5b6007546001600160a01b03163314610c915760405162461bcd60e51b8152602060048201819052602482015260008051602061293d8339815191526044820152606401610a42565b47610cde5760405162461bcd60e51b815260206004820152600f60248201527f42616c616e6365206973207a65726f00000000000000000000000000000000006044820152606401610a42565b610cfe610cec6005476127d8565b6012546001600160a01b03169061199b565b601354610d14906001600160a01b03164761199b565b565b6109de83838360405180602001604052806000815250611134565b600080546001600160801b031681805b82811015610dc257600081815260036020908152604091829020825160608101845290546001600160a01b0381168252600160a01b810467ffffffffffffffff1692820192909252600160e01b90910460ff16151591810182905290610db95785831415610db25750949350505050565b6001909201915b50600101610d41565b506040517fa723001c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6007546001600160a01b03163314610e3d5760405162461bcd60e51b8152602060048201819052602482015260008051602061293d8339815191526044820152606401610a42565b8051610e5090600e9060208401906122f3565b5050565b6000610e5f82611ab4565b5192915050565b60006001600160a01b038216610ea8576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506001600160a01b031660009081526004602052604090205467ffffffffffffffff1690565b6007546001600160a01b03163314610f165760405162461bcd60e51b8152602060048201819052602482015260008051602061293d8339815191526044820152606401610a42565b610d146000611bf1565b6007546001600160a01b03163314610f685760405162461bcd60e51b8152602060048201819052602482015260008051602061293d8339815191526044820152606401610a42565b601055565b6007546001600160a01b03163314610fb55760405162461bcd60e51b8152602060048201819052602482015260008051602061293d8339815191526044820152606401610a42565b6009548111156110075760405162461bcd60e51b815260206004820152601b60248201527f45786365656473207265736572766564204e465420737570706c7900000000006044820152606401610a42565b8060096000828254611019919061280b565b90915550610e5090508282611c50565b6007546001600160a01b031633146110715760405162461bcd60e51b8152602060048201819052602482015260008051602061293d8339815191526044820152606401610a42565b600c55565b6060600280546108439061284e565b6001600160a01b0382163314156110c8576040517fb06307db00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360008181526006602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61113f848484611730565b61114b84848484611c5a565b611168576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b606061117982611693565b6111af576040517fa14c4b5000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006111b9611d69565b90508051600014156111da5760405180602001604052806000815250611205565b806111e484611d78565b6040516020016111f592919061271a565b6040516020818303038152906040525b9392505050565b6007546001600160a01b031633146112545760405162461bcd60e51b8152602060048201819052602482015260008051602061293d8339815191526044820152606401610a42565b600f55565b600e80546112669061284e565b80601f01602080910402602001604051908101604052809291908181526020018280546112929061284e565b80156112df5780601f106112b4576101008083540402835291602001916112df565b820191906000526020600020905b8154815290600101906020018083116112c257829003601f168201915b505050505081565b6002600854141561133a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610a42565b60026008556000600d5460ff166002811115611358576113586128e4565b14156113a65760405162461bcd60e51b815260206004820152600d60248201527f53616c6520696e616374697665000000000000000000000000000000000000006044820152606401610a42565b600b5484111561141e5760405162461bcd60e51b815260206004820152602f60248201527f416d6f756e74206973206d6f7265207468616e206d617820616c6c6f7765642060448201527f706572207472616e73616374696f6e00000000000000000000000000000000006064820152608401610a42565b600954600a5461142e919061280b565b8461145e6000546001600160801b0370010000000000000000000000000000000082048116918116919091031690565b61146891906127c0565b11156114b65760405162461bcd60e51b815260206004820152600960248201527f536f6c64206f75742100000000000000000000000000000000000000000000006044820152606401610a42565b83600c546114c491906127ec565b3410156115135760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206f66204554482073656e7420697320696e636f7272656374006044820152606401610a42565b6002600d5460ff16600281111561152c5761152c6128e4565b14156115405761153b84611eaa565b61156b565b6001600d5460ff166002811115611559576115596128e4565b141561156b5761156b84848484611eb4565b505060016008555050565b6007546001600160a01b031633146115be5760405162461bcd60e51b8152602060048201819052602482015260008051602061293d8339815191526044820152606401610a42565b600b55565b6007546001600160a01b0316331461160b5760405162461bcd60e51b8152602060048201819052602482015260008051602061293d8339815191526044820152606401610a42565b6001600160a01b0381166116875760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610a42565b61169081611bf1565b50565b600080546001600160801b03168210801561082e575050600090815260036020526040902054600160e01b900460ff161590565b600082815260056020526040808220805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600061173b82611ab4565b80519091506000906001600160a01b0316336001600160a01b031614806117695750815161176990336106df565b80611784575033611779846108c6565b6001600160a01b0316145b9050806117bd576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b846001600160a01b031682600001516001600160a01b03161461180c576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03841661184c576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61185c60008484600001516116c7565b6001600160a01b038581166000908152600460209081526040808320805467ffffffffffffffff1980821667ffffffffffffffff92831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600390945282852080546001600160e01b031916909417600160a01b429092169190910217909255908601808352912054909116611951576000546001600160801b0316811015611951578251600082815260036020908152604090912080549186015167ffffffffffffffff16600160a01b026001600160e01b03199092166001600160a01b03909316929092171790555b5082846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b5050505050565b804710156119eb5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610a42565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611a38576040519150601f19603f3d011682016040523d82523d6000602084013e611a3d565b606091505b50509050806109de5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610a42565b60408051606081018252600080825260208201819052918101829052905482906001600160801b0316811015611bbf57600081815260036020908152604091829020825160608101845290546001600160a01b0381168252600160a01b810467ffffffffffffffff1692820192909252600160e01b90910460ff16151591810182905290611bbd5780516001600160a01b031615611b53579392505050565b5060001901600081815260036020908152604091829020825160608101845290546001600160a01b038116808352600160a01b820467ffffffffffffffff1693830193909352600160e01b900460ff1615159281019290925215611bb8579392505050565b611b53565b505b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600780546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b610e50828261203c565b60006001600160a01b0384163b15611d5d57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611c9e903390899088908890600401612749565b602060405180830381600087803b158015611cb857600080fd5b505af1925050508015611ce8575060408051601f3d908101601f19168201909252611ce5918101906125c0565b60015b611d43573d808015611d16576040519150601f19603f3d011682016040523d82523d6000602084013e611d1b565b606091505b508051611d3b576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611d61565b5060015b949350505050565b6060600e80546108439061284e565b606081611db857505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115611de25780611dcc81612889565b9150611ddb9050600a836127d8565b9150611dbc565b60008167ffffffffffffffff811115611dfd57611dfd612910565b6040519080825280601f01601f191660200182016040528015611e27576020820181803683370190505b5090505b8415611d6157611e3c60018361280b565b9150611e49600a866128a4565b611e549060306127c0565b60f81b818381518110611e6957611e696128fa565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350611ea3600a866127d8565b9450611e2b565b6116903382611c50565b336000908152601160205260409020548390611ed19086906127c0565b1115611f455760405162461bcd60e51b815260206004820152603860248201527f416d6f756e74206d757374206265206c657373207468616e206f72206571756160448201527f6c20746f2077686974656c69737420616c6c6f77616e636500000000000000006064820152608401610a42565b611fc1828280806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506010546040516bffffffffffffffffffffffff193360601b16602082015260348101899052909250605401905060405160208183030381529060405280519060200120612056565b61200d5760405162461bcd60e51b815260206004820152601260248201527f50726f6f66206973206e6f742076616c696400000000000000000000000000006044820152606401610a42565b336000908152601160205260408120805486929061202c9084906127c0565b9091555061116890503385611c50565b610e5082826040518060200160405280600081525061206c565b6000826120638584612079565b14949350505050565b6109de8383836001612125565b600081815b845181101561211d57600085828151811061209b5761209b6128fa565b602002602001015190508083116120dd57604080516020810185905290810182905260600160405160208183030381529060405280519060200120925061210a565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b508061211581612889565b91505061207e565b509392505050565b6000546001600160801b03166001600160a01b038516612171576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b836121a8576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038516600081815260046020908152604080832080546fffffffffffffffffffffffffffffffff19811667ffffffffffffffff8083168c0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168c018116909202179091558584526003909252822080546001600160e01b031916909317600160a01b42909216919091021790915581905b858110156122c45760405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a483801561229a57506122986000888488611c5a565b155b156122b8576040516368d2bf6b60e11b815260040160405180910390fd5b60019182019101612243565b50600080546fffffffffffffffffffffffffffffffff19166001600160801b0392909216919091179055611994565b8280546122ff9061284e565b90600052602060002090601f0160209004810192826123215760008555612367565b82601f1061233a57805160ff1916838001178555612367565b82800160010185558215612367579182015b8281111561236757825182559160200191906001019061234c565b50612373929150612377565b5090565b5b808211156123735760008155600101612378565b600067ffffffffffffffff808411156123a7576123a7612910565b604051601f8501601f19908116603f011681019082821181831017156123cf576123cf612910565b816040528093508581528686860111156123e857600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b038116811461241957600080fd5b919050565b60006020828403121561243057600080fd5b61120582612402565b6000806040838503121561244c57600080fd5b61245583612402565b915061246360208401612402565b90509250929050565b60008060006060848603121561248157600080fd5b61248a84612402565b925061249860208501612402565b9150604084013590509250925092565b600080600080608085870312156124be57600080fd5b6124c785612402565b93506124d560208601612402565b925060408501359150606085013567ffffffffffffffff8111156124f857600080fd5b8501601f8101871361250957600080fd5b6125188782356020840161238c565b91505092959194509250565b6000806040838503121561253757600080fd5b61254083612402565b91506020830135801515811461255557600080fd5b809150509250929050565b6000806040838503121561257357600080fd5b61257c83612402565b946020939093013593505050565b60006020828403121561259c57600080fd5b5035919050565b6000602082840312156125b557600080fd5b813561120581612926565b6000602082840312156125d257600080fd5b815161120581612926565b6000602082840312156125ef57600080fd5b813567ffffffffffffffff81111561260657600080fd5b8201601f8101841361261757600080fd5b611d618482356020840161238c565b6000806040838503121561263957600080fd5b50508035926020909101359150565b6000806000806060858703121561265e57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561268457600080fd5b818701915087601f83011261269857600080fd5b8135818111156126a757600080fd5b8860208260051b85010111156126bc57600080fd5b95989497505060200194505050565b6000602082840312156126dd57600080fd5b813560ff8116811461120557600080fd5b60008151808452612706816020860160208601612822565b601f01601f19169290920160200192915050565b6000835161272c818460208801612822565b835190830190612740818360208801612822565b01949350505050565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261277b60808301846126ee565b9695505050505050565b60208101600383106127a757634e487b7160e01b600052602160045260246000fd5b91905290565b60208152600061120560208301846126ee565b600082198211156127d3576127d36128b8565b500190565b6000826127e7576127e76128ce565b500490565b6000816000190483118215151615612806576128066128b8565b500290565b60008282101561281d5761281d6128b8565b500390565b60005b8381101561283d578181015183820152602001612825565b838111156111685750506000910152565b600181811c9082168061286257607f821691505b6020821081141561288357634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561289d5761289d6128b8565b5060010190565b6000826128b3576128b36128ce565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b03198116811461169057600080fdfe4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220c1cd70fc377a188c5ea9c9cc2eb60c420a1968b1d6b7c5d8415e21128cce71e764736f6c63430008060033
Verified Source Code Full Match
Compiler: v0.8.6+commit.11564f7e
EVM: berlin
Optimization: Yes (1000 runs)
PixieNFT.sol 191 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
// @title: PIXIE NFTs
// @desc: 4,400 MAGICAL CREATURES
// @founder: https://twitter.com/ManticoreProG
// @artist: https://twitter.com/wunder_bot
// @dev: https://twitter.com/marcelc63
// @url: https://pixienft.io/
/*
* ###### ### # # ### #######
* # # # # # # #
* # # # # # # #
* ###### # # # #####
* # # # # # #
* # # # # # #
* # ### # # ### #######
*/
import "erc721a/contracts/ERC721A.sol";
import "@openzeppelin/contracts/interfaces/IERC2981.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
contract PixieNFT is ERC721A, Ownable, IERC2981, ReentrancyGuard {
using Address for address payable;
// .・゜゜・ Supply ・゜゜・.
uint256 public reserved = 30;
uint256 public maxSupply = 4400;
uint256 public maxAmountPerTx = 3;
// .・゜゜・ Cost ・゜゜・.
uint256 private price = 0.04 ether;
// .・゜゜・ Mint Status ・゜゜・.
enum MintStatus {
CLOSED,
PRESALE,
PUBLIC
}
MintStatus public mintStatus = MintStatus.CLOSED;
// .・゜゜・ General ・゜゜・.
string public baseTokenURI;
uint256 private royaltyDivisor = 20;
// .・゜゜・ Mint Tracking ・゜゜・.
bytes32 public merkleRoot;
mapping(address => uint256) public addressToPresaleMintCount;
// .・゜゜・ Withdraw Addresses ・゜゜・.
address t1 = 0x5e226ae843aDf2F0d7E8596fc1effc58eB0e2af8;
address t2 = 0xF1023b1E95694585f7b8C0d3718d56e42aD8d6Eb;
// .・゜゜・ Contract ・゜゜・.
constructor(
string memory _baseTokenURI,
bytes32 _merkleRoot,
uint256 _maxSupply
) ERC721A("Pixie NFTs", "PIXIE") {
merkleRoot = _merkleRoot;
baseTokenURI = _baseTokenURI;
maxSupply = _maxSupply;
}
function _baseURI() internal view virtual override returns (string memory) {
return baseTokenURI;
}
// .・゜゜・ Mint ・゜゜・.
function mint(
uint256 _amount,
uint256 _maxAmount,
bytes32[] calldata _proof
) public payable nonReentrant {
require(mintStatus != MintStatus.CLOSED, "Sale inactive");
require(
_amount <= maxAmountPerTx,
"Amount is more than max allowed per transaction"
);
require(totalSupply() + _amount <= maxSupply - reserved, "Sold out!");
require(msg.value >= price * _amount, "Amount of ETH sent is incorrect");
if (mintStatus == MintStatus.PUBLIC) {
_mintPublic(_amount);
} else if (mintStatus == MintStatus.PRESALE) {
_mintPresale(_amount, _maxAmount, _proof);
}
}
function mintReserved(address _to, uint256 _amount) external onlyOwner {
require(_amount <= reserved, "Exceeds reserved NFT supply");
reserved -= _amount;
_mintPrivate(_to, _amount);
}
function _mintPublic(uint256 _amount) internal {
_mintPrivate(msg.sender, _amount);
}
function _mintPresale(
uint256 _amount,
uint256 _maxAmount,
bytes32[] calldata _proof
) internal {
require(
addressToPresaleMintCount[msg.sender] + _amount <= _maxAmount,
"Amount must be less than or equal to whitelist allowance"
);
require(
MerkleProof.verify(
_proof,
merkleRoot,
keccak256(abi.encodePacked(msg.sender, _maxAmount))
),
"Proof is not valid"
);
addressToPresaleMintCount[msg.sender] += _amount;
_mintPrivate(msg.sender, _amount);
}
function _mintPrivate(address _to, uint256 _amount) internal {
_safeMint(_to, _amount);
}
// .・゜゜・ Setters ・゜゜・.
function setPrice(uint256 _newPrice) external onlyOwner {
price = _newPrice;
}
function setBaseURI(string memory _baseTokenURI) external onlyOwner {
baseTokenURI = _baseTokenURI;
}
function setMerkleRoot(bytes32 _merkleRoot) external onlyOwner {
merkleRoot = _merkleRoot;
}
function setMaxAmountPerTx(uint256 _maxAmountPerTx) external onlyOwner {
maxAmountPerTx = _maxAmountPerTx;
}
function setReserved(uint256 _reserved) external onlyOwner {
reserved = _reserved;
}
function setRoyaltyDivisor(uint256 _divisor) external onlyOwner {
royaltyDivisor = _divisor;
}
function setStatus(uint8 _status) external onlyOwner {
mintStatus = MintStatus(_status);
}
// .・゜゜・ Withdraw ・゜゜・.
function withdraw() public onlyOwner {
require(address(this).balance != 0, "Balance is zero");
payable(t1).sendValue(address(this).balance / 5);
payable(t2).sendValue(address(this).balance);
}
// .・゜゜・ Misc ・゜゜・.
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
override
returns (address receiver, uint256 royaltyAmount)
{
require(_exists(tokenId), "Nonexistent token");
return (address(this), salePrice / royaltyDivisor);
}
}
ERC721A.sol 628 lines
// SPDX-License-Identifier: MIT
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import '@openzeppelin/contracts/utils/Context.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import '@openzeppelin/contracts/utils/introspection/ERC165.sol';
error ApprovalCallerNotOwnerNorApproved();
error ApprovalQueryForNonexistentToken();
error ApproveToCaller();
error ApprovalToCurrentOwner();
error BalanceQueryForZeroAddress();
error MintedQueryForZeroAddress();
error BurnedQueryForZeroAddress();
error MintToZeroAddress();
error MintZeroQuantity();
error OwnerIndexOutOfBounds();
error OwnerQueryForNonexistentToken();
error TokenIndexOutOfBounds();
error TransferCallerNotOwnerNorApproved();
error TransferFromIncorrectOwner();
error TransferToNonERC721ReceiverImplementer();
error TransferToZeroAddress();
error URIQueryForNonexistentToken();
/**
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
* the Metadata and Enumerable extension. Built to optimize for lower gas during batch mints.
*
* Assumes serials are sequentially minted starting at 0 (e.g. 0, 1, 2, 3..).
*
* Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
*
* Assumes that the maximum token id cannot exceed 2**128 - 1 (max value of uint128).
*/
contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
using Address for address;
using Strings for uint256;
// Compiler will pack this into a single 256bit word.
struct TokenOwnership {
// The address of the owner.
address addr;
// Keeps track of the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
}
// Compiler will pack this into a single 256bit word.
struct AddressData {
// Realistically, 2**64-1 is more than enough.
uint64 balance;
// Keeps track of mint count with minimal overhead for tokenomics.
uint64 numberMinted;
// Keeps track of burn count with minimal overhead for tokenomics.
uint64 numberBurned;
}
// Compiler will pack the following
// _currentIndex and _burnCounter into a single 256bit word.
// The tokenId of the next token to be minted.
uint128 internal _currentIndex;
// The number of tokens burned.
uint128 internal _burnCounter;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details.
mapping(uint256 => TokenOwnership) internal _ownerships;
// Mapping owner address to address data
mapping(address => AddressData) private _addressData;
// Mapping from token ID to approved address
mapping(uint256 => address) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
// Counter underflow is impossible as _burnCounter cannot be incremented
// more than _currentIndex times
unchecked {
return _currentIndex - _burnCounter;
}
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
* This read function is O(totalSupply). If calling from a separate contract, be sure to test gas first.
* It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case.
*/
function tokenByIndex(uint256 index) public view override returns (uint256) {
uint256 numMintedSoFar = _currentIndex;
uint256 tokenIdsIdx;
// Counter overflow is impossible as the loop breaks when
// uint256 i is equal to another uint256 numMintedSoFar.
unchecked {
for (uint256 i; i < numMintedSoFar; i++) {
TokenOwnership memory ownership = _ownerships[i];
if (!ownership.burned) {
if (tokenIdsIdx == index) {
return i;
}
tokenIdsIdx++;
}
}
}
revert TokenIndexOutOfBounds();
}
/**
* @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
* This read function is O(totalSupply). If calling from a separate contract, be sure to test gas first.
* It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) {
if (index >= balanceOf(owner)) revert OwnerIndexOutOfBounds();
uint256 numMintedSoFar = _currentIndex;
uint256 tokenIdsIdx;
address currOwnershipAddr;
// Counter overflow is impossible as the loop breaks when
// uint256 i is equal to another uint256 numMintedSoFar.
unchecked {
for (uint256 i; i < numMintedSoFar; i++) {
TokenOwnership memory ownership = _ownerships[i];
if (ownership.burned) {
continue;
}
if (ownership.addr != address(0)) {
currOwnershipAddr = ownership.addr;
}
if (currOwnershipAddr == owner) {
if (tokenIdsIdx == index) {
return i;
}
tokenIdsIdx++;
}
}
}
// Execution should never reach this point.
revert();
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
interfaceId == type(IERC721Enumerable).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC721-balanceOf}.
*/
function balanceOf(address owner) public view override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return uint256(_addressData[owner].balance);
}
function _numberMinted(address owner) internal view returns (uint256) {
if (owner == address(0)) revert MintedQueryForZeroAddress();
return uint256(_addressData[owner].numberMinted);
}
function _numberBurned(address owner) internal view returns (uint256) {
if (owner == address(0)) revert BurnedQueryForZeroAddress();
return uint256(_addressData[owner].numberBurned);
}
/**
* Gas spent here starts off proportional to the maximum mint batch size.
* It gradually moves to O(1) as tokens get transferred around in the collection over time.
*/
function ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
uint256 curr = tokenId;
unchecked {
if (curr < _currentIndex) {
TokenOwnership memory ownership = _ownerships[curr];
if (!ownership.burned) {
if (ownership.addr != address(0)) {
return ownership;
}
// Invariant:
// There will always be an ownership that has an address and is not burned
// before an ownership that does not have an address and is not burned.
// Hence, curr will not underflow.
while (true) {
curr--;
ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
}
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* @dev See {IERC721-ownerOf}.
*/
function ownerOf(uint256 tokenId) public view override returns (address) {
return ownershipOf(tokenId).addr;
}
/**
* @dev See {IERC721Metadata-name}.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev See {IERC721Metadata-symbol}.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev See {IERC721Metadata-tokenURI}.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
string memory baseURI = _baseURI();
return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : '';
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return '';
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public override {
address owner = ERC721A.ownerOf(tokenId);
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_approve(to, tokenId, owner);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public override {
if (operator == _msgSender()) revert ApproveToCaller();
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, '');
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
_transfer(from, to, tokenId);
if (!_checkOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
*/
function _exists(uint256 tokenId) internal view returns (bool) {
return tokenId < _currentIndex && !_ownerships[tokenId].burned;
}
function _safeMint(address to, uint256 quantity) internal {
_safeMint(to, quantity, '');
}
/**
* @dev Safely mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
_mint(to, quantity, _data, true);
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event.
*/
function _mint(
address to,
uint256 quantity,
bytes memory _data,
bool safe
) internal {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// balance or numberMinted overflow if current value of either + quantity > 3.4e38 (2**128) - 1
// updatedIndex overflows if _currentIndex + quantity > 3.4e38 (2**128) - 1
unchecked {
_addressData[to].balance += uint64(quantity);
_addressData[to].numberMinted += uint64(quantity);
_ownerships[startTokenId].addr = to;
_ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
uint256 updatedIndex = startTokenId;
for (uint256 i; i < quantity; i++) {
emit Transfer(address(0), to, updatedIndex);
if (safe && !_checkOnERC721Received(address(0), to, updatedIndex, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
updatedIndex++;
}
_currentIndex = uint128(updatedIndex);
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
*
* Emits a {Transfer} event.
*/
function _transfer(
address from,
address to,
uint256 tokenId
) private {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
isApprovedForAll(prevOwnership.addr, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();
if (to == address(0)) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, prevOwnership.addr);
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as tokenId would have to be 2**128.
unchecked {
_addressData[from].balance -= 1;
_addressData[to].balance += 1;
_ownerships[tokenId].addr = to;
_ownerships[tokenId].startTimestamp = uint64(block.timestamp);
// If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
// Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
uint256 nextTokenId = tokenId + 1;
if (_ownerships[nextTokenId].addr == address(0)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId < _currentIndex) {
_ownerships[nextTokenId].addr = prevOwnership.addr;
_ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId) internal virtual {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
_beforeTokenTransfers(prevOwnership.addr, address(0), tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, prevOwnership.addr);
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as tokenId would have to be 2**128.
unchecked {
_addressData[prevOwnership.addr].balance -= 1;
_addressData[prevOwnership.addr].numberBurned += 1;
// Keep track of who burned the token, and the timestamp of burning.
_ownerships[tokenId].addr = prevOwnership.addr;
_ownerships[tokenId].startTimestamp = uint64(block.timestamp);
_ownerships[tokenId].burned = true;
// If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it.
// Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
uint256 nextTokenId = tokenId + 1;
if (_ownerships[nextTokenId].addr == address(0)) {
// This will suffice for checking _exists(nextTokenId),
// as a burned slot cannot contain the zero address.
if (nextTokenId < _currentIndex) {
_ownerships[nextTokenId].addr = prevOwnership.addr;
_ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(prevOwnership.addr, address(0), tokenId);
_afterTokenTransfers(prevOwnership.addr, address(0), tokenId, 1);
// Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
unchecked {
_burnCounter++;
}
}
/**
* @dev Approve `to` to operate on `tokenId`
*
* Emits a {Approval} event.
*/
function _approve(
address to,
uint256 tokenId,
address owner
) private {
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
/**
* @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
* The call is not executed if the target address is not a contract.
*
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
/**
* @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
* And also called before burning one token.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes
* minting.
* And also called after one token has been burned.
*
* startTokenId - the first token id to be transferred
* quantity - the amount to be transferred
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
* transferred to `to`.
* - When `from` is zero, `tokenId` has been minted for `to`.
* - When `to` is zero, `tokenId` has been burned by `from`.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
}
Address.sol 217 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 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);
}
}
IERC165.sol 6 lines
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol";
IERC2981.sol 23 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC2981.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard
*/
interface IERC2981 is IERC165 {
/**
* @dev Called with the sale price to determine how much royalty is owed and to whom.
* @param tokenId - the NFT asset queried for royalty information
* @param salePrice - the sale price of the NFT asset specified by `tokenId`
* @return receiver - address of who should be sent the royalty payment
* @return royaltyAmount - the royalty payment amount for `salePrice`
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}
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;
}
ReentrancyGuard.sol 63 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
MerkleProof.sol 52 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proofs.
*
* The proofs can be generated using the JavaScript library
* https://github.com/miguelmota/merkletreejs[merkletreejs].
* Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
*
* See `test/utils/cryptography/MerkleProof.test.js` for some examples.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merklee tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
} else {
// Hash(current element of the proof + current computed hash)
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
}
}
return computedHash;
}
}
IERC721Metadata.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional metadata extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
IERC721Enumerable.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 tokenId);
/**
* @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
addressToPresaleMintCount 0xa41c979c → uint256
balanceOf 0x70a08231 → uint256
baseTokenURI 0xd547cfb7 → string
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
maxAmountPerTx 0x85b27c85 → uint256
maxSupply 0xd5abeb01 → uint256
merkleRoot 0x2eb4a7ab → bytes32
mintStatus 0x9da3f8fd → uint8
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
reserved 0xfe60d12c → uint256
royaltyInfo 0x2a55205a → address, uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalSupply 0x18160ddd → uint256
Write Contract 17 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address to
uint256 tokenId
mint 0xe6d37b88
uint256 _amount
uint256 _maxAmount
bytes32[] _proof
mintReserved 0x7de55fe1
address _to
uint256 _amount
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 _baseTokenURI
setMaxAmountPerTx 0xf26a9816
uint256 _maxAmountPerTx
setMerkleRoot 0x7cb64759
bytes32 _merkleRoot
setPrice 0x91b7f5ed
uint256 _newPrice
setReserved 0x2d6e71b6
uint256 _reserved
setRoyaltyDivisor 0xcbc21b08
uint256 _divisor
setStatus 0x2e49d78b
uint8 _status
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address