Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0xab505a667039d08d8E33cef95C81897A8B5fEd1A
Balance 0 ETH
Nonce 1
Code Size 24056 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

24056 bytes
0x6080604052600436106103195760003560e01c80635c975abb116101ab578063b0ec6dff116100f7578063d55eb49611610095578063ddd0eebd1161006f578063ddd0eebd14610be1578063e985e9c514610c0a578063f242432a14610c47578063f2fde38b14610c7057610319565b8063d55eb49614610b60578063d5e156dc14610b8b578063dbddb26a14610bb657610319565b8063beb9716d116100d1578063beb9716d14610ab6578063c002d23d14610ae1578063c8637b3514610b0c578063d327c69914610b3757610319565b8063b0ec6dff14610a32578063b7dc3b1814610a5d578063bd85b03914610a7957610319565b8063853828b6116101645780638a2091251161013e5780638a209125146109645780638da5cb5b146109a15780639534dd3e146109cc578063a22cb46514610a0957610319565b8063853828b6146108e5578063868482d814610910578063876b15661461093957610319565b80635c975abb146107e257806367cefb071461080d57806370e448a014610838578063715018a61461087a5780637a4f6258146108915780638456cb59146108ce57610319565b80631dd36e511161026a5780633f4ba83a116102235780634e1273f4116101fd5780634e1273f4146107125780634f558e791461074f57806358d3d2e01461078c57806358d9a212146107b757610319565b80633f4ba83a146106a55780634288ff1d146106bc578063448e9dce146106e757610319565b80631dd36e511461059157806327fcb984146105ad5780632864b34b146105d65780632a55205a146106135780632eb2c2d61461065157806332cb6b0c1461067a57610319565b80630d0c6af6116102d7578063160dbc82116102b1578063160dbc82146104e75780631657c43f1461051057806318160ddd1461053b5780631b8042971461056657610319565b80630d0c6af6146104545780630e89341c1461047f578063122e04a8146104bc57610319565b8062fdd58e1461031e57806301ffc9a71461035b578063025e7c271461039857806302fe5305146103d557806308e13100146103fe5780630c2e05e014610429575b600080fd5b34801561032a57600080fd5b50610345600480360381019061034091906142e0565b610c99565b604051610352919061432f565b60405180910390f35b34801561036757600080fd5b50610382600480360381019061037d91906143a2565b610cf3565b60405161038f91906143ea565b60405180910390f35b3480156103a457600080fd5b506103bf60048036038101906103ba9190614405565b610d6d565b6040516103cc9190614441565b60405180910390f35b3480156103e157600080fd5b506103fc60048036038101906103f791906145a2565b610dac565b005b34801561040a57600080fd5b50610413610dc0565b60405161042091906147d3565b60405180910390f35b34801561043557600080fd5b5061043e610f83565b60405161044b919061432f565b60405180910390f35b34801561046057600080fd5b50610469610f88565b6040516104769190614441565b60405180910390f35b34801561048b57600080fd5b506104a660048036038101906104a19190614405565b610fa0565b6040516104b3919061483f565b60405180910390f35b3480156104c857600080fd5b506104d1611034565b6040516104de9190614441565b60405180910390f35b3480156104f357600080fd5b5061050e60048036038101906105099190614861565b61104c565b005b34801561051c57600080fd5b50610525611098565b604051610532919061483f565b60405180910390f35b34801561054757600080fd5b50610550611167565b60405161055d919061432f565b60405180910390f35b34801561057257600080fd5b5061057b611171565b60405161058891906148ed565b60405180910390f35b6105ab60048036038101906105a691906145a2565b611197565b005b3480156105b957600080fd5b506105d460048036038101906105cf9190614405565b611544565b005b3480156105e257600080fd5b506105fd60048036038101906105f891906145a2565b611556565b60405161060a9190614441565b60405180910390f35b34801561061f57600080fd5b5061063a60048036038101906106359190614908565b61159f565b604051610648929190614948565b60405180910390f35b34801561065d57600080fd5b5061067860048036038101906106739190614ada565b6115cf565b005b34801561068657600080fd5b5061068f611677565b60405161069c919061432f565b60405180910390f35b3480156106b157600080fd5b506106ba61167d565b005b3480156106c857600080fd5b506106d161168f565b6040516106de91906143ea565b60405180910390f35b3480156106f357600080fd5b506106fc6116a2565b604051610709919061432f565b60405180910390f35b34801561071e57600080fd5b5061073960048036038101906107349190614c6c565b6116a8565b6040516107469190614d93565b60405180910390f35b34801561075b57600080fd5b5061077660048036038101906107719190614405565b6117b7565b60405161078391906143ea565b60405180910390f35b34801561079857600080fd5b506107a16117cb565b6040516107ae919061432f565b60405180910390f35b3480156107c357600080fd5b506107cc6117d1565b6040516107d9919061432f565b60405180910390f35b3480156107ee57600080fd5b506107f76117d7565b60405161080491906143ea565b60405180910390f35b34801561081957600080fd5b506108226117ee565b60405161082f91906147d3565b60405180910390f35b34801561084457600080fd5b5061085f600480360381019061085a9190614405565b611b50565b60405161087196959493929190614db5565b60405180910390f35b34801561088657600080fd5b5061088f611c64565b005b34801561089d57600080fd5b506108b860048036038101906108b391906145a2565b611c78565b6040516108c591906143ea565b60405180910390f35b3480156108da57600080fd5b506108e3611cfe565b005b3480156108f157600080fd5b506108fa611d10565b60405161090791906143ea565b60405180910390f35b34801561091c57600080fd5b5061093760048036038101906109329190614e49565b611de1565b005b34801561094557600080fd5b5061094e611e06565b60405161095b9190614f25565b60405180910390f35b34801561097057600080fd5b5061098b600480360381019061098691906145a2565b611e94565b60405161099891906143ea565b60405180910390f35b3480156109ad57600080fd5b506109b66120fe565b6040516109c39190614441565b60405180910390f35b3480156109d857600080fd5b506109f360048036038101906109ee9190614861565b612128565b604051610a00919061483f565b60405180910390f35b348015610a1557600080fd5b50610a306004803603810190610a2b9190614f47565b6121c8565b005b348015610a3e57600080fd5b50610a476121de565b604051610a54919061432f565b60405180910390f35b610a776004803603810190610a729190614f87565b6121e3565b005b348015610a8557600080fd5b50610aa06004803603810190610a9b9190614405565b61294f565b604051610aad919061432f565b60405180910390f35b348015610ac257600080fd5b50610acb61296c565b604051610ad891906143ea565b60405180910390f35b348015610aed57600080fd5b50610af6612afe565b604051610b03919061432f565b60405180910390f35b348015610b1857600080fd5b50610b21612b0a565b604051610b2e91906148ed565b60405180910390f35b348015610b4357600080fd5b50610b5e6004803603810190610b599190614405565b612b30565b005b348015610b6c57600080fd5b50610b75612b42565b604051610b82919061505a565b60405180910390f35b348015610b9757600080fd5b50610ba0612ba2565b604051610bad9190614441565b60405180910390f35b348015610bc257600080fd5b50610bcb612bba565b604051610bd8919061483f565b60405180910390f35b348015610bed57600080fd5b50610c086004803603810190610c039190614861565b612c48565b005b348015610c1657600080fd5b50610c316004803603810190610c2c9190615075565b612c94565b604051610c3e91906143ea565b60405180910390f35b348015610c5357600080fd5b50610c6e6004803603810190610c6991906150b5565b612d28565b005b348015610c7c57600080fd5b50610c976004803603810190610c929190614861565b612d4e565b005b600080600083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60007f2a55205a000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610d665750610d6582612dd4565b5b9050919050565b60108181548110610d7d57600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610db4612eb6565b610dbd81612f3d565b50565b6060610dca612eb6565b6011805480602002602001604051908101604052809291908181526020016000905b82821015610f7a57838290600052602060002090600602016040518060c00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600282018054610ecb9061517b565b80601f0160208091040260200160405190810160405280929190818152602001828054610ef79061517b565b8015610f445780601f10610f1957610100808354040283529160200191610f44565b820191906000526020600020905b815481529060010190602001808311610f2757829003601f168201915b50505050508152602001600382015481526020016004820154815260200160058201548152505081526020019060010190610dec565b50505050905090565b600a81565b73031deb56fa8eb212ef3bcf8cb2f126993ededc1981565b606060028054610faf9061517b565b80601f0160208091040260200160405190810160405280929190818152602001828054610fdb9061517b565b80156110285780601f10610ffd57610100808354040283529160200191611028565b820191906000526020600020905b81548152906001019060200180831161100b57829003601f168201915b50505050509050919050565b73031deb56fa8eb212ef3bcf8cb2f126993ededc1981565b611054612eb6565b80600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6060600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080546110e49061517b565b80601f01602080910402602001604051908101604052809291908181526020018280546111109061517b565b801561115d5780601f106111325761010080835404028352916020019161115d565b820191906000526020600020905b81548152906001019060200180831161114057829003601f168201915b5050505050905090565b6000600654905090565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61119f612f50565b600f60009054906101000a900460ff16156113545760006111c1336000610c99565b118061126b57506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1662fdd58e336008546040518363ffffffff1660e01b8152600401611228929190614948565b602060405180830381865afa158015611245573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126991906151c1565b115b8061131457506000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1662fdd58e33600a546040518363ffffffff1660e01b81526004016112d1929190614948565b602060405180830381865afa1580156112ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131291906151c1565b115b611353576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134a90615260565b60405180910390fd5b5b6000600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080546113a09061517b565b9050146113e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d9906152cc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600e8260405161140a9190615328565b908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461148f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114869061538b565b60405180910390fd5b80600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090816114db919061554d565b5033600e826040516114ed9190615328565b908152602001604051809103902060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611541612f96565b50565b61154c612eb6565b80600a8190555050565b600e818051602081018201805184825260208301602085012081835280955050505050506000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073031deb56fa8eb212ef3bcf8cb2f126993ededc19600a846115c4919061567d565b915091509250929050565b60006115d9612fa0565b90508073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415801561161e575061161c8682612c94565b155b156116625780866040517fe237d9220000000000000000000000000000000000000000000000000000000081526004016116599291906156ae565b60405180910390fd5b61166f8686868686612fa8565b505050505050565b6101dd81565b611685612eb6565b61168d6130a0565b565b600f60009054906101000a900460ff1681565b600a5481565b606081518351146116f457815183516040517f5b0599910000000000000000000000000000000000000000000000000000000081526004016116eb9291906156d7565b60405180910390fd5b6000835167ffffffffffffffff81111561171157611710614477565b5b60405190808252806020026020018201604052801561173f5781602001602082028036833780820191505090505b50905060005b84518110156117ac5761177c611764828761310390919063ffffffff16565b611777838761311790919063ffffffff16565b610c99565b82828151811061178f5761178e615700565b5b602002602001018181525050806117a59061572f565b9050611745565b508091505092915050565b6000806117c38361294f565b119050919050565b60085481565b600b5481565b6000600460149054906101000a900460ff16905090565b60606000805b60118054905081101561189b573373ffffffffffffffffffffffffffffffffffffffff166011828154811061182c5761182b615700565b5b906000526020600020906006020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16036118885781806118849061572f565b9250505b80806118939061572f565b9150506117f4565b5060008167ffffffffffffffff8111156118b8576118b7614477565b5b6040519080825280602002602001820160405280156118f157816020015b6118de6141a3565b8152602001906001900390816118d65790505b5090506000805b601180549050811015611b46573373ffffffffffffffffffffffffffffffffffffffff16601182815481106119305761192f615700565b5b906000526020600020906006020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603611b33576011818154811061199157611990615700565b5b90600052602060002090600602016040518060c00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600282018054611a669061517b565b80601f0160208091040260200160405190810160405280929190818152602001828054611a929061517b565b8015611adf5780601f10611ab457610100808354040283529160200191611adf565b820191906000526020600020905b815481529060010190602001808311611ac257829003601f168201915b505050505081526020016003820154815260200160048201548152602001600582015481525050838381518110611b1957611b18615700565b5b60200260200101819052508180611b2f9061572f565b9250505b8080611b3e9061572f565b9150506118f8565b5081935050505090565b60118181548110611b6057600080fd5b90600052602060002090600602016000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806002018054611bcf9061517b565b80601f0160208091040260200160405190810160405280929190818152602001828054611bfb9061517b565b8015611c485780601f10611c1d57610100808354040283529160200191611c48565b820191906000526020600020905b815481529060010190602001808311611c2b57829003601f168201915b5050505050908060030154908060040154908060050154905086565b611c6c612eb6565b611c76600061312b565b565b60008073ffffffffffffffffffffffffffffffffffffffff16600e83604051611ca19190615328565b908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603611cf45760009050611cf9565b600190505b919050565b611d06612eb6565b611d0e6131f1565b565b6000611d1a612eb6565b600073031deb56fa8eb212ef3bcf8cb2f126993ededc1973ffffffffffffffffffffffffffffffffffffffff1647604051611d54906157a8565b60006040518083038185875af1925050503d8060008114611d91576040519150601f19603f3d011682016040523d82523d6000602084013e611d96565b606091505b5050905080611dda576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd190615809565b60405180910390fd5b8091505090565b611de9612eb6565b80600f60006101000a81548160ff02191690831515021790555050565b60606010805480602002602001604051908101604052809291908181526020018280548015611e8a57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611e40575b5050505050905090565b6000600f60009054906101000a900460ff161561201c576000611eb8336000610c99565b148015611f6357506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1662fdd58e336008546040518363ffffffff1660e01b8152600401611f20929190614948565b602060405180830381865afa158015611f3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f6191906151c1565b145b801561200d57506000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1662fdd58e33600a546040518363ffffffff1660e01b8152600401611fca929190614948565b602060405180830381865afa158015611fe7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200b91906151c1565b145b1561201b57600090506120f9565b5b6000600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080546120689061517b565b9050111561207957600090506120f9565b600073ffffffffffffffffffffffffffffffffffffffff16600e836040516120a19190615328565b908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146120f457600090506120f9565b600190505b919050565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600d60205280600052604060002060009150905080546121479061517b565b80601f01602080910402602001604051908101604052809291908181526020018280546121739061517b565b80156121c05780601f10612195576101008083540402835291602001916121c0565b820191906000526020600020905b8154815290600101906020018083116121a357829003601f168201915b505050505081565b6121da6121d3612fa0565b8383613254565b5050565b600a81565b6121eb6133c4565b6121f3612f50565b600f60009054906101000a900460ff16156123a8576000612215336000610c99565b11806122bf57506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1662fdd58e336008546040518363ffffffff1660e01b815260040161227c929190614948565b602060405180830381865afa158015612299573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122bd91906151c1565b115b8061236857506000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1662fdd58e33600a546040518363ffffffff1660e01b8152600401612325929190614948565b602060405180830381865afa158015612342573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061236691906151c1565b115b6123a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161239e90615260565b60405180910390fd5b5b600a8211156123ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123e390615875565b60405180910390fd5b81670de0b6b3a76400006124009190615895565b3414612441576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161243890615949565b60405180910390fd5b6101dd82600b546124529190615969565b1115612493576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248a906159e9565b60405180910390fd5b816124a661249f6120fe565b6000610c99565b10156124e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124de90615a55565b60405180910390fd5b6000808251111561280d57600073ffffffffffffffffffffffffffffffffffffffff16600e8360405161251a9190615328565b908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff160361259f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161259690615ac1565b60405180910390fd5b600a606484670de0b6b3a76400006125b79190615895565b6125c1919061567d565b6125cb9190615895565b90506000600e836040516125df9190615328565b908152602001604051809103902060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060006040518060c001604052803373ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff168152602001858152602001868152602001848152602001428152509050601181908060018154018082558091505060019003906000526020600020906006020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550604082015181600201908161273c919061554d565b50606082015181600301556080820151816004015560a08201518160050155505060008273ffffffffffffffffffffffffffffffffffffffff1684604051612783906157a8565b60006040518083038185875af1925050503d80600081146127c0576040519150601f19603f3d011682016040523d82523d6000602084013e6127c5565b606091505b5050905080612809576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161280090615b2d565b60405180910390fd5b5050505b82600b600082825461281f9190615969565b9250508190555061282f33613405565b61285361283a6120fe565b336000866040518060200160405280600081525061347e565b61286361285e6120fe565b613589565b600073031deb56fa8eb212ef3bcf8cb2f126993ededc1973ffffffffffffffffffffffffffffffffffffffff168285670de0b6b3a76400006128a59190615895565b6128af9190615b4d565b6040516128bb906157a8565b60006040518083038185875af1925050503d80600081146128f8576040519150601f19603f3d011682016040523d82523d6000602084013e6128fd565b606091505b5050905080612941576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161293890615bcd565b60405180910390fd5b505061294b612f96565b5050565b600060056000838152602001908152602001600020549050919050565b6000600f60009054906101000a900460ff16801561299457506000612992336000610c99565b145b8015612a3e57506000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1662fdd58e336008546040518363ffffffff1660e01b81526004016129fb929190614948565b602060405180830381865afa158015612a18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a3c91906151c1565b145b8015612ae857506000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1662fdd58e33600a546040518363ffffffff1660e01b8152600401612aa5929190614948565b602060405180830381865afa158015612ac2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ae691906151c1565b145b15612af65760009050612afb565b600190505b90565b670de0b6b3a764000081565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b612b38612eb6565b8060088190555050565b612b4a614205565b60006040518060a001604052806101dd8152602001600b548152602001670de0b6b3a76400008152602001612b7d6117d7565b15158152602001600f60009054906101000a900460ff16151581525090508091505090565b734faa0fac32f844acaf59b5b5a72c0d38de8bd0cd81565b600c8054612bc79061517b565b80601f0160208091040260200160405190810160405280929190818152602001828054612bf39061517b565b8015612c405780601f10612c1557610100808354040283529160200191612c40565b820191906000526020600020905b815481529060010190602001808311612c2357829003601f168201915b505050505081565b612c50612eb6565b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b612d3184613405565b612d3e8585858585613676565b612d4785613589565b5050505050565b612d56612eb6565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603612dc85760006040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401612dbf9190614441565b60405180910390fd5b612dd18161312b565b50565b60007fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480612e9f57507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80612eaf5750612eae8261371e565b5b9050919050565b612ebe612fa0565b73ffffffffffffffffffffffffffffffffffffffff16612edc6120fe565b73ffffffffffffffffffffffffffffffffffffffff1614612f3b57612eff612fa0565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401612f329190614441565b60405180910390fd5b565b8060029081612f4c919061554d565b5050565b600260035403612f8c576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600381905550565b6001600381905550565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff160361301a5760006040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016130119190614441565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff160361308c5760006040517f01a835140000000000000000000000000000000000000000000000000000000081526004016130839190614441565b60405180910390fd5b6130998585858585613788565b5050505050565b6130a861383a565b6000600460146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6130ec612fa0565b6040516130f99190614441565b60405180910390a1565b600060208202602084010151905092915050565b600060208202602084010151905092915050565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6131f96133c4565b6001600460146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861323d612fa0565b60405161324a9190614441565b60405180910390a1565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036132c65760006040517fced3e1000000000000000000000000000000000000000000000000000000000081526004016132bd9190614441565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516133b791906143ea565b60405180910390a3505050565b6133cc6117d7565b15613403576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b6000613412826000610c99565b0361347b576010819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036134f05760006040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016134e79190614441565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16036135625760006040517f01a835140000000000000000000000000000000000000000000000000000000081526004016135599190614441565b60405180910390fd5b60008061356f858561387a565b915091506135808787848487613788565b50505050505050565b6000613596826000610c99565b036136735760005b601080549050811015613671578173ffffffffffffffffffffffffffffffffffffffff16601082815481106135d6576135d5615700565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff160361365e57601081815481106136305761362f615700565b5b9060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555b80806136699061572f565b91505061359e565b505b50565b6000613680612fa0565b90508073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141580156136c557506136c38682612c94565b155b156137095780866040517fe237d9220000000000000000000000000000000000000000000000000000000081526004016137009291906156ae565b60405180910390fd5b613716868686868661347e565b505050505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b613794858585856138aa565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16146138335760006137d2612fa0565b905060018451036138225760006137f360008661311790919063ffffffff16565b9050600061380b60008661311790919063ffffffff16565b905061381b8389898585896138bc565b5050613831565b613830818787878787613a70565b5b505b5050505050565b6138426117d7565b613878576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b60608060405191506001825283602083015260408201905060018152826020820152604081016040529250929050565b6138b684848484613c24565b50505050565b60008473ffffffffffffffffffffffffffffffffffffffff163b1115613a68578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b815260040161391d959493929190615c42565b6020604051808303816000875af192505050801561395957506040513d601f19601f820116820180604052508101906139569190615cb1565b60015b6139dd573d8060008114613989576040519150601f19603f3d011682016040523d82523d6000602084013e61398e565b606091505b5060008151036139d557846040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016139cc9190614441565b60405180910390fd5b805181602001fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614613a6657846040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401613a5d9190614441565b60405180910390fd5b505b505050505050565b60008473ffffffffffffffffffffffffffffffffffffffff163b1115613c1c578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b8152600401613ad1959493929190615cde565b6020604051808303816000875af1925050508015613b0d57506040513d601f19601f82011682018060405250810190613b0a9190615cb1565b60015b613b91573d8060008114613b3d576040519150601f19603f3d011682016040523d82523d6000602084013e613b42565b606091505b506000815103613b8957846040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401613b809190614441565b60405180910390fd5b805181602001fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614613c1a57846040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401613c119190614441565b60405180910390fd5b505b505050505050565b613c3084848484613ddb565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603613d10576000805b8351811015613cf4576000838281518110613c8657613c85615700565b5b602002602001015190508060056000878581518110613ca857613ca7615700565b5b602002602001015181526020019081526020016000206000828254613ccd9190615969565b925050819055508083613ce09190615969565b92505080613ced9061572f565b9050613c68565b508060066000828254613d079190615969565b92505081905550505b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603613dd5576000805b8351811015613dc2576000838281518110613d6657613d65615700565b5b602002602001015190508060056000878581518110613d8857613d87615700565b5b602002602001015181526020019081526020016000206000828254039250508190555080830192505080613dbb9061572f565b9050613d48565b5080600660008282540392505081905550505b50505050565b613de36133c4565b613def84848484613df5565b50505050565b8051825114613e3f57815181516040517f5b059991000000000000000000000000000000000000000000000000000000008152600401613e369291906156d7565b60405180910390fd5b6000613e49612fa0565b905060005b835181101561405e576000613e6c828661311790919063ffffffff16565b90506000613e83838661311790919063ffffffff16565b9050600073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1614613fb057600080600084815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015613f5857888183856040517f03dee4c5000000000000000000000000000000000000000000000000000000008152600401613f4f9493929190615d46565b60405180910390fd5b81810360008085815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161461404b578060008084815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546140439190615969565b925050819055505b5050806140579061572f565b9050613e4e565b50600183510361411d57600061407e60008561311790919063ffffffff16565b9050600061409660008561311790919063ffffffff16565b90508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62858560405161410e9291906156d7565b60405180910390a4505061419c565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051614193929190615d8b565b60405180910390a45b5050505050565b6040518060c00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001606081526020016000815260200160008152602001600081525090565b6040518060a001604052806000815260200160008152602001600081526020016000151581526020016000151581525090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006142778261424c565b9050919050565b6142878161426c565b811461429257600080fd5b50565b6000813590506142a48161427e565b92915050565b6000819050919050565b6142bd816142aa565b81146142c857600080fd5b50565b6000813590506142da816142b4565b92915050565b600080604083850312156142f7576142f6614242565b5b600061430585828601614295565b9250506020614316858286016142cb565b9150509250929050565b614329816142aa565b82525050565b60006020820190506143446000830184614320565b92915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61437f8161434a565b811461438a57600080fd5b50565b60008135905061439c81614376565b92915050565b6000602082840312156143b8576143b7614242565b5b60006143c68482850161438d565b91505092915050565b60008115159050919050565b6143e4816143cf565b82525050565b60006020820190506143ff60008301846143db565b92915050565b60006020828403121561441b5761441a614242565b5b6000614429848285016142cb565b91505092915050565b61443b8161426c565b82525050565b60006020820190506144566000830184614432565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6144af82614466565b810181811067ffffffffffffffff821117156144ce576144cd614477565b5b80604052505050565b60006144e1614238565b90506144ed82826144a6565b919050565b600067ffffffffffffffff82111561450d5761450c614477565b5b61451682614466565b9050602081019050919050565b82818337600083830152505050565b6000614545614540846144f2565b6144d7565b90508281526020810184848401111561456157614560614461565b5b61456c848285614523565b509392505050565b600082601f8301126145895761458861445c565b5b8135614599848260208601614532565b91505092915050565b6000602082840312156145b8576145b7614242565b5b600082013567ffffffffffffffff8111156145d6576145d5614247565b5b6145e284828501614574565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6146208161426c565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015614660578082015181840152602081019050614645565b60008484015250505050565b600061467782614626565b6146818185614631565b9350614691818560208601614642565b61469a81614466565b840191505092915050565b6146ae816142aa565b82525050565b600060c0830160008301516146cc6000860182614617565b5060208301516146df6020860182614617565b50604083015184820360408601526146f7828261466c565b915050606083015161470c60608601826146a5565b50608083015161471f60808601826146a5565b5060a083015161473260a08601826146a5565b508091505092915050565b600061474983836146b4565b905092915050565b6000602082019050919050565b6000614769826145eb565b61477381856145f6565b93508360208202850161478585614607565b8060005b858110156147c157848403895281516147a2858261473d565b94506147ad83614751565b925060208a01995050600181019050614789565b50829750879550505050505092915050565b600060208201905081810360008301526147ed818461475e565b905092915050565b600082825260208201905092915050565b600061481182614626565b61481b81856147f5565b935061482b818560208601614642565b61483481614466565b840191505092915050565b600060208201905081810360008301526148598184614806565b905092915050565b60006020828403121561487757614876614242565b5b600061488584828501614295565b91505092915050565b6000819050919050565b60006148b36148ae6148a98461424c565b61488e565b61424c565b9050919050565b60006148c582614898565b9050919050565b60006148d7826148ba565b9050919050565b6148e7816148cc565b82525050565b600060208201905061490260008301846148de565b92915050565b6000806040838503121561491f5761491e614242565b5b600061492d858286016142cb565b925050602061493e858286016142cb565b9150509250929050565b600060408201905061495d6000830185614432565b61496a6020830184614320565b9392505050565b600067ffffffffffffffff82111561498c5761498b614477565b5b602082029050602081019050919050565b600080fd5b60006149b56149b084614971565b6144d7565b905080838252602082019050602084028301858111156149d8576149d761499d565b5b835b81811015614a0157806149ed88826142cb565b8452602084019350506020810190506149da565b5050509392505050565b600082601f830112614a2057614a1f61445c565b5b8135614a308482602086016149a2565b91505092915050565b600067ffffffffffffffff821115614a5457614a53614477565b5b614a5d82614466565b9050602081019050919050565b6000614a7d614a7884614a39565b6144d7565b905082815260208101848484011115614a9957614a98614461565b5b614aa4848285614523565b509392505050565b600082601f830112614ac157614ac061445c565b5b8135614ad1848260208601614a6a565b91505092915050565b600080600080600060a08688031215614af657614af5614242565b5b6000614b0488828901614295565b9550506020614b1588828901614295565b945050604086013567ffffffffffffffff811115614b3657614b35614247565b5b614b4288828901614a0b565b935050606086013567ffffffffffffffff811115614b6357614b62614247565b5b614b6f88828901614a0b565b925050608086013567ffffffffffffffff811115614b9057614b8f614247565b5b614b9c88828901614aac565b9150509295509295909350565b600067ffffffffffffffff821115614bc457614bc3614477565b5b602082029050602081019050919050565b6000614be8614be384614ba9565b6144d7565b90508083825260208201905060208402830185811115614c0b57614c0a61499d565b5b835b81811015614c345780614c208882614295565b845260208401935050602081019050614c0d565b5050509392505050565b600082601f830112614c5357614c5261445c565b5b8135614c63848260208601614bd5565b91505092915050565b60008060408385031215614c8357614c82614242565b5b600083013567ffffffffffffffff811115614ca157614ca0614247565b5b614cad85828601614c3e565b925050602083013567ffffffffffffffff811115614cce57614ccd614247565b5b614cda85828601614a0b565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000614d1c83836146a5565b60208301905092915050565b6000602082019050919050565b6000614d4082614ce4565b614d4a8185614cef565b9350614d5583614d00565b8060005b83811015614d86578151614d6d8882614d10565b9750614d7883614d28565b925050600181019050614d59565b5085935050505092915050565b60006020820190508181036000830152614dad8184614d35565b905092915050565b600060c082019050614dca6000830189614432565b614dd76020830188614432565b8181036040830152614de98187614806565b9050614df86060830186614320565b614e056080830185614320565b614e1260a0830184614320565b979650505050505050565b614e26816143cf565b8114614e3157600080fd5b50565b600081359050614e4381614e1d565b92915050565b600060208284031215614e5f57614e5e614242565b5b6000614e6d84828501614e34565b91505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000614eae8383614617565b60208301905092915050565b6000602082019050919050565b6000614ed282614e76565b614edc8185614e81565b9350614ee783614e92565b8060005b83811015614f18578151614eff8882614ea2565b9750614f0a83614eba565b925050600181019050614eeb565b5085935050505092915050565b60006020820190508181036000830152614f3f8184614ec7565b905092915050565b60008060408385031215614f5e57614f5d614242565b5b6000614f6c85828601614295565b9250506020614f7d85828601614e34565b9150509250929050565b60008060408385031215614f9e57614f9d614242565b5b6000614fac858286016142cb565b925050602083013567ffffffffffffffff811115614fcd57614fcc614247565b5b614fd985828601614574565b9150509250929050565b614fec816143cf565b82525050565b60a08201600082015161500860008501826146a5565b50602082015161501b60208501826146a5565b50604082015161502e60408501826146a5565b5060608201516150416060850182614fe3565b5060808201516150546080850182614fe3565b50505050565b600060a08201905061506f6000830184614ff2565b92915050565b6000806040838503121561508c5761508b614242565b5b600061509a85828601614295565b92505060206150ab85828601614295565b9150509250929050565b600080600080600060a086880312156150d1576150d0614242565b5b60006150df88828901614295565b95505060206150f088828901614295565b9450506040615101888289016142cb565b9350506060615112888289016142cb565b925050608086013567ffffffffffffffff81111561513357615132614247565b5b61513f88828901614aac565b9150509295509295909350565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061519357607f821691505b6020821081036151a6576151a561514c565b5b50919050565b6000815190506151bb816142b4565b92915050565b6000602082840312156151d7576151d6614242565b5b60006151e5848285016151ac565b91505092915050565b7f596f75206e65656420746f206f776e206174206c65617374203120706861736560008201527f20312c2070686173652032206f722070686173652033206e6674000000000000602082015250565b600061524a603a836147f5565b9150615255826151ee565b604082019050919050565b600060208201905081810360008301526152798161523d565b9050919050565b7f526566657272616c20636f646520616c7265616479206d696e74656400000000600082015250565b60006152b6601c836147f5565b91506152c182615280565b602082019050919050565b600060208201905081810360008301526152e5816152a9565b9050919050565b600081905092915050565b600061530282614626565b61530c81856152ec565b935061531c818560208601614642565b80840191505092915050565b600061533482846152f7565b915081905092915050565b7f526566657272616c20636f646520616c726561647920696e2075736500000000600082015250565b6000615375601c836147f5565b91506153808261533f565b602082019050919050565b600060208201905081810360008301526153a481615368565b9050919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b60006008830261540d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826153d0565b61541786836153d0565b95508019841693508086168417925050509392505050565b600061544a615445615440846142aa565b61488e565b6142aa565b9050919050565b6000819050919050565b6154648361542f565b61547861547082615451565b8484546153dd565b825550505050565b600090565b61548d615480565b61549881848461545b565b505050565b5b818110156154bc576154b1600082615485565b60018101905061549e565b5050565b601f821115615501576154d2816153ab565b6154db846153c0565b810160208510156154ea578190505b6154fe6154f6856153c0565b83018261549d565b50505b505050565b600082821c905092915050565b600061552460001984600802615506565b1980831691505092915050565b600061553d8383615513565b9150826002028217905092915050565b61555682614626565b67ffffffffffffffff81111561556f5761556e614477565b5b615579825461517b565b6155848282856154c0565b600060209050601f8311600181146155b757600084156155a5578287015190505b6155af8582615531565b865550615617565b601f1984166155c5866153ab565b60005b828110156155ed578489015182556001820191506020850194506020810190506155c8565b8683101561560a5784890151615606601f891682615513565b8355505b6001600288020188555050505b505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000615688826142aa565b9150615693836142aa565b9250826156a3576156a261561f565b5b828204905092915050565b60006040820190506156c36000830185614432565b6156d06020830184614432565b9392505050565b60006040820190506156ec6000830185614320565b6156f96020830184614320565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600061573a826142aa565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361576c5761576b61564e565b5b600182019050919050565b600081905092915050565b50565b6000615792600083615777565b915061579d82615782565b600082019050919050565b60006157b382615785565b9150819050919050565b7f57495448445241575f4641494c45440000000000000000000000000000000000600082015250565b60006157f3600f836147f5565b91506157fe826157bd565b602082019050919050565b60006020820190508181036000830152615822816157e6565b9050919050565b7f4d6178696d756d203130206d696e747320706572207472616e73616374696f6e600082015250565b600061585f6020836147f5565b915061586a82615829565b602082019050919050565b6000602082019050818103600083015261588e81615852565b9050919050565b60006158a0826142aa565b91506158ab836142aa565b92508282026158b9816142aa565b915082820484148315176158d0576158cf61564e565b5b5092915050565b7f496e636f727265637420616d6f756e74206f662065746865722070726f76696460008201527f656420666f7220746865206d696e742100000000000000000000000000000000602082015250565b60006159336030836147f5565b915061593e826158d7565b604082019050919050565b6000602082019050818103600083015261596281615926565b9050919050565b6000615974826142aa565b915061597f836142aa565b92508282019050808211156159975761599661564e565b5b92915050565b7f4d6178696d756d206e756d626572206f6620746f6b656e73206d696e74656400600082015250565b60006159d3601f836147f5565b91506159de8261599d565b602082019050919050565b60006020820190508181036000830152615a02816159c6565b9050919050565b7f496e73756666696369656e742062616c616e6365000000000000000000000000600082015250565b6000615a3f6014836147f5565b9150615a4a82615a09565b602082019050919050565b60006020820190508181036000830152615a6e81615a32565b9050919050565b7f496e76616c696420726566657272616c20636f64650000000000000000000000600082015250565b6000615aab6015836147f5565b9150615ab682615a75565b602082019050919050565b60006020820190508181036000830152615ada81615a9e565b9050919050565b7f4661696c656420746f2073656e6420726566657272616c206574680000000000600082015250565b6000615b17601b836147f5565b9150615b2282615ae1565b602082019050919050565b60006020820190508181036000830152615b4681615b0a565b9050919050565b6000615b58826142aa565b9150615b63836142aa565b9250828203905081811115615b7b57615b7a61564e565b5b92915050565b7f4661696c656420746f2073656e64207769746864726177616c20657468000000600082015250565b6000615bb7601d836147f5565b9150615bc282615b81565b602082019050919050565b60006020820190508181036000830152615be681615baa565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000615c1482615bed565b615c1e8185615bf8565b9350615c2e818560208601614642565b615c3781614466565b840191505092915050565b600060a082019050615c576000830188614432565b615c646020830187614432565b615c716040830186614320565b615c7e6060830185614320565b8181036080830152615c908184615c09565b90509695505050505050565b600081519050615cab81614376565b92915050565b600060208284031215615cc757615cc6614242565b5b6000615cd584828501615c9c565b91505092915050565b600060a082019050615cf36000830188614432565b615d006020830187614432565b8181036040830152615d128186614d35565b90508181036060830152615d268185614d35565b90508181036080830152615d3a8184615c09565b90509695505050505050565b6000608082019050615d5b6000830187614432565b615d686020830186614320565b615d756040830185614320565b615d826060830184614320565b95945050505050565b60006040820190508181036000830152615da58185614d35565b90508181036020830152615db98184614d35565b9050939250505056fea2646970667358221220c5468d0db8833b4c431a01077f7acaa177c43813ae75b9d2cebe8b8bb412325064736f6c63430008140033

Verified Source Code Full Match

Compiler: v0.8.20+commit.a1b79de6 EVM: paris Optimization: No
IgnisElitePhaseIII.sol 327 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";
import "@openzeppelin/contracts/interfaces/IERC2981.sol";

////////////////////////////
//                        //
//                        //
//                        //
//    ┳    •   ┏┓┓•       //
//    ┃┏┓┏┓┓┏  ┣ ┃┓╋┏┓    //
//    ┻┗┫┛┗┗┛  ┗┛┗┗┗┗     //
//      ┛                 //
//                        //
//                        //
//                        //
////////////////////////////

contract IgnisElitePhaseIII is ERC1155, IERC2981, ReentrancyGuard, Ownable, ERC1155Pausable, ERC1155Supply {

    uint256 public constant MINT_PRICE = 1 ether;
    uint256 public constant MAX_SUPPLY = 477;
    uint256 public constant GIVEAWAY_SUPPLY = 10;

    uint256 public constant REFERRAL_PERCENTAGE = 10;

    address public constant WITHDRAW_ADDRESS = 0x031DeB56fA8eB212EF3bCF8Cb2F126993eDEDc19;
    address public constant ROYALTY_RECEIVER = 0x031DeB56fA8eB212EF3bCF8Cb2F126993eDEDc19;
    address public constant GIVEAWAY_ADDRESS = 0x4faa0fac32F844ACAF59b5B5a72C0D38de8bd0CD;

    IERC1155 public PHASE1_CONTRACT;
    uint256 public PHASE1_ID = 1;

    IERC1155 public PHASE2_CONTRACT;
    uint256 public PHASE2_ID = 0;

    uint256 public MINTED_SUPPLY = 0;

    string public BASE_URI = "https://cdn.ignislabs.ai/elite-phase-iii/{id}.json";

    mapping(address => string) public referralCodes;
    mapping(string => address) public iReferralCodes;

    bool public requireHolder = true;

    address[] public owners;

    struct MintSettings {
        uint256 maxSupply;
        uint256 mintedSupply;
        uint256 mintPrice;
        bool isPaused;
        bool requireHolder;
    }

    struct ReferralMint {
        address minter;
        address receiver;
        string code;
        uint256 num;
        uint256 ethEarned;
        uint256 timestamp;
    }

    ReferralMint[] public referralMints;

    constructor(address _phaseOneContractAddress, address _phaseTwoContractAddress) ERC1155(BASE_URI) Ownable(msg.sender) {
        mint(msg.sender, 0, MAX_SUPPLY - GIVEAWAY_SUPPLY, "");
        mint(GIVEAWAY_ADDRESS, 0, GIVEAWAY_SUPPLY, "");

        MINTED_SUPPLY = GIVEAWAY_SUPPLY;
        PHASE1_CONTRACT = IERC1155(_phaseOneContractAddress);
        PHASE2_CONTRACT = IERC1155(_phaseTwoContractAddress);

        owners.push(msg.sender);
        owners.push(GIVEAWAY_ADDRESS);

        requireHolder = true;
    }

    function setRequireHolder(bool _newRequireHolder) external onlyOwner
    {
        requireHolder = _newRequireHolder;
    }

    function setPhaseOneContract(address _contractAddress) external onlyOwner
    {
        PHASE1_CONTRACT = IERC1155(_contractAddress);
    }

    function setPhaseOneId(uint256 _newId) external onlyOwner
    {
        PHASE1_ID = _newId;
    }

    function setPhaseTwoContract(address _contractAddress) external onlyOwner
    {
        PHASE2_CONTRACT = IERC1155(_contractAddress);
    }

    function setPhaseTwoId(uint256 _newId) external onlyOwner
    {
        PHASE2_ID = _newId;
    }

    function canMintReferralCode(string memory referralCode) external view returns (bool)
    {
        if (requireHolder) {
            if (balanceOf(msg.sender, 0) == 0 && PHASE1_CONTRACT.balanceOf(msg.sender, PHASE1_ID) == 0 && PHASE2_CONTRACT.balanceOf(msg.sender, PHASE2_ID) == 0) {
                return false;
            }
        }

        if (bytes(referralCodes[msg.sender]).length > 0) {
            return false;
        }

        if (iReferralCodes[referralCode] != address(0)) {
            return false;
        }

        return true;
    }

    function mintReferralCode(string memory referralCode) public payable nonReentrant
    {
        if (requireHolder) {
            require(balanceOf(msg.sender, 0) > 0 || PHASE1_CONTRACT.balanceOf(msg.sender, PHASE1_ID) > 0 || PHASE2_CONTRACT.balanceOf(msg.sender, PHASE2_ID) > 0, "You need to own at least 1 phase 1, phase 2 or phase 3 nft");
        }

        require(bytes(referralCodes[msg.sender]).length == 0, "Referral code already minted");
        require(iReferralCodes[referralCode] == address(0), "Referral code already in use");

        referralCodes[msg.sender] = referralCode;
        iReferralCodes[referralCode] = msg.sender;
    }

    function myReferralCode() external view returns (string memory)
    {
        return referralCodes[msg.sender];
    }

    function isValidReferralCode(string memory referralCode) public view returns(bool)
    {
        if (iReferralCodes[referralCode] == address(0)) {
            return false;
        }

        return true;
    }

    function canMint() public view returns(bool)
    {
        if (requireHolder && balanceOf(msg.sender, 0) == 0 && PHASE1_CONTRACT.balanceOf(msg.sender, PHASE1_ID) == 0 && PHASE2_CONTRACT.balanceOf(msg.sender, PHASE2_ID) == 0) {
            return false;
        }

        return true;
    }

    function buy(uint256 num, string memory referralCode) external payable whenNotPaused nonReentrant
    {
        if (requireHolder) {
            require(balanceOf(msg.sender, 0) > 0 || PHASE1_CONTRACT.balanceOf(msg.sender, PHASE1_ID) > 0 || PHASE2_CONTRACT.balanceOf(msg.sender, PHASE2_ID) > 0, "You need to own at least 1 phase 1, phase 2 or phase 3 nft");
        }

        require(num <= 10, "Maximum 10 mints per transaction");
        require(msg.value == (MINT_PRICE * num), "Incorrect amount of ether provided for the mint!");
        require((MINTED_SUPPLY + num) <= MAX_SUPPLY, "Maximum number of tokens minted");
        require(balanceOf(owner(), 0) >= num, "Insufficient balance");

        uint256 referralEthEarned = 0;

        if (bytes(referralCode).length > 0) {
            // require valid referralCode
            require(iReferralCodes[referralCode] != address(0), "Invalid referral code");

            referralEthEarned = ((MINT_PRICE * num) / 100) * REFERRAL_PERCENTAGE;
            address referralReceiver = iReferralCodes[referralCode];

            ReferralMint memory referralMint = ReferralMint(msg.sender, referralReceiver, referralCode, num, referralEthEarned, block.timestamp);
            referralMints.push(referralMint);

            // send eth to referralReceiver
            (bool sent,) = referralReceiver.call{value: referralEthEarned}("");
            require(sent, "Failed to send referral eth");

        }

        MINTED_SUPPLY += num;

        _safeTransferBefore(msg.sender);
        _safeTransferFrom(owner(), msg.sender, 0, num, "");
        _safeTransferAfter(owner());

        // send eth to withdraw address
        (bool sentRemaining,) = WITHDRAW_ADDRESS.call{value: (MINT_PRICE * num) - referralEthEarned}("");
        require(sentRemaining, "Failed to send withdrawal eth");
    }

    function _safeTransferBefore(address to) internal
    {
        if (balanceOf(to, 0) == 0) {
            owners.push(to);
        }
    }

    function _safeTransferAfter(address from) internal
    {
        if (balanceOf(from, 0) == 0) {
            for (uint256 i = 0; i < owners.length; i++) {
                if (owners[i] == from) {
                    delete owners[i];
                }
            }
        }
    }

    function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) public virtual override
    {
        _safeTransferBefore(to);
        super.safeTransferFrom(from, to, id, value, data);
        _safeTransferAfter(from);
    }


    function getTokenHolders() external view returns (address[] memory) {
        return owners;
    }

    function getAllReferralMints() external view onlyOwner returns (ReferralMint[] memory)
    {
        return referralMints;
    }

    function getMyReferralMints() external view returns (ReferralMint[] memory)
    {
        uint256 count = 0;
        for (uint256 i = 0; i < referralMints.length; i++) {
            if (referralMints[i].receiver == msg.sender) {
                count++;
            }
        }

        ReferralMint[] memory myReferralMints = new ReferralMint[](count);

        uint256 c = 0;
        for (uint256 i = 0; i < referralMints.length; i++) {
            if (referralMints[i].receiver == msg.sender) {
                myReferralMints[c] = referralMints[i];
                c++;
            }
        }

        return myReferralMints;
    }

    function getMintSettings() external view returns (MintSettings memory) {
        MintSettings memory mintSettings = MintSettings(
            MAX_SUPPLY, MINTED_SUPPLY, MINT_PRICE, paused(), requireHolder
        );

        return mintSettings;
    }

    function withdrawAll() external onlyOwner returns (bool)
    {
        (bool sent,) = WITHDRAW_ADDRESS.call{value: address(this).balance}("");
        require(sent, "WITHDRAW_FAILED");

        return sent;
    }

    function setURI(string memory newUri) public onlyOwner
    {
        _setURI(newUri);
    }

    function pause() public onlyOwner
    {
        _pause();
    }

    function unpause() public onlyOwner
    {
        _unpause();
    }

    function mint(address account, uint256 id, uint256 amount, bytes memory data) internal onlyOwner
    {
        _mint(account, id, amount, data);
    }

    function _update(address from, address to, uint256[] memory ids, uint256[] memory values) internal override(ERC1155, ERC1155Pausable, ERC1155Supply)
    {
        super._update(from, to, ids, values);
    }


    /**
     * @dev Interface implementation for the NFT Royalty Standard (ERC-2981).
     * Called by marketplaces that supports the standard with the sale price to determine how much royalty
     * is owed and to whom.
     * The first parameter tokenId (the NFT asset queried for royalty information) is not used as royalties
     * are calculated equally for all tokens.
     * @param salePrice - the sale price of the NFT asset specified by `tokenId`
     * @return receiver - address of who should be sent the royalty payment
     * @return royaltyAmount - the royalty payment amount for `salePrice`
     */
    function royaltyInfo(uint256, uint256 salePrice) external pure override returns (address, uint256)
    {
        return (ROYALTY_RECEIVER, salePrice / 10);
    }

    function supportsInterface(
        bytes4 interfaceId
    ) public view override(ERC1155, IERC165) returns (bool)
    {
        return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
    }

}
Arrays.sol 127 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Arrays.sol)

pragma solidity ^0.8.20;

import {StorageSlot} from "./StorageSlot.sol";
import {Math} from "./math/Math.sol";

/**
 * @dev Collection of functions related to array types.
 */
library Arrays {
    using StorageSlot for bytes32;

    /**
     * @dev Searches a sorted `array` and returns the first index that contains
     * a value greater or equal to `element`. If no such index exists (i.e. all
     * values in the array are strictly less than `element`), the array length is
     * returned. Time complexity O(log n).
     *
     * `array` is expected to be sorted in ascending order, and to contain no
     * repeated elements.
     */
    function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
        uint256 low = 0;
        uint256 high = array.length;

        if (high == 0) {
            return 0;
        }

        while (low < high) {
            uint256 mid = Math.average(low, high);

            // Note that mid will always be strictly less than high (i.e. it will be a valid array index)
            // because Math.average rounds towards zero (it does integer division with truncation).
            if (unsafeAccess(array, mid).value > element) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }

        // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.
        if (low > 0 && unsafeAccess(array, low - 1).value == element) {
            return low - 1;
        } else {
            return low;
        }
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) {
        bytes32 slot;
        // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
        // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays.

        /// @solidity memory-safe-assembly
        assembly {
            mstore(0, arr.slot)
            slot := add(keccak256(0, 0x20), pos)
        }
        return slot.getAddressSlot();
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) {
        bytes32 slot;
        // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
        // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays.

        /// @solidity memory-safe-assembly
        assembly {
            mstore(0, arr.slot)
            slot := add(keccak256(0, 0x20), pos)
        }
        return slot.getBytes32Slot();
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) {
        bytes32 slot;
        // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr`
        // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays.

        /// @solidity memory-safe-assembly
        assembly {
            mstore(0, arr.slot)
            slot := add(keccak256(0, 0x20), pos)
        }
        return slot.getUint256Slot();
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) {
        assembly {
            res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
        }
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeMemoryAccess(address[] memory arr, uint256 pos) internal pure returns (address res) {
        assembly {
            res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
        }
    }
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @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;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../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.
 *
 * The initial owner is set to the address provided by the deployer. 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;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @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 {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _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 119 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;

import {Context} from "../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 {
    bool private _paused;

    /**
     * @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);

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @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 {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

    /**
     * @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());
    }
}
Math.sol 415 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    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.
     */
    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.
     */
    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.
     */
    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.
     */
    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 largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
     * denominator == 0.
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
     * Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.
            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.

            uint256 twos = denominator & (0 - denominator);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
            // works in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
     * towards zero.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}
StorageSlot.sol 135 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.20;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(newImplementation.code.length > 0);
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}
IERC2981.sol 23 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../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.
 */
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);
}
ERC1155.sol 468 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.20;

import {IERC1155} from "./IERC1155.sol";
import {IERC1155Receiver} from "./IERC1155Receiver.sol";
import {IERC1155MetadataURI} from "./extensions/IERC1155MetadataURI.sol";
import {Context} from "../../utils/Context.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol";
import {Arrays} from "../../utils/Arrays.sol";
import {IERC1155Errors} from "../../interfaces/draft-IERC6093.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
 */
abstract contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IERC1155Errors {
    using Arrays for uint256[];
    using Arrays for address[];

    mapping(uint256 id => mapping(address account => uint256)) private _balances;

    mapping(address account => mapping(address operator => 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 /* id */) public view virtual returns (string memory) {
        return _uri;
    }

    /**
     * @dev See {IERC1155-balanceOf}.
     */
    function balanceOf(address account, uint256 id) public view virtual returns (uint256) {
        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 returns (uint256[] memory) {
        if (accounts.length != ids.length) {
            revert ERC1155InvalidArrayLength(ids.length, accounts.length);
        }

        uint256[] memory batchBalances = new uint256[](accounts.length);

        for (uint256 i = 0; i < accounts.length; ++i) {
            batchBalances[i] = balanceOf(accounts.unsafeMemoryAccess(i), ids.unsafeMemoryAccess(i));
        }

        return batchBalances;
    }

    /**
     * @dev See {IERC1155-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC1155-isApprovedForAll}.
     */
    function isApprovedForAll(address account, address operator) public view virtual returns (bool) {
        return _operatorApprovals[account][operator];
    }

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) public virtual {
        address sender = _msgSender();
        if (from != sender && !isApprovedForAll(from, sender)) {
            revert ERC1155MissingApprovalForAll(sender, from);
        }
        _safeTransferFrom(from, to, id, value, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory values,
        bytes memory data
    ) public virtual {
        address sender = _msgSender();
        if (from != sender && !isApprovedForAll(from, sender)) {
            revert ERC1155MissingApprovalForAll(sender, from);
        }
        _safeBatchTransferFrom(from, to, ids, values, data);
    }

    /**
     * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. Will mint (or burn) if `from`
     * (or `to`) is the zero address.
     *
     * Emits a {TransferSingle} event if the arrays contain one element, and {TransferBatch} otherwise.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement either {IERC1155Receiver-onERC1155Received}
     *   or {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value.
     * - `ids` and `values` must have the same length.
     *
     * NOTE: The ERC-1155 acceptance check is not performed in this function. See {_updateWithAcceptanceCheck} instead.
     */
    function _update(address from, address to, uint256[] memory ids, uint256[] memory values) internal virtual {
        if (ids.length != values.length) {
            revert ERC1155InvalidArrayLength(ids.length, values.length);
        }

        address operator = _msgSender();

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids.unsafeMemoryAccess(i);
            uint256 value = values.unsafeMemoryAccess(i);

            if (from != address(0)) {
                uint256 fromBalance = _balances[id][from];
                if (fromBalance < value) {
                    revert ERC1155InsufficientBalance(from, fromBalance, value, id);
                }
                unchecked {
                    // Overflow not possible: value <= fromBalance
                    _balances[id][from] = fromBalance - value;
                }
            }

            if (to != address(0)) {
                _balances[id][to] += value;
            }
        }

        if (ids.length == 1) {
            uint256 id = ids.unsafeMemoryAccess(0);
            uint256 value = values.unsafeMemoryAccess(0);
            emit TransferSingle(operator, from, to, id, value);
        } else {
            emit TransferBatch(operator, from, to, ids, values);
        }
    }

    /**
     * @dev Version of {_update} that performs the token acceptance check by calling
     * {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} on the receiver address if it
     * contains code (eg. is a smart contract at the moment of execution).
     *
     * IMPORTANT: Overriding this function is discouraged because it poses a reentrancy risk from the receiver. So any
     * update to the contract state after this function would break the check-effect-interaction pattern. Consider
     * overriding {_update} instead.
     */
    function _updateWithAcceptanceCheck(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory values,
        bytes memory data
    ) internal virtual {
        _update(from, to, ids, values);
        if (to != address(0)) {
            address operator = _msgSender();
            if (ids.length == 1) {
                uint256 id = ids.unsafeMemoryAccess(0);
                uint256 value = values.unsafeMemoryAccess(0);
                _doSafeTransferAcceptanceCheck(operator, from, to, id, value, data);
            } else {
                _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, values, data);
            }
        }
    }

    /**
     * @dev Transfers a `value` 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 `value` 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 value, bytes memory data) internal {
        if (to == address(0)) {
            revert ERC1155InvalidReceiver(address(0));
        }
        if (from == address(0)) {
            revert ERC1155InvalidSender(address(0));
        }
        (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
        _updateWithAcceptanceCheck(from, to, ids, values, 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.
     * - `ids` and `values` must have the same length.
     */
    function _safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory values,
        bytes memory data
    ) internal {
        if (to == address(0)) {
            revert ERC1155InvalidReceiver(address(0));
        }
        if (from == address(0)) {
            revert ERC1155InvalidSender(address(0));
        }
        _updateWithAcceptanceCheck(from, to, ids, values, 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 values 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 a `value` amount of tokens of 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 value, bytes memory data) internal {
        if (to == address(0)) {
            revert ERC1155InvalidReceiver(address(0));
        }
        (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
        _updateWithAcceptanceCheck(address(0), to, ids, values, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `values` must have the same length.
     * - `to` cannot be the zero address.
     * - 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 values, bytes memory data) internal {
        if (to == address(0)) {
            revert ERC1155InvalidReceiver(address(0));
        }
        _updateWithAcceptanceCheck(address(0), to, ids, values, data);
    }

    /**
     * @dev Destroys a `value` amount of tokens of type `id` from `from`
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `value` amount of tokens of type `id`.
     */
    function _burn(address from, uint256 id, uint256 value) internal {
        if (from == address(0)) {
            revert ERC1155InvalidSender(address(0));
        }
        (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
        _updateWithAcceptanceCheck(from, address(0), ids, values, "");
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `value` amount of tokens of type `id`.
     * - `ids` and `values` must have the same length.
     */
    function _burnBatch(address from, uint256[] memory ids, uint256[] memory values) internal {
        if (from == address(0)) {
            revert ERC1155InvalidSender(address(0));
        }
        _updateWithAcceptanceCheck(from, address(0), ids, values, "");
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the zero address.
     */
    function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
        if (operator == address(0)) {
            revert ERC1155InvalidOperator(address(0));
        }
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Performs an acceptance check by calling {IERC1155-onERC1155Received} on the `to` address
     * if it contains code at the moment of execution.
     */
    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 value,
        bytes memory data
    ) private {
        if (to.code.length > 0) {
            try IERC1155Receiver(to).onERC1155Received(operator, from, id, value, data) returns (bytes4 response) {
                if (response != IERC1155Receiver.onERC1155Received.selector) {
                    // Tokens rejected
                    revert ERC1155InvalidReceiver(to);
                }
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    // non-ERC1155Receiver implementer
                    revert ERC1155InvalidReceiver(to);
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        }
    }

    /**
     * @dev Performs a batch acceptance check by calling {IERC1155-onERC1155BatchReceived} on the `to` address
     * if it contains code at the moment of execution.
     */
    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory values,
        bytes memory data
    ) private {
        if (to.code.length > 0) {
            try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, values, data) returns (
                bytes4 response
            ) {
                if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
                    // Tokens rejected
                    revert ERC1155InvalidReceiver(to);
                }
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    // non-ERC1155Receiver implementer
                    revert ERC1155InvalidReceiver(to);
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        }
    }

    /**
     * @dev Creates an array in memory with only one value for each of the elements provided.
     */
    function _asSingletonArrays(
        uint256 element1,
        uint256 element2
    ) private pure returns (uint256[] memory array1, uint256[] memory array2) {
        /// @solidity memory-safe-assembly
        assembly {
            // Load the free memory pointer
            array1 := mload(0x40)
            // Set array length to 1
            mstore(array1, 1)
            // Store the single element at the next word after the length (where content starts)
            mstore(add(array1, 0x20), element1)

            // Repeat for next array locating it right after the first array
            array2 := add(array1, 0x40)
            mstore(array2, 1)
            mstore(add(array2, 0x20), element2)

            // Update the free memory pointer by pointing after the second array
            mstore(0x40, add(array2, 0x40))
        }
    }
}
ReentrancyGuard.sol 84 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

/**
 * @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;

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    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() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

        // Any calls to nonReentrant after this point will fail
        _status = ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == ENTERED;
    }
}
IERC1155.sol 127 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` amount of tokens of 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 value 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 a `value` amount of tokens of type `id` from `from` to `to`.
     *
     * WARNING: This function can potentially allow a reentrancy attack when transferring tokens
     * to an untrusted contract, when invoking {onERC1155Received} on the receiver.
     * Ensure to follow the checks-effects-interactions pattern and consider employing
     * reentrancy guards when interacting with untrusted contracts.
     *
     * 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 `value` 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 value, bytes calldata data) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * WARNING: This function can potentially allow a reentrancy attack when transferring tokens
     * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.
     * Ensure to follow the checks-effects-interactions pattern and consider employing
     * reentrancy guards when interacting with untrusted contracts.
     *
     * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.
     *
     * Requirements:
     *
     * - `ids` and `values` 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 values,
        bytes calldata data
    ) external;
}
draft-IERC6093.sol 161 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}
ERC165.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "./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);
 * }
 * ```
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @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 59 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../utils/introspection/IERC165.sol";

/**
 * @dev Interface that must be implemented by smart contracts in order to receive
 * ERC-1155 token transfers.
 */
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 87 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/ERC1155Supply.sol)

pragma solidity ^0.8.20;

import {ERC1155} from "../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.
 *
 * NOTE: This contract implies a global limit of 2**256 - 1 to the number of tokens
 * that can be minted.
 *
 * CAUTION: This extension should not be added in an upgrade to an already deployed contract.
 */
abstract contract ERC1155Supply is ERC1155 {
    mapping(uint256 id => uint256) private _totalSupply;
    uint256 private _totalSupplyAll;

    /**
     * @dev Total value of tokens in with a given id.
     */
    function totalSupply(uint256 id) public view virtual returns (uint256) {
        return _totalSupply[id];
    }

    /**
     * @dev Total value of tokens.
     */
    function totalSupply() public view virtual returns (uint256) {
        return _totalSupplyAll;
    }

    /**
     * @dev Indicates whether any token exist with a given id, or not.
     */
    function exists(uint256 id) public view virtual returns (bool) {
        return totalSupply(id) > 0;
    }

    /**
     * @dev See {ERC1155-_update}.
     */
    function _update(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory values
    ) internal virtual override {
        super._update(from, to, ids, values);

        if (from == address(0)) {
            uint256 totalMintValue = 0;
            for (uint256 i = 0; i < ids.length; ++i) {
                uint256 value = values[i];
                // Overflow check required: The rest of the code assumes that totalSupply never overflows
                _totalSupply[ids[i]] += value;
                totalMintValue += value;
            }
            // Overflow check required: The rest of the code assumes that totalSupplyAll never overflows
            _totalSupplyAll += totalMintValue;
        }

        if (to == address(0)) {
            uint256 totalBurnValue = 0;
            for (uint256 i = 0; i < ids.length; ++i) {
                uint256 value = values[i];

                unchecked {
                    // Overflow not possible: values[i] <= balanceOf(from, ids[i]) <= totalSupply(ids[i])
                    _totalSupply[ids[i]] -= value;
                    // Overflow not possible: sum_i(values[i]) <= sum_i(totalSupply(ids[i])) <= totalSupplyAll
                    totalBurnValue += value;
                }
            }
            unchecked {
                // Overflow not possible: totalBurnValue = sum_i(values[i]) <= sum_i(totalSupply(ids[i])) <= totalSupplyAll
                _totalSupplyAll -= totalBurnValue;
            }
        }
    }
}
ERC1155Pausable.sol 38 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/ERC1155Pausable.sol)

pragma solidity ^0.8.20;

import {ERC1155} from "../ERC1155.sol";
import {Pausable} from "../../../utils/Pausable.sol";

/**
 * @dev ERC1155 token with pausable token transfers, minting and burning.
 *
 * Useful for scenarios such as preventing trades until the end of an evaluation
 * period, or having an emergency switch for freezing all token transfers in the
 * event of a large bug.
 *
 * IMPORTANT: This contract does not include public pause and unpause functions. In
 * addition to inheriting this contract, you must define both functions, invoking the
 * {Pausable-_pause} and {Pausable-_unpause} internal functions, with appropriate
 * access control, e.g. using {AccessControl} or {Ownable}. Not doing so will
 * make the contract pause mechanism of the contract unreachable, and thus unusable.
 */
abstract contract ERC1155Pausable is ERC1155, Pausable {
    /**
     * @dev See {ERC1155-_update}.
     *
     * Requirements:
     *
     * - the contract must not be paused.
     */
    function _update(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory values
    ) internal virtual override whenNotPaused {
        super._update(from, to, ids, values);
    }
}
IERC1155MetadataURI.sol 20 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/IERC1155MetadataURI.sol)

pragma solidity ^0.8.20;

import {IERC1155} from "../IERC1155.sol";

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 */
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

BASE_URI 0xdbddb26a → string
GIVEAWAY_ADDRESS 0xd5e156dc → address
GIVEAWAY_SUPPLY 0xb0ec6dff → uint256
MAX_SUPPLY 0x32cb6b0c → uint256
MINTED_SUPPLY 0x58d9a212 → uint256
MINT_PRICE 0xc002d23d → uint256
PHASE1_CONTRACT 0x1b804297 → address
PHASE1_ID 0x58d3d2e0 → uint256
PHASE2_CONTRACT 0xc8637b35 → address
PHASE2_ID 0x448e9dce → uint256
REFERRAL_PERCENTAGE 0x0c2e05e0 → uint256
ROYALTY_RECEIVER 0x0d0c6af6 → address
WITHDRAW_ADDRESS 0x122e04a8 → address
balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
canMint 0xbeb9716d → bool
canMintReferralCode 0x8a209125 → bool
exists 0x4f558e79 → bool
getAllReferralMints 0x08e13100 → tuple[]
getMintSettings 0xd55eb496 → tuple
getMyReferralMints 0x67cefb07 → tuple[]
getTokenHolders 0x876b1566 → address[]
iReferralCodes 0x2864b34b → address
isApprovedForAll 0xe985e9c5 → bool
isValidReferralCode 0x7a4f6258 → bool
myReferralCode 0x1657c43f → string
owner 0x8da5cb5b → address
owners 0x025e7c27 → address
paused 0x5c975abb → bool
referralCodes 0x9534dd3e → string
referralMints 0x70e448a0 → address, address, string, uint256, uint256, uint256
requireHolder 0x4288ff1d → bool
royaltyInfo 0x2a55205a → address, uint256
supportsInterface 0x01ffc9a7 → bool
totalSupply 0x18160ddd → uint256
totalSupply 0xbd85b039 → uint256
uri 0x0e89341c → string

Write Contract 16 functions

These functions modify contract state and require a wallet transaction to execute.

buy 0xb7dc3b18
uint256 num
string referralCode
mintReferralCode 0x1dd36e51
string referralCode
pause 0x8456cb59
No parameters
renounceOwnership 0x715018a6
No parameters
safeBatchTransferFrom 0x2eb2c2d6
address from
address to
uint256[] ids
uint256[] values
bytes data
safeTransferFrom 0xf242432a
address from
address to
uint256 id
uint256 value
bytes data
setApprovalForAll 0xa22cb465
address operator
bool approved
setPhaseOneContract 0xddd0eebd
address _contractAddress
setPhaseOneId 0xd327c699
uint256 _newId
setPhaseTwoContract 0x160dbc82
address _contractAddress
setPhaseTwoId 0x27fcb984
uint256 _newId
setRequireHolder 0x868482d8
bool _newRequireHolder
setURI 0x02fe5305
string newUri
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters
withdrawAll 0x853828b6
No parameters
returns: bool

Recent Transactions

No transactions found for this address