Address Contract Verified
Address
0xc215d7d3368658c1e9F75Cd458342fe81A6C4120
Balance
0 ETH
Nonce
1
Code Size
10626 bytes
Creator
0x2f232baA...7c0e at tx 0x66e65db7...7b4f7a
Indexed Transactions
0
Contract Bytecode
10626 bytes
0x6080604052600436106101cc575f3560e01c8063697ce654116100f6578063a217fddf11610094578063d547741f11610063578063d547741f146105fc578063f2fde38b14610624578063f9af54ee1461064c578063fe38331914610688576101cc565b8063a217fddf14610556578063bd3d7a7a14610580578063bedb86fb146105aa578063d5391393146105d2576101cc565b80637b6fa73a116100d05780637b6fa73a1461048c5780637cb64759146104c85780638da5cb5b146104f057806391d148541461051a576101cc565b8063697ce65414610424578063715018a61461044c57806378b2e3a914610462576101cc565b80632f2ff15d1161016e57806344a0d68a1161013d57806344a0d68a1461039a5780635a19b4db146103c25780635b4c37b0146103de5780635c975abb146103fa576101cc565b80632f2ff15d1461031857806336568abe146103405780633ab1a494146103685780633ccfd60b14610390576101cc565b8063248a9ca3116101aa578063248a9ca3146102605780632a0acc6a1461029c5780632b4fd779146102c65780632eb4a7ab146102ee576101cc565b806301ffc9a7146101d057806313faede61461020c5780631581b60014610236575b5f80fd5b3480156101db575f80fd5b506101f660048036038101906101f19190611ca9565b6106b0565b6040516102039190611cee565b60405180910390f35b348015610217575f80fd5b50610220610729565b60405161022d9190611d1f565b60405180910390f35b348015610241575f80fd5b5061024a61072f565b6040516102579190611d77565b60405180910390f35b34801561026b575f80fd5b5061028660048036038101906102819190611dc3565b610754565b6040516102939190611dfd565b60405180910390f35b3480156102a7575f80fd5b506102b0610771565b6040516102bd9190611dfd565b60405180910390f35b3480156102d1575f80fd5b506102ec60048036038101906102e79190611e40565b610795565b005b3480156102f9575f80fd5b50610302610803565b60405161030f9190611dfd565b60405180910390f35b348015610323575f80fd5b5061033e60048036038101906103399190611e6b565b610809565b005b34801561034b575f80fd5b5061036660048036038101906103619190611e6b565b61082a565b005b348015610373575f80fd5b5061038e60048036038101906103899190611e40565b6108ad565b005b6103986108f8565b005b3480156103a5575f80fd5b506103c060048036038101906103bb9190611ed3565b610995565b005b6103dc60048036038101906103d79190611f5f565b6109ca565b005b6103f860048036038101906103f39190611fbc565b610d1f565b005b348015610405575f80fd5b5061040e6110a0565b60405161041b9190611cee565b60405180910390f35b34801561042f575f80fd5b5061044a60048036038101906104459190611e40565b6110b3565b005b348015610457575f80fd5b50610460611121565b005b34801561046d575f80fd5b50610476611134565b6040516104839190612088565b60405180910390f35b348015610497575f80fd5b506104b260048036038101906104ad9190611ed3565b611159565b6040516104bf9190611d77565b60405180910390f35b3480156104d3575f80fd5b506104ee60048036038101906104e99190611dc3565b6111fa565b005b3480156104fb575f80fd5b5061050461122f565b6040516105119190611d77565b60405180910390f35b348015610525575f80fd5b50610540600480360381019061053b9190611e6b565b611256565b60405161054d9190611cee565b60405180910390f35b348015610561575f80fd5b5061056a6112ba565b6040516105779190611dfd565b60405180910390f35b34801561058b575f80fd5b506105946112c0565b6040516105a19190611d77565b60405180910390f35b3480156105b5575f80fd5b506105d060048036038101906105cb91906120cb565b6112e5565b005b3480156105dd575f80fd5b506105e661132d565b6040516105f39190611dfd565b60405180910390f35b348015610607575f80fd5b50610622600480360381019061061d9190611e6b565b611351565b005b34801561062f575f80fd5b5061064a60048036038101906106459190611e40565b611372565b005b348015610657575f80fd5b50610672600480360381019061066d9190611ed3565b6113f4565b60405161067f9190611cee565b60405180910390f35b348015610693575f80fd5b506106ae60048036038101906106a991906120f6565b6114f3565b005b5f7f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610722575061072182611548565b5b9050919050565b60045481565b60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f60015f8381526020019081526020015f20600101549050919050565b7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4281565b7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec426107bf816115b1565b8160065f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b60035481565b61081282610754565b61081b816115b1565b61082583836115c5565b505050565b61083261169f565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161461089f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610896906121da565b60405180910390fd5b6108a982826116a6565b5050565b6108b5611781565b8060025f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b610900611781565b5f60025f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff164760405161094690612225565b5f6040518083038185875af1925050503d805f8114610980576040519150601f19603f3d011682016040523d82523d5f602084013e610985565b606091505b5050905080610992575f80fd5b50565b7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec426109bf816115b1565b816004819055505050565b3373ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610a38576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2f90612283565b60405180910390fd5b600260149054906101000a900460ff1615610a88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7f906122eb565b60405180910390fd5b346004541115610acd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ac490612353565b60405180910390fd5b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e856040518263ffffffff1660e01b8152600401610b5f9190611d1f565b602060405180830381865afa158015610b7a573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b9e9190612385565b73ffffffffffffffffffffffffffffffffffffffff1614610bf4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610beb906123fa565b60405180910390fd5b5f3384604051602001610c0892919061247d565b604051602081830303815290604052805190602001209050610c2e8383600354846117ff565b610c6d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c64906124f2565b60405180910390fd5b60065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342842e0e60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1633876040518463ffffffff1660e01b8152600401610cec93929190612510565b5f604051808303815f87803b158015610d03575f80fd5b505af1158015610d15573d5f803e3d5ffd5b5050505050505050565b3373ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610d8d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8490612283565b60405180910390fd5b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6610db7816115b1565b600260149054906101000a900460ff1615610e07576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dfe906122eb565b60405180910390fd5b346004541115610e4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4390612353565b60405180910390fd5b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e876040518263ffffffff1660e01b8152600401610ede9190611d1f565b602060405180830381865afa158015610ef9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f1d9190612385565b73ffffffffffffffffffffffffffffffffffffffff1614610f73576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6a906123fa565b60405180910390fd5b5f8286604051602001610f8792919061247d565b604051602081830303815290604052805190602001209050610fad8585600354846117ff565b610fec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fe3906124f2565b60405180910390fd5b60065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342842e0e60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685896040518463ffffffff1660e01b815260040161106b93929190612510565b5f604051808303815f87803b158015611082575f80fd5b505af1158015611094573d5f803e3d5ffd5b50505050505050505050565b600260149054906101000a900460ff1681565b7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec426110dd816115b1565b8160055f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b611129611781565b6111325f611817565b565b60065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f60065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b81526004016111b49190611d1f565b602060405180830381865afa1580156111cf573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111f39190612385565b9050919050565b7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec42611224816115b1565b816003819055505050565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b5f60015f8481526020019081526020015f205f015f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16905092915050565b5f801b81565b60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4261130f816115b1565b81600260146101000a81548160ff0219169083151502179055505050565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b61135a82610754565b611363816115b1565b61136d83836116a6565b505050565b61137a611781565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036113e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113df906125b5565b60405180910390fd5b6113f181611817565b50565b5f60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e846040518263ffffffff1660e01b81526004016114879190611d1f565b602060405180830381865afa1580156114a2573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114c69190612385565b73ffffffffffffffffffffffffffffffffffffffff16036114ea57600190506114ee565b5f90505b919050565b7fdf8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec4261151d816115b1565b61152685610995565b61152f846111fa565b611538836110b3565b61154182610795565b5050505050565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6115c2816115bd61169f565b6118d8565b50565b6115cf8282611256565b61169b576001805f8481526020019081526020015f205f015f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555061164061169f565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b5f33905090565b6116b08282611256565b1561177d575f60015f8481526020019081526020015f205f015f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555061172261169f565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45b5050565b61178961169f565b73ffffffffffffffffffffffffffffffffffffffff166117a761122f565b73ffffffffffffffffffffffffffffffffffffffff16146117fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117f49061261d565b60405180910390fd5b565b5f8261180c86868561195c565b149050949350505050565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6118e28282611256565b611958576118ef816119ac565b6118fc835f1c60206119d9565b60405160200161190d929190612721565b6040516020818303038152906040526040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194f91906127a2565b60405180910390fd5b5050565b5f808290505f5b858590508110156119a05761199182878784818110611985576119846127c2565b5b90506020020135611c0e565b91508080600101915050611963565b50809150509392505050565b60606119d28273ffffffffffffffffffffffffffffffffffffffff16601460ff166119d9565b9050919050565b60605f60028360026119eb919061281c565b6119f5919061285d565b67ffffffffffffffff811115611a0e57611a0d612890565b5b6040519080825280601f01601f191660200182016040528015611a405781602001600182028036833780820191505090505b5090507f3000000000000000000000000000000000000000000000000000000000000000815f81518110611a7757611a766127c2565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611ada57611ad96127c2565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053505f6001846002611b18919061281c565b611b22919061285d565b90505b6001811115611bc1577f3031323334353637383961626364656600000000000000000000000000000000600f861660108110611b6457611b636127c2565b5b1a60f81b828281518110611b7b57611b7a6127c2565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a905350600485901c945080611bba906128bd565b9050611b25565b505f8414611c04576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bfb9061292e565b60405180910390fd5b8091505092915050565b5f818310611c2557611c208284611c38565b611c30565b611c2f8383611c38565b5b905092915050565b5f825f528160205260405f20905092915050565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611c8881611c54565b8114611c92575f80fd5b50565b5f81359050611ca381611c7f565b92915050565b5f60208284031215611cbe57611cbd611c4c565b5b5f611ccb84828501611c95565b91505092915050565b5f8115159050919050565b611ce881611cd4565b82525050565b5f602082019050611d015f830184611cdf565b92915050565b5f819050919050565b611d1981611d07565b82525050565b5f602082019050611d325f830184611d10565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f611d6182611d38565b9050919050565b611d7181611d57565b82525050565b5f602082019050611d8a5f830184611d68565b92915050565b5f819050919050565b611da281611d90565b8114611dac575f80fd5b50565b5f81359050611dbd81611d99565b92915050565b5f60208284031215611dd857611dd7611c4c565b5b5f611de584828501611daf565b91505092915050565b611df781611d90565b82525050565b5f602082019050611e105f830184611dee565b92915050565b611e1f81611d57565b8114611e29575f80fd5b50565b5f81359050611e3a81611e16565b92915050565b5f60208284031215611e5557611e54611c4c565b5b5f611e6284828501611e2c565b91505092915050565b5f8060408385031215611e8157611e80611c4c565b5b5f611e8e85828601611daf565b9250506020611e9f85828601611e2c565b9150509250929050565b611eb281611d07565b8114611ebc575f80fd5b50565b5f81359050611ecd81611ea9565b92915050565b5f60208284031215611ee857611ee7611c4c565b5b5f611ef584828501611ebf565b91505092915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f840112611f1f57611f1e611efe565b5b8235905067ffffffffffffffff811115611f3c57611f3b611f02565b5b602083019150836020820283011115611f5857611f57611f06565b5b9250929050565b5f805f60408486031215611f7657611f75611c4c565b5b5f611f8386828701611ebf565b935050602084013567ffffffffffffffff811115611fa457611fa3611c50565b5b611fb086828701611f0a565b92509250509250925092565b5f805f8060608587031215611fd457611fd3611c4c565b5b5f611fe187828801611ebf565b945050602085013567ffffffffffffffff81111561200257612001611c50565b5b61200e87828801611f0a565b9350935050604061202187828801611e2c565b91505092959194509250565b5f819050919050565b5f61205061204b61204684611d38565b61202d565b611d38565b9050919050565b5f61206182612036565b9050919050565b5f61207282612057565b9050919050565b61208281612068565b82525050565b5f60208201905061209b5f830184612079565b92915050565b6120aa81611cd4565b81146120b4575f80fd5b50565b5f813590506120c5816120a1565b92915050565b5f602082840312156120e0576120df611c4c565b5b5f6120ed848285016120b7565b91505092915050565b5f805f806080858703121561210e5761210d611c4c565b5b5f61211b87828801611ebf565b945050602061212c87828801611daf565b935050604061213d87828801611e2c565b925050606061214e87828801611e2c565b91505092959194509250565b5f82825260208201905092915050565b7f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e63655f8201527f20726f6c657320666f722073656c660000000000000000000000000000000000602082015250565b5f6121c4602f8361215a565b91506121cf8261216a565b604082019050919050565b5f6020820190508181035f8301526121f1816121b8565b9050919050565b5f81905092915050565b50565b5f6122105f836121f8565b915061221b82612202565b5f82019050919050565b5f61222f82612205565b9150819050919050565b7f5468652063616c6c657220697320616e6f7468657220636f6e74726163742e005f82015250565b5f61226d601f8361215a565b915061227882612239565b602082019050919050565b5f6020820190508181035f83015261229a81612261565b9050919050565b7f74686520636f6e747261637420697320706175736564000000000000000000005f82015250565b5f6122d560168361215a565b91506122e0826122a1565b602082019050919050565b5f6020820190508181035f830152612302816122c9565b9050919050565b7f696e73756666696369656e742066756e647300000000000000000000000000005f82015250565b5f61233d60128361215a565b915061234882612309565b602082019050919050565b5f6020820190508181035f83015261236a81612331565b9050919050565b5f8151905061237f81611e16565b92915050565b5f6020828403121561239a57612399611c4c565b5b5f6123a784828501612371565b91505092915050565b7f4e4654206f7574206f662073746f636b000000000000000000000000000000005f82015250565b5f6123e460108361215a565b91506123ef826123b0565b602082019050919050565b5f6020820190508181035f830152612411816123d8565b9050919050565b5f8160601b9050919050565b5f61242e82612418565b9050919050565b5f61243f82612424565b9050919050565b61245761245282611d57565b612435565b82525050565b5f819050919050565b61247761247282611d07565b61245d565b82525050565b5f6124888285612446565b6014820191506124988284612466565b6020820191508190509392505050565b7f75736572206973206e6f7420616c6c6f776c69737465640000000000000000005f82015250565b5f6124dc60178361215a565b91506124e7826124a8565b602082019050919050565b5f6020820190508181035f830152612509816124d0565b9050919050565b5f6060820190506125235f830186611d68565b6125306020830185611d68565b61253d6040830184611d10565b949350505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f20615f8201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b5f61259f60268361215a565b91506125aa82612545565b604082019050919050565b5f6020820190508181035f8301526125cc81612593565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725f82015250565b5f61260760208361215a565b9150612612826125d3565b602082019050919050565b5f6020820190508181035f830152612634816125fb565b9050919050565b5f81905092915050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000005f82015250565b5f61267960178361263b565b915061268482612645565b601782019050919050565b5f81519050919050565b8281835e5f83830152505050565b5f6126b18261268f565b6126bb818561263b565b93506126cb818560208601612699565b80840191505092915050565b7f206973206d697373696e6720726f6c65200000000000000000000000000000005f82015250565b5f61270b60118361263b565b9150612716826126d7565b601182019050919050565b5f61272b8261266d565b915061273782856126a7565b9150612742826126ff565b915061274e82846126a7565b91508190509392505050565b5f601f19601f8301169050919050565b5f6127748261268f565b61277e818561215a565b935061278e818560208601612699565b6127978161275a565b840191505092915050565b5f6020820190508181035f8301526127ba818461276a565b905092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61282682611d07565b915061283183611d07565b925082820261283f81611d07565b91508282048414831517612856576128556127ef565b5b5092915050565b5f61286782611d07565b915061287283611d07565b925082820190508082111561288a576128896127ef565b5b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f6128c782611d07565b91505f82036128d9576128d86127ef565b5b600182039050919050565b7f537472696e67733a20686578206c656e67746820696e73756666696369656e745f82015250565b5f61291860208361215a565b9150612923826128e4565b602082019050919050565b5f6020820190508181035f8301526129458161290c565b905091905056fea2646970667358221220d600c7dfdc9499887de4e52d75dc75a5a08a47cec6e53789a04063fec97888a164736f6c634300081a0033
Verified Source Code Full Match
Compiler: v0.8.26+commit.8a97fa7a
EVM: cancun
Optimization: No
minter_2nd_sale.sol 134 lines
// SPDX-License-Identifier: MIT
// Copyright (c) 2023 Keisuke OHNO (kei31.eth)
pragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
//NFT interface
interface iNFTCollection {
function balanceOf(address _owner) external view returns (uint);
function ownerOf(uint256 tokenId) external view returns (address);
function safeTransferFrom( address from, address to, uint256 tokenId) external ;
}
contract IYASAKASellser is Ownable , AccessControl{
constructor() {
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
grantRole( ADMIN , msg.sender);
setMerkleRoot(0xb459efcce43c854e36a6669b7cb680bcda35bebf11a0f3663f7722cb968dace3);
setSellserWalletAddress(0x2f232baAb931f0c1243FC848c290e500aC7E7c0e);
setNFTCollection(0xCFea11232aA81bbD397EDc3206B612a3302e63FD);
}
bytes32 public constant ADMIN = keccak256("ADMIN");
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
//
//withdraw section
//
address public withdrawAddress = 0xe72301c175e589eE2F94e77c40A2E37096a771D0;
function setWithdrawAddress(address _withdrawAddress) public onlyOwner {
withdrawAddress = _withdrawAddress;
}
function withdraw() public payable onlyOwner {
(bool os, ) = payable(withdrawAddress).call{value: address(this).balance}('');
require(os);
}
//
//buy section
//
bool public paused = true;
bytes32 public merkleRoot;
uint256 public cost = 36900000000000000;
address public sellerWalletAddress = 0x2f232baAb931f0c1243FC848c290e500aC7E7c0e;
//https://eth-converter.com/
iNFTCollection public NFTCollection;
modifier callerIsUser() {
require(tx.origin == msg.sender, "The caller is another contract.");
_;
}
function buy(uint256 _tokenId , bytes32[] calldata _merkleProof ) public payable callerIsUser{
require(!paused, "the contract is paused");
require(cost <= msg.value, "insufficient funds");
require(NFTCollection.ownerOf(_tokenId) == sellerWalletAddress , "NFT out of stock");
bytes32 leaf = keccak256( abi.encodePacked(msg.sender, _tokenId) );
require(MerkleProof.verifyCalldata(_merkleProof, merkleRoot, leaf), "user is not allowlisted");
NFTCollection.safeTransferFrom( sellerWalletAddress , msg.sender , _tokenId );
}
function buyPie(uint256 _tokenId , bytes32[] calldata _merkleProof , address receiver) public payable callerIsUser onlyRole(MINTER_ROLE){
require(!paused, "the contract is paused");
require(cost <= msg.value, "insufficient funds");
require(NFTCollection.ownerOf(_tokenId) == sellerWalletAddress , "NFT out of stock");
bytes32 leaf = keccak256( abi.encodePacked(receiver, _tokenId) );
require(MerkleProof.verifyCalldata(_merkleProof, merkleRoot, leaf), "user is not allowlisted");
NFTCollection.safeTransferFrom( sellerWalletAddress , receiver , _tokenId );
}
function setPause(bool _state) public onlyRole(ADMIN) {
paused = _state;
}
function setCost(uint256 _newCost) public onlyRole(ADMIN) {
cost = _newCost;
}
function setMerkleRoot(bytes32 _merkleRoot) public onlyRole(ADMIN) {
merkleRoot = _merkleRoot;
}
function setSellserWalletAddress(address _sellerWalletAddress) public onlyRole(ADMIN) {
sellerWalletAddress = _sellerWalletAddress;
}
function setNFTCollection(address _address) public onlyRole(ADMIN) {
NFTCollection = iNFTCollection(_address);
}
function setSaleData(
uint256 _newCost,
bytes32 _merkleRoot,
address _sellerWalletAddress,
address _address
) public onlyRole(ADMIN){
setCost(_newCost);
setMerkleRoot(_merkleRoot);
setSellserWalletAddress(_sellerWalletAddress);
setNFTCollection(_address);
}
function nftOwnerOf(uint256 _tokenId)public view returns(address){
return NFTCollection.ownerOf(_tokenId);
}
function NFTinStock(uint256 _tokenId)public view returns(bool){
if( NFTCollection.ownerOf(_tokenId) == sellerWalletAddress ){
return true;
}else{
return false;
}
}
}
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 85 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
import "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @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] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (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 Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling 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);
}
}
Math.sol 339 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}
AccessControl.sol 248 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(account),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}
IAccessControl.sol 88 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}
SignedMath.sol 43 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}
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);
}
MerkleProof.sol 227 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.2) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Tree proofs.
*
* The tree and the proofs can be generated using our
* https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
* You will find a quickstart guide in the readme.
*
* WARNING: You should avoid using leaf values that are 64 bytes long prior to
* hashing, or use a hash function other than keccak256 for hashing leaves.
* This is because the concatenation of a sorted pair of internal nodes in
* the merkle tree could be reinterpreted as a leaf value.
* OpenZeppelin's JavaScript library generates merkle trees that are safe
* against this attack out of the box.
*/
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 Calldata version of {verify}
*
* _Available since v4.7._
*/
function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
return processProofCalldata(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merkle 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++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Calldata version of {processProof}
*
* _Available since v4.7._
*/
function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
computedHash = _hashPair(computedHash, proof[i]);
}
return computedHash;
}
/**
* @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by
* `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function multiProofVerify(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProof(proof, proofFlags, leaves) == root;
}
/**
* @dev Calldata version of {multiProofVerify}
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function multiProofVerifyCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32 root,
bytes32[] memory leaves
) internal pure returns (bool) {
return processMultiProofCalldata(proof, proofFlags, leaves) == root;
}
/**
* @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
* proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
* leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
* respectively.
*
* CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
* is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
* tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
*
* _Available since v4.7._
*/
function processMultiProof(
bytes32[] memory proof,
bool[] memory proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
require(proofPos == proofLen, "MerkleProof: invalid multiproof");
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
/**
* @dev Calldata version of {processMultiProof}.
*
* CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.
*
* _Available since v4.7._
*/
function processMultiProofCalldata(
bytes32[] calldata proof,
bool[] calldata proofFlags,
bytes32[] memory leaves
) internal pure returns (bytes32 merkleRoot) {
// This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
// consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
// `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
// the merkle tree.
uint256 leavesLen = leaves.length;
uint256 proofLen = proof.length;
uint256 totalHashes = proofFlags.length;
// Check proof validity.
require(leavesLen + proofLen - 1 == totalHashes, "MerkleProof: invalid multiproof");
// The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
// `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
bytes32[] memory hashes = new bytes32[](totalHashes);
uint256 leafPos = 0;
uint256 hashPos = 0;
uint256 proofPos = 0;
// At each step, we compute the next hash using two values:
// - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
// get the next hash.
// - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
// `proof` array.
for (uint256 i = 0; i < totalHashes; i++) {
bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
bytes32 b = proofFlags[i]
? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
: proof[proofPos++];
hashes[i] = _hashPair(a, b);
}
if (totalHashes > 0) {
require(proofPos == proofLen, "MerkleProof: invalid multiproof");
unchecked {
return hashes[totalHashes - 1];
}
} else if (leavesLen > 0) {
return leaves[0];
} else {
return proof[0];
}
}
function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
Read Contract
ADMIN 0x2a0acc6a → bytes32
DEFAULT_ADMIN_ROLE 0xa217fddf → bytes32
MINTER_ROLE 0xd5391393 → bytes32
NFTCollection 0x78b2e3a9 → address
NFTinStock 0xf9af54ee → bool
cost 0x13faede6 → uint256
getRoleAdmin 0x248a9ca3 → bytes32
hasRole 0x91d14854 → bool
merkleRoot 0x2eb4a7ab → bytes32
nftOwnerOf 0x7b6fa73a → address
owner 0x8da5cb5b → address
paused 0x5c975abb → bool
sellerWalletAddress 0xbd3d7a7a → address
supportsInterface 0x01ffc9a7 → bool
withdrawAddress 0x1581b600 → address
Write Contract 15 functions
These functions modify contract state and require a wallet transaction to execute.
buy 0x5a19b4db
uint256 _tokenId
bytes32[] _merkleProof
buyPie 0x5b4c37b0
uint256 _tokenId
bytes32[] _merkleProof
address receiver
grantRole 0x2f2ff15d
bytes32 role
address account
renounceOwnership 0x715018a6
No parameters
renounceRole 0x36568abe
bytes32 role
address account
revokeRole 0xd547741f
bytes32 role
address account
setCost 0x44a0d68a
uint256 _newCost
setMerkleRoot 0x7cb64759
bytes32 _merkleRoot
setNFTCollection 0x2b4fd779
address _address
setPause 0xbedb86fb
bool _state
setSaleData 0xfe383319
uint256 _newCost
bytes32 _merkleRoot
address _sellerWalletAddress
address _address
setSellserWalletAddress 0x697ce654
address _sellerWalletAddress
setWithdrawAddress 0x3ab1a494
address _withdrawAddress
transferOwnership 0xf2fde38b
address newOwner
withdraw 0x3ccfd60b
No parameters
Recent Transactions
No transactions found for this address