Address Contract Partially Verified
Address
0xfA71Ab5Dd2Fee31C0620544BF2741C48115C9E92
Balance
0 ETH
Nonce
1
Code Size
16592 bytes
Creator
0x0D4674A1...964B at tx 0xe058f8e0...b51b6b
Indexed Transactions
0
Contract Bytecode
16592 bytes
0x6080604052600436106103b8576000357c01000000000000000000000000000000000000000000000000000000009004806374721235116101f9578063ba5a33b01161011f578063d79779b2116100bd578063e985e9c51161008c578063e985e9c514610aa5578063efef39a114610aee578063f2fde38b14610b01578063fa156f9a14610b2157600080fd5b8063d79779b214610a31578063e2ab10ce14610a67578063e2d5ee2d14610a7a578063e33b7de314610a9057600080fd5b8063ce7c2ac2116100f9578063ce7c2ac2146109bb578063cf9e8e69146109f1578063cfc86f7b14610a06578063d7224ba014610a1b57600080fd5b8063ba5a33b014610968578063befe26e61461097b578063c87b56dd1461099b57600080fd5b8063904be6da11610197578063a0bcfc7f11610166578063a0bcfc7f146108f2578063a22cb46514610912578063b85ef03614610932578063b88d4fde1461094857600080fd5b8063904be6da1461087c57806395d89b41146108925780639852595c146108a75780639d044ed3146108dd57600080fd5b80638456cb59116101d35780638456cb59146108145780638b83209b146108295780638d859f3e146108495780638da5cb5b1461085e57600080fd5b806374721235146107b45780637b96a3b2146107d45780637cb64759146107f457600080fd5b80633a98ef39116102de5780635c975abb1161027c578063696fa41e1161024b578063696fa41e146107495780636c2f5acd1461075f57806370a082311461077f578063715018a61461079f57600080fd5b80635c975abb146106e65780635f0d246a146106fe5780636352211e1461071457806366cfb1f31461073457600080fd5b806340c10f19116102b857806340c10f191461067357806342842e0e1461068657806348b75044146106a65780634f6ccce7146106c657600080fd5b80633a98ef39146106035780633f4ba83a14610618578063406072a91461062d57600080fd5b80631e84c413116103565780632a55205a116103255780632a55205a1461057b5780632f745c59146105ba5780632fc37ab2146105da578063313f944f146105f057600080fd5b80631e84c4131461051a57806322f4596f1461052f578063235b6ea11461054557806323b872dd1461055b57600080fd5b8063095ea7b311610392578063095ea7b314610495578063139b3936146104b757806318160ddd146104d757806319165587146104fa57600080fd5b806301ffc9a71461040657806306fdde031461043b578063081812fc1461045d57600080fd5b36610401577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be7703360408051600160a060020a0390921682523460208301520160405180910390a1005b600080fd5b34801561041257600080fd5b50610426610421366004613656565b610b37565b60405190151581526020015b60405180910390f35b34801561044757600080fd5b50610450610b7b565b60405161043291906136cb565b34801561046957600080fd5b5061047d6104783660046136de565b610c0d565b604051600160a060020a039091168152602001610432565b3480156104a157600080fd5b506104b56104b036600461370c565b610cb0565b005b3480156104c357600080fd5b506104b56104d2366004613738565b610de8565b3480156104e357600080fd5b506104ec610e2f565b604051908152602001610432565b34801561050657600080fd5b506104b5610515366004613738565b610e44565b34801561052657600080fd5b50610426610f7c565b34801561053b57600080fd5b506104ec60175481565b34801561055157600080fd5b506104ec60155481565b34801561056757600080fd5b506104b5610576366004613755565b610f94565b34801561058757600080fd5b5061059b610596366004613796565b610f9f565b60408051600160a060020a039093168352602083019190915201610432565b3480156105c657600080fd5b506104ec6105d536600461370c565b610ff4565b3480156105e657600080fd5b506104ec60145481565b6104b56105fe36600461370c565b61119a565b34801561060f57600080fd5b50600c546104ec565b34801561062457600080fd5b506104b5611230565b34801561063957600080fd5b506104ec6106483660046137b8565b600160a060020a03918216600090815260126020908152604080832093909416825291909152205490565b6104b561068136600461370c565b611267565b34801561069257600080fd5b506104b56106a1366004613755565b6112a7565b3480156106b257600080fd5b506104b56106c13660046137b8565b6112c2565b3480156106d257600080fd5b506104ec6106e13660046136de565b6114bd565b3480156106f257600080fd5b50600a5460ff16610426565b34801561070a57600080fd5b506104ec60165481565b34801561072057600080fd5b5061047d61072f3660046136de565b611542565b34801561074057600080fd5b506104ec611554565b34801561075557600080fd5b506104ec601c5481565b34801561076b57600080fd5b506104b561077a36600461370c565b611571565b34801561078b57600080fd5b506104ec61079a366004613738565b6115a8565b3480156107ab57600080fd5b506104b561164e565b3480156107c057600080fd5b506104b56107cf3660046137f1565b611685565b3480156107e057600080fd5b506104266107ef366004613891565b6116d8565b34801561080057600080fd5b506104b561080f3660046136de565b611765565b34801561082057600080fd5b506104b5611797565b34801561083557600080fd5b5061047d6108443660046136de565b6117cc565b34801561085557600080fd5b506104ec6117fc565b34801561086a57600080fd5b50600054600160a060020a031661047d565b34801561088857600080fd5b506104ec60195481565b34801561089e57600080fd5b50610450611819565b3480156108b357600080fd5b506104ec6108c2366004613738565b600160a060020a03166000908152600f602052604090205490565b3480156108e957600080fd5b50610426611828565b3480156108fe57600080fd5b506104b561090d366004613975565b61184b565b34801561091e57600080fd5b506104b561092d3660046139cc565b611884565b34801561093e57600080fd5b506104ec601a5481565b34801561095457600080fd5b506104b56109633660046139fa565b61194b565b6104b561097636600461370c565b611987565b34801561098757600080fd5b506104b5610996366004613738565b611a40565b3480156109a757600080fd5b506104506109b63660046136de565b611a8a565b3480156109c757600080fd5b506104ec6109d6366004613738565b600160a060020a03166000908152600e602052604090205490565b3480156109fd57600080fd5b506017546104ec565b348015610a1257600080fd5b50610450611b67565b348015610a2757600080fd5b506104ec60085481565b348015610a3d57600080fd5b506104ec610a4c366004613738565b600160a060020a031660009081526011602052604090205490565b6104b5610a75366004613a7a565b611bf5565b348015610a8657600080fd5b506104ec60185481565b348015610a9c57600080fd5b50600d546104ec565b348015610ab157600080fd5b50610426610ac03660046137b8565b600160a060020a03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6104b5610afc3660046136de565b611c5e565b348015610b0d57600080fd5b506104b5610b1c366004613738565b611c91565b348015610b2d57600080fd5b506104ec601b5481565b6000600160e060020a031982167f2a55205a000000000000000000000000000000000000000000000000000000001480610b755750610b7582611d46565b92915050565b606060028054610b8a90613aad565b80601f0160208091040260200160405190810160405280929190818152602001828054610bb690613aad565b8015610c035780601f10610bd857610100808354040283529160200191610c03565b820191906000526020600020905b815481529060010190602001808311610be657829003601f168201915b5050505050905090565b6000610c1a826001541190565b610c945760405160e560020a62461bcd02815260206004820152602d60248201527f455243373231413a20617070726f76656420717565727920666f72206e6f6e6560448201527f78697374656e7420746f6b656e0000000000000000000000000000000000000060648201526084015b60405180910390fd5b50600090815260066020526040902054600160a060020a031690565b6000610cbb82611542565b905080600160a060020a031683600160a060020a031603610d475760405160e560020a62461bcd02815260206004820152602260248201527f455243373231413a20617070726f76616c20746f2063757272656e74206f776e60448201527f65720000000000000000000000000000000000000000000000000000000000006064820152608401610c8b565b33600160a060020a0382161480610d635750610d638133610ac0565b610dd85760405160e560020a62461bcd02815260206004820152603960248201527f455243373231413a20617070726f76652063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f76656420666f7220616c6c000000000000006064820152608401610c8b565b610de3838383611e15565b505050565b600054600160a060020a03163314610e155760405160e560020a62461bcd028152600401610c8b90613aea565b600160a060020a03166000908152600b6020526040812055565b600060018054610e3f9190613b38565b905090565b600160a060020a0381166000908152600e6020526040902054610e7c5760405160e560020a62461bcd028152600401610c8b90613b4f565b6000610e87600d5490565b610e92903031613bac565b90506000610ebf8383610eba86600160a060020a03166000908152600f602052604090205490565b611e7e565b905080600003610ee45760405160e560020a62461bcd028152600401610c8b90613bc4565b600160a060020a0383166000908152600f602052604081208054839290610f0c908490613bac565b9250508190555080600d6000828254610f259190613bac565b90915550610f3590508382611ec4565b60408051600160a060020a0385168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056910160405180910390a1505050565b6000601a5460001480610e3f575042601a5410905090565b610de3838383611fe4565b60408051808201909152600954600160a060020a03811680835260a060020a90910462ffffff1660208301819052909160009161271090610fe09086613c21565b610fea9190613c59565b9150509250929050565b6000610fff836115a8565b82106110765760405160e560020a62461bcd02815260206004820152602260248201527f455243373231413a206f776e657220696e646578206f7574206f6620626f756e60448201527f64730000000000000000000000000000000000000000000000000000000000006064820152608401610c8b565b6000611080610e2f565b905060008060005b8381101561112857600081815260046020908152604091829020825180840190935254600160a060020a03811680845260a060020a90910467ffffffffffffffff1691830191909152156110db57805192505b87600160a060020a031683600160a060020a0316036111155786840361110757509350610b7592505050565b8361111181613c6d565b9450505b508061112081613c6d565b915050611088565b5060405160e560020a62461bcd02815260206004820152602e60248201527f455243373231413a20756e61626c6520746f2067657420746f6b656e206f662060448201527f6f776e657220627920696e6465780000000000000000000000000000000000006064820152608401610c8b565b600a5460ff16156111c05760405160e560020a62461bcd028152600401610c8b90613c86565b336000908152600b60205260409020546001146112225760405160e560020a62461bcd02815260206004820152601660248201527f496e76616c69642045787465726e616c2072656c6179000000000000000000006044820152606401610c8b565b61122c82826123af565b5050565b600054600160a060020a0316331461125d5760405160e560020a62461bcd028152600401610c8b90613aea565b61126561245e565b565b600054600160a060020a031633146112945760405160e560020a62461bcd028152600401610c8b90613aea565b61129d816124fd565b61122c828261258a565b610de38383836040518060200160405280600081525061194b565b600160a060020a0381166000908152600e60205260409020546112fa5760405160e560020a62461bcd028152600401610c8b90613b4f565b600160a060020a0382166000908152601160205260408120546040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600160a060020a038516906370a0823190602401602060405180830381865afa158015611370573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113949190613cbd565b61139e9190613bac565b905060006113d78383610eba8787600160a060020a03918216600090815260126020908152604080832093909416825291909152205490565b9050806000036113fc5760405160e560020a62461bcd028152600401610c8b90613bc4565b600160a060020a03808516600090815260126020908152604080832093871683529290529081208054839290611433908490613bac565b9091555050600160a060020a03841660009081526011602052604081208054839290611460908490613bac565b9091555061147190508484836125a4565b60408051600160a060020a038581168252602082018490528616917f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a910160405180910390a250505050565b60006114c7610e2f565b821061153e5760405160e560020a62461bcd02815260206004820152602360248201527f455243373231413a20676c6f62616c20696e646578206f7574206f6620626f7560448201527f6e647300000000000000000000000000000000000000000000000000000000006064820152608401610c8b565b5090565b600061154d82612624565b5192915050565b600061155e611828565b1561156a575060195490565b5060185490565b600054600160a060020a0316331461159e5760405160e560020a62461bcd028152600401610c8b90613aea565b61122c82826127f5565b6000600160a060020a0382166116295760405160e560020a62461bcd02815260206004820152602b60248201527f455243373231413a2062616c616e636520717565727920666f7220746865207a60448201527f65726f20616464726573730000000000000000000000000000000000000000006064820152608401610c8b565b50600160a060020a03166000908152600560205260409020546001608060020a031690565b600054600160a060020a0316331461167b5760405160e560020a62461bcd028152600401610c8b90613aea565b61126560006128a4565b600054600160a060020a031633146116b25760405160e560020a62461bcd028152600401610c8b90613aea565b601a97909755601b95909555601893909355601991909155601555601655601455601c55565b60006040516c01000000000000000000000000600160a060020a03861602602082015260009060340160405160208183030381529060405280519060200120905061175a848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506014549150849050612901565b9150505b9392505050565b600054600160a060020a031633146117925760405160e560020a62461bcd028152600401610c8b90613aea565b601455565b600054600160a060020a031633146117c45760405160e560020a62461bcd028152600401610c8b90613aea565b611265612917565b6000601082815481106117e1576117e1613cd6565b600091825260209091200154600160a060020a031692915050565b6000611806611828565b15611812575060165490565b5060155490565b606060038054610b8a90613aad565b6000601b5460001480610e3f575042601b54108015610e3f575050601a54421090565b600054600160a060020a031633146118785760405160e560020a62461bcd028152600401610c8b90613aea565b601361122c8282613d35565b33600160a060020a038316036118df5760405160e560020a62461bcd02815260206004820152601a60248201527f455243373231413a20617070726f766520746f2063616c6c65720000000000006044820152606401610c8b565b336000818152600760209081526040808320600160a060020a03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611956848484611fe4565b61196284848484612972565b6119815760405160e560020a62461bcd028152600401610c8b90613dfb565b50505050565b600a5460ff16156119ad5760405160e560020a62461bcd028152600401610c8b90613c86565b336000908152600b6020526040902054600114611a0f5760405160e560020a62461bcd02815260206004820152601660248201527f496e76616c69642045787465726e616c2072656c6179000000000000000000006044820152606401610c8b565b611a17611828565b611a365760405160e560020a62461bcd028152600401610c8b90613e58565b61122c8282612aa8565b600054600160a060020a03163314611a6d5760405160e560020a62461bcd028152600401610c8b90613aea565b600160a060020a03166000908152600b6020526040902060019055565b6060611a97826001541190565b611b0c5760405160e560020a62461bcd02815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006064820152608401610c8b565b6000611b16612b00565b90506000815111611b36576040518060200160405280600081525061175e565b80611b4084612b34565b604051602001611b51929190613eb5565b6040516020818303038152906040529392505050565b60138054611b7490613aad565b80601f0160208091040260200160405190810160405280929190818152602001828054611ba090613aad565b8015611bed5780601f10611bc257610100808354040283529160200191611bed565b820191906000526020600020905b815481529060010190602001808311611bd057829003601f168201915b505050505081565b600a5460ff1615611c1b5760405160e560020a62461bcd028152600401610c8b90613c86565b611c23611828565b8015611c355750611c353383836116d8565b611c545760405160e560020a62461bcd028152600401610c8b90613e58565b610de33384612aa8565b600a5460ff1615611c845760405160e560020a62461bcd028152600401610c8b90613c86565b611c8e33826123af565b50565b600054600160a060020a03163314611cbe5760405160e560020a62461bcd028152600401610c8b90613aea565b600160a060020a038116611d3d5760405160e560020a62461bcd02815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610c8b565b611c8e816128a4565b6000600160e060020a031982167f80ac58cd000000000000000000000000000000000000000000000000000000001480611da95750600160e060020a031982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b80611ddd5750600160e060020a031982167f780e9d6300000000000000000000000000000000000000000000000000000000145b80610b7557507f01ffc9a700000000000000000000000000000000000000000000000000000000600160e060020a0319831614610b75565b600082815260066020526040808220805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600c54600160a060020a0384166000908152600e602052604081205490918391611ea89086613c21565b611eb29190613c59565b611ebc9190613b38565b949350505050565b3031811115611f185760405160e560020a62461bcd02815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610c8b565b600082600160a060020a03168260405160006040518083038185875af1925050503d8060008114611f65576040519150601f19603f3d011682016040523d82523d6000602084013e611f6a565b606091505b5050905080610de35760405160e560020a62461bcd02815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610c8b565b6000611fef82612624565b8051909150600090600160a060020a031633600160a060020a0316148061202657503361201b84610c0d565b600160a060020a0316145b80612038575081516120389033610ac0565b9050806120b05760405160e560020a62461bcd02815260206004820152603260248201527f455243373231413a207472616e736665722063616c6c6572206973206e6f742060448201527f6f776e6572206e6f7220617070726f76656400000000000000000000000000006064820152608401610c8b565b84600160a060020a03168260000151600160a060020a03161461213e5760405160e560020a62461bcd02815260206004820152602660248201527f455243373231413a207472616e736665722066726f6d20696e636f727265637460448201527f206f776e657200000000000000000000000000000000000000000000000000006064820152608401610c8b565b600160a060020a0384166121bd5760405160e560020a62461bcd02815260206004820152602560248201527f455243373231413a207472616e7366657220746f20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610c8b565b6121cd6000848460000151611e15565b600160a060020a03851660009081526005602052604081208054600192906121ff9084906001608060020a0316613ee4565b82546101009290920a6001608060020a03818102199093169183160217909155600160a060020a0386166000908152600560205260408120805460019450909261224b91859116613f0c565b82546001608060020a039182166101009390930a928302919092021990911617905550604080518082018252600160a060020a03808716825267ffffffffffffffff42811660208085019182526000898152600490915294852093518454915190921660a060020a02600160e060020a031990911691909216171790556122d3846001613bac565b600081815260046020526040902054909150600160a060020a0316612365576122fd816001541190565b15612365576040805180820182528451600160a060020a03908116825260208087015167ffffffffffffffff908116828501908152600087815260049093529490912092518354945190911660a060020a02600160e060020a03199094169116179190911790555b8385600160a060020a031687600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b6123bc8282601854612c70565b6123c4610f7c565b6124135760405160e560020a62461bcd02815260206004820152601b60248201527f424153455f434f4c4c454354494f4e2f43414e4e4f545f4d494e5400000000006044820152606401610c8b565b6124208160155484612da7565b8060155483600160a060020a03167f12cb4648cf3058b17ceeb33e579f8b0bc269fe0843f3900b8e24b6c54871703c60405160405180910390a45050565b600a5460ff166124b35760405160e560020a62461bcd02815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610c8b565b600a805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b604051600160a060020a03909116815260200160405180910390a1565b60175481612509610e2f565b6125139190613bac565b1115611c8e5760405160e560020a62461bcd02815260206004820152602260248201527f424153455f434f4c4c454354494f4e2f455843454544535f4d41585f5355505060448201527f4c590000000000000000000000000000000000000000000000000000000000006064820152608401610c8b565b61122c828260405180602001604052806000815250612e61565b60408051600160a060020a038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610de3908490613199565b6040805180820190915260008082526020820152612643826001541190565b6126b85760405160e560020a62461bcd02815260206004820152602a60248201527f455243373231413a206f776e657220717565727920666f72206e6f6e6578697360448201527f74656e7420746f6b656e000000000000000000000000000000000000000000006064820152608401610c8b565b60007f0000000000000000000000000000000000000000000000000000000000000d0583106127195761270b7f0000000000000000000000000000000000000000000000000000000000000d0584613b38565b612716906001613bac565b90505b825b81811061278357600081815260046020908152604091829020825180840190935254600160a060020a03811680845260a060020a90910467ffffffffffffffff16918301919091521561277057949350505050565b508061277b81613f2e565b91505061271b565b5060405160e560020a62461bcd02815260206004820152602f60248201527f455243373231413a20756e61626c6520746f2064657465726d696e652074686560448201527f206f776e6572206f6620746f6b656e00000000000000000000000000000000006064820152608401610c8b565b61271081111561284a5760405160e560020a62461bcd02815260206004820152601a60248201527f45524332393831526f79616c746965733a20546f6f20686967680000000000006044820152606401610c8b565b60408051808201909152600160a060020a0390921680835262ffffff90911660209092018290526009805460a060020a90930276ffffffffffffffffffffffffffffffffffffffffffffff19909316909117919091179055565b60008054600160a060020a0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008261290e8584613281565b14949350505050565b600a5460ff161561293d5760405160e560020a62461bcd028152600401610c8b90613c86565b600a805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586124e03390565b6000600160a060020a0384163b15612a9d576040517f150b7a02000000000000000000000000000000000000000000000000000000008152600160a060020a0385169063150b7a02906129cf903390899088908890600401613f45565b6020604051808303816000875af1925050508015612a0a575060408051601f3d908101601f19168201909252612a0791810190613f81565b60015b612a6a573d808015612a38576040519150601f19603f3d011682016040523d82523d6000602084013e612a3d565b606091505b508051600003612a625760405160e560020a62461bcd028152600401610c8b90613dfb565b805181602001fd5b600160e060020a0319167f150b7a0200000000000000000000000000000000000000000000000000000000149050611ebc565b506001949350505050565b612ab58282601954612c70565b612ac28160165484612da7565b8060165483600160a060020a03167f38bd02858ca92987ff585a4c06998aea8187e96864df1eaf349dec3cfddc0fbb60405160405180910390a45050565b60606013612b0f30601461332d565b604051602001612b20929190613f9e565b604051602081830303815290604052905090565b606081600003612b7757505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115612ba15780612b8b81613c6d565b9150612b9a9050600a83613c59565b9150612b7b565b60008167ffffffffffffffff811115612bbc57612bbc6138e6565b6040519080825280601f01601f191660200182016040528015612be6576020820181803683370190505b5090505b8415611ebc57612bfb600183613b38565b9150612c08600a8661404d565b612c13906030613bac565b7f010000000000000000000000000000000000000000000000000000000000000002818381518110612c4757612c47613cd6565b6020010190600160f860020a031916908160001a905350612c69600a86613c59565b9450612bea565b612c79826124fd565b601c541580612c8a5750601c548211155b612cff5760405160e560020a62461bcd02815260206004820152602b60248201527f424153455f434f4c4c454354494f4e2f455843454544535f4d41585f5045525f60448201527f5452414e53414354494f4e0000000000000000000000000000000000000000006064820152608401610c8b565b600160a060020a0383166000908152601d6020526040812054612d23908490613bac565b9050811580612d325750818111155b6119815760405160e560020a62461bcd02815260206004820152602960248201527f424153455f434f4c4c454354494f4e2f455843454544535f494e44495649445560448201527f414c5f535550504c5900000000000000000000000000000000000000000000006064820152608401610c8b565b34612db28484613c21565b1115612e295760405160e560020a62461bcd02815260206004820152602760248201527f424153455f434f4c4c454354494f4e2f494e53554646494349454e545f45544860448201527f5f414d4f554e54000000000000000000000000000000000000000000000000006064820152608401610c8b565b600160a060020a0381166000908152601d602052604081208054859290612e51908490613bac565b90915550610de39050818461258a565b600154600160a060020a038416612ee35760405160e560020a62461bcd02815260206004820152602160248201527f455243373231413a206d696e7420746f20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610c8b565b612eee816001541190565b15612f3e5760405160e560020a62461bcd02815260206004820152601d60248201527f455243373231413a20746f6b656e20616c7265616479206d696e7465640000006044820152606401610c8b565b7f0000000000000000000000000000000000000000000000000000000000000d05831115612fd75760405160e560020a62461bcd02815260206004820152602260248201527f455243373231413a207175616e7469747920746f206d696e7420746f6f20686960448201527f67680000000000000000000000000000000000000000000000000000000000006064820152608401610c8b565b600160a060020a0384166000908152600560209081526040918290208251808401845290546001608060020a0380821683527001000000000000000000000000000000009091041691810191909152815180830190925280519091908190613040908790613f0c565b6001608060020a0316815260200185836020015161305e9190613f0c565b6001608060020a03908116909152600160a060020a03808816600081815260056020908152604080832087519783015187167001000000000000000000000000000000000297909616969096179094558451808601865291825267ffffffffffffffff428116838601908152888352600490955294812091518254945190951660a060020a02600160e060020a031990941694909216939093179190911790915582905b8581101561318e576040518290600160a060020a038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a461314f6000888488612972565b61316e5760405160e560020a62461bcd028152600401610c8b90613dfb565b8161317881613c6d565b925050808061318690613c6d565b915050613102565b5060018190556123a7565b60006131ee826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656481525085600160a060020a031661352f9092919063ffffffff16565b805190915015610de3578080602001905181019061320c9190614061565b610de35760405160e560020a62461bcd02815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610c8b565b600081815b84518110156133255760008582815181106132a3576132a3613cd6565b602002602001015190508083116132e5576040805160208101859052908101829052606001604051602081830303815290604052805190602001209250613312565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b508061331d81613c6d565b915050613286565b509392505050565b6060600061333c836002613c21565b613347906002613bac565b67ffffffffffffffff81111561335f5761335f6138e6565b6040519080825280601f01601f191660200182016040528015613389576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106133c0576133c0613cd6565b6020010190600160f860020a031916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061340b5761340b613cd6565b6020010190600160f860020a031916908160001a905350600061342f846002613c21565b61343a906001613bac565b90505b60018111156134dd577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061347b5761347b613cd6565b1a7f0100000000000000000000000000000000000000000000000000000000000000028282815181106134b0576134b0613cd6565b6020010190600160f860020a031916908160001a9053506010909404936134d681613f2e565b905061343d565b50831561175e5760405160e560020a62461bcd02815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c8b565b6060611ebc848460008585843b61358b5760405160e560020a62461bcd02815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610c8b565b60008086600160a060020a031685876040516135a7919061407e565b60006040518083038185875af1925050503d80600081146135e4576040519150601f19603f3d011682016040523d82523d6000602084013e6135e9565b606091505b50915091506135f9828286613604565b979650505050505050565b6060831561361357508161175e565b8251156136235782518084602001fd5b8160405160e560020a62461bcd028152600401610c8b91906136cb565b600160e060020a031981168114611c8e57600080fd5b60006020828403121561366857600080fd5b813561175e81613640565b60005b8381101561368e578181015183820152602001613676565b838111156119815750506000910152565b600081518084526136b7816020860160208601613673565b601f01601f19169290920160200192915050565b60208152600061175e602083018461369f565b6000602082840312156136f057600080fd5b5035919050565b600160a060020a0381168114611c8e57600080fd5b6000806040838503121561371f57600080fd5b823561372a816136f7565b946020939093013593505050565b60006020828403121561374a57600080fd5b813561175e816136f7565b60008060006060848603121561376a57600080fd5b8335613775816136f7565b92506020840135613785816136f7565b929592945050506040919091013590565b600080604083850312156137a957600080fd5b50508035926020909101359150565b600080604083850312156137cb57600080fd5b82356137d6816136f7565b915060208301356137e6816136f7565b809150509250929050565b600080600080600080600080610100898b03121561380e57600080fd5b505086359860208801359850604088013597606081013597506080810135965060a0810135955060c0810135945060e0013592509050565b60008083601f84011261385857600080fd5b50813567ffffffffffffffff81111561387057600080fd5b602083019150836020808302850101111561388a57600080fd5b9250929050565b6000806000604084860312156138a657600080fd5b83356138b1816136f7565b9250602084013567ffffffffffffffff8111156138cd57600080fd5b6138d986828701613846565b9497909650939450505050565b60e060020a634e487b7102600052604160045260246000fd5b600067ffffffffffffffff8084111561391a5761391a6138e6565b604051601f8501601f19908116603f01168101908282118183101715613942576139426138e6565b8160405280935085815286868601111561395b57600080fd5b858560208301376000602087830101525050509392505050565b60006020828403121561398757600080fd5b813567ffffffffffffffff81111561399e57600080fd5b8201601f810184136139af57600080fd5b611ebc848235602084016138ff565b8015158114611c8e57600080fd5b600080604083850312156139df57600080fd5b82356139ea816136f7565b915060208301356137e6816139be565b60008060008060808587031215613a1057600080fd5b8435613a1b816136f7565b93506020850135613a2b816136f7565b925060408501359150606085013567ffffffffffffffff811115613a4e57600080fd5b8501601f81018713613a5f57600080fd5b613a6e878235602084016138ff565b91505092959194509250565b600080600060408486031215613a8f57600080fd5b83359250602084013567ffffffffffffffff8111156138cd57600080fd5b600281046001821680613ac157607f821691505b602082108103613ae45760e060020a634e487b7102600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60e060020a634e487b7102600052601160045260246000fd5b600082821015613b4a57613b4a613b1f565b500390565b60208082526026908201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060408201527f7368617265730000000000000000000000000000000000000000000000000000606082015260800190565b60008219821115613bbf57613bbf613b1f565b500190565b6020808252602b908201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060408201527f647565207061796d656e74000000000000000000000000000000000000000000606082015260800190565b6000816000190483118215151615613c3b57613c3b613b1f565b500290565b60e060020a634e487b7102600052601260045260246000fd5b600082613c6857613c68613c40565b500490565b600060018201613c7f57613c7f613b1f565b5060010190565b60208082526010908201527f5061757361626c653a2070617573656400000000000000000000000000000000604082015260600190565b600060208284031215613ccf57600080fd5b5051919050565b60e060020a634e487b7102600052603260045260246000fd5b601f821115610de3576000818152602081206020601f86010481016020861015613d165750805b6020601f860104820191505b818110156123a757828155600101613d22565b815167ffffffffffffffff811115613d4f57613d4f6138e6565b613d6381613d5d8454613aad565b84613cef565b602080601f831160018114613d9c5760008415613d805750858301515b60028086026008870290910a60001904198216178655506123a7565b600085815260208120601f198616915b82811015613dcb57888601518255948401946001909101908401613dac565b5085821015613deb57878501516008601f88160260020a60001904191681555b5050505050600202600101905550565b60208082526033908201527f455243373231413a207472616e7366657220746f206e6f6e204552433732315260408201527f6563656976657220696d706c656d656e74657200000000000000000000000000606082015260800190565b60208082526023908201527f424153455f434f4c4c454354494f4e2f43414e4e4f545f4d494e545f5052455360408201527f414c450000000000000000000000000000000000000000000000000000000000606082015260800190565b60008351613ec7818460208801613673565b835190830190613edb818360208801613673565b01949350505050565b60006001608060020a0383811690831681811015613f0457613f04613b1f565b039392505050565b60006001608060020a03808316818516808303821115613edb57613edb613b1f565b600081613f3d57613f3d613b1f565b506000190190565b6000600160a060020a03808716835280861660208401525083604083015260806060830152613f77608083018461369f565b9695505050505050565b600060208284031215613f9357600080fd5b815161175e81613640565b6000808454613fac81613aad565b60018281168015613fc45760018114613fd957614008565b60ff1984168752821515830287019450614008565b8860005260208060002060005b85811015613fff5781548a820152908401908201613fe6565b50505082870194505b508651925061401b838560208a01613673565b7f2f00000000000000000000000000000000000000000000000000000000000000939092019283525001949350505050565b60008261405c5761405c613c40565b500690565b60006020828403121561407357600080fd5b815161175e816139be565b60008251614090818460208701613673565b919091019291505056fea2646970667358221220cb656d381cf7596a0b7e6a5cb651fb07d1e42ebed2640375c2260df3a041806c64736f6c634300080f0033
Verified Source Code Partial Match
Compiler: v0.8.15+commit.e14f2714
EVM: byzantium
Optimization: Yes (200 runs)
Superf3st.sol 188 lines
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/finance/PaymentSplitter.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "./external/ERC721AWithRoyalties.sol";
import "./external/ExternallyPurchaseable.sol";
// @author rollauver.eth
contract Superf3st is ERC721AWithRoyalties, ExternallyPurchaseable, PaymentSplitter {
string public _baseTokenURI;
bytes32 public _merkleRoot;
uint256 public _price;
uint256 public _presalePrice;
uint256 public _maxSupply;
uint256 public _maxPerAddress;
uint256 public _presaleMaxPerAddress;
uint256 public _publicSaleTime;
uint256 public _preSaleTime;
uint256 public _maxTxPerAddress;
mapping(address => uint256) private _purchases;
event EarlyPurchase(address indexed addr, uint256 indexed atPrice, uint256 indexed count);
event Purchase(address indexed addr, uint256 indexed atPrice, uint256 indexed count);
constructor(
string memory name,
string memory symbol,
string memory baseTokenURI, // baseTokenURI - 0
uint256[] memory numericValues, // price - 0, presalePrice - 1, maxSupply - 2, maxPerAddress - 3, presaleMaxPerAddress - 4, publicSaleTime - 5, _preSaleTime - 6, _maxTxPerAddress - 7
bytes32 merkleRoot,
address[] memory payees,
uint256[] memory shares,
address royaltyRecipient,
uint256 royaltyAmount
) ERC721AWithRoyalties(name, symbol, numericValues[2], royaltyRecipient, royaltyAmount) PaymentSplitter(payees, shares) {
_baseTokenURI = baseTokenURI;
_price = numericValues[0];
_presalePrice = numericValues[1];
_maxSupply = numericValues[2];
_maxPerAddress = numericValues[3];
_presaleMaxPerAddress = numericValues[4];
_publicSaleTime = numericValues[5];
_preSaleTime = numericValues[6];
_maxTxPerAddress = numericValues[7];
_merkleRoot = merkleRoot;
}
function setSaleInformation(
uint256 publicSaleTime,
uint256 preSaleTime,
uint256 maxPerAddress,
uint256 presaleMaxPerAddress,
uint256 price,
uint256 presalePrice,
bytes32 merkleRoot,
uint256 maxTxPerAddress
) external onlyOwner {
_publicSaleTime = publicSaleTime;
_preSaleTime = preSaleTime;
_maxPerAddress = maxPerAddress;
_presaleMaxPerAddress = presaleMaxPerAddress;
_price = price;
_presalePrice = presalePrice;
_merkleRoot = merkleRoot;
_maxTxPerAddress = maxTxPerAddress;
}
function isPublicSaleActive() public view override returns (bool) {
return (_publicSaleTime == 0 || _publicSaleTime < block.timestamp);
}
function isPreSaleActive() public view override returns (bool) {
return (_preSaleTime == 0 || (_preSaleTime < block.timestamp) && (block.timestamp < _publicSaleTime));
}
function onEarlyPurchaseList(address addr, bytes32[] calldata merkleProof) public view returns (bool) {
require(_merkleRoot.length > 0, "BASE_COLLECTION/PRESALE_MINT_LIST_UNSET");
bytes32 node = keccak256(abi.encodePacked(addr));
return MerkleProof.verify(merkleProof, _merkleRoot, node);
}
function MAX_TOTAL_MINT() public view returns (uint256) {
return _maxSupply;
}
function PRICE() public view returns (uint256) {
if (isPreSaleActive()) {
return _presalePrice;
}
return _price;
}
function MAX_TOTAL_MINT_PER_ADDRESS() public view returns (uint256) {
if (isPreSaleActive()) {
return _presaleMaxPerAddress;
}
return _maxPerAddress;
}
function setBaseUri(
string memory baseUri
) external onlyOwner {
_baseTokenURI = baseUri;
}
function setMerkleRoot(bytes32 merkleRoot) external onlyOwner {
_merkleRoot = merkleRoot;
}
function pause() external onlyOwner {
_pause();
}
function unpause() external onlyOwner {
_unpause();
}
function mint(address to, uint256 count) external payable onlyOwner {
ensureMintConditions(count);
_safeMint(to, count);
}
function purchase(uint256 count) external payable whenNotPaused {
purchaseHelper(msg.sender, count);
}
function earlyPurchase(uint256 count, bytes32[] calldata merkleProof) external payable whenNotPaused {
require(isPreSaleActive() && onEarlyPurchaseList(msg.sender, merkleProof), "BASE_COLLECTION/CANNOT_MINT_PRESALE");
earlyPurchaseHelper(msg.sender, count);
}
function _baseURI() override internal view virtual returns (string memory) {
return string(
abi.encodePacked(
_baseTokenURI,
Strings.toHexString(uint256(uint160(address(this))), 20),
'/'
)
);
}
function purchaseHelper(address to, uint256 count) internal override {
ensurePublicMintConditions(to, count, _maxPerAddress);
require(isPublicSaleActive(), "BASE_COLLECTION/CANNOT_MINT");
_purchase(count, _price, to);
emit Purchase(to, _price, count);
}
function earlyPurchaseHelper(address to, uint256 count) internal override {
ensurePublicMintConditions(to, count, _presaleMaxPerAddress);
_purchase(count, _presalePrice, to);
emit EarlyPurchase(to, _presalePrice, count);
}
function _purchase(uint256 count, uint256 price, address to) private {
require(price * count <= msg.value, 'BASE_COLLECTION/INSUFFICIENT_ETH_AMOUNT');
_purchases[to] += count;
_safeMint(to, count);
}
function ensureMintConditions(uint256 count) internal view {
require(totalSupply() + count <= _maxSupply, "BASE_COLLECTION/EXCEEDS_MAX_SUPPLY");
}
function ensurePublicMintConditions(address to, uint256 count, uint256 maxPerAddress) internal view {
ensureMintConditions(count);
require((_maxTxPerAddress == 0) || (count <= _maxTxPerAddress), "BASE_COLLECTION/EXCEEDS_MAX_PER_TRANSACTION");
uint256 totalMintFromAddress = _purchases[to] + count;
require ((maxPerAddress == 0) || (totalMintFromAddress <= maxPerAddress), "BASE_COLLECTION/EXCEEDS_INDIVIDUAL_SUPPLY");
}
}
ERC721A.sol 547 lines
// SPDX-License-Identifier: MIT
// Creators: locationtba.eth, 2pmflow.eth
pragma solidity ^0.8.0;
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";
/**
* @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..).
*
* Does not support burning tokens to address(0).
*/
contract ERC721A is
Context,
ERC165,
IERC721,
IERC721Metadata,
IERC721Enumerable
{
using Address for address;
using Strings for uint256;
struct TokenOwnership {
address addr;
uint64 startTimestamp;
}
struct AddressData {
uint128 balance;
uint128 numberMinted;
}
uint256 private currentIndex = 1;
uint256 internal immutable maxBatchSize;
// 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) private _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;
/**
* @dev
* `maxBatchSize` refers to how much a minter can mint at a time.
*/
constructor(
string memory name_,
string memory symbol_,
uint256 maxBatchSize_
) {
require(maxBatchSize_ > 0, "ERC721A: max batch size must be nonzero");
_name = name_;
_symbol = symbol_;
maxBatchSize = maxBatchSize_;
}
/**
* @dev See {IERC721Enumerable-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return currentIndex - 1;
}
/**
* @dev See {IERC721Enumerable-tokenByIndex}.
*/
function tokenByIndex(uint256 index) public view override returns (uint256) {
require(index < totalSupply(), "ERC721A: global index out of bounds");
return index;
}
/**
* @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)
{
require(index < balanceOf(owner), "ERC721A: owner index out of bounds");
uint256 numMintedSoFar = totalSupply();
uint256 tokenIdsIdx = 0;
address currOwnershipAddr = address(0);
for (uint256 i = 0; i < numMintedSoFar; i++) {
TokenOwnership memory ownership = _ownerships[i];
if (ownership.addr != address(0)) {
currOwnershipAddr = ownership.addr;
}
if (currOwnershipAddr == owner) {
if (tokenIdsIdx == index) {
return i;
}
tokenIdsIdx++;
}
}
revert("ERC721A: unable to get token of owner by index");
}
/**
* @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) {
require(owner != address(0), "ERC721A: balance query for the zero address");
return uint256(_addressData[owner].balance);
}
function _numberMinted(address owner) internal view returns (uint256) {
require(
owner != address(0),
"ERC721A: number minted query for the zero address"
);
return uint256(_addressData[owner].numberMinted);
}
function ownershipOf(uint256 tokenId)
internal
view
returns (TokenOwnership memory)
{
require(_exists(tokenId), "ERC721A: owner query for nonexistent token");
uint256 lowestTokenToCheck;
if (tokenId >= maxBatchSize) {
lowestTokenToCheck = tokenId - maxBatchSize + 1;
}
for (uint256 curr = tokenId; curr >= lowestTokenToCheck; curr--) {
TokenOwnership memory ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
revert("ERC721A: unable to determine the owner of token");
}
/**
* @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)
{
require(
_exists(tokenId),
"ERC721Metadata: URI query for nonexistent token"
);
string memory baseURI = _baseURI();
return
bytes(baseURI).length > 0
? string(abi.encodePacked(baseURI, tokenId.toString()))
: "";
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return "";
}
/**
* @dev See {IERC721-approve}.
*/
function approve(address to, uint256 tokenId) public override {
address owner = ERC721A.ownerOf(tokenId);
require(to != owner, "ERC721A: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721A: approve caller is not owner nor approved for all"
);
_approve(to, tokenId, owner);
}
/**
* @dev See {IERC721-getApproved}.
*/
function getApproved(uint256 tokenId) public view override returns (address) {
require(_exists(tokenId), "ERC721A: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
/**
* @dev See {IERC721-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public override {
require(operator != _msgSender(), "ERC721A: approve to caller");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC721-isApprovedForAll}.
*/
function isApprovedForAll(address owner, address operator)
public
view
virtual
override
returns (bool)
{
return _operatorApprovals[owner][operator];
}
/**
* @dev See {IERC721-transferFrom}.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public override {
_transfer(from, to, tokenId);
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public override {
safeTransferFrom(from, to, tokenId, "");
}
/**
* @dev See {IERC721-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public override {
_transfer(from, to, tokenId);
require(
_checkOnERC721Received(from, to, tokenId, _data),
"ERC721A: transfer to non ERC721Receiver implementer"
);
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted (`_mint`),
*/
function _exists(uint256 tokenId) internal view returns (bool) {
return tokenId < currentIndex;
}
function _safeMint(address to, uint256 quantity) internal {
_safeMint(to, quantity, "");
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` cannot be larger than the max batch size.
*
* Emits a {Transfer} event.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
uint256 startTokenId = currentIndex;
require(to != address(0), "ERC721A: mint to the zero address");
// We know if the first token in the batch doesn't exist, the other ones don't as well, because of serial ordering.
require(!_exists(startTokenId), "ERC721A: token already minted");
require(quantity <= maxBatchSize, "ERC721A: quantity to mint too high");
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
AddressData memory addressData = _addressData[to];
_addressData[to] = AddressData(
addressData.balance + uint128(quantity),
addressData.numberMinted + uint128(quantity)
);
_ownerships[startTokenId] = TokenOwnership(to, uint64(block.timestamp));
uint256 updatedIndex = startTokenId;
for (uint256 i = 0; i < quantity; i++) {
emit Transfer(address(0), to, updatedIndex);
require(
_checkOnERC721Received(address(0), to, updatedIndex, _data),
"ERC721A: transfer to non ERC721Receiver implementer"
);
updatedIndex++;
}
currentIndex = 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 ||
getApproved(tokenId) == _msgSender() ||
isApprovedForAll(prevOwnership.addr, _msgSender()));
require(
isApprovedOrOwner,
"ERC721A: transfer caller is not owner nor approved"
);
require(
prevOwnership.addr == from,
"ERC721A: transfer from incorrect owner"
);
require(to != address(0), "ERC721A: transfer to the zero address");
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner
_approve(address(0), tokenId, prevOwnership.addr);
_addressData[from].balance -= 1;
_addressData[to].balance += 1;
_ownerships[tokenId] = TokenOwnership(to, 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)) {
if (_exists(nextTokenId)) {
_ownerships[nextTokenId] = TokenOwnership(
prevOwnership.addr,
prevOwnership.startTimestamp
);
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @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);
}
uint256 public nextOwnerToExplicitlySet = 0;
/**
* @dev Explicitly set `owners` to eliminate loops in future calls of ownerOf().
*/
function _setOwnersExplicit(uint256 quantity) internal {
uint256 oldNextOwnerToSet = nextOwnerToExplicitlySet;
require(quantity > 0, "quantity must be nonzero");
uint256 endIndex = oldNextOwnerToSet + quantity - 1;
if (endIndex > currentIndex - 1) {
endIndex = currentIndex - 1;
}
// We know if the last one in the group exists, all in the group exist, due to serial ordering.
require(_exists(endIndex), "not enough minted yet for this cleanup");
for (uint256 i = oldNextOwnerToSet; i <= endIndex; i++) {
if (_ownerships[i].addr == address(0)) {
TokenOwnership memory ownership = ownershipOf(i);
_ownerships[i] = TokenOwnership(
ownership.addr,
ownership.startTimestamp
);
}
}
nextOwnerToExplicitlySet = endIndex + 1;
}
/**
* @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("ERC721A: transfer to non ERC721Receiver implementer");
} 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.
*
* 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`.
*/
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.
*
* 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` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
}
Purchaseable.sol 19 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
// @author rollauver.eth
abstract contract Purchaseable is Ownable, Pausable {
function purchaseHelper(address to, uint256 count)
internal virtual;
function earlyPurchaseHelper(address to, uint256 count)
internal virtual;
function isPreSaleActive() public view virtual returns (bool);
function isPublicSaleActive() public view virtual returns (bool);
}
IERC2981Royalties.sol 17 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title IERC2981Royalties
/// @dev Interface for the ERC2981 - Token Royalty standard
interface IERC2981Royalties {
/// @notice 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 _value - 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 value sale price
function royaltyInfo(uint256 _tokenId, uint256 _value)
external
view
returns (address _receiver, uint256 _royaltyAmount);
}
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);
}
}
ERC721AWithRoyalties.sol 67 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./ERC721A.sol";
import "./IERC2981Royalties.sol";
// @author rollauver.eth
contract ERC721AWithRoyalties is
Ownable,
ERC721A,
IERC2981Royalties
{
struct RoyaltyInfo {
address recipient;
uint24 amount;
}
RoyaltyInfo private _royalties;
constructor(
string memory name_,
string memory symbol_,
uint256 maxBatchSize_,
address royaltyRecipient,
uint256 royaltyValue
) ERC721A(name_, symbol_, maxBatchSize_) {
_setRoyalties(royaltyRecipient, royaltyValue);
}
/// @inheritdoc ERC165
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override
returns (bool)
{
return
interfaceId == type(IERC2981Royalties).interfaceId ||
super.supportsInterface(interfaceId);
}
/// @dev Sets token royalties
/// @param recipient recipient of the royalties
/// @param value percentage (using 2 decimals - 10000 = 100, 0 = 0)
function _setRoyalties(address recipient, uint256 value) internal {
require(value <= 10000, 'ERC2981Royalties: Too high');
_royalties = RoyaltyInfo(recipient, uint24(value));
}
/// @inheritdoc IERC2981Royalties
function royaltyInfo(uint256, uint256 value)
external
view
override
returns (address receiver, uint256 royaltyAmount)
{
RoyaltyInfo memory royalties = _royalties;
receiver = royalties.recipient;
royaltyAmount = (value * royalties.amount) / 10000;
}
function updateRoyalties(address recipient, uint256 value) external onlyOwner {
_setRoyalties(recipient, value);
}
}
Pausable.sol 91 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
ExternallyPurchaseable.sol 38 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;
import "./Purchaseable.sol";
// @author rollauver.eth
abstract contract ExternallyPurchaseable is Purchaseable {
mapping(address => uint256) private _externalRelays;
address private constant _defaultRelay = 0xdAb1a1854214684acE522439684a145E62505233;
constructor() {
_externalRelays[_defaultRelay] = 1;
}
modifier onlyRelay() {
require(_externalRelays[msg.sender] == 1, "Invalid External relay");
_;
}
function externalPurchase(address to, uint256 count) external payable whenNotPaused onlyRelay {
purchaseHelper(to, count);
}
function externalEarlyPurchase(address to, uint256 count) external payable whenNotPaused onlyRelay {
require(isPreSaleActive(), "BASE_COLLECTION/CANNOT_MINT_PRESALE");
earlyPurchaseHelper(to, count);
}
function addExternalRelay(address relay) external onlyOwner {
_externalRelays[relay] = 1;
}
function removeExternalRelay(address relay) external onlyOwner {
_externalRelays[relay] = 0;
}
}
IERC20.sol 82 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
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;
}
PaymentSplitter.sol 189 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (finance/PaymentSplitter.sol)
pragma solidity ^0.8.0;
import "../token/ERC20/utils/SafeERC20.sol";
import "../utils/Address.sol";
import "../utils/Context.sol";
/**
* @title PaymentSplitter
* @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware
* that the Ether will be split in this way, since it is handled transparently by the contract.
*
* The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each
* account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim
* an amount proportional to the percentage of total shares they were assigned.
*
* `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the
* accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release}
* function.
*
* NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and
* tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you
* to run tests before sending real value to this contract.
*/
contract PaymentSplitter is Context {
event PayeeAdded(address account, uint256 shares);
event PaymentReleased(address to, uint256 amount);
event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount);
event PaymentReceived(address from, uint256 amount);
uint256 private _totalShares;
uint256 private _totalReleased;
mapping(address => uint256) private _shares;
mapping(address => uint256) private _released;
address[] private _payees;
mapping(IERC20 => uint256) private _erc20TotalReleased;
mapping(IERC20 => mapping(address => uint256)) private _erc20Released;
/**
* @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at
* the matching position in the `shares` array.
*
* All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no
* duplicates in `payees`.
*/
constructor(address[] memory payees, uint256[] memory shares_) payable {
require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch");
require(payees.length > 0, "PaymentSplitter: no payees");
for (uint256 i = 0; i < payees.length; i++) {
_addPayee(payees[i], shares_[i]);
}
}
/**
* @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully
* reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the
* reliability of the events, and not the actual splitting of Ether.
*
* To learn more about this see the Solidity documentation for
* https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback
* functions].
*/
receive() external payable virtual {
emit PaymentReceived(_msgSender(), msg.value);
}
/**
* @dev Getter for the total shares held by payees.
*/
function totalShares() public view returns (uint256) {
return _totalShares;
}
/**
* @dev Getter for the total amount of Ether already released.
*/
function totalReleased() public view returns (uint256) {
return _totalReleased;
}
/**
* @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20
* contract.
*/
function totalReleased(IERC20 token) public view returns (uint256) {
return _erc20TotalReleased[token];
}
/**
* @dev Getter for the amount of shares held by an account.
*/
function shares(address account) public view returns (uint256) {
return _shares[account];
}
/**
* @dev Getter for the amount of Ether already released to a payee.
*/
function released(address account) public view returns (uint256) {
return _released[account];
}
/**
* @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an
* IERC20 contract.
*/
function released(IERC20 token, address account) public view returns (uint256) {
return _erc20Released[token][account];
}
/**
* @dev Getter for the address of the payee number `index`.
*/
function payee(uint256 index) public view returns (address) {
return _payees[index];
}
/**
* @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the
* total shares and their previous withdrawals.
*/
function release(address payable account) public virtual {
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
uint256 totalReceived = address(this).balance + totalReleased();
uint256 payment = _pendingPayment(account, totalReceived, released(account));
require(payment != 0, "PaymentSplitter: account is not due payment");
_released[account] += payment;
_totalReleased += payment;
Address.sendValue(account, payment);
emit PaymentReleased(account, payment);
}
/**
* @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their
* percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20
* contract.
*/
function release(IERC20 token, address account) public virtual {
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token);
uint256 payment = _pendingPayment(account, totalReceived, released(token, account));
require(payment != 0, "PaymentSplitter: account is not due payment");
_erc20Released[token][account] += payment;
_erc20TotalReleased[token] += payment;
SafeERC20.safeTransfer(token, account, payment);
emit ERC20PaymentReleased(token, account, payment);
}
/**
* @dev internal logic for computing the pending payment of an `account` given the token historical balances and
* already released amounts.
*/
function _pendingPayment(
address account,
uint256 totalReceived,
uint256 alreadyReleased
) private view returns (uint256) {
return (totalReceived * _shares[account]) / _totalShares - alreadyReleased;
}
/**
* @dev Add a new payee to the contract.
* @param account The address of the payee to add.
* @param shares_ The number of shares owned by the payee.
*/
function _addPayee(address account, uint256 shares_) private {
require(account != address(0), "PaymentSplitter: account is the zero address");
require(shares_ > 0, "PaymentSplitter: shares are 0");
require(_shares[account] == 0, "PaymentSplitter: account already has shares");
_payees.push(account);
_shares[account] = shares_;
_totalShares = _totalShares + shares_;
emit PayeeAdded(account, shares_);
}
}
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;
}
}
SafeERC20.sol 99 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
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
MAX_TOTAL_MINT 0xcf9e8e69 → uint256
MAX_TOTAL_MINT_PER_ADDRESS 0x66cfb1f3 → uint256
PRICE 0x8d859f3e → uint256
_baseTokenURI 0xcfc86f7b → string
_maxPerAddress 0xe2d5ee2d → uint256
_maxSupply 0x22f4596f → uint256
_maxTxPerAddress 0x696fa41e → uint256
_merkleRoot 0x2fc37ab2 → bytes32
_preSaleTime 0xfa156f9a → uint256
_presaleMaxPerAddress 0x904be6da → uint256
_presalePrice 0x5f0d246a → uint256
_price 0x235b6ea1 → uint256
_publicSaleTime 0xb85ef036 → uint256
balanceOf 0x70a08231 → uint256
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
isPreSaleActive 0x9d044ed3 → bool
isPublicSaleActive 0x1e84c413 → bool
name 0x06fdde03 → string
nextOwnerToExplicitlySet 0xd7224ba0 → uint256
onEarlyPurchaseList 0x7b96a3b2 → bool
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
paused 0x5c975abb → bool
payee 0x8b83209b → address
released 0x406072a9 → uint256
released 0x9852595c → uint256
royaltyInfo 0x2a55205a → address, uint256
shares 0xce7c2ac2 → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
totalReleased 0xd79779b2 → uint256
totalReleased 0xe33b7de3 → uint256
totalShares 0x3a98ef39 → uint256
totalSupply 0x18160ddd → uint256
Write Contract 22 functions
These functions modify contract state and require a wallet transaction to execute.
addExternalRelay 0xbefe26e6
address relay
approve 0x095ea7b3
address to
uint256 tokenId
earlyPurchase 0xe2ab10ce
uint256 count
bytes32[] merkleProof
externalEarlyPurchase 0xba5a33b0
address to
uint256 count
externalPurchase 0x313f944f
address to
uint256 count
mint 0x40c10f19
address to
uint256 count
pause 0x8456cb59
No parameters
purchase 0xefef39a1
uint256 count
release 0x19165587
address account
release 0x48b75044
address token
address account
removeExternalRelay 0x139b3936
address relay
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 0xa0bcfc7f
string baseUri
setMerkleRoot 0x7cb64759
bytes32 merkleRoot
setSaleInformation 0x74721235
uint256 publicSaleTime
uint256 preSaleTime
uint256 maxPerAddress
uint256 presaleMaxPerAddress
uint256 price
uint256 presalePrice
bytes32 merkleRoot
uint256 maxTxPerAddress
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters
updateRoyalties 0x6c2f5acd
address recipient
uint256 value
Recent Transactions
No transactions found for this address