Address Contract Verified
Address
0xc10dadD54D945c5Cd537882bbE826807928d0Bc6
Balance
0.226935 ETH
Nonce
1
Code Size
15041 bytes
Creator
0xB34EbA47...9006 at tx 0x6a75b6cd...ba4220
Indexed Transactions
0
Contract Bytecode
15041 bytes
0x6080604052600436106102ba5760003560e01c8063783300a71161016e578063b85a786d116100cb578063e985e9c51161007f578063f2fde38b11610064578063f2fde38b14610762578063f512f46b14610782578063f5298aca146107a257600080fd5b8063e985e9c5146106f9578063f242432a1461074257600080fd5b8063bd85b039116100b0578063bd85b03914610676578063ce7c2ac2146106a3578063d91d2a4e146106d957600080fd5b8063b85a786d1461064d578063bb82a7ea1461066057600080fd5b806391b7f5ed116101225780639bdc31d2116101075780639bdc31d2146105f7578063a22cb4651461060d578063af4a3c281461062d57600080fd5b806391b7f5ed146105c257806395d89b41146105e257600080fd5b80638456cb59116101535780638456cb591461056f5780638da5cb5b146105845780638ff51fa8146105ac57600080fd5b8063783300a7146105465780637e17e7b71461055c57600080fd5b80632eb2c2d61161021c5780635c975abb116101d05780636817c76c116101b55780636817c76c146104fb5780636b20c45414610511578063715018a61461053157600080fd5b80635c975abb146104cd57806367bd4b5d146104e557600080fd5b80634133ea7d116102015780634133ea7d1461045b5780634e1273f4146104715780634f558e791461049e57600080fd5b80632eb2c2d6146104265780633f4ba83a1461044657600080fd5b8063089c59cb11610273578063110575db11610258578063110575db146103c657806319165587146103e657806319c54d3c1461040657600080fd5b8063089c59cb146103795780630e89341c146103a657600080fd5b806302fe5305116102a457806302fe530514610322578063031b18291461034457806306fdde031461035757600080fd5b8062fdd58e146102bf57806301ffc9a7146102f2575b600080fd5b3480156102cb57600080fd5b506102df6102da366004612e61565b6107c2565b6040519081526020015b60405180910390f35b3480156102fe57600080fd5b5061031261030d366004612ebb565b61086d565b60405190151581526020016102e9565b34801561032e57600080fd5b5061034261033d366004612f92565b610952565b005b610342610352366004612ff1565b610966565b34801561036357600080fd5b5061036c610a0b565b6040516102e9919061307c565b34801561038557600080fd5b506102df61039436600461308f565b60076020526000908152604090205481565b3480156103b257600080fd5b5061036c6103c13660046130ac565b610a9d565b3480156103d257600080fd5b506103426103e13660046130c5565b610b34565b3480156103f257600080fd5b5061034261040136600461308f565b610c9d565b34801561041257600080fd5b506102df61042136600461308f565b610db8565b34801561043257600080fd5b506103426104413660046131bf565b610e1a565b34801561045257600080fd5b50610342610eb5565b34801561046757600080fd5b506102df60135481565b34801561047d57600080fd5b5061049161048c36600461326d565b610ec7565b6040516102e99190613375565b3480156104aa57600080fd5b506103126104b93660046130ac565b600090815260046020526040902054151590565b3480156104d957600080fd5b5060005460ff16610312565b3480156104f157600080fd5b506102df60105481565b34801561050757600080fd5b506102df60085481565b34801561051d57600080fd5b5061034261052c366004613388565b611005565b34801561053d57600080fd5b506103426110a3565b34801561055257600080fd5b506102df60125481565b61034261056a366004612ff1565b6110b5565b34801561057b57600080fd5b50610342611119565b34801561059057600080fd5b506005546040516001600160a01b0390911681526020016102e9565b3480156105b857600080fd5b506102df60145481565b3480156105ce57600080fd5b506103426105dd3660046130ac565b611129565b3480156105ee57600080fd5b5061036c611136565b34801561060357600080fd5b506102df60115481565b34801561061957600080fd5b506103426106283660046133fe565b611145565b34801561063957600080fd5b5061034261064836600461343c565b611150565b61034261065b366004612ff1565b6111f0565b34801561066c57600080fd5b506102df60155481565b34801561068257600080fd5b506102df6106913660046130ac565b60009081526004602052604090205490565b3480156106af57600080fd5b506102df6106be36600461308f565b6001600160a01b03166000908152600d602052604090205490565b3480156106e557600080fd5b506103426106f436600461347f565b611203565b34801561070557600080fd5b506103126107143660046134f4565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205460ff1690565b34801561074e57600080fd5b5061034261075d366004613522565b6112a7565b34801561076e57600080fd5b5061034261077d36600461308f565b611342565b34801561078e57600080fd5b5061034261079d36600461359d565b6113cf565b3480156107ae57600080fd5b506103426107bd3660046135d9565b6114fa565b60006001600160a01b0383166108455760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201527f616c6964206f776e65720000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b5060009081526001602090815260408083206001600160a01b03949094168352929052205490565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167fd9b67a2600000000000000000000000000000000000000000000000000000000148061090057507fffffffff0000000000000000000000000000000000000000000000000000000082167f0e89341c00000000000000000000000000000000000000000000000000000000145b8061094c57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b61095a611593565b610963816115ed565b50565b61096e611600565b6010546011546040518060400160405280600281526020017f4f470000000000000000000000000000000000000000000000000000000000008152508242101580156109ba5750814211155b816040516020016109cb919061360e565b604051602081830303815290604052906109f85760405162461bcd60e51b815260040161083c919061307c565b50610a04338686611653565b5050505050565b606060098054610a1a9061364f565b80601f0160208091040260200160405190810160405280929190818152602001828054610a469061364f565b8015610a935780601f10610a6857610100808354040283529160200191610a93565b820191906000526020600020905b815481529060010190602001808311610a7657829003601f168201915b5050505050905090565b600081815260046020526040902054606090610afb5760405162461bcd60e51b815260206004820152601460248201527f546f6b656e20646f6573206e6f74206578697374000000000000000000000000604482015260640161083c565b610b048261186d565b610b0d83611901565b604051602001610b1e9291906136a3565b6040516020818303038152906040529050919050565b610b3c611593565b6000610b488284613729565b60ff16905080610b9a5760405162461bcd60e51b815260206004820152601660248201527f496e76616c696420616d6f756e74206f66206b65797300000000000000000000604482015260640161083c565b600160005260046020527fabd6e7cb50984ff9c2f3e18a2660c3353dadf4e3291deeb275dae2cd1e44fe0554610dac90610bd89060ff85169061374e565b11158015610c2157506000805260046020527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec546103e890610c1e9060ff86169061374e565b11155b610c6d5760405162461bcd60e51b815260206004820152601260248201527f4d617820737570706c7920726561636865640000000000000000000000000000604482015260640161083c565b60ff831615610c8257610c8284600085611a3b565b60ff821615610c9757610c9784600184611a3b565b50505050565b6001600160a01b0381166000908152600d6020526040902054610d025760405162461bcd60e51b815260206004820152601c60248201527f41646472657373206973206e6f742061207368617265686f6c64657200000000604482015260640161083c565b6000610d0d82610db8565b905080610d5c5760405162461bcd60e51b815260206004820181905260248201527f5368617265686f6c646572206973206e6f74206475652061207061796d656e74604482015260640161083c565b6001600160a01b0382166000908152600e6020526040902054610d8090829061374e565b6001600160a01b0383166000908152600e6020526040902055600c54610da790829061374e565b600c55610db48282611a5c565b5050565b600080600c5447610dc9919061374e565b6001600160a01b0384166000908152600e6020908152604080832054600b54600d9093529220549293509091610dff9084613766565b610e0991906137d2565b610e1391906137e6565b9392505050565b6001600160a01b038516331480610e365750610e368533610714565b610ea85760405162461bcd60e51b815260206004820152602f60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206e6f7220617070726f7665640000000000000000000000000000000000606482015260840161083c565b610a048585858585611b75565b610ebd611593565b610ec5611e24565b565b60608151835114610f405760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d617463680000000000000000000000000000000000000000000000606482015260840161083c565b6000835167ffffffffffffffff811115610f5c57610f5c612ed8565b604051908082528060200260200182016040528015610f85578160200160208202803683370190505b50905060005b8451811015610ffd57610fd0858281518110610fa957610fa96137fd565b6020026020010151858381518110610fc357610fc36137fd565b60200260200101516107c2565b828281518110610fe257610fe26137fd565b6020908102919091010152610ff68161382c565b9050610f8b565b509392505050565b6001600160a01b03831633148061102157506110218333610714565b6110935760405162461bcd60e51b815260206004820152602f60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206e6f7220617070726f7665640000000000000000000000000000000000606482015260840161083c565b61109e838383611e94565b505050565b6110ab611593565b610ec56000612134565b6110bd611600565b6012546013546040518060400160405280600981526020017f416c7068616c69737400000000000000000000000000000000000000000000008152508242101580156109ba575081421115816040516020016109cb919061360e565b611121611593565b610ec561219e565b611131611593565b600855565b6060600a8054610a1a9061364f565b610db43383836121f9565b611158611593565b838211801561116657508584115b801561117157508585115b801561117c57508383115b801561118757508181115b6111d35760405162461bcd60e51b815260206004820152601760248201527f496e76616c6964206d696e74696e672077696e646f7773000000000000000000604482015260640161083c565b601095909555601193909355601291909155601355601455601555565b6111f8611600565b610db4338383611653565b61120b611593565b8061121557600080fd5b60005b8181101561109e576000838383818110611234576112346137fd565b90506060020180360381019061124a9190613865565b8051602080830151604080519283019052600080835293945061126d939161230c565b6112948160000151600160ff1683604001516040518060200160405280600081525061230c565b508061129f8161382c565b915050611218565b6001600160a01b0385163314806112c357506112c38533610714565b6113355760405162461bcd60e51b815260206004820152602f60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206e6f7220617070726f7665640000000000000000000000000000000000606482015260840161083c565b610a04858585858561244d565b61134a611593565b6001600160a01b0381166113c65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161083c565b61096381612134565b6113d7611593565b6113df611600565b600160005260046020527fabd6e7cb50984ff9c2f3e18a2660c3353dadf4e3291deeb275dae2cd1e44fe0554610dac9061141e9061ffff84169061374e565b1115801561146857506000805260046020527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec546103e8906114659061ffff85169061374e565b11155b6114b45760405162461bcd60e51b815260206004820152601260248201527f4d617820737570706c7920726561636865640000000000000000000000000000604482015260640161083c565b6114d783600060ff168461ffff166040518060200160405280600081525061230c565b61109e83600160ff168361ffff166040518060200160405280600081525061230c565b6001600160a01b03831633148061151657506115168333610714565b6115885760405162461bcd60e51b815260206004820152602f60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201527f6572206e6f7220617070726f7665640000000000000000000000000000000000606482015260840161083c565b61109e838383612635565b6005546001600160a01b03163314610ec55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161083c565b8051610db4906003906020840190612db3565b60005460ff1615610ec55760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161083c565b600260065414156116a65760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161083c565b600260065560006116b78284613729565b60ff169050806117095760405162461bcd60e51b815260206004820152601660248201527f496e76616c696420616d6f756e74206f66206b65797300000000000000000000604482015260640161083c565b600160005260046020527fabd6e7cb50984ff9c2f3e18a2660c3353dadf4e3291deeb275dae2cd1e44fe0554610dac906117479060ff85169061374e565b1115801561179057506000805260046020527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec546103e89061178d9060ff86169061374e565b11155b6117dc5760405162461bcd60e51b815260206004820152601260248201527f4d617820737570706c7920726561636865640000000000000000000000000000604482015260640161083c565b6008546117e99082613766565b3410156118385760405162461bcd60e51b815260206004820152601c60248201527f496e76616c696420616d6f756e74206f662066756e64732073656e7400000000604482015260640161083c565b60ff83161561184d5761184d84600085611a3b565b60ff8216156118625761186284600184611a3b565b505060016006555050565b60606003805461187c9061364f565b80601f01602080910402602001604051908101604052809291908181526020018280546118a89061364f565b80156118f55780601f106118ca576101008083540402835291602001916118f5565b820191906000526020600020905b8154815290600101906020018083116118d857829003601f168201915b50505050509050919050565b60608161194157505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b811561196b57806119558161382c565b91506119649050600a836137d2565b9150611945565b60008167ffffffffffffffff81111561198657611986612ed8565b6040519080825280601f01601f1916602001820160405280156119b0576020820181803683370190505b5090505b8415611a33576119c56001836137e6565b91506119d2600a866138c7565b6119dd90603061374e565b60f81b8183815181106119f2576119f26137fd565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350611a2c600a866137d2565b94506119b4565b949350505050565b61109e838360ff168360ff166040518060200160405280600081525061230c565b80471015611aac5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161083c565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611af9576040519150601f19603f3d011682016040523d82523d6000602084013e611afe565b606091505b505090508061109e5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161083c565b8151835114611bec5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060448201527f6d69736d61746368000000000000000000000000000000000000000000000000606482015260840161083c565b6001600160a01b038416611c685760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161083c565b33611c778187878787876127fc565b60005b8451811015611db6576000858281518110611c9757611c976137fd565b602002602001015190506000858381518110611cb557611cb56137fd565b60209081029190910181015160008481526001835260408082206001600160a01b038e168352909352919091205490915081811015611d5c5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e7366657200000000000000000000000000000000000000000000606482015260840161083c565b60008381526001602090815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290611d9b90849061374e565b9250508190555050505080611daf9061382c565b9050611c7a565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051611e069291906138db565b60405180910390a4611e1c81878787878761280a565b505050505050565b611e2c612a1e565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b038316611f105760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161083c565b8051825114611f875760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060448201527f6d69736d61746368000000000000000000000000000000000000000000000000606482015260840161083c565b6000339050611faa818560008686604051806020016040528060008152506127fc565b60005b83518110156120c7576000848281518110611fca57611fca6137fd565b602002602001015190506000848381518110611fe857611fe86137fd565b60209081029190910181015160008481526001835260408082206001600160a01b038c16835290935291909120549091508181101561208e5760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e636500000000000000000000000000000000000000000000000000000000606482015260840161083c565b60009283526001602090815260408085206001600160a01b038b16865290915290922091039055806120bf8161382c565b915050611fad565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb86866040516121189291906138db565b60405180910390a4604080516020810190915260009052610c97565b600580546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6121a6611600565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611e773390565b816001600160a01b0316836001600160a01b031614156122815760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c660000000000000000000000000000000000000000000000606482015260840161083c565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0384166123885760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161083c565b33600061239485612a70565b905060006123a185612a70565b90506123b2836000898585896127fc565b60008681526001602090815260408083206001600160a01b038b168452909152812080548792906123e490849061374e565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461244483600089898989612abb565b50505050505050565b6001600160a01b0384166124c95760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161083c565b3360006124d585612a70565b905060006124e285612a70565b90506124f28389898585896127fc565b60008681526001602090815260408083206001600160a01b038c1684529091529020548581101561258b5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201527f72207472616e7366657200000000000000000000000000000000000000000000606482015260840161083c565b60008781526001602090815260408083206001600160a01b038d8116855292528083208985039055908a168252812080548892906125ca90849061374e565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461262a848a8a8a8a8a612abb565b505050505050505050565b6001600160a01b0383166126b15760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161083c565b3360006126bd84612a70565b905060006126ca84612a70565b90506126ea838760008585604051806020016040528060008152506127fc565b60008581526001602090815260408083206001600160a01b038a168452909152902054848110156127825760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e636500000000000000000000000000000000000000000000000000000000606482015260840161083c565b60008681526001602090815260408083206001600160a01b038b81168086529184528285208a8703905582518b81529384018a90529092908816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4604080516020810190915260009052612444565b611e1c868686868686612c25565b6001600160a01b0384163b15611e1c576040517fbc197c810000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063bc197c81906128679089908990889088908890600401613909565b602060405180830381600087803b15801561288157600080fd5b505af19250505080156128b1575060408051601f3d908101601f191682019092526128ae91810190613967565b60015b612967576128bd613984565b806308c379a014156128f757506128d26139a0565b806128dd57506128f9565b8060405162461bcd60e51b815260040161083c919061307c565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560448201527f526563656976657220696d706c656d656e746572000000000000000000000000606482015260840161083c565b7fffffffff0000000000000000000000000000000000000000000000000000000081167fbc197c8100000000000000000000000000000000000000000000000000000000146124445760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e73000000000000000000000000000000000000000000000000606482015260840161083c565b60005460ff16610ec55760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161083c565b60408051600180825281830190925260609160009190602080830190803683370190505090508281600081518110612aaa57612aaa6137fd565b602090810291909101015292915050565b6001600160a01b0384163b15611e1c576040517ff23a6e610000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063f23a6e6190612b189089908990889088908890600401613a48565b602060405180830381600087803b158015612b3257600080fd5b505af1925050508015612b62575060408051601f3d908101601f19168201909252612b5f91810190613967565b60015b612b6e576128bd613984565b7fffffffff0000000000000000000000000000000000000000000000000000000081167ff23a6e6100000000000000000000000000000000000000000000000000000000146124445760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a6563746560448201527f6420746f6b656e73000000000000000000000000000000000000000000000000606482015260840161083c565b6001600160a01b038516612cac5760005b8351811015612caa57828181518110612c5157612c516137fd565b602002602001015160046000868481518110612c6f57612c6f6137fd565b602002602001015181526020019081526020016000206000828254612c94919061374e565b90915550612ca390508161382c565b9050612c36565b505b6001600160a01b038416611e1c5760005b8351811015612444576000848281518110612cda57612cda6137fd565b602002602001015190506000848381518110612cf857612cf86137fd565b6020026020010151905060006004600084815260200190815260200160002054905081811015612d905760405162461bcd60e51b815260206004820152602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f7460448201527f616c537570706c79000000000000000000000000000000000000000000000000606482015260840161083c565b60009283526004602052604090922091039055612dac8161382c565b9050612cbd565b828054612dbf9061364f565b90600052602060002090601f016020900481019282612de15760008555612e27565b82601f10612dfa57805160ff1916838001178555612e27565b82800160010185558215612e27579182015b82811115612e27578251825591602001919060010190612e0c565b50612e33929150612e37565b5090565b5b80821115612e335760008155600101612e38565b6001600160a01b038116811461096357600080fd5b60008060408385031215612e7457600080fd5b8235612e7f81612e4c565b946020939093013593505050565b7fffffffff000000000000000000000000000000000000000000000000000000008116811461096357600080fd5b600060208284031215612ecd57600080fd5b8135610e1381612e8d565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff82111715612f2d57612f2d612ed8565b6040525050565b600067ffffffffffffffff831115612f4e57612f4e612ed8565b604051612f656020601f19601f8701160182612f07565b809150838152848484011115612f7a57600080fd5b83836020830137600060208583010152509392505050565b600060208284031215612fa457600080fd5b813567ffffffffffffffff811115612fbb57600080fd5b8201601f81018413612fcc57600080fd5b611a3384823560208401612f34565b803560ff81168114612fec57600080fd5b919050565b6000806040838503121561300457600080fd5b61300d83612fdb565b915061301b60208401612fdb565b90509250929050565b60005b8381101561303f578181015183820152602001613027565b83811115610c975750506000910152565b60008151808452613068816020860160208601613024565b601f01601f19169290920160200192915050565b602081526000610e136020830184613050565b6000602082840312156130a157600080fd5b8135610e1381612e4c565b6000602082840312156130be57600080fd5b5035919050565b6000806000606084860312156130da57600080fd5b83356130e581612e4c565b92506130f360208501612fdb565b915061310160408501612fdb565b90509250925092565b600067ffffffffffffffff82111561312457613124612ed8565b5060051b60200190565b600082601f83011261313f57600080fd5b8135602061314c8261310a565b6040516131598282612f07565b83815260059390931b850182019282810191508684111561317957600080fd5b8286015b84811015613194578035835291830191830161317d565b509695505050505050565b600082601f8301126131b057600080fd5b610e1383833560208501612f34565b600080600080600060a086880312156131d757600080fd5b85356131e281612e4c565b945060208601356131f281612e4c565b9350604086013567ffffffffffffffff8082111561320f57600080fd5b61321b89838a0161312e565b9450606088013591508082111561323157600080fd5b61323d89838a0161312e565b9350608088013591508082111561325357600080fd5b506132608882890161319f565b9150509295509295909350565b6000806040838503121561328057600080fd5b823567ffffffffffffffff8082111561329857600080fd5b818501915085601f8301126132ac57600080fd5b813560206132b98261310a565b6040516132c68282612f07565b83815260059390931b85018201928281019150898411156132e657600080fd5b948201945b8386101561330d5785356132fe81612e4c565b825294820194908201906132eb565b9650508601359250508082111561332357600080fd5b506133308582860161312e565b9150509250929050565b600081518084526020808501945080840160005b8381101561336a5781518752958201959082019060010161334e565b509495945050505050565b602081526000610e13602083018461333a565b60008060006060848603121561339d57600080fd5b83356133a881612e4c565b9250602084013567ffffffffffffffff808211156133c557600080fd5b6133d18783880161312e565b935060408601359150808211156133e757600080fd5b506133f48682870161312e565b9150509250925092565b6000806040838503121561341157600080fd5b823561341c81612e4c565b91506020830135801515811461343157600080fd5b809150509250929050565b60008060008060008060c0878903121561345557600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b6000806020838503121561349257600080fd5b823567ffffffffffffffff808211156134aa57600080fd5b818501915085601f8301126134be57600080fd5b8135818111156134cd57600080fd5b8660206060830285010111156134e257600080fd5b60209290920196919550909350505050565b6000806040838503121561350757600080fd5b823561351281612e4c565b9150602083013561343181612e4c565b600080600080600060a0868803121561353a57600080fd5b853561354581612e4c565b9450602086013561355581612e4c565b93506040860135925060608601359150608086013567ffffffffffffffff81111561357f57600080fd5b6132608882890161319f565b803561ffff81168114612fec57600080fd5b6000806000606084860312156135b257600080fd5b83356135bd81612e4c565b92506135cb6020850161358b565b91506131016040850161358b565b6000806000606084860312156135ee57600080fd5b83356135f981612e4c565b95602085013595506040909401359392505050565b60008251613620818460208701613024565b7f206d696e7420697320636c6f7365640000000000000000000000000000000000920191825250600f01919050565b600181811c9082168061366357607f821691505b6020821081141561369d577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600083516136b5818460208801613024565b8351908301906136c9818360208801613024565b7f2e6a736f6e0000000000000000000000000000000000000000000000000000009101908152600501949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600060ff821660ff84168060ff03821115613746576137466136fa565b019392505050565b60008219821115613761576137616136fa565b500190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561379e5761379e6136fa565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826137e1576137e16137a3565b500490565b6000828210156137f8576137f86136fa565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561385e5761385e6136fa565b5060010190565b60006060828403121561387757600080fd5b6040516060810181811067ffffffffffffffff8211171561389a5761389a612ed8565b60405282356138a881612e4c565b8152602083810135908201526040928301359281019290925250919050565b6000826138d6576138d66137a3565b500690565b6040815260006138ee604083018561333a565b8281036020840152613900818561333a565b95945050505050565b60006001600160a01b03808816835280871660208401525060a0604083015261393560a083018661333a565b8281036060840152613947818661333a565b9050828103608084015261395b8185613050565b98975050505050505050565b60006020828403121561397957600080fd5b8151610e1381612e8d565b600060033d111561399d5760046000803e5060005160e01c5b90565b600060443d10156139ae5790565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc803d016004833e81513d67ffffffffffffffff81602484011181841117156139fc57505050505090565b8285019150815181811115613a145750505050505090565b843d8701016020828501011115613a2e5750505050505090565b613a3d60208286010187612f07565b509095945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152613a8060a0830184613050565b97965050505050505056fea26469706673582212204ab5eee906eec9f2a730225cc8297237eb69ba0881fb674b1c6f786e610efa8164736f6c63430008090033
Verified Source Code Full Match
Compiler: v0.8.9+commit.e5eed63a
EVM: london
Optimization: Yes (9000 runs)
ERC1155Base.sol 51 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";
import "../common/MintingBase.sol";
abstract contract ERC1155Base is
Pausable,
ERC1155,
ERC1155Supply,
ERC1155Burnable,
MintingBase
{
string name_;
string symbol_;
function pause() external onlyOwner {
_pause();
}
function unpause() external onlyOwner {
_unpause();
}
function setURI(string memory baseURI) external onlyOwner {
_setURI(baseURI);
}
function name() public view returns (string memory) {
return name_;
}
function symbol() public view returns (string memory) {
return symbol_;
}
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual override(ERC1155, ERC1155Supply) {
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
}
}
MintingBase.sol 101 lines
// pragma solidity ^0.8.9;
// import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
// import "@openzeppelin/contracts/access/Ownable.sol";
// import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
// abstract contract MintingBase is Ownable, ReentrancyGuard {
// uint8 public maxTxs;
// mapping(address => uint256) public mintTxs;
// uint256 public mintPrice;
// bytes32 public merkleRoot;
// constructor(
// uint8 _maxTxs,
// uint256 _mintPrice,
// bytes32 _merkleRoot
// ) {
// maxTxs = _maxTxs;
// mintPrice = _mintPrice;
// merkleRoot = _merkleRoot;
// }
// function setPrice(uint256 _mintPrice) external onlyOwner {
// mintPrice = _mintPrice;
// }
// function setMerkleRoot(bytes32 _merkleRoot) external onlyOwner {
// merkleRoot = _merkleRoot;
// }
// modifier mintingIsOpen(
// uint256 _startTime,
// uint256 _endTime,
// string memory _windowName
// ) {
// require(
// block.timestamp >= _startTime && block.timestamp <= _endTime,
// string(abi.encodePacked(_windowName, " mint is closed"))
// );
// _;
// }
// modifier limitTxs() {
// require(
// mintTxs[msg.sender] < maxTxs,
// "Max amount of transactions reached"
// );
// _;
// }
// modifier onlyAllowList(bytes32[] calldata _merkleProof) {
// bytes32 leaf = keccak256(abi.encodePacked(msg.sender));
// require(
// MerkleProof.verify(_merkleProof, merkleRoot, leaf),
// "Incorrect proof"
// );
// _;
// }
// }
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
abstract contract MintingBase is Ownable, ReentrancyGuard {
mapping(address => uint256) public mintTxs;
uint256 public mintPrice;
constructor(uint256 _mintPrice) {
mintPrice = _mintPrice;
}
function setPrice(uint256 _mintPrice) external onlyOwner {
mintPrice = _mintPrice;
}
modifier mintingIsOpen(
uint256 _startTime,
uint256 _endTime,
string memory _windowName
) {
require(
block.timestamp >= _startTime && block.timestamp <= _endTime,
string(abi.encodePacked(_windowName, " mint is closed"))
);
_;
}
}
HouseOfBandits.sol 176 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/utils/Strings.sol";
import "./ERC1155Base.sol";
import "../common/EquitySplitter.sol";
contract HouseOfBandits is ERC1155Base, EquitySplitter {
uint8 constant MASTER = 0;
uint8 constant HOUSE = 1;
uint16 constant MAX_SUPPLY_MASTER = 1000;
uint16 constant MAX_SUPPLY_HOUSE = 3500;
uint256 public ogMintStartTime;
uint256 public ogMintEndTime;
uint256 public alphalistMintStartTime;
uint256 public alphalistMintEndTime;
uint256 public publicRaffleMintStartTime;
uint256 public publicRaffleMintEndTime;
struct KeyHolder {
address walletAddress;
uint256 numMaster;
uint256 numHouse;
}
constructor(
string memory _name,
string memory _symbol,
string memory _uri
) ERC1155(_uri) MintingBase(0.123 ether) {
name_ = _name;
symbol_ = _symbol;
}
function setMintingWindows(
uint256 _ogMintStartTime,
uint256 _ogMintEndTime,
uint256 _alphalistMintStartTime,
uint256 _alphalistMintEndTime,
uint256 _publicSaleMintStartTime,
uint256 _publicSaleMintEndTime
) external onlyOwner {
require(
_publicSaleMintStartTime > _alphalistMintStartTime &&
_alphalistMintStartTime > _ogMintStartTime &&
_ogMintEndTime > _ogMintStartTime &&
_alphalistMintEndTime > _alphalistMintStartTime &&
_publicSaleMintEndTime > _publicSaleMintStartTime,
"Invalid minting windows"
);
ogMintStartTime = _ogMintStartTime;
ogMintEndTime = _ogMintEndTime;
alphalistMintStartTime = _alphalistMintStartTime;
alphalistMintEndTime = _alphalistMintEndTime;
publicRaffleMintStartTime = _publicSaleMintStartTime;
publicRaffleMintEndTime = _publicSaleMintEndTime;
}
function teamMint(
address _address,
uint16 _amountMaster,
uint16 _amountHouse
) external onlyOwner whenNotPaused {
require(
totalSupply(HOUSE) + _amountHouse <= MAX_SUPPLY_HOUSE &&
totalSupply(MASTER) + _amountMaster <= MAX_SUPPLY_MASTER,
"Max supply reached"
);
_mint(_address, MASTER, _amountMaster, "");
_mint(_address, HOUSE, _amountHouse, "");
}
function ogMint(
uint8 _amountMaster,
uint8 _amountHouse
)
external
payable
whenNotPaused
mintingIsOpen(ogMintStartTime, ogMintEndTime, "OG")
{
_mintTokens(msg.sender, _amountMaster, _amountHouse);
}
function alphalistMint(
uint8 _amountMaster,
uint8 _amountHouse
)
external
payable
whenNotPaused
mintingIsOpen(alphalistMintStartTime, alphalistMintEndTime, "Alphalist")
{
_mintTokens(msg.sender, _amountMaster, _amountHouse);
}
function publicMint(uint8 _amountMaster, uint8 _amountHouse)
external
payable
whenNotPaused
{
_mintTokens(msg.sender, _amountMaster, _amountHouse);
}
function ownerMint(address to, uint8 _amountMaster, uint8 _amountHouse) external onlyOwner {
uint256 totalAmount = _amountMaster + _amountHouse;
require(totalAmount != 0, "Invalid amount of keys");
require(
totalSupply(HOUSE) + _amountHouse <= MAX_SUPPLY_HOUSE &&
totalSupply(MASTER) + _amountMaster <= MAX_SUPPLY_MASTER,
"Max supply reached"
);
if (_amountMaster > 0) {
_mintToken(to, MASTER, _amountMaster);
}
if (_amountHouse > 0) {
_mintToken(to, HOUSE, _amountHouse);
}
}
function runAirDrop(KeyHolder[] calldata _holders) external onlyOwner {
require(_holders.length != 0);
for (uint256 i = 0; i < _holders.length; i++){
KeyHolder memory holder = _holders[i];
_mint(holder.walletAddress, MASTER, holder.numMaster, "");
_mint(holder.walletAddress, HOUSE, holder.numHouse, "");
}
}
function _mintTokens(address to, uint8 _amountMaster, uint8 _amountHouse) private nonReentrant {
uint256 totalAmount = _amountMaster + _amountHouse;
require(totalAmount != 0, "Invalid amount of keys");
require(
totalSupply(HOUSE) + _amountHouse <= MAX_SUPPLY_HOUSE &&
totalSupply(MASTER) + _amountMaster <= MAX_SUPPLY_MASTER,
"Max supply reached"
);
require(
msg.value >= totalAmount * mintPrice,
"Invalid amount of funds sent"
);
if (_amountMaster > 0) {
_mintToken(to, MASTER, _amountMaster);
}
if (_amountHouse > 0) {
_mintToken(to, HOUSE, _amountHouse);
}
}
function _mintToken(address to, uint8 _tokenId, uint8 _amount) private {
_mint(to, _tokenId, _amount, "");
}
function uri(uint256 _id) public view override returns (string memory) {
require(exists(_id), "Token does not exist");
return
string(
abi.encodePacked(super.uri(_id), Strings.toString(_id), ".json")
);
}
}
EquitySplitter.sol 89 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
contract EquitySplitter is Context {
uint256 private _totalShares;
uint256 private _totalReleased;
mapping(address => uint256) private _shares;
mapping(address => uint256) private _released;
address[] private _shareHolders;
constructor() payable {
address communityWalletAddress = 0x4A18125bd508dbb15956ca455E6c4200237b931E;
uint256 communityWalletEquity = 400;
_addShareHolder(communityWalletAddress, communityWalletEquity);
address banditAddress = 0x3B2E4f122de2413Ea547440Ac2696f1c85692C57;
_addShareHolder(banditAddress, _getEquity(350));
address winkyAddress = 0xE076E510D4Da2133207d26090C4FDf0961efE53d;
_addShareHolder(winkyAddress, _getEquity(200));
address spliffyAddress = 0x856f4eB0CAb52C7470f79905E929409101143DEB;
_addShareHolder(spliffyAddress, _getEquity(150));
address djDabsAddress = 0xB34EbA47FFDcf33153928F3C64baAFa269059006;
_addShareHolder(djDabsAddress, _getEquity(50));
address vcmAddress = 0x3AC610d0Abe06609B9C13cF35CbfAe0f4D886205;
_addShareHolder(vcmAddress, _getEquity(125));
address tonyPAddress = 0x92bf7D200b62ea43CFE26BDAbc1779E2dC076D67;
_addShareHolder(tonyPAddress, _getEquity(75));
address aliasOrphanAddress = 0xE51537CA658728208aA41bfc27c04D7fdE203eE3;
_addShareHolder(aliasOrphanAddress, _getEquity(50));
require(_totalShares == 1000, "Equity split needs to equal 100%");
}
function shares(address _address) public view returns (uint256) {
return _shares[_address];
}
function unreleasedShares(address _address) public view returns (uint256) {
uint256 totalReceived = address(this).balance + _totalReleased;
return
(totalReceived * _shares[_address]) /
_totalShares -
_released[_address];
}
function release(address payable _address) public virtual {
require(_shares[_address] > 0, "Address is not a shareholder");
uint256 payment = unreleasedShares(_address);
require(payment != 0, "Shareholder is not due a payment");
_released[_address] = _released[_address] + payment;
_totalReleased = _totalReleased + payment;
Address.sendValue(_address, payment);
}
function _addShareHolder(address _address, uint256 _equity) private {
require(_address != address(0), "Invalid address");
require(_equity > 0, "Invalid equity");
require(_shares[_address] == 0, "Account already exists");
_shareHolders.push(_address);
_shares[_address] = _equity;
_totalShares = _totalShares + _equity;
}
function _getEquity(uint256 _equity) private pure returns (uint256) {
uint256 totalShares = 1000;
uint256 communityWalletEquity = 400;
uint256 remainingEquity = totalShares - communityWalletEquity;
return (remainingEquity * _equity) / totalShares;
}
}
Address.sol 222 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Strings.sol 75 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// 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);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions 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);
}
}
Pausable.sol 105 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
SafeMath.sol 227 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
ERC1155.sol 517 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.0;
import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the basic standard multi-token.
* See https://eips.ethereum.org/EIPS/eip-1155
* Originally based on code by Enjin: https://github.com/enjin/erc-1155
*
* _Available since v3.1._
*/
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
// Mapping from token ID to account balances
mapping(uint256 => mapping(address => uint256)) private _balances;
// Mapping from account to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
string private _uri;
/**
* @dev See {_setURI}.
*/
constructor(string memory uri_) {
_setURI(uri_);
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the same URI for *all* token types. It relies
* on the token type ID substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* Clients calling this function must replace the `\{id\}` substring with the
* actual token type ID.
*/
function uri(uint256) public view virtual override returns (string memory) {
return _uri;
}
/**
* @dev See {IERC1155-balanceOf}.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
require(account != address(0), "ERC1155: address zero is not a valid owner");
return _balances[id][account];
}
/**
* @dev See {IERC1155-balanceOfBatch}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
virtual
override
returns (uint256[] memory)
{
require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts[i], ids[i]);
}
return batchBalances;
}
/**
* @dev See {IERC1155-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC1155-isApprovedForAll}.
*/
function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
return _operatorApprovals[account][operator];
}
/**
* @dev See {IERC1155-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not token owner nor approved"
);
_safeTransferFrom(from, to, id, amount, data);
}
/**
* @dev See {IERC1155-safeBatchTransferFrom}.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not token owner nor approved"
);
_safeBatchTransferFrom(from, to, ids, amounts, data);
}
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `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 memory data
) internal virtual {
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
emit TransferSingle(operator, from, to, id, amount);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - 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[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
}
emit TransferBatch(operator, from, to, ids, amounts);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
}
/**
* @dev Sets a new URI for all token types, by relying on the token type ID
* substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* By this mechanism, any occurrence of the `\{id\}` substring in either the
* URI or any of the amounts in the JSON file at said URI will be replaced by
* clients with the token type ID.
*
* For example, the `https://token-cdn-domain/\{id\}.json` URI would be
* interpreted by clients as
* `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
* for token type ID 0x4cce0.
*
* See {uri}.
*
* Because these URIs cannot be meaningfully represented by the {URI} event,
* this function emits no events.
*/
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
/**
* @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
_balances[id][to] += amount;
emit TransferSingle(operator, address(0), to, id, amount);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
*
* 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 _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; i++) {
_balances[ids[i]][to] += amounts[i];
}
emit TransferBatch(operator, address(0), to, ids, amounts);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
/**
* @dev Destroys `amount` tokens of token type `id` from `from`
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `amount` tokens of token type `id`.
*/
function _burn(
address from,
uint256 id,
uint256 amount
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
emit TransferSingle(operator, from, address(0), id, amount);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
*/
function _burnBatch(
address from,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
}
emit TransferBatch(operator, from, address(0), ids, amounts);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits an {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC1155: setting approval status for self");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning, as well as batched variants.
*
* The same hook is called on both single and batched variants. For single
* transfers, the length of the `ids` and `amounts` arrays will be 1.
*
* Calling conditions (for each `id` and `amount` pair):
*
* - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* of token type `id` will be transferred to `to`.
* - When `from` is zero, `amount` tokens of token type `id` will be minted
* for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
* will be burned.
* - `from` and `to` are never both zero.
* - `ids` and `amounts` have the same, non-zero length.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
/**
* @dev Hook that is called after any token transfer. This includes minting
* and burning, as well as batched variants.
*
* The same hook is called on both single and batched variants. For single
* transfers, the length of the `id` and `amount` arrays will be 1.
*
* Calling conditions (for each `id` and `amount` pair):
*
* - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* of token type `id` will be transferred to `to`.
* - When `from` is zero, `amount` tokens of token type `id` will be minted
* for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
* will be burned.
* - `from` and `to` are never both zero.
* - `ids` and `amounts` have the same, non-zero length.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
function _doSafeTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
if (response != IERC1155Receiver.onERC1155Received.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
uint256[] memory array = new uint256[](1);
array[0] = element;
return array;
}
}
IERC1155.sol 125 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (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 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;
}
ReentrancyGuard.sol 63 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
ERC165.sol 29 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC1155Receiver.sol 58 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev _Available since v3.1._
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
ERC1155Supply.sol 64 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol)
pragma solidity ^0.8.0;
import "../ERC1155.sol";
/**
* @dev Extension of ERC1155 that adds tracking of total supply per id.
*
* Useful for scenarios where Fungible and Non-fungible tokens have to be
* clearly identified. Note: While a totalSupply of 1 might mean the
* corresponding is an NFT, there is no guarantees that no other token with the
* same id are not going to be minted.
*/
abstract contract ERC1155Supply is ERC1155 {
mapping(uint256 => uint256) private _totalSupply;
/**
* @dev Total amount of tokens in with a given id.
*/
function totalSupply(uint256 id) public view virtual returns (uint256) {
return _totalSupply[id];
}
/**
* @dev Indicates whether any token exist with a given id, or not.
*/
function exists(uint256 id) public view virtual returns (bool) {
return ERC1155Supply.totalSupply(id) > 0;
}
/**
* @dev See {ERC1155-_beforeTokenTransfer}.
*/
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual override {
super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
if (from == address(0)) {
for (uint256 i = 0; i < ids.length; ++i) {
_totalSupply[ids[i]] += amounts[i];
}
}
if (to == address(0)) {
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 supply = _totalSupply[id];
require(supply >= amount, "ERC1155: burn amount exceeds totalSupply");
unchecked {
_totalSupply[id] = supply - amount;
}
}
}
}
}
ERC1155Burnable.sol 40 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/extensions/ERC1155Burnable.sol)
pragma solidity ^0.8.0;
import "../ERC1155.sol";
/**
* @dev Extension of {ERC1155} that allows token holders to destroy both their
* own tokens and those that they have been approved to use.
*
* _Available since v3.1._
*/
abstract contract ERC1155Burnable is ERC1155 {
function burn(
address account,
uint256 id,
uint256 value
) public virtual {
require(
account == _msgSender() || isApprovedForAll(account, _msgSender()),
"ERC1155: caller is not token owner nor approved"
);
_burn(account, id, value);
}
function burnBatch(
address account,
uint256[] memory ids,
uint256[] memory values
) public virtual {
require(
account == _msgSender() || isApprovedForAll(account, _msgSender()),
"ERC1155: caller is not token owner nor approved"
);
_burnBatch(account, ids, values);
}
}
IERC1155MetadataURI.sol 22 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)
pragma solidity ^0.8.0;
import "../IERC1155.sol";
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
*
* _Available since v3.1._
*/
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}
Read Contract
alphalistMintEndTime 0x4133ea7d → uint256
alphalistMintStartTime 0x783300a7 → uint256
balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
exists 0x4f558e79 → bool
isApprovedForAll 0xe985e9c5 → bool
mintPrice 0x6817c76c → uint256
mintTxs 0x089c59cb → uint256
name 0x06fdde03 → string
ogMintEndTime 0x9bdc31d2 → uint256
ogMintStartTime 0x67bd4b5d → uint256
owner 0x8da5cb5b → address
paused 0x5c975abb → bool
publicRaffleMintEndTime 0xbb82a7ea → uint256
publicRaffleMintStartTime 0x8ff51fa8 → uint256
shares 0xce7c2ac2 → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
totalSupply 0xbd85b039 → uint256
unreleasedShares 0x19c54d3c → uint256
uri 0x0e89341c → string
Write Contract 19 functions
These functions modify contract state and require a wallet transaction to execute.
alphalistMint 0x7e17e7b7
uint8 _amountMaster
uint8 _amountHouse
burn 0xf5298aca
address account
uint256 id
uint256 value
burnBatch 0x6b20c454
address account
uint256[] ids
uint256[] values
ogMint 0x031b1829
uint8 _amountMaster
uint8 _amountHouse
ownerMint 0x110575db
address to
uint8 _amountMaster
uint8 _amountHouse
pause 0x8456cb59
No parameters
publicMint 0xb85a786d
uint8 _amountMaster
uint8 _amountHouse
release 0x19165587
address _address
renounceOwnership 0x715018a6
No parameters
runAirDrop 0xaa59e01f
tuple[] _holders
safeBatchTransferFrom 0x2eb2c2d6
address from
address to
uint256[] ids
uint256[] amounts
bytes data
safeTransferFrom 0xf242432a
address from
address to
uint256 id
uint256 amount
bytes data
setApprovalForAll 0xa22cb465
address operator
bool approved
setMintingWindows 0xaf4a3c28
uint256 _ogMintStartTime
uint256 _ogMintEndTime
uint256 _alphalistMintStartTime
uint256 _alphalistMintEndTime
uint256 _publicSaleMintStartTime
uint256 _publicSaleMintEndTime
setPrice 0x91b7f5ed
uint256 _mintPrice
setURI 0x02fe5305
string baseURI
teamMint 0xf512f46b
address _address
uint16 _amountMaster
uint16 _amountHouse
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters
Recent Transactions
No transactions found for this address