Address Contract Partially Verified
Address
0xF03c4e6b6187AcA96B18162CBb4468FC6E339120
Balance
0.237384 ETH
Nonce
1
Code Size
18213 bytes
Creator
0xFBC7ab8e...2954 at tx 0x8e18ff64...f24397
Indexed Transactions
0
Contract Bytecode
18213 bytes
0x6080604052600436106102b25760003560e01c80638b83209b11610175578063d0d46a0b116100dc578063e09159a011610095578063e97206a91161006f578063e97206a9146109da578063e985e9c514610a53578063ececaf0014610a9c578063f2fde38b14610abc57600080fd5b8063e09159a014610990578063e33b7de3146109b0578063e4ed53a9146109c557600080fd5b8063d0d46a0b1461080b578063d274958d14610869578063d48ede9914610889578063d92e82e4146108a9578063dbbc853b1461095b578063df2388001461097057600080fd5b8063b88d4fde1161012e578063b88d4fde1461074d578063c04231451461076d578063c0ac99831461078d578063c87b56dd146107a2578063ce7c2ac2146107c2578063cefc3e5d146107f857600080fd5b80638b83209b146106915780638da5cb5b146106b157806395d89b41146106cf5780639852595c146106e4578063a22cb4651461071a578063ae7bf4c81461073a57600080fd5b80633a98ef39116102195780634f6ccce7116101d25780634f6ccce7146105dc5780636352211e146105fc5780636c19e7831461061c57806370a082311461063c578063715018a61461065c578063847fd5bf1461067157600080fd5b80633a98ef391461050457806342842e0e14610519578063438b6300146105395780634a994eef146105665780634d44660c146105865780634f64b2be146105a657600080fd5b806318160ddd1161026b57806318160ddd1461044e57806318f9b02314610471578063191655871461049157806323b872dd146104b157806323cf0a22146104d15780632f745c59146104e457600080fd5b806301ffc9a714610300578063022914a71461033557806306fdde03146103b257806307779627146103d4578063081812fc146103f4578063095ea7b31461042c57600080fd5b366102fb577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033604080516001600160a01b0390921682523460208301520160405180910390a1005b600080fd5b34801561030c57600080fd5b5061032061031b366004613a38565b610adc565b60405190151581526020015b60405180910390f35b34801561034157600080fd5b50610384610350366004613a6a565b60046020526000908152604090205461ffff80821691620100008104821691600160201b8204811691600160301b90041684565b6040805161ffff9586168152938516602085015291841691830191909152909116606082015260800161032c565b3480156103be57600080fd5b506103c7610b07565b60405161032c9190613adf565b3480156103e057600080fd5b506103206103ef366004613a6a565b610b99565b34801561040057600080fd5b5061041461040f366004613af2565b610bec565b6040516001600160a01b03909116815260200161032c565b34801561043857600080fd5b5061044c610447366004613b0b565b610c6b565b005b34801561045a57600080fd5b50610463610d76565b60405190815260200161032c565b34801561047d57600080fd5b5061044c61048c366004613b0b565b610d85565b34801561049d57600080fd5b5061044c6104ac366004613a6a565b610dbd565b3480156104bd57600080fd5b5061044c6104cc366004613b37565b610f8e565b61044c6104df366004613b88565b610fc0565b3480156104f057600080fd5b506104636104ff366004613b0b565b6113ef565b34801561051057600080fd5b50600954610463565b34801561052557600080fd5b5061044c610534366004613b37565b6114ec565b34801561054557600080fd5b50610559610554366004613a6a565b61152c565b60405161032c9190613be0565b34801561057257600080fd5b5061044c610581366004613c01565b611629565b34801561059257600080fd5b506103206105a1366004613c7e565b61167e565b3480156105b257600080fd5b506104146105c1366004613af2565b6003602052600090815260409020546001600160a01b031681565b3480156105e857600080fd5b506104636105f7366004613af2565b6116f3565b34801561060857600080fd5b50610414610617366004613af2565b611765565b34801561062857600080fd5b5061044c610637366004613a6a565b6117a8565b34801561064857600080fd5b50610463610657366004613a6a565b6117f8565b34801561066857600080fd5b5061044c611884565b34801561067d57600080fd5b5061044c61068c366004613a6a565b6118ba565b34801561069d57600080fd5b506104146106ac366004613af2565b61190b565b3480156106bd57600080fd5b506000546001600160a01b0316610414565b3480156106db57600080fd5b506103c761193b565b3480156106f057600080fd5b506104636106ff366004613a6a565b6001600160a01b03166000908152600c602052604090205490565b34801561072657600080fd5b5061044c610735366004613c01565b61194a565b61044c610748366004613cd2565b6119b6565b34801561075957600080fd5b5061044c610768366004613d53565b611bab565b34801561077957600080fd5b5061044c610788366004613e32565b611be3565b34801561079957600080fd5b506103c7611c28565b3480156107ae57600080fd5b506103c76107bd366004613af2565b611cb6565b3480156107ce57600080fd5b506104636107dd366004613a6a565b6001600160a01b03166000908152600b602052604090205490565b61044c610806366004613ecb565b611d42565b34801561081757600080fd5b5061082b610826366004613a6a565b6122bf565b60405161032c9190815161ffff9081168252602080840151821690830152604080840151821690830152606092830151169181019190915260800190565b34801561087557600080fd5b50601054610414906001600160a01b031681565b34801561089557600080fd5b5061044c6108a4366004613f72565b6126bc565b3480156108b557600080fd5b50600f5461090b906001600160401b0381169061ffff600160401b8204811691600160501b8104821691600160601b8204811691600160701b81049091169060ff600160801b8204811691600160881b90041687565b604080516001600160401b03909816885261ffff968716602089015294861694870194909452918416606086015292909216608084015260ff90911660a0830152151560c082015260e00161032c565b34801561096757600080fd5b506103c7612704565b34801561097c57600080fd5b5061044c61098b366004613fd1565b612711565b34801561099c57600080fd5b5061044c6109ab366004613ff8565b612746565b3480156109bc57600080fd5b50600a54610463565b3480156109d157600080fd5b5061044c612782565b3480156109e657600080fd5b50600254610a1e9061ffff80821691620100008104821691600160201b8204811691600160301b8104821691600160401b9091041685565b6040805161ffff968716815294861660208601529285169284019290925283166060830152909116608082015260a00161032c565b348015610a5f57600080fd5b50610320610a6e366004614010565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b348015610aa857600080fd5b5061044c610ab736600461403e565b6127b4565b348015610ac857600080fd5b5061044c610ad7366004613a6a565b612829565b60006001600160e01b0319821663780e9d6360e01b1480610b015750610b0182612882565b92915050565b606060058054610b16906140d2565b80601f0160208091040260200160405190810160405280929190818152602001828054610b42906140d2565b8015610b8f5780601f10610b6457610100808354040283529160200191610b8f565b820191906000526020600020905b815481529060010190602001808311610b7257829003601f168201915b5050505050905090565b600080546001600160a01b03163314610bcd5760405162461bcd60e51b8152600401610bc490614107565b60405180910390fd5b506001600160a01b031660009081526001602052604090205460ff1690565b6000610bf7826128d2565b610c4f5760405162461bcd60e51b815260206004820152602360248201527f4552433732313a20717565727920666f72206e6f6e6578697374656e7420746f60448201526235b2b760e91b6064820152608401610bc4565b506000908152600760205260409020546001600160a01b031690565b6000610c7682611765565b9050806001600160a01b0316836001600160a01b03161415610ce55760405162461bcd60e51b815260206004820152602260248201527f455243373231423a20617070726f76616c20746f2063757272656e74206f776e60448201526132b960f11b6064820152608401610bc4565b336001600160a01b0382161480610d015750610d018133610a6e565b610d675760405162461bcd60e51b815260206004820152603160248201527f455243373231423a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201527008185c1c1c9bdd995908199bdc88185b1b607a1b6064820152608401610bc4565b610d718383612923565b505050565b6000610d80612991565b905090565b6000546001600160a01b03163314610daf5760405162461bcd60e51b8152600401610bc490614107565b610db982826129b8565b5050565b6001600160a01b0381166000908152600b6020526040902054610e315760405162461bcd60e51b815260206004820152602660248201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060448201526573686172657360d01b6064820152608401610bc4565b6000600a5447610e419190614152565b6001600160a01b0383166000908152600c6020908152604080832054600954600b909352908320549394509192610e78908561416a565b610e82919061419f565b610e8c91906141b3565b905080610eef5760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060448201526a191d59481c185e5b595b9d60aa1b6064820152608401610bc4565b6001600160a01b0383166000908152600c6020526040902054610f13908290614152565b6001600160a01b0384166000908152600c6020526040902055600a54610f3a908290614152565b600a55610f478382612b9e565b604080516001600160a01b0385168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056910160405180910390a1505050565b610f99335b82612cb7565b610fb55760405162461bcd60e51b8152600401610bc4906141ca565b610d71838383612d58565b6040805160e081018252600f546001600160401b038116825261ffff600160401b820481166020840152600160501b8204811693830193909352600160601b810483166060830152600160701b81048316608083015260ff600160801b8204811660a0840152600160881b90910416151560c08201529082166110755760405162461bcd60e51b815260206004820152600d60248201526c6d757374206f7264657220312b60981b6044820152606401610bc4565b806060015161ffff168261ffff1611156110c15760405162461bcd60e51b815260206004820152600d60248201526c6f7264657220746f6f2062696760981b6044820152606401610bc4565b806080015161ffff168261ffff166110d7610d76565b6110e19190614152565b111561112f5760405162461bcd60e51b815260206004820152601960248201527f6d696e742f6f72646572206578636565647320737570706c79000000000000006044820152606401610bc4565b60a08101516008908116811461117c5760405162461bcd60e51b815260206004820152601260248201527173616c65206973206e6f742061637469766560701b6044820152606401610bc4565b336000908152600460209081526040918290208251608081018452905461ffff8082168352620100008204811693830193909352600160201b8104831682850152600160301b90048216606082018190529285015190929116906111e1908690614229565b61ffff1611156112255760405162461bcd60e51b815260206004820152600f60248201526e646f6e27742062652067726565647960881b6044820152606401610bc4565b60008360c0015180156112475750816040015161ffff16846020015161ffff16115b156112e65781604001518460200151611260919061424f565b90508061ffff168561ffff16106112e357600061127d828761424f565b85519091506112909061ffff8316614272565b6001600160401b03163410156112dd5760405162461bcd60e51b8152602060048201526012602482015271696e73756666696369656e742066756e647360701b6044820152606401610bc4565b506112e6565b50835b60405180608001604052808684600001516113019190614229565b61ffff168152602001836020015161ffff1681526020018284604001516113289190614229565b61ffff1681526020018684606001516113419190614229565b61ffff9081169091523360009081526004602090815260408083208551815493870151928701516060909701518616600160301b0261ffff60301b19978716600160201b029790971667ffffffff0000000019938716620100000263ffffffff1990951691909616179290921716929092179290921790555b8561ffff168110156113e7576113d7336113d2612e8b565b612ed2565b6113e0816142a1565b90506113ba565b505050505050565b6001600160a01b03821660009081526004602052604081205461ffff16821061146f5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c65423a206f776e657220696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610bc4565b600254600090600160301b900461ffff165b600254600160401b900461ffff168110156114e4576000818152600360205260409020546001600160a01b038681169116146114bc576114d4565b816114c6816142a1565b92508414156114d4576114e4565b6114dd816142a1565b9050611481565b949350505050565b6114f533610f93565b6115115760405162461bcd60e51b8152600401610bc4906141ca565b610d7183838360405180602001604052806000815250612f9c565b6001600160a01b0381166000908152600460205260408120546060919061ffff1681816001600160401b0381111561156657611566613d3d565b60405190808252806020026020018201604052801561158f578160200160208202803683370190505b50600254909150600160301b900461ffff165b600254600160401b900461ffff16811015611620576000818152600360205260409020546001600160a01b0387811691161415611610578082856115e5816142a1565b9650815181106115f7576115f76142bc565b6020026020010181815250508284141561161057611620565b611619816142a1565b90506115a2565b50949350505050565b6000546001600160a01b031633146116535760405162461bcd60e51b8152600401610bc490614107565b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b6000805b828110156116e657600360008585848181106116a0576116a06142bc565b60209081029290920135835250810191909152604001600020546001600160a01b038681169116146116d65760009150506116ec565b6116df816142a1565b9050611682565b50600190505b9392505050565b60006116fe826128d2565b6117615760405162461bcd60e51b815260206004820152602e60248201527f455243373231456e756d657261626c65423a20717565727920666f72206e6f6e60448201526d32bc34b9ba32b73a103a37b5b2b760911b6064820152608401610bc4565b5090565b6000611770826128d2565b61178c5760405162461bcd60e51b8152600401610bc4906142d2565b506000908152600360205260409020546001600160a01b031690565b3360009081526001602052604090205460ff166117d75760405162461bcd60e51b8152600401610bc490614316565b600e80546001600160a01b0319166001600160a01b03831617905550565b50565b60006001600160a01b0382166118645760405162461bcd60e51b815260206004820152602b60248201527f455243373231423a2062616c616e636520717565727920666f7220746865207a60448201526a65726f206164647265737360a81b6064820152608401610bc4565b506001600160a01b031660009081526004602052604090205461ffff1690565b6000546001600160a01b031633146118ae5760405162461bcd60e51b8152600401610bc490614107565b6118b86000612fcf565b565b3360009081526001602052604090205460ff166118e95760405162461bcd60e51b8152600401610bc490614316565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6000600d8281548110611920576119206142bc565b6000918252602090912001546001600160a01b031692915050565b606060068054610b16906140d2565b3360008181526008602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b3360009081526001602052604090205460ff166119e55760405162461bcd60e51b8152600401610bc490614316565b828114611a495760405162461bcd60e51b815260206004820152602c60248201527f4d7573742070726f7669646520657175616c207175616e74697469657320616e60448201526b6420726563697069656e747360a01b6064820152608401610bc4565b600080611a54610d76565b905060005b85811015611aa857868682818110611a7357611a736142bc565b9050602002016020810190611a889190613b88565b611a969061ffff1684614152565b9250611aa1816142a1565b9050611a59565b50600f54600160701b900461ffff16611ac18383614152565b1115611b0f5760405162461bcd60e51b815260206004820152601960248201527f4d696e742f6f72646572206578636565647320737570706c79000000000000006044820152606401610bc4565b60005b83811015611ba25760005b878783818110611b2f57611b2f6142bc565b9050602002016020810190611b449190613b88565b61ffff16811015611b9157611b81868684818110611b6457611b646142bc565b9050602002016020810190611b799190613a6a565b6113d2612e8b565b611b8a816142a1565b9050611b1d565b50611b9b816142a1565b9050611b12565b50505050505050565b611bb53383612cb7565b611bd15760405162461bcd60e51b8152600401610bc4906141ca565b611bdd84848484612f9c565b50505050565b60005b81811015611c2157611c118585858585818110611c0557611c056142bc565b90506020020135610f8e565b611c1a816142a1565b9050611be6565b5050505050565b60118054611c35906140d2565b80601f0160208091040260200160405190810160405280929190818152602001828054611c61906140d2565b8015611cae5780601f10611c8357610100808354040283529160200191611cae565b820191906000526020600020905b815481529060010190602001808311611c9157829003601f168201915b505050505081565b6060611cc1826128d2565b611d0d5760405162461bcd60e51b815260206004820152601b60248201527f717565727920666f72206e6f6e6578697374656e7420746f6b656e00000000006044820152606401610bc4565b6011611d188361301f565b6012604051602001611d2c939291906143da565b6040516020818303038152906040529050919050565b6040805160e081018252600f546001600160401b038116825261ffff600160401b82048116602080850191909152600160501b8304821684860152600160601b83048216606080860191909152600160701b8404831660808087019190915260ff600160801b8604811660a0880152600160881b909504909416151560c08601523360009081526004835286902086519485018752548084168552620100008104841692850192909252600160201b8204831695840195909552600160301b90048116938201939093529091891615611fb35760a082015160019081168114611e665760405162461bcd60e51b815260206004820152601660248201527518985919d9481cd85b19481a5cc8191a5cd8589b195960521b6044820152606401610bc4565b611e8a604051806040016040528060018152602001603160f81b815250868661311c565b611ed65760405162461bcd60e51b815260206004820152601e60248201527f6e6f7420617574686f72697a656420666f72206261646765206d696e747300006044820152606401610bc4565b601054604051627eeac760e11b8152336004820152600060248201819052916001600160a01b03169062fdd58e90604401602060405180830381600087803b158015611f2157600080fd5b505af1158015611f35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f59919061440d565b9050808b8460200151611f6c9190614229565b61ffff161115611fb05760405162461bcd60e51b815260206004820152600f60248201526e185b1b0818985919d95cc81d5cd959608a1b6044820152606401610bc4565b50505b61ffff8816156120895760a08201516002908116811461200e5760405162461bcd60e51b8152602060048201526016602482015275185b1c1a18481cd85b19481a5cc8191a5cd8589b195960521b6044820152606401610bc4565b6010546001600160a01b031663666abf233361202a600161317f565b6120378d61ffff1661317f565b6040518463ffffffff1660e01b815260040161205593929190614426565b600060405180830381600087803b15801561206f57600080fd5b505af1158015612083573d6000803e3d6000fd5b50505050505b61ffff87161561215e5760a0820151600490811681146120e35760405162461bcd60e51b815260206004820152601560248201527418995d18481cd85b19481a5cc8191a5cd8589b1959605a1b6044820152606401610bc4565b6010546001600160a01b031663666abf23336120ff600261317f565b61210c8c61ffff1661317f565b6040518463ffffffff1660e01b815260040161212a93929190614426565b600060405180830381600087803b15801561214457600080fd5b505af1158015612158573d6000803e3d6000fd5b50505050505b60008761216b8a8c614229565b6121759190614229565b905061ffff811686146121a45760405162461bcd60e51b81526020600482015260006024820152604401610bc4565b60405180608001604052808284600001516121bf9190614229565b61ffff1681526020018b84602001516121d89190614229565b61ffff168152602001836040015161ffff1681526020018284606001516121ff9190614229565b61ffff9081169091523360009081526004602090815260408083208551815493870151928701516060909701518616600160301b0261ffff60301b19978716600160201b029790971667ffffffff0000000019938716620100000263ffffffff1990951691909616179290921716929092179290921790555b868110156122b2576122a233898984818110612296576122966142bc565b90506020020135612ed2565b6122ab816142a1565b9050612278565b5050505050505050505050565b6040805160808101825260008082526020820181905291810182905260608101919091526010546001600160a01b03166123335760405162461bcd60e51b815260206004820152601560248201527424b73b30b634b21031b7b73334b3bab930ba34b7b760591b6044820152606401610bc4565b506040805160e081018252600f546001600160401b038116825261ffff600160401b82048116602080850191909152600160501b8304821684860152600160601b83048216606080860191909152600160701b840490921660808086019190915260ff600160801b8504811660a08701908152600160881b90950416151560c0860152855190810186526000808252918101829052948501819052908401525160019081168114156124dc57601054604051627eeac760e11b81526001600160a01b038681166004830152600060248301529091169062fdd58e90604401602060405180830381600087803b15801561242b57600080fd5b505af115801561243f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612463919061440d565b61ffff90811684526001600160a01b0385166000908152600460205260409020548451620100009091048216911611156124d7576001600160a01b03841660009081526004602052604090205483516201000090910461ffff169084906124cb90839061424f565b61ffff169052506124dc565b600083525b5060a0810151600290811681141561257c57601054604051627eeac760e11b81526001600160a01b038681166004830152600160248301529091169062fdd58e90604401602060405180830381600087803b15801561253a57600080fd5b505af115801561254e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612572919061440d565b61ffff1660208401525b5060a0810151600490811681141561261c57601054604051627eeac760e11b81526001600160a01b038681166004830152600260248301529091169062fdd58e90604401602060405180830381600087803b1580156125da57600080fd5b505af11580156125ee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612612919061440d565b61ffff1660408401525b8160c00151156126b557600f5461ffff600160401b9091048116606085019081526001600160a01b0386166000908152600460205260409020549051600160201b9091048216911611156126ad576001600160a01b038416600090815260046020526040902054606084018051600160201b90920461ffff16916126a190839061424f565b61ffff169052506126b5565b600060608401525b5050919050565b3360009081526001602052604090205460ff166126eb5760405162461bcd60e51b8152600401610bc490614316565b6126f760118585613992565b50611c2160128383613992565b60128054611c35906140d2565b6000546001600160a01b0316331461273b5760405162461bcd60e51b8152600401610bc490614107565b610d718383836131c6565b3360009081526001602052604090205460ff166127755760405162461bcd60e51b8152600401610bc490614316565b80600f610d718282614493565b6000546001600160a01b031633146127ac5760405162461bcd60e51b8152600401610bc490614107565b6118b861325f565b60005b83811015611ba25761281987878787858181106127d6576127d66142bc565b9050602002013586868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611bab92505050565b612822816142a1565b90506127b7565b6000546001600160a01b031633146128535760405162461bcd60e51b8152600401610bc490614107565b6001600160a01b0381166000908152600160208190526040909120805460ff191690911790556117f5816132bf565b60006001600160e01b031982166380ac58cd60e01b14806128b357506001600160e01b03198216635b5e139f60e01b145b80610b0157506301ffc9a760e01b6001600160e01b0319831614610b01565b600254600090600160301b900461ffff1682108015906128fe5750600254600160401b900461ffff1682105b8015610b015750506000908152600360205260409020546001600160a01b0316151590565b600081815260076020526040902080546001600160a01b0319166001600160a01b038416908117909155819061295882611765565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6002546000906129af9061ffff80821691600160201b90041661424f565b61ffff16905090565b6001600160a01b038216612a235760405162461bcd60e51b815260206004820152602c60248201527f5061796d656e7453706c69747465723a206163636f756e74206973207468652060448201526b7a65726f206164647265737360a01b6064820152608401610bc4565b60008111612a735760405162461bcd60e51b815260206004820152601d60248201527f5061796d656e7453706c69747465723a207368617265732061726520300000006044820152606401610bc4565b6001600160a01b0382166000908152600b602052604090205415612aed5760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e7420616c726561647960448201526a206861732073686172657360a81b6064820152608401610bc4565b600d8054600181019091557fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180546001600160a01b0319166001600160a01b0384169081179091556000908152600b60205260409020819055600954612b55908290614152565b600955604080516001600160a01b0384168152602081018390527f40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac910160405180910390a15050565b80471015612bee5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610bc4565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612c3b576040519150601f19603f3d011682016040523d82523d6000602084013e612c40565b606091505b5050905080610d715760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610bc4565b6000612cc2826128d2565b612cde5760405162461bcd60e51b8152600401610bc4906142d2565b6000612ce983611765565b9050806001600160a01b0316846001600160a01b03161480612d245750836001600160a01b0316612d1984610bec565b6001600160a01b0316145b806114e457506001600160a01b0380821660009081526008602090815260408083209388168352929052205460ff166114e4565b826001600160a01b0316612d6b82611765565b6001600160a01b031614612dd45760405162461bcd60e51b815260206004820152602a60248201527f455243373231423a207472616e73666572206f6620746f6b656e20746861742060448201526934b9903737ba1037bbb760b11b6064820152608401610bc4565b600081815260076020526040902080546001600160a01b03191690556001600160a01b038381166000818152600460209081526040808320805461ffff1980821661ffff92831660001901831617909255958816808552828520805492831692881660010190971691909117909555858352600390915280822080546001600160a01b0319168517905551849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60025462010000900461ffff165b612ea2816128d2565b15612eb757612eb0816142a1565b9050612e99565b6002805463ffff000019166201000061ffff84160217905590565b612edb816128d2565b15612f285760405162461bcd60e51b815260206004820181905260248201527f455243373231423a206d696e7420666f72206578697374696e6720746f6b656e6044820152606401610bc4565b612f3181613357565b60408051602080820183526001600160a01b0385811680845260008681526003909352848320935184546001600160a01b03191692169190911790925591518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b612fa7848484612d58565b612fb38484848461348c565b611bdd5760405162461bcd60e51b8152600401610bc4906145d0565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060816130435750506040805180820190915260018152600360fc1b602082015290565b8160005b811561306d5780613057816142a1565b91506130669050600a8361419f565b9150613047565b6000816001600160401b0381111561308757613087613d3d565b6040519080825280601f01601f1916602001820160405280156130b1576020820181803683370190505b5090505b84156114e4576130c66001836141b3565b91506130d3600a86614623565b6130de906030614152565b60f81b8183815181106130f3576130f36142bc565b60200101906001600160f81b031916908160001a905350613115600a8661419f565b94506130b5565b600061316661312a85613599565b84848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506135cd92505050565b600e546001600160a01b03918216911614949350505050565b6040805160018082528183019092526060916020808301908036833701905050905081816000815181106131b5576131b56142bc565b602002602001018181525050919050565b6001600160a01b0382166000908152600b602052604090205460095482916131ed916141b3565b6131f79190614152565b6009556001600160a01b0382166000908152600b60205260409020819055600d80548391908590811061322c5761322c6142bc565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550505050565b6000600a8190555b600d548110156117f5576000600c6000600d848154811061328a5761328a6142bc565b60009182526020808320909101546001600160a01b031683528201929092526040019020556132b8816142a1565b9050613267565b6000546001600160a01b031633146132e95760405162461bcd60e51b8152600401610bc490614107565b6001600160a01b03811661334e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610bc4565b6117f581612fcf565b6040805160a08101825260025461ffff808216835262010000820481166020840152600160201b82048116938301848152600160301b830482166060850152600160401b90920416608083015290916133af90614637565b61ffff90811690915260208201511682116133da578060200180516133d390614637565b61ffff1690525b806080015161ffff168211156133ff576133f5826001614152565b61ffff1660808201525b80516002805460208401516040850151606086015160809096015161ffff908116600160401b0269ffff000000000000000019978216600160301b0261ffff60301b19938316600160201b029390931667ffffffff0000000019948316620100000263ffffffff199096169290971691909117939093179190911693909317929092179290921617905550565b60006001600160a01b0384163b1561358e57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906134d0903390899088908890600401614659565b602060405180830381600087803b1580156134ea57600080fd5b505af192505050801561351a575060408051601f3d908101601f191682019092526135179181019061468c565b60015b613574573d808015613548576040519150601f19603f3d011682016040523d82523d6000602084013e61354d565b606091505b50805161356c5760405162461bcd60e51b8152600401610bc4906145d0565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506114e4565b506001949350505050565b60003033836040516020016135b0939291906146a9565b604051602081830303815290604052805190602001209050919050565b60006116ec826135dc856135e2565b9061361d565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c016135b0565b600080600061362c8585613641565b91509150613639816136b1565b509392505050565b6000808251604114156136785760208301516040840151606085015160001a61366c8782858561386c565b945094505050506136aa565b8251604014156136a25760208301516040840151613697868383613959565b9350935050506136aa565b506000905060025b9250929050565b60008160048111156136c5576136c5614213565b14156136ce5750565b60018160048111156136e2576136e2614213565b14156137305760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610bc4565b600281600481111561374457613744614213565b14156137925760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610bc4565b60038160048111156137a6576137a6614213565b14156137ff5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610bc4565b600481600481111561381357613813614213565b14156117f55760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610bc4565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156138a35750600090506003613950565b8460ff16601b141580156138bb57508460ff16601c14155b156138cc5750600090506004613950565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613920573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661394957600060019250925050613950565b9150600090505b94509492505050565b6000806001600160ff1b0383168161397660ff86901c601b614152565b90506139848782888561386c565b935093505050935093915050565b82805461399e906140d2565b90600052602060002090601f0160209004810192826139c05760008555613a06565b82601f106139d95782800160ff19823516178555613a06565b82800160010185558215613a06579182015b82811115613a065782358255916020019190600101906139eb565b506117619291505b808211156117615760008155600101613a0e565b6001600160e01b0319811681146117f557600080fd5b600060208284031215613a4a57600080fd5b81356116ec81613a22565b6001600160a01b03811681146117f557600080fd5b600060208284031215613a7c57600080fd5b81356116ec81613a55565b60005b83811015613aa2578181015183820152602001613a8a565b83811115611bdd5750506000910152565b60008151808452613acb816020860160208601613a87565b601f01601f19169290920160200192915050565b6020815260006116ec6020830184613ab3565b600060208284031215613b0457600080fd5b5035919050565b60008060408385031215613b1e57600080fd5b8235613b2981613a55565b946020939093013593505050565b600080600060608486031215613b4c57600080fd5b8335613b5781613a55565b92506020840135613b6781613a55565b929592945050506040919091013590565b61ffff811681146117f557600080fd5b600060208284031215613b9a57600080fd5b81356116ec81613b78565b600081518084526020808501945080840160005b83811015613bd557815187529582019590820190600101613bb9565b509495945050505050565b6020815260006116ec6020830184613ba5565b80151581146117f557600080fd5b60008060408385031215613c1457600080fd5b8235613c1f81613a55565b91506020830135613c2f81613bf3565b809150509250929050565b60008083601f840112613c4c57600080fd5b5081356001600160401b03811115613c6357600080fd5b6020830191508360208260051b85010111156136aa57600080fd5b600080600060408486031215613c9357600080fd5b8335613c9e81613a55565b925060208401356001600160401b03811115613cb957600080fd5b613cc586828701613c3a565b9497909650939450505050565b60008060008060408587031215613ce857600080fd5b84356001600160401b0380821115613cff57600080fd5b613d0b88838901613c3a565b90965094506020870135915080821115613d2457600080fd5b50613d3187828801613c3a565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215613d6957600080fd5b8435613d7481613a55565b93506020850135613d8481613a55565b92506040850135915060608501356001600160401b0380821115613da757600080fd5b818701915087601f830112613dbb57600080fd5b813581811115613dcd57613dcd613d3d565b604051601f8201601f19908116603f01168101908382118183101715613df557613df5613d3d565b816040528281528a6020848701011115613e0e57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060008060608587031215613e4857600080fd5b8435613e5381613a55565b93506020850135613e6381613a55565b925060408501356001600160401b03811115613e7e57600080fd5b613d3187828801613c3a565b60008083601f840112613e9c57600080fd5b5081356001600160401b03811115613eb357600080fd5b6020830191508360208285010111156136aa57600080fd5b600080600080600080600060a0888a031215613ee657600080fd5b8735613ef181613b78565b96506020880135613f0181613b78565b95506040880135613f1181613b78565b945060608801356001600160401b0380821115613f2d57600080fd5b613f398b838c01613c3a565b909650945060808a0135915080821115613f5257600080fd5b50613f5f8a828b01613e8a565b989b979a50959850939692959293505050565b60008060008060408587031215613f8857600080fd5b84356001600160401b0380821115613f9f57600080fd5b613fab88838901613e8a565b90965094506020870135915080821115613fc457600080fd5b50613d3187828801613e8a565b600080600060608486031215613fe657600080fd5b833592506020840135613b6781613a55565b600060e0828403121561400a57600080fd5b50919050565b6000806040838503121561402357600080fd5b823561402e81613a55565b91506020830135613c2f81613a55565b6000806000806000806080878903121561405757600080fd5b863561406281613a55565b9550602087013561407281613a55565b945060408701356001600160401b038082111561408e57600080fd5b61409a8a838b01613c3a565b909650945060608901359150808211156140b357600080fd5b506140c089828a01613e8a565b979a9699509497509295939492505050565b600181811c908216806140e657607f821691505b6020821081141561400a57634e487b7160e01b600052602260045260246000fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082198211156141655761416561413c565b500190565b60008160001904831182151516156141845761418461413c565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826141ae576141ae614189565b500490565b6000828210156141c5576141c561413c565b500390565b60208082526029908201527f455243373231423a2063616c6c6572206973206e6f74206f776e6572206e6f7260408201526808185c1c1c9bdd995960ba1b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b600061ffff8083168185168083038211156142465761424661413c565b01949350505050565b600061ffff8381169083168181101561426a5761426a61413c565b039392505050565b60006001600160401b03808316818516818304811182151516156142985761429861413c565b02949350505050565b60006000198214156142b5576142b561413c565b5060010190565b634e487b7160e01b600052603260045260246000fd5b60208082526024908201527f455243373231423a20717565727920666f72206e6f6e6578697374656e74207460408201526337b5b2b760e11b606082015260800190565b60208082526010908201526f496e76616c69642064656c656761746560801b604082015260600190565b8054600090600181811c908083168061435a57607f831692505b602080841082141561437c57634e487b7160e01b600052602260045260246000fd5b81801561439057600181146143a1576143ce565b60ff198616895284890196506143ce565b60008881526020902060005b868110156143c65781548b8201529085019083016143ad565b505084890196505b50505050505092915050565b60006143e68286614340565b84516143f6818360208901613a87565b61440281830186614340565b979650505050505050565b60006020828403121561441f57600080fd5b5051919050565b6001600160a01b038416815260606020820181905260009061444a90830185613ba5565b828103604084015261445c8185613ba5565b9695505050505050565b60008135610b0181613b78565b6000813560ff81168114610b0157600080fd5b60008135610b0181613bf3565b81356001600160401b0381168082146144ab57600080fd5b825467ffffffffffffffff19811682178455915060208401356144cd81613b78565b69ffffffffffffffffffff199290921617604091821b69ffff0000000000000000161782558201356144fe81613b78565b815461ffff60501b1916605082901b61ffff60501b161782555061454761452760608401614466565b82805461ffff60601b191660609290921b61ffff60601b16919091179055565b61457661455660808401614466565b82805461ffff60701b191660709290921b61ffff60701b16919091179055565b6145a361458560a08401614473565b82805460ff60801b191660809290921b60ff60801b16919091179055565b610db96145b260c08401614486565b82805460ff60881b191691151560881b60ff60881b16919091179055565b60208082526033908201527f455243373231423a207472616e7366657220746f206e6f6e204552433732315260408201527232b1b2b4bb32b91034b6b83632b6b2b73a32b960691b606082015260800190565b60008261463257614632614189565b500690565b600061ffff8083168181141561464f5761464f61413c565b6001019392505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061445c90830184613ab3565b60006020828403121561469e57600080fd5b81516116ec81613a22565b60006bffffffffffffffffffffffff19808660601b168352808560601b1660148401525082516146e0816028850160208701613a87565b9190910160280194935050505056fea2646970667358221220409bd08019623539e721ed55844c6860c977816bf097ee5f71f5689b6ceb1d0264736f6c63430008090033
Verified Source Code Partial Match
Compiler: v0.8.9+commit.e5eed63a
EVM: london
Optimization: Yes (200 runs)
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);
}
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
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);
}
}
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);
}
Signed.sol 32 lines
// SPDX-License-Identifier: BSD-3
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
contract Signed{
using ECDSA for bytes32;
address internal _signer;
constructor( address signer ){
_setSigner( signer );
}
function _createHash( string memory data ) internal virtual view returns ( bytes32 ){
return keccak256( abi.encodePacked( address(this), msg.sender, data ) );
}
function _isAuthorizedSigner( string memory data, bytes calldata signature ) internal view virtual returns( bool ){
return _signer == _recoverSigner( _createHash( data ), signature );
}
function _recoverSigner( bytes32 hashed, bytes memory signature ) internal pure returns( address ){
return hashed.toEthSignedMessageHash().recover( signature );
}
function _setSigner( address signer ) internal{
_signer = signer;
}
}
IERC721Batch.sol 10 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
interface IERC721Batch {
function isOwnerOf( address account, uint[] calldata tokenIds ) external view returns( bool );
function safeTransferBatch( address from, address to, uint[] calldata tokenIds, bytes calldata data ) external;
function transferBatch( address from, address to, uint[] calldata tokenIds ) external;
function walletOfOwner( address account ) external view returns( uint[] memory );
}
ERC721Batch.sol 43 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "./IERC721Batch.sol";
import "./ERC721EnumerableB.sol";
abstract contract ERC721Batch is ERC721EnumerableB, IERC721Batch {
function isOwnerOf( address account, uint[] calldata tokenIds ) external view override returns( bool ){
for(uint i; i < tokenIds.length; ++i ){
if( account != tokens[ tokenIds[i] ].owner )
return false;
}
return true;
}
function safeTransferBatch( address from, address to, uint256[] calldata tokenIds, bytes calldata data ) external override{
for(uint i; i < tokenIds.length; ++i ){
safeTransferFrom( from, to, tokenIds[i], data );
}
}
function transferBatch( address from, address to, uint256[] calldata tokenIds ) external override{
for(uint i; i < tokenIds.length; ++i ){
transferFrom( from, to, tokenIds[i] );
}
}
function walletOfOwner( address account ) external view override returns( uint[] memory ){
uint256 count;
uint256 quantity = owners[ account ].balance;
uint256[] memory wallet = new uint[]( quantity );
for( uint i = range.lower; i < range.upper; ++i ){
if( account == tokens[i].owner ){
wallet[ count++ ] = i;
if( count == quantity )
break;
}
}
return wallet;
}
}
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);
}
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;
}
}
IERC721Enumerable.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)
pragma solidity ^0.8.0;
import "../IERC721.sol";
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
IERC721Receiver.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (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 `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
MasterCats.sol 258 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/interfaces/IERC2981.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import './Delegated.sol';
import './ERC721Batch.sol';
import './PaymentSplitterMod.sol';
import './Signed.sol';
interface IThe3030Badge{
function balanceOf( address, uint ) external returns( uint );
function burnFrom( address, uint[] calldata, uint[] calldata ) external payable;
}
contract MasterCats is Delegated, ERC721Batch, PaymentSplitterMod, Signed {
using Strings for uint256;
enum SaleState{
NONE, //0
BADGE, //1
ALPHA, //2
_3,
BETA, //4
_5,
_6,
_7,
MAIN //8
}
struct ClaimBalances{
uint16 badge;
uint16 alpha;
uint16 beta;
uint16 free;
}
struct MintConfig{
uint64 ethPrice;
uint16 freeMints;
uint16 maxMint;
uint16 maxOrder;
uint16 maxSupply;
uint8 saleState;
bool isFreeMintActive;
}
MintConfig public CONFIG = MintConfig(
0.07 ether, //ethPrice
1, //freeMints
9000, //maxMint
10, //maxOrder
9000, //maxSupply
uint8(SaleState.NONE), //saleState
false
);
IThe3030Badge public PRINCIPAL = IThe3030Badge( 0x01aFE4Ed0CFee364307a67Ec4EE28ebe480833C3 );
string public tokenURIPrefix;
string public tokenURISuffix;
constructor()
ERC721B("Master Cats", "MASTER" )
Signed( 0x41C9E80FAa5E12Ac1d61549267fB497041f0EFb8 ){
_addPayee( 0xed386149321FBd84f0c4e27a1701Ad05eCA32f8A, 32 ether );
_addPayee( 0xf9467442d7f5c12283186101C80cd4a71497D7d5, 33 ether );
_addPayee( 0x085FBF2d78308d2D69E9427d6D5eA774BCBC97AE, 15 ether );
_addPayee( 0x4ba29e49F4EfeF6A4069e51545c31e4df634cdEA, 10 ether );
_addPayee( 0x73b4c65d013c976cF774173FA3bd6f48Ec300419, 10 ether );
}
//view
function getClaims( address account ) external returns( ClaimBalances memory balances ){
require( address(PRINCIPAL) != address(0), "Invalid configuration" );
MintConfig memory cfg = CONFIG;
balances = ClaimBalances( 0, 0, 0, 0 );
uint8 checkState = uint8(SaleState.BADGE);
if( cfg.saleState & checkState == checkState ){
balances.badge = uint16(PRINCIPAL.balanceOf( account, 0 ));
if( balances.badge > owners[ account ].badges )
balances.badge -= owners[ account ].badges;
else
balances.badge = 0;
}
checkState = uint8(SaleState.ALPHA);
if( cfg.saleState & checkState == checkState )
balances.alpha = uint16(PRINCIPAL.balanceOf( account, 1 ));
checkState = uint8(SaleState.BETA);
if( cfg.saleState & checkState == checkState )
balances.beta = uint16(PRINCIPAL.balanceOf( account, 2 ));
if( cfg.isFreeMintActive ){
balances.free = CONFIG.freeMints;
if( balances.free > owners[ account ].claimed )
balances.free -= owners[ account ].claimed;
else
balances.free = 0;
}
return balances;
}
//view: IERC721Metadata
function tokenURI( uint tokenId ) external view override returns( string memory ){
require(_exists(tokenId), "query for nonexistent token");
return string(abi.encodePacked(tokenURIPrefix, tokenId.toString(), tokenURISuffix));
}
function claim( uint16 badgeQty, uint16 alphaQty, uint16 betaQty, uint256[] calldata tokenIds, bytes calldata badgeSig ) external payable{
MintConfig memory cfg = CONFIG;
Owner memory prev = owners[msg.sender];
if( badgeQty > 0 ){
uint8 badgeState = uint8(SaleState.BADGE);
require( cfg.saleState & badgeState == badgeState, "badge sale is disabled" );
require( _isAuthorizedSigner( "1", badgeSig ), "not authorized for badge mints" );
uint badgeBalance = PRINCIPAL.balanceOf( msg.sender, 0 );
require( prev.badges + badgeQty <= badgeBalance, "all badges used" );
}
if( alphaQty > 0 ){
uint8 alphaState = uint8(SaleState.ALPHA);
require( cfg.saleState & alphaState == alphaState, "alpha sale is disabled" );
PRINCIPAL.burnFrom( msg.sender, _asArray( 1 ), _asArray( alphaQty ) );
}
if( betaQty > 0 ){
uint8 betaState = uint8(SaleState.BETA);
require( cfg.saleState & betaState == betaState, "beta sale is disabled" );
PRINCIPAL.burnFrom( msg.sender, _asArray( 2 ), _asArray( betaQty ) );
}
uint16 totalQuantity = badgeQty + alphaQty + betaQty;
require( totalQuantity == tokenIds.length, "" );
owners[msg.sender] = Owner(
prev.balance + totalQuantity,
prev.badges + badgeQty,
prev.claimed,
prev.purchased + totalQuantity
);
for(uint i; i < tokenIds.length; ++i){
_mint( msg.sender, tokenIds[ i ] );
}
}
//payable
function mint( uint16 quantity ) external payable{
MintConfig memory cfg = CONFIG;
require( quantity > 0, "must order 1+" );
require( quantity <= cfg.maxOrder, "order too big" );
require( totalSupply() + quantity <= cfg.maxSupply, "mint/order exceeds supply" );
uint8 mainState = uint8(SaleState.MAIN);
require( cfg.saleState & mainState == mainState, "sale is not active" );
Owner memory prev = owners[msg.sender];
require( prev.purchased + quantity <= cfg.maxMint, "don't be greedy" );
uint16 freeQty = 0;
if( cfg.isFreeMintActive && cfg.freeMints > prev.claimed ){
freeQty = cfg.freeMints - prev.claimed;
if( quantity >= freeQty ){
//use all free mints
uint16 paidQty = quantity - freeQty;
require( msg.value >= paidQty * cfg.ethPrice, "insufficient funds" );
}
else{
freeQty = quantity;
}
}
owners[msg.sender] = Owner(
prev.balance + quantity,
prev.badges,
prev.claimed + freeQty,
prev.purchased + quantity
);
for(uint i; i < quantity; ++i){
_mint( msg.sender, _next() );
}
}
//onlyDelegates
function mintTo(uint16[] calldata quantity, address[] calldata recipient) external payable onlyDelegates{
require(quantity.length == recipient.length, "Must provide equal quantities and recipients" );
uint totalQuantity;
uint supply = totalSupply();
for(uint i; i < quantity.length; ++i){
totalQuantity += quantity[i];
}
require( supply + totalQuantity <= CONFIG.maxSupply, "Mint/order exceeds supply" );
for(uint i; i < recipient.length; ++i){
for(uint j; j < quantity[i]; ++j){
_mint( recipient[i], _next() );
}
}
}
function setConfig( MintConfig calldata config ) external onlyDelegates{
CONFIG = config;
}
function setPrincipal( IThe3030Badge newPrincipal ) external onlyDelegates{
PRINCIPAL = newPrincipal;
}
function setSigner( address newSigner ) external onlyDelegates{
_setSigner( newSigner );
}
function setTokenURI( string calldata prefix, string calldata suffix ) external onlyDelegates{
tokenURIPrefix = prefix;
tokenURISuffix = suffix;
}
//onlyOwner
function addPayee(address account, uint256 shares_) external onlyOwner {
_addPayee( account, shares_ );
}
function resetCounters() external onlyOwner {
_resetCounters();
}
function setPayee( uint index, address account, uint newShares ) external onlyOwner {
_setPayee(index, account, newShares);
}
function _asArray(uint256 element) private pure returns (uint256[] memory array) {
array = new uint256[](1);
array[0] = element;
}
}
ECDSA.sol 230 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}
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;
}
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (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`.
*
* 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;
/**
* @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 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 the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @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);
}
IERC1155.sol 125 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}
IERC2981.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.0;
import "../utils/introspection/IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*
* _Available since v4.5._
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}
PaymentSplitterMod.sol 131 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/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.
*/
contract PaymentSplitterMod is Context {
event PayeeAdded(address account, uint256 shares);
event PaymentReleased(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[] internal _payees;
/**
* @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() payable {}
/**
* @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 {
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 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 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 = (totalReceived * _shares[account]) / _totalShares - _released[account];
require(payment != 0, "PaymentSplitter: account is not due payment");
_released[account] = _released[account] + payment;
_totalReleased = _totalReleased + payment;
Address.sendValue(account, payment);
emit PaymentReleased(account, payment);
}
function _addPayee(address account, uint256 shares_) internal {
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_);
}
function _resetCounters() internal {
_totalReleased = 0;
for(uint i; i < _payees.length; ++i ){
_released[ _payees[i] ] = 0;
}
}
function _setPayee( uint index, address account, uint newShares ) internal {
_totalShares = _totalShares - _shares[ account ] + newShares;
_shares[ account ] = newShares;
_payees[ index ] = account;
}
}
ERC721EnumerableB.sol 36 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "./ERC721B.sol";
abstract contract ERC721EnumerableB is ERC721B, IERC721Enumerable {
function supportsInterface( bytes4 interfaceId ) public view virtual override(IERC165, ERC721B) returns( bool ){
return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
}
function tokenOfOwnerByIndex( address owner, uint256 index ) external view override returns( uint ){
require( owners[ owner ].balance > index, "ERC721EnumerableB: owner index out of bounds" );
uint256 count;
uint256 tokenId;
for( tokenId = range.lower; tokenId < range.upper; ++tokenId ){
if( owner != tokens[tokenId].owner )
continue;
if( index == count++ )
break;
}
return tokenId;
}
function tokenByIndex( uint256 index ) external view override returns( uint ){
require( _exists( index ), "ERC721EnumerableB: query for nonexistent token");
return index;
}
function totalSupply() public view virtual override( ERC721B, IERC721Enumerable ) returns( uint ){
return super.totalSupply();
}
}
ERC721B.sol 245 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
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/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
abstract contract ERC721B is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
struct Owner{
uint16 balance;
uint16 badges;
uint16 claimed;
uint16 purchased;
}
struct TokenRange{
uint16 burned;
uint16 current;
uint16 minted;
uint16 lower;
uint16 upper;
}
struct Token{
address owner;
}
//Token[] public tokens;
TokenRange public range;
mapping(uint256 => Token) public tokens;
mapping(address => Owner) public owners;
string private _name;
string private _symbol;
mapping(uint256 => address) internal _tokenApprovals;
mapping(address => mapping(address => bool)) private _operatorApprovals;
constructor(string memory name_, string memory symbol_ ){
_name = name_;
_symbol = symbol_;
}
//public view
function balanceOf(address owner) external view override returns( uint256 balance ){
require(owner != address(0), "ERC721B: balance query for the zero address");
return owners[owner].balance;
}
function name() external view override returns( string memory name_ ){
return _name;
}
function ownerOf(uint256 tokenId) public view override returns( address owner ){
require(_exists(tokenId), "ERC721B: query for nonexistent token");
return tokens[tokenId].owner;
}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns( bool isSupported ){
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
function symbol() external view override returns( string memory symbol_ ){
return _symbol;
}
function totalSupply() public view virtual returns( uint256 ){
return range.minted - range.burned;
}
//approvals
function approve(address to, uint256 tokenId) external override {
address owner = ownerOf(tokenId);
require(to != owner, "ERC721B: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721B: caller is not owner nor approved for all"
);
_approve(to, tokenId);
}
function getApproved(uint256 tokenId) public view override returns( address approver ){
require(_exists(tokenId), "ERC721: query for nonexistent token");
return _tokenApprovals[tokenId];
}
function isApprovedForAll(address owner, address operator) public view override returns( bool isApproved ){
return _operatorApprovals[owner][operator];
}
function setApprovalForAll(address operator, bool approved) external override {
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
//transfers
function safeTransferFrom(address from, address to, uint256 tokenId) external override{
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721B: caller is not owner nor approved");
_safeTransfer(from, to, tokenId, "");
}
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public override {
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721B: caller is not owner nor approved");
_safeTransfer(from, to, tokenId, _data);
}
function transferFrom(address from, address to, uint256 tokenId) public override {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721B: caller is not owner nor approved");
_transfer(from, to, tokenId);
}
//internal
function _approve(address to, uint256 tokenId) internal{
_tokenApprovals[tokenId] = to;
emit Approval(ownerOf(tokenId), to, tokenId);
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual {
}
/*
function _burn(address from, uint256 tokenId) internal {
require(ownerOf(tokenId) == from, "ERC721B: burn of token that is not own");
// Clear approvals
delete _tokenApprovals[tokenId];
_beforeTokenTransfer(from, address(0), tokenId);
++range.burned;
--owners[ from ].balance;
tokens[tokenId].owner = address(0);
emit Transfer(from, address(0), tokenId);
}
*/
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns( bool ){
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721B: transfer to non ERC721Receiver implementer");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
}
function _exists(uint256 tokenId) internal view returns( bool ){
return range.lower <= tokenId
&& tokenId < range.upper
&& tokens[tokenId].owner != address(0);
}
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns( bool isApproved ){
require(_exists(tokenId), "ERC721B: query for nonexistent token");
address owner = ownerOf(tokenId);
return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
}
function _mint( address to, uint256 tokenId ) internal virtual{
require(!_exists(tokenId), "ERC721B: mint for existing token");
_beforeTokenTransfer(address(0), to, tokenId);
_updateRange( tokenId );
tokens[ tokenId ] = Token( to );
emit Transfer( address(0), to, tokenId );
}
function _next() internal virtual returns(uint256 current){
current = range.current;
while( _exists( current ) ){
++current;
}
range.current = uint16( current );
}
function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal{
_transfer(from, to, tokenId);
require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721B: transfer to non ERC721Receiver implementer");
}
function _transfer(address from, address to, uint256 tokenId) internal virtual {
require(ownerOf(tokenId) == from, "ERC721B: transfer of token that is not own");
// Clear approvals from the previous owner
delete _tokenApprovals[tokenId];
_beforeTokenTransfer(from, to, tokenId);
unchecked {
--owners[from].balance;
++owners[to].balance;
}
tokens[tokenId].owner = to;
emit Transfer(from, to, tokenId);
}
function _updateRange(uint256 tokenId) private{
TokenRange memory prev = range;
++prev.minted;
if( tokenId <= prev.current ){
//console.log( "_updateRange", tokenId, prev.current );
++prev.current;
}
if( tokenId > prev.upper )
prev.upper = uint16(tokenId + 1);
range = prev;
/*
range = TokenRange(
prev.burned,
prev.current,
prev.minted,
prev.lower,
prev.upper
);
*/
}
}
Delegated.sol 33 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;
import "@openzeppelin/contracts/access/Ownable.sol";
contract Delegated is Ownable{
mapping(address => bool) internal _delegates;
modifier onlyDelegates {
require(_delegates[msg.sender], "Invalid delegate" );
_;
}
constructor()
Ownable(){
setDelegate( owner(), true );
}
//onlyOwner
function isDelegate( address addr ) external view onlyOwner returns( bool ){
return _delegates[addr];
}
function setDelegate( address addr, bool isDelegate_ ) public onlyOwner{
_delegates[addr] = isDelegate_;
}
function transferOwnership(address newOwner) public virtual override onlyOwner {
_delegates[newOwner] = true;
super.transferOwnership( newOwner );
}
}
Read Contract
CONFIG 0xd92e82e4 → uint64, uint16, uint16, uint16, uint16, uint8, bool
PRINCIPAL 0xd274958d → address
balanceOf 0x70a08231 → uint256
getApproved 0x081812fc → address
isApprovedForAll 0xe985e9c5 → bool
isDelegate 0x07779627 → bool
isOwnerOf 0x4d44660c → bool
name 0x06fdde03 → string
owner 0x8da5cb5b → address
ownerOf 0x6352211e → address
owners 0x022914a7 → uint16, uint16, uint16, uint16
payee 0x8b83209b → address
range 0xe97206a9 → uint16, uint16, uint16, uint16, uint16
released 0x9852595c → uint256
shares 0xce7c2ac2 → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
tokenByIndex 0x4f6ccce7 → uint256
tokenOfOwnerByIndex 0x2f745c59 → uint256
tokenURI 0xc87b56dd → string
tokenURIPrefix 0xc0ac9983 → string
tokenURISuffix 0xdbbc853b → string
tokens 0x4f64b2be → address
totalReleased 0xe33b7de3 → uint256
totalShares 0x3a98ef39 → uint256
totalSupply 0x18160ddd → uint256
walletOfOwner 0x438b6300 → uint256[]
Write Contract 22 functions
These functions modify contract state and require a wallet transaction to execute.
addPayee 0x18f9b023
address account
uint256 shares_
approve 0x095ea7b3
address to
uint256 tokenId
claim 0xcefc3e5d
uint16 badgeQty
uint16 alphaQty
uint16 betaQty
uint256[] tokenIds
bytes badgeSig
getClaims 0xd0d46a0b
address account
returns: tuple
mint 0x23cf0a22
uint16 quantity
mintTo 0xae7bf4c8
uint16[] quantity
address[] recipient
release 0x19165587
address account
renounceOwnership 0x715018a6
No parameters
resetCounters 0xe4ed53a9
No parameters
safeTransferBatch 0xececaf00
address from
address to
uint256[] tokenIds
bytes data
safeTransferFrom 0x42842e0e
address from
address to
uint256 tokenId
safeTransferFrom 0xb88d4fde
address from
address to
uint256 tokenId
bytes _data
setApprovalForAll 0xa22cb465
address operator
bool approved
setConfig 0x4df60e21
tuple config
setDelegate 0x4a994eef
address addr
bool isDelegate_
setPayee 0xdf238800
uint256 index
address account
uint256 newShares
setPrincipal 0x847fd5bf
address newPrincipal
setSigner 0x6c19e783
address newSigner
setTokenURI 0xd48ede99
string prefix
string suffix
transferBatch 0xc0423145
address from
address to
uint256[] tokenIds
transferFrom 0x23b872dd
address from
address to
uint256 tokenId
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address