Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x11ce3c5ECfA4cC788eaa94157a63a1ca4863A90c
Balance 1.6970 ETH
Nonce 1
Code Size 18044 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

18044 bytes
0x6080604052600436106102305760003560e01c80636a6e4c381161012e578063aad48c17116100ab578063c4b151411161006f578063c4b1514114610755578063dd473d2b1461076a578063e61a70c01461077f578063f23a6e61146107b6578063f8ce3164146107e257600080fd5b8063aad48c17146106b2578063b027a725146106d2578063b1433f7f146106e7578063bc197c81146106fd578063be9af5361461074257600080fd5b806395478fbf116100f257806395478fbf1461058757806396cbf2e9146105a7578063a28ad112146105c7578063a6e22b0214610672578063a7fa49c51461069257600080fd5b80636a6e4c38146104b357806371029ffd146104e35780637be3f006146105195780637ee87a271461052f5780638da5cb5b1461056757600080fd5b80632211fec4116101bc57806343b555dd1161018057806343b555dd14610413578063450defaa1461043357806346c4a388146104535780634a63421c146104735780634c89b86c1461049357600080fd5b80632211fec41461038757806329aa3a42146103a75780632a983a04146103bc5780632aa74ce4146103dc57806334a7f193146103fc57600080fd5b8063111992851161020357806311199285146102e757806313af403514610314578063166117e81461033457806317ce4f1e146103475780631e7c9e181461036757600080fd5b806301839ee31461023557806301ffc9a714610257578063023d20b01461028c5780630761b9bd146102b9575b600080fd5b34801561024157600080fd5b5061025561025036600461402c565b6107f8565b005b34801561026357600080fd5b50610277610272366004613fc1565b61086a565b60405190151581526020015b60405180910390f35b34801561029857600080fd5b506102ac6102a7366004613d61565b61088f565b6040516102839190614225565b3480156102c557600080fd5b506102d96102d436600461405e565b610c3a565b604051908152602001610283565b3480156102f357600080fd5b50610307610302366004613d61565b610c6b565b6040516102839190614335565b34801561032057600080fd5b5061025561032f366004613d61565b610f4e565b61025561034236600461402c565b610fd9565b34801561035357600080fd5b50610255610362366004613d61565b61124f565b34801561037357600080fd5b5061025561038236600461402c565b6112da565b34801561039357600080fd5b506102556103a2366004613e89565b61166a565b3480156103b357600080fd5b506102ac6116ac565b3480156103c857600080fd5b506102556103d736600461402c565b6119a7565b3480156103e857600080fd5b506102ac6103f736600461405e565b611a16565b34801561040857600080fd5b506004546102d99081565b34801561041f57600080fd5b5061030761042e36600461402c565b611d6c565b34801561043f57600080fd5b506102ac61044e366004613f71565b61203a565b34801561045f57600080fd5b5061025561046e366004613ec0565b6123a3565b34801561047f57600080fd5b5061025561048e36600461402c565b612704565b34801561049f57600080fd5b506102556104ae366004613d61565b612888565b3480156104bf57600080fd5b506102776104ce366004613d61565b60116020526000908152604090205460ff1681565b3480156104ef57600080fd5b506102d96104fe366004613d61565b6001600160a01b031660009081526010602052604090205490565b34801561052557600080fd5b506102d9600a5481565b34801561053b57600080fd5b5060095461054f906001600160a01b031681565b6040516001600160a01b039091168152602001610283565b34801561057357600080fd5b5060085461054f906001600160a01b031681565b34801561059357600080fd5b506102ac6105a2366004613feb565b612908565b3480156105b357600080fd5b506102556105c2366004613d61565b612d8b565b3480156105d357600080fd5b5061062d6105e236600461402c565b600f60205260009081526040902080546001820154600283015460038401546004850154600590950154939492936001600160a01b0390921692909160ff8082169161010090041687565b6040805197885260208801969096526001600160a01b03909416948601949094526060850191909152608084015290151560a0830152151560c082015260e001610283565b34801561067e57600080fd5b5061025561068d36600461402c565b612e0c565b34801561069e57600080fd5b506102d96106ad366004613f47565b612ef2565b3480156106be57600080fd5b506103076106cd366004613f71565b612f0e565b3480156106de57600080fd5b506102d96131f0565b3480156106f357600080fd5b506102d9600c5481565b34801561070957600080fd5b50610729610718366004613d7c565b63bc197c8160e01b95945050505050565b6040516001600160e01b03199091168152602001610283565b61025561075036600461402c565b613216565b34801561076157600080fd5b506102d9613602565b34801561077657600080fd5b50610255613612565b34801561078b57600080fd5b5061079f61079a36600461402c565b613711565b6040516102839b9a99989796959493929190614455565b3480156107c257600080fd5b506107296107d1366004613e25565b63f23a6e6160e01b95945050505050565b3480156107ee57600080fd5b506102d9600b5481565b6008546001600160a01b0316331461080f57600080fd5b60058111156108655760405162461bcd60e51b815260206004820152601760248201527f3525206d6178696d756d2066656520616c6c6f7765642e00000000000000000060448201526064015b60405180910390fd5b600a55565b60006001600160e01b03198216630271189760e51b1480610889575060015b92915050565b6060600061089c60045490565b905060008060005b8381101561096b576001600160a01b038616600d60006108c5846001614504565b81526020810191909152604001600020600401546001600160a01b03161480156109175750600d60006108f9836001614504565b8152602081019190915260400160002060080154610100900460ff16155b80156109465750600d600061092d836001614504565b815260208101919091526040016000206008015460ff16155b1561095957610956600184614504565b92505b80610963816145af565b9150506108a4565b506000826001600160401b0381111561098657610986614622565b6040519080825280602002602001820160405280156109bf57816020015b6109ac613acc565b8152602001906001900390816109a45790505b50905060005b84811015610c30576001600160a01b038716600d60006109e6846001614504565b81526020810191909152604001600020600401546001600160a01b0316148015610a385750600d6000610a1a836001614504565b8152602081019190915260400160002060080154610100900460ff16155b8015610a675750600d6000610a4e836001614504565b815260208101919091526040016000206008015460ff16155b15610c1e576000600d81610a7c846001614504565b81526020808201929092526040908101600090812054808252600d8452908290208251610160810184528154815260018201546001600160a01b03811695820195909552919450929091839190830190600160a01b900460ff166002811115610ae757610ae76145f6565b6002811115610af857610af86145f6565b8152600282015460208201526003820154604082015260048201546001600160a01b039081166060830152600583015416608082015260068201805460a090920191610b4390614574565b80601f0160208091040260200160405190810160405280929190818152602001828054610b6f90614574565b8015610bbc5780601f10610b9157610100808354040283529160200191610bbc565b820191906000526020600020905b815481529060010190602001808311610b9f57829003601f168201915b50505091835250506007820154602082015260089091015460ff808216151560408401526101009091041615156060909101528451859087908110610c0357610c0361460c565b6020908102919091010152610c19600186614504565b945050505b80610c28816145af565b9150506109c5565b5095945050505050565b600e6020528160005260406000208181548110610c5657600080fd5b90600052602060002001600091509150505481565b6001600160a01b03811660009081526010602090815260408083208054825181850281018501909352808352606094938493929190830182828015610ccf57602002820191906000526020600020905b815481526020019060010190808311610cbb575b5050505050905060005b8151811015610d8457600f6000838381518110610cf857610cf861460c565b602090810291909101810151825281019190915260400160002060050154610100900460ff16158015610d5f5750600f6000838381518110610d3c57610d3c61460c565b60209081029190910181015182528101919091526040016000206005015460ff16155b15610d725782610d6e816145af565b9350505b80610d7c816145af565b915050610cd9565b506000826001600160401b03811115610d9f57610d9f614622565b604051908082528060200260200182016040528015610dd857816020015b610dc5613b26565b815260200190600190039081610dbd5790505b5090506000805b8351811015610f4357600f6000858381518110610dfe57610dfe61460c565b602090810291909101810151825281019190915260400160002060050154610100900460ff16158015610e655750600f6000858381518110610e4257610e4261460c565b60209081029190910181015182528101919091526040016000206005015460ff16155b15610f31576000600f6000868481518110610e8257610e8261460c565b6020908102919091018101518252818101929092526040908101600020815160e0810183528154815260018201549381019390935260028101546001600160a01b03169183019190915260038101546060830152600481015460808301526005015460ff808216151560a084015261010090910416151560c082015284519091508190859085908110610f1757610f1761460c565b6020908102919091010152610f2d600184614504565b9250505b80610f3b816145af565b915050610ddf565b509095945050505050565b6008546001600160a01b03163314610f6557600080fd5b6001600160a01b038116610fb75760405162461bcd60e51b81526020600482015260196024820152780c1e0c081859191c995cdcc81b9bdd081c195c9b5a5d1d1959603a1b604482015260640161085c565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b60026000541415610ffc5760405162461bcd60e51b815260040161085c906143c4565b60026000908155818152600d60205260409020600101546001600160a01b03161580159061103c57506000818152600d602052604090206008015460ff16155b801561105f57506000818152600d6020526040902060080154610100900460ff16155b61109e5760405162461bcd60e51b815260206004820152601060248201526f24b73b30b634b21034ba32b69034b21760811b604482015260640161085c565b600034116110e55760405162461bcd60e51b815260206004820152601460248201527321b0b713ba1037b33332b9103737ba3434b7339760611b604482015260640161085c565b6110f3600780546001019055565b60006110fe60075490565b6040805160e0810182528281526020808201868152338385018181523460608087018281524260808901908152600060a08a0181815260c08b018281528d8352600f8b528c83208c51815599516001808c0191909155975160028b0180546001600160a01b039283166001600160a01b0319909116179055945160038b015592516004808b0191909155905160059099018054935115156101000261ff00199a15159a909a1661ffff1990941693909317989098179091558c8152600e885289812080548087018255908252888220018b90558581526010885289812080548087018255908252888220018b90558c8152600d88528990209384015493909501548851908616815295860193909352848701529451959650929493169286927f9078ebced75ce8ca9324d2ab0c437296b64a0eff2a049ae70dde1790b443ede1928290030190a35050600160005550565b6008546001600160a01b0316331461126657600080fd5b6001600160a01b0381166112b85760405162461bcd60e51b81526020600482015260196024820152780c1e0c081859191c995cdcc81b9bdd081c195c9b5a5d1d1959603a1b604482015260640161085c565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600260005414156112fd5760405162461bcd60e51b815260040161085c906143c4565b60026000908155818152600f6020908152604080832060010154808452600d909252909120600401546001600160a01b0316331461136f5760405162461bcd60e51b815260206004820152600f60248201526e2737ba1034ba32b69039b2b63632b960891b604482015260640161085c565b6000828152600f6020526040902060050154610100900460ff161580156113a857506000828152600f602052604090206005015460ff16155b6113f45760405162461bcd60e51b815260206004820152601e60248201527f416c7265616479206163636570746564206f722063616e63656c6c65642e0000604482015260640161085c565b6000828152600f602052604081206003810154600290910154600a5491926001600160a01b03909116916114339061142d856064613809565b9061381e565b6009549091506001600160a01b0316156114d8576009546040516303793c8d60e11b81523360048201526000916001600160a01b0316906306f2791a9060240160206040518083038186803b15801561148b57600080fd5b505afa15801561149f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c39190614045565b90506114d48161142d846064613809565b9150505b60006114e4848361385a565b604051909150339082156108fc029083906000818181858888f19350505050158015611514573d6000803e3d6000fd5b5081156115335781600b600082825461152d9190614504565b90915550505b6000858152600d6020818152604080842060018101548b8652600f8452918520600290810154958b905293909252918101546003909101546115929360ff600160a01b850416936001600160a01b039081169330939290911691613876565b6000868152600f602090815260408083206005808201805461ff001916610100179055898552600d9093529281902060088101805460ff1916600190811790915560029485015482850180546001600160a01b0319166001600160a01b039283161790558454820190945593810154938101549151919092169188917f1f4ecd8562ffa9ee0b2ae53cd3747ab603ad7fd1a39605f4a9cb2fc083cd7b6a916116459133918a916006909101908c906141e8565b60405180910390a4600c5461165a9085613aad565b600c555050600160005550505050565b6008546001600160a01b0316331461168157600080fd5b6001600160a01b03919091166000908152601160205260409020805460ff1916911515919091179055565b606060006116b960045490565b905060006116c660065490565b6005546116d39190614504565b6004546116e0919061455d565b9050600080826001600160401b038111156116fd576116fd614622565b60405190808252806020026020018201604052801561173657816020015b611723613acc565b81526020019060019003908161171b5790505b50905060005b8481101561199e576000600d81611754846001614504565b81526020810191909152604001600020600501546001600160a01b03161480156117a65750600d6000611788836001614504565b8152602081019190915260400160002060080154610100900460ff16155b80156117d55750600d60006117bc836001614504565b815260208101919091526040016000206008015460ff16155b1561198c576000600d816117ea846001614504565b81526020808201929092526040908101600090812054808252600d8452908290208251610160810184528154815260018201546001600160a01b03811695820195909552919450929091839190830190600160a01b900460ff166002811115611855576118556145f6565b6002811115611866576118666145f6565b8152600282015460208201526003820154604082015260048201546001600160a01b039081166060830152600583015416608082015260068201805460a0909201916118b190614574565b80601f01602080910402602001604051908101604052809291908181526020018280546118dd90614574565b801561192a5780601f106118ff5761010080835404028352916020019161192a565b820191906000526020600020905b81548152906001019060200180831161190d57829003601f168201915b50505091835250506007820154602082015260089091015460ff8082161515604084015261010090910416151560609091015284518590879081106119715761197161460c565b6020908102919091010152611987600186614504565b945050505b80611996816145af565b91505061173c565b50949350505050565b6008546001600160a01b031633146119be57600080fd5b600354811180156119d0575060648111155b611a115760405162461bcd60e51b815260206004820152601260248201527124b73b30b634b2103732bb9039b634b1b29760711b604482015260640161085c565b600355565b6060611a2160045490565b83108015611a3157506004548211155b611a725760405162461bcd60e51b81526020600482015260126024820152712830b3b29037baba1037b3103930b733b29760711b604482015260640161085c565b6000835b838111611aff576000818152600d60205260409020600501546001600160a01b0316158015611abc57506000818152600d6020526040902060080154610100900460ff16155b8015611ada57506000818152600d602052604090206008015460ff16155b15611aed5781611ae9816145af565b9250505b80611af7816145af565b915050611a76565b50600080826001600160401b03811115611b1b57611b1b614622565b604051908082528060200260200182016040528015611b5457816020015b611b41613acc565b815260200190600190039081611b395790505b509050855b858111610c30576000818152600d60205260409020600501546001600160a01b0316158015611b9f57506000818152600d6020526040902060080154610100900460ff16155b8015611bbd57506000818152600d602052604090206008015460ff16155b15611d5a576000818152600d6020908152604080832054808452928190208151610160810183528154815260018201546001600160a01b0381169482019490945290929091839190830190600160a01b900460ff166002811115611c2357611c236145f6565b6002811115611c3457611c346145f6565b8152600282015460208201526003820154604082015260048201546001600160a01b039081166060830152600583015416608082015260068201805460a090920191611c7f90614574565b80601f0160208091040260200160405190810160405280929190818152602001828054611cab90614574565b8015611cf85780601f10611ccd57610100808354040283529160200191611cf8565b820191906000526020600020905b815481529060010190602001808311611cdb57829003601f168201915b50505091835250506007820154602082015260089091015460ff808216151560408401526101009091041615156060909101528451859087908110611d3f57611d3f61460c565b6020908102919091010152611d55600186614504565b945050505b80611d64816145af565b915050611b59565b6000818152600e602090815260408083208054825181850281018501909352808352606094938493929190830182828015611dc657602002820191906000526020600020905b815481526020019060010190808311611db2575b5050505050905060005b8151811015611e7b57600f6000838381518110611def57611def61460c565b602090810291909101810151825281019190915260400160002060050154610100900460ff16158015611e565750600f6000838381518110611e3357611e3361460c565b60209081029190910181015182528101919091526040016000206005015460ff16155b15611e695782611e65816145af565b9350505b80611e73816145af565b915050611dd0565b506000826001600160401b03811115611e9657611e96614622565b604051908082528060200260200182016040528015611ecf57816020015b611ebc613b26565b815260200190600190039081611eb45790505b5090506000805b8351811015610f4357600f6000858381518110611ef557611ef561460c565b602090810291909101810151825281019190915260400160002060050154610100900460ff16158015611f5c5750600f6000858381518110611f3957611f3961460c565b60209081029190910181015182528101919091526040016000206005015460ff16155b15612028576000600f6000868481518110611f7957611f7961460c565b6020908102919091018101518252818101929092526040908101600020815160e0810183528154815260018201549381019390935260028101546001600160a01b03169183019190915260038101546060830152600481015460808301526005015460ff808216151560a084015261010090910416151560c08201528451909150819085908590811061200e5761200e61460c565b6020908102919091010152612024600184614504565b9250505b80612032816145af565b915050611ed6565b606061204560045490565b8310801561205557506004548211155b6120965760405162461bcd60e51b81526020600482015260126024820152712830b3b29037baba1037b3103930b733b29760711b604482015260640161085c565b600080845b848111612128576000818152600d60205260409020600401546001600160a01b0388811691161480156120e557506000818152600d6020526040902060080154610100900460ff16155b801561210357506000818152600d602052604090206008015460ff16155b1561211657612113600184614504565b92505b80612120816145af565b91505061209b565b506000826001600160401b0381111561214357612143614622565b60405190808252806020026020018201604052801561217c57816020015b612169613acc565b8152602001906001900390816121615790505b509050855b858111612398576000818152600d60205260409020600401546001600160a01b0389811691161480156121cb57506000818152600d6020526040902060080154610100900460ff16155b80156121e957506000818152600d602052604090206008015460ff16155b15612386576000818152600d6020908152604080832054808452928190208151610160810183528154815260018201546001600160a01b0381169482019490945290929091839190830190600160a01b900460ff16600281111561224f5761224f6145f6565b6002811115612260576122606145f6565b8152600282015460208201526003820154604082015260048201546001600160a01b039081166060830152600583015416608082015260068201805460a0909201916122ab90614574565b80601f01602080910402602001604051908101604052809291908181526020018280546122d790614574565b80156123245780601f106122f957610100808354040283529160200191612324565b820191906000526020600020905b81548152906001019060200180831161230757829003601f168201915b50505091835250506007820154602082015260089091015460ff80821615156040840152610100909104161515606090910152845185908790811061236b5761236b61460c565b6020908102919091010152612381600186614504565b945050505b80612390816145af565b915050612181565b509695505050505050565b600260005414156123c65760405162461bcd60e51b815260040161085c906143c4565b6002600055826124105760405162461bcd60e51b81526020600482015260156024820152744e6f206974656d20666f722066726565206865726560581b604482015260640161085c565b600084116124555760405162461bcd60e51b815260206004820152601260248201527120ba103632b0b9ba1037b732903a37b5b2b760711b604482015260640161085c565b6001600160a01b03871660009081526011602052604090205460ff1615156001146124c25760405162461bcd60e51b815260206004820152601b60248201527f546f6b656e20636f6e7472616374206e6f7420617070726f7665640000000000604482015260640161085c565b6124d0600480546001019055565b60006124db60045490565b9050604051806101600160405280828152602001896001600160a01b03168152602001886002811115612510576125106145f6565b8152602001878152602001868152602001336001600160a01b0316815260200160006001600160a01b0316815260200184848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250938552505050602080830188905260408084018390526060909301829052848252600d81529082902083518155908301516001820180546001600160a01b039092166001600160a01b031983168117825593850151929390916001600160a81b03191617600160a01b8360028111156125ed576125ed6145f6565b0217905550606082015160028201556080820151600382015560a08201516004820180546001600160a01b039283166001600160a01b03199182161790915560c084015160058401805491909316911617905560e0820151805161265b916006840191602090910190613b70565b50610100828101516007830155610120830151600890920180546101409094015161ffff1990941692151561ff00191692909217921515029190911790556126a7878933308a8a613876565b85886001600160a01b0316827fb14a35721f094e1cc300be4448eaca7bfd8ea84ec6ce595ef237cfdd3220d0e38833600089898c6040516126ed969594939291906143fb565b60405180910390a450506001600055505050505050565b600260005414156127275760405162461bcd60e51b815260040161085c906143c4565b60026000818155828152600f6020526040902001546001600160a01b03163314801561276557506000818152600f602052604090206005015460ff16155b6127c45760405162461bcd60e51b815260206004820152602a60248201527f57726f6e6720626964646572206f72206f6666657220697320616c72656164796044820152690818d85b98d95b1b195960b21b606482015260840161085c565b6000818152600f6020526040902060050154610100900460ff161561281f5760405162461bcd60e51b815260206004820152601160248201527020b63932b0b23c9030b1b1b2b83a32b21760791b604482015260640161085c565b6000818152600f6020526040808220600281015460058201805460ff1916600117905560039091015491516001600160a01b0390911692839280156108fc02929091818181858888f1935050505015801561287e573d6000803e3d6000fd5b5050600160005550565b6008546001600160a01b0316331461289f57600080fd5b6001600160a01b0381166128e65760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a59081dd85b1b195d60921b604482015260640161085c565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6060600061291560045490565b905060008060005b83811015612a55578686604051602001612938929190614166565b60405160208183030381529060405280519060200120600d600083600161295f9190614504565b81526020019081526020016000206006016040516020016129809190614176565b604051602081830303815290604052805190602001201480156129cd57506000600d816129ae846001614504565b81526020810191909152604001600020600501546001600160a01b0316145b8015612a015750600d60006129e3836001614504565b8152602081019190915260400160002060080154610100900460ff16155b8015612a305750600d6000612a17836001614504565b815260208101919091526040016000206008015460ff16155b15612a4357612a40600184614504565b92505b80612a4d816145af565b91505061291d565b506000826001600160401b03811115612a7057612a70614622565b604051908082528060200260200182016040528015612aa957816020015b612a96613acc565b815260200190600190039081612a8e5790505b50905060005b84811015612398578787604051602001612aca929190614166565b60405160208183030381529060405280519060200120600d6000836001612af19190614504565b8152602001908152602001600020600601604051602001612b129190614176565b60405160208183030381529060405280519060200120148015612b5f57506000600d81612b40846001614504565b81526020810191909152604001600020600501546001600160a01b0316145b8015612b935750600d6000612b75836001614504565b8152602081019190915260400160002060080154610100900460ff16155b8015612bc25750600d6000612ba9836001614504565b815260208101919091526040016000206008015460ff16155b15612d79576000600d81612bd7846001614504565b81526020808201929092526040908101600090812054808252600d8452908290208251610160810184528154815260018201546001600160a01b03811695820195909552919450929091839190830190600160a01b900460ff166002811115612c4257612c426145f6565b6002811115612c5357612c536145f6565b8152600282015460208201526003820154604082015260048201546001600160a01b039081166060830152600583015416608082015260068201805460a090920191612c9e90614574565b80601f0160208091040260200160405190810160405280929190818152602001828054612cca90614574565b8015612d175780601f10612cec57610100808354040283529160200191612d17565b820191906000526020600020905b815481529060010190602001808311612cfa57829003601f168201915b50505091835250506007820154602082015260089091015460ff808216151560408401526101009091041615156060909101528451859087908110612d5e57612d5e61460c565b6020908102919091010152612d74600186614504565b945050505b80612d83816145af565b915050612aaf565b6008546001600160a01b03163314612da257600080fd5b6001600160a01b038116612dea5760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b2103bb0b63632ba1760891b604482015260640161085c565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b600454811115612e1b57600080fd5b6000818152600d60205260409020600401546001600160a01b03163314612e4157600080fd5b6000818152600d6020526040902060080154610100900460ff16158015612e7a57506000818152600d602052604090206008015460ff16155b612e8357600080fd5b6000818152600d60205260409020600801805461ff001916610100179055612eaf600680546001019055565b6000818152600d6020526040902060018101546002820154600390920154612eef9260ff600160a01b840416926001600160a01b03169130913391613876565b50565b60106020528160005260406000208181548110610c5657600080fd5b6001600160a01b03831660009081526010602090815260408083208054825181850281018501909352808352606094938493929190830182828015612f7257602002820191906000526020600020905b815481526020019060010190808311612f5e575b509394508893505050505b84811161302657600f6000838381518110612f9a57612f9a61460c565b602090810291909101810151825281019190915260400160002060050154610100900460ff161580156130015750600f6000838381518110612fde57612fde61460c565b60209081029190910181015182528101919091526040016000206005015460ff16155b156130145782613010816145af565b9350505b8061301e816145af565b915050612f7d565b506000826001600160401b0381111561304157613041614622565b60405190808252806020026020018201604052801561307a57816020015b613067613b26565b81526020019060019003908161305f5790505b5090506000865b8681116131e357600f600085838151811061309e5761309e61460c565b602090810291909101810151825281019190915260400160002060050154610100900460ff161580156131055750600f60008583815181106130e2576130e261460c565b60209081029190910181015182528101919091526040016000206005015460ff16155b156131d1576000600f60008684815181106131225761312261460c565b6020908102919091018101518252818101929092526040908101600020815160e0810183528154815260018201549381019390935260028101546001600160a01b03169183019190915260038101546060830152600481015460808301526005015460ff808216151560a084015261010090910416151560c0820152845190915081908590859081106131b7576131b761460c565b60209081029190910101526131cd600184614504565b9250505b806131db816145af565b915050613081565b5090979650505050505050565b6000806131fc60065490565b6005546132099190614504565b600454610889919061455d565b600260005414156132395760405162461bcd60e51b815260040161085c906143c4565b60026000818155828152600d6020526040902060078101549101543482146132a35760405162461bcd60e51b815260206004820152601d60248201527f4e6f742074686520636f7272656374206d6573736167652076616c7565000000604482015260640161085c565b6000838152600d602052604090206008015460ff16156133055760405162461bcd60e51b815260206004820152601a60248201527f54686973206974656d20697320616c726561647920736f6c642e000000000000604482015260640161085c565b6000838152600d6020526040902060080154610100900460ff161561336c5760405162461bcd60e51b815260206004820152601a60248201527f54686973206974656d206973206e6f7420666f722073616c652e000000000000604482015260640161085c565b6000838152600d60205260409020600401546001600160a01b03163314156133d65760405162461bcd60e51b815260206004820152601960248201527f43616e6e6f742062757920796f7572206f776e206974656d2e00000000000000604482015260640161085c565b60006133e9600a5461142d856064613809565b6009549091506001600160a01b03161561348e576009546040516303793c8d60e11b81523360048201526000916001600160a01b0316906306f2791a9060240160206040518083038186803b15801561344157600080fd5b505afa158015613455573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134799190614045565b905061348a8161142d846064613809565b9150505b600061349a848361385a565b6000868152600d60205260408082206004015490519293506001600160a01b03169183156108fc0291849190818181858888f193505050501580156134e3573d6000803e3d6000fd5b5081600b60008282546134f69190614504565b90915550506000858152600d60205260409020600181015460039091015461353a9160ff600160a01b820416916001600160a01b0390911690309033908890613876565b6000858152600d6020526040902060088101805460ff19166001179055600590810180546001600160a01b031916331790556135799080546001019055565b600c546135869085613aad565b600c556000858152600d60205260409081902060018101546004820154925186936001600160a01b03928316938a937f1f4ecd8562ffa9ee0b2ae53cd3747ab603ad7fd1a39605f4a9cb2fc083cd7b6a936135ee939091169133916006909101908c906141e8565b60405180910390a450506001600055505050565b600061360d60055490565b905090565b6001546001600160a01b031633148061363557506002546001600160a01b031633145b8061364a57506008546001600160a01b031633145b61365357600080fd5b6000600b541161366257600080fd5b600061367760035461142d600b546064613809565b9050600061369082600b5461385a90919063ffffffff16565b6000600b8190556001546040519293506001600160a01b03169183156108fc0291849190818181858888f193505050501580156136d1573d6000803e3d6000fd5b506002546040516001600160a01b039091169083156108fc029084906000818181858888f1935050505015801561370c573d6000803e3d6000fd5b505050565b600d60205260009081526040902080546001820154600283015460038401546004850154600586015460068701805496976001600160a01b0380881698600160a01b90980460ff16979481169493169290919061376d90614574565b80601f016020809104026020016040519081016040528092919081815260200182805461379990614574565b80156137e65780601f106137bb576101008083540402835291602001916137e6565b820191906000526020600020905b8154815290600101906020018083116137c957829003601f168201915b50505050600783015460089093015491929160ff8082169250610100909104168b565b600080613816838561451c565b949350505050565b60008261382d57506000610889565b6000613839838561453e565b905082613846858361451c565b14613853576138536145ca565b9392505050565b60008282111561386c5761386c6145ca565b613853828461455d565b600086600281111561388a5761388a6145f6565b1415613900576040516323b872dd60e01b81526001600160a01b0385811660048301528481166024830152604482018490528616906323b872dd906064015b600060405180830381600087803b1580156138e357600080fd5b505af11580156138f7573d6000803e3d6000fd5b50505050613aa5565b6001866002811115613914576139146145f6565b141561396c57604051637921219560e11b81526001600160a01b0385811660048301528481166024830152604482018490526001606483015260a06084830152600060a483015286169063f242432a9060c4016138c9565b6002866002811115613980576139806145f6565b1415613aa5576001600160a01b038416301415613a195760405163095ea7b360e01b8152306004820152602481018290526001600160a01b0386169063095ea7b390604401602060405180830381600087803b1580156139df57600080fd5b505af11580156139f3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a179190613fa4565b505b6040516323b872dd60e01b81526001600160a01b0385811660048301528481166024830152604482018390528616906323b872dd90606401602060405180830381600087803b158015613a6b57600080fd5b505af1158015613a7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613aa39190613fa4565b505b505050505050565b600080613aba8385614504565b905083811015613853576138536145ca565b6040805161016081018252600080825260208201819052909182019081526000602082018190526040820181905260608083018290526080830182905260a083015260c0820181905260e082018190526101009091015290565b6040518060e00160405280600081526020016000815260200160006001600160a01b0316815260200160008152602001600081526020016000151581526020016000151581525090565b828054613b7c90614574565b90600052602060002090601f016020900481019282613b9e5760008555613be4565b82601f10613bb757805160ff1916838001178555613be4565b82800160010185558215613be4579182015b82811115613be4578251825591602001919060010190613bc9565b50613bf0929150613bf4565b5090565b5b80821115613bf05760008155600101613bf5565b80356001600160a01b0381168114613c2057600080fd5b919050565b600082601f830112613c3657600080fd5b813560206001600160401b03821115613c5157613c51614622565b8160051b613c608282016144d4565b838152828101908684018388018501891015613c7b57600080fd5b600093505b85841015613c9e578035835260019390930192918401918401613c80565b50979650505050505050565b600082601f830112613cbb57600080fd5b81356001600160401b03811115613cd457613cd4614622565b613ce7601f8201601f19166020016144d4565b818152846020838601011115613cfc57600080fd5b816020850160208301376000918101602001919091529392505050565b60008083601f840112613d2b57600080fd5b5081356001600160401b03811115613d4257600080fd5b602083019150836020828501011115613d5a57600080fd5b9250929050565b600060208284031215613d7357600080fd5b61385382613c09565b600080600080600060a08688031215613d9457600080fd5b613d9d86613c09565b9450613dab60208701613c09565b935060408601356001600160401b0380821115613dc757600080fd5b613dd389838a01613c25565b94506060880135915080821115613de957600080fd5b613df589838a01613c25565b93506080880135915080821115613e0b57600080fd5b50613e1888828901613caa565b9150509295509295909350565b600080600080600060a08688031215613e3d57600080fd5b613e4686613c09565b9450613e5460208701613c09565b9350604086013592506060860135915060808601356001600160401b03811115613e7d57600080fd5b613e1888828901613caa565b60008060408385031215613e9c57600080fd5b613ea583613c09565b91506020830135613eb581614638565b809150509250929050565b600080600080600080600060c0888a031215613edb57600080fd5b613ee488613c09565b9650602088013560038110613ef857600080fd5b955060408801359450606088013593506080880135925060a08801356001600160401b03811115613f2857600080fd5b613f348a828b01613d19565b989b979a50959850939692959293505050565b60008060408385031215613f5a57600080fd5b613f6383613c09565b946020939093013593505050565b600080600060608486031215613f8657600080fd5b613f8f84613c09565b95602085013595506040909401359392505050565b600060208284031215613fb657600080fd5b815161385381614638565b600060208284031215613fd357600080fd5b81356001600160e01b03198116811461385357600080fd5b60008060208385031215613ffe57600080fd5b82356001600160401b0381111561401457600080fd5b61402085828601613d19565b90969095509350505050565b60006020828403121561403e57600080fd5b5035919050565b60006020828403121561405757600080fd5b5051919050565b6000806040838503121561407157600080fd5b50508035926020909101359150565b6003811061409e57634e487b7160e01b600052602160045260246000fd5b9052565b6000815180845260005b818110156140c8576020818501810151868301820152016140ac565b818111156140da576000602083870101525b50601f01601f19169290920160200192915050565b600081546140fc81614574565b808552602060018381168015614119576001811461412d5761415b565b60ff1985168884015260408801955061415b565b866000528260002060005b858110156141535781548a8201860152908301908401614138565b890184019650505b505050505092915050565b8183823760009101908152919050565b600080835461418481614574565b6001828116801561419c57600181146141ad576141dc565b60ff198416875282870194506141dc565b8760005260208060002060005b858110156141d35781548a8201529084019082016141ba565b50505082870194505b50929695505050505050565b6001600160a01b03858116825284166020820152608060408201819052600090614214908301856140ef565b905082606083015295945050505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561432757603f19898403018552815180518452878101516001600160a01b031688850152868101516101609061428889870182614080565b50606082810151908601526080808301519086015260a0808301516001600160a01b03811682880152505060c0828101516001600160a01b03811687830152505060e08083015182828801526142e0838801826140a2565b92505050610100808301518187015250610120808301516143048288018215159052565b50506101409182015115159490910193909352938601939086019060010161424c565b509098975050505050505050565b602080825282518282018190526000919060409081850190868401855b828110156143b7578151805185528681015187860152858101516001600160a01b031686860152606080820151908601526080808201519086015260a08082015115159086015260c09081015115159085015260e09093019290850190600101614352565b5091979650505050505050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b8681526001600160a01b0386811660208301528516604082015260a06060820181905281018390526000838560c0840137600060c0858401015260c0601f19601f8601168301019050826080830152979650505050505050565b8b81526001600160a01b038b811660208301526000906101609061447c604085018e614080565b8b60608501528a6080850152808a1660a085015280891660c0850152508060e08401526144ab818401886140a2565b610100840196909652505091151561012083015215156101409091015298975050505050505050565b604051601f8201601f191681016001600160401b03811182821017156144fc576144fc614622565b604052919050565b60008219821115614517576145176145e0565b500190565b60008261453957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615614558576145586145e0565b500290565b60008282101561456f5761456f6145e0565b500390565b600181811c9082168061458857607f821691505b602082108114156145a957634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156145c3576145c36145e0565b5060010190565b634e487b7160e01b600052600160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b8015158114612eef57600080fdfea2646970667358221220c41f50b588772cd0977122454e7feaa244a2bc55778e8b7188e1e7e73bd6f4f964736f6c63430008060033

Verified Source Code Partial Match

Compiler: v0.8.6+commit.11564f7e EVM: berlin Optimization: Yes (200 runs)
ShiryoMarket.sol 1367 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

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

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256 id,
        uint256 value
    );

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(
        address indexed account,
        address indexed operator,
        bool approved
    );

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id)
        external
        view
        returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator)
        external
        view
        returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
        @dev Handles the receipt of a single ERC1155 token type. This function is
        called at the end of a `safeTransferFrom` after the balance has been updated.
        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. 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);
}

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount)
        external
        returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender)
        external
        view
        returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );
}

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(
        address indexed from,
        address indexed to,
        uint256 indexed tokenId
    );

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(
        address indexed owner,
        address indexed approved,
        uint256 indexed tokenId
    );

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(
        address indexed owner,
        address indexed operator,
        bool approved
    );

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId)
        external
        view
        returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator)
        external
        view
        returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}

// File: @openzeppelin/contracts/utils/ReentrancyGuard.sol

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

// For future use to allow buyers to receive a discount depending on staking or other rules.
interface IDiscountManager {
    function getDiscount(address buyer)
        external
        view
        returns (uint256 discount);
}

contract ShiryoMarket is IERC1155Receiver, ReentrancyGuard {
    using SafeMath for uint256;

    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }

     modifier onlyClevel() {
        require(msg.sender == walletA || msg.sender == walletB || msg.sender == owner);
    _;
    }

    address walletA;
    address walletB;
    uint256 walletBPercentage = 20;

    using Counters for Counters.Counter;
    Counters.Counter public _itemIds; // Id for each individual item
    Counters.Counter private _itemsSold; // Number of items sold
    Counters.Counter private _itemsCancelled; // Number of items sold
    Counters.Counter private _offerIds; // Tracking offers

    address payable public owner; // The owner of the market contract
    address public discountManager = address(0x0); // a contract that can be callled to discover if there is a discount on the transaction fee.

    uint256 public saleFeePercentage = 5; // Percentage fee paid to team for each sale
    uint256 public accumulatedFee = 0;

    uint256 public volumeTraded = 0; // Total amount traded

    enum TokenType {
        ERC721, //0
        ERC1155, //1
        ERC20 //2
    }

    constructor() {
        owner = payable(msg.sender);
    }

    struct MarketOffer {
        uint256 offerId;
        uint256 itemId;
        address payable bidder;
        uint256 offerAmount;
        uint256 offerTime;
        bool cancelled;
        bool accepted;
    }

    struct MarketItem {
        uint256 itemId;
        address tokenContract;
        TokenType tokenType;
        uint256 tokenId; // 0 If token is ERC20
        uint256 amount; // 1 unless QTY of ERC20
        address payable seller;
        address payable buyer;
        string category;
        uint256 price;
        bool isSold;
        bool cancelled;
    }

    mapping(uint256 => MarketItem) public idToMarketItem;

    mapping(uint256 => uint256[]) public itemIdToMarketOfferIds;

    mapping(uint256 => MarketOffer) public offerIdToMarketOffer;

    mapping(address => uint256[]) public bidderToMarketOfferIds;

    mapping(address => bool) public approvedSourceContracts;

    event MarketItemCreated(
        uint256 indexed itemId,
        address indexed tokenContract,
        uint256 indexed tokenId,
        uint256 amount,
        address seller,
        address owner,
        string category,
        uint256 price
    );

    event MarketSaleCreated(
        uint256 indexed itemId,
        address indexed tokenContract,
        uint256 indexed tokenId,
        address seller,
        address buyer,
        string category,
        uint256 price
    );

    event ItemOfferCreated(
        uint256 indexed itemId,
        address indexed tokenContract,
        address owner,
        address bidder,
        uint256 bidAmount
    );

    // transfers one of the token types to/from the contracts
    function transferAnyToken(
        TokenType _tokenType,
        address _tokenContract,
        address _from,
        address _to,
        uint256 _tokenId,
        uint256 _amount
    ) internal {
        // type = 0
        if (_tokenType == TokenType.ERC721) {
            //IERC721(_tokenContract).approve(address(this), _tokenId);
            IERC721(_tokenContract).transferFrom(_from, _to, _tokenId);
            return;
        }

        // type = 1
        if (_tokenType == TokenType.ERC1155) {
            IERC1155(_tokenContract).safeTransferFrom(
                _from,
                _to,
                _tokenId,
                1,
                ""
            ); // amount - only 1 of an ERC1155 per item
            return;
        }

        // type = 2
        if (_tokenType == TokenType.ERC20) {
            if (_from==address(this)){
                IERC20(_tokenContract).approve(address(this), _amount);
            }
            IERC20(_tokenContract).transferFrom(_from, _to, _amount); // amount - ERC20 can be multiple tokens per item (bundle)
            return;
        }
    }

   // market item functions
    
    // creates a market item by transferring it from the originating contract
    // the amount will be 1 for ERC721 or ERC1155
    // amount could be more for ERC20
    function createMarketItem(
        address _tokenContract,
        TokenType _tokenType,
        uint256 _tokenId,
        uint256 _amount,
        uint256 _price,
        string calldata _category
    ) public nonReentrant {
        require(_price > 0, "No item for free here");
        require(_amount > 0, "At least one token");
        require(approvedSourceContracts[_tokenContract]==true,"Token contract not approved");

        _itemIds.increment();
        uint256 itemId = _itemIds.current();
        idToMarketItem[itemId] = MarketItem(
            itemId,
            _tokenContract,
            _tokenType,
            _tokenId,
            _amount,
            payable(msg.sender),
            payable(address(0)), // No owner for the item
            _category,
            _price,
            false,
            false
        );

        transferAnyToken(
            _tokenType,
            _tokenContract,
            msg.sender,
            address(this),
            _tokenId,
            _amount
        );

        emit MarketItemCreated(
            itemId,
            _tokenContract,
            _tokenId,
            _amount,
            msg.sender,
            address(0),
            _category,
            _price
        );
    }

    // cancels a market item that's for sale
    function cancelMarketItem(uint256 itemId) public {
        require(itemId <= _itemIds.current());
        require(idToMarketItem[itemId].seller == msg.sender);
        require(
            idToMarketItem[itemId].cancelled == false &&
                idToMarketItem[itemId].isSold == false
        );

        idToMarketItem[itemId].cancelled = true;
        _itemsCancelled.increment();

        transferAnyToken(
            idToMarketItem[itemId].tokenType,
            idToMarketItem[itemId].tokenContract,
            address(this),
            msg.sender,
            idToMarketItem[itemId].tokenId,
            idToMarketItem[itemId].amount
        );
    }

    // buys an item at it's current sale value

    function createMarketSale(uint256 itemId) public payable nonReentrant {
        uint256 price = idToMarketItem[itemId].price;
        uint256 tokenId = idToMarketItem[itemId].tokenId;
        require(
            msg.value == price,
            "Not the correct message value"
        );
        require(
            idToMarketItem[itemId].isSold == false,
            "This item is already sold."
        );
        require(
            idToMarketItem[itemId].cancelled == false,
            "This item is not for sale."
        );
        require(
            idToMarketItem[itemId].seller != msg.sender,
            "Cannot buy your own item."
        );

        // take fees and transfer the balance to the seller (TODO)
        uint256 fees = SafeMath.div(price, 100).mul(saleFeePercentage);

        if (discountManager != address(0x0)) {
            // how much discount does this user get?
            uint256 feeDiscountPercent = IDiscountManager(discountManager)
                .getDiscount(msg.sender);
            fees = fees.div(100).mul(feeDiscountPercent);
        }

        uint256 saleAmount = price.sub(fees);
        idToMarketItem[itemId].seller.transfer(saleAmount);
        accumulatedFee+=fees;

        transferAnyToken(
            idToMarketItem[itemId].tokenType,
            idToMarketItem[itemId].tokenContract,
            address(this),
            msg.sender,
            tokenId,
            idToMarketItem[itemId].amount
        );

        idToMarketItem[itemId].isSold = true;
        idToMarketItem[itemId].buyer = payable(msg.sender);

        _itemsSold.increment();
        volumeTraded = volumeTraded.add(price);

        emit MarketSaleCreated(
            itemId,
            idToMarketItem[itemId].tokenContract,
            tokenId,
            idToMarketItem[itemId].seller,
            msg.sender,
            idToMarketItem[itemId].category,
            price
        );
    }

    function getMarketItemsByPage(uint256 _from, uint256 _to) external view returns (MarketItem[] memory) {
        require(_from < _itemIds.current() && _to <= _itemIds.current(), "Page out of range.");

        uint256 itemCount;
        for (uint256 i = _from; i <= _to; i++) {
            if (
                idToMarketItem[i].buyer == address(0) &&
                idToMarketItem[i].cancelled == false &&
                idToMarketItem[i].isSold == false
            ){
                itemCount++;
            }
        }

        uint256 currentIndex = 0;
        MarketItem[] memory marketItems = new MarketItem[](itemCount);
        for (uint256 i = _from; i <= _to; i++) {

             if (
                idToMarketItem[i].buyer == address(0) &&
                idToMarketItem[i].cancelled == false &&
                idToMarketItem[i].isSold == false
            ){
                uint256 currentId = idToMarketItem[i].itemId;
                MarketItem storage currentItem = idToMarketItem[currentId];
                marketItems[currentIndex] = currentItem;
                currentIndex += 1;
            }

        }
        return marketItems;
    }

    // returns all of the current items for sale
    function getMarketItems() external view returns (MarketItem[] memory) {
        uint256 itemCount = _itemIds.current();
        uint256 unsoldItemCount = _itemIds.current() -
            (_itemsSold.current() + _itemsCancelled.current());
        uint256 currentIndex = 0;

        MarketItem[] memory marketItems = new MarketItem[](unsoldItemCount);
        for (uint256 i = 0; i < itemCount; i++) {
            if (
                idToMarketItem[i + 1].buyer == address(0) &&
                idToMarketItem[i + 1].cancelled == false &&
                idToMarketItem[i + 1].isSold == false
            ) {
                uint256 currentId = idToMarketItem[i + 1].itemId;
                MarketItem storage currentItem = idToMarketItem[currentId];
                marketItems[currentIndex] = currentItem;
                currentIndex += 1;
            }
        }
        return marketItems;
    }

    // returns all itemsby seller and
    function getMarketItemsBySeller(address _seller)
        external
        view
        returns (MarketItem[] memory)
    {
        uint256 totalItemCount = _itemIds.current();
        uint256 itemCount = 0;
        uint256 currentIndex = 0;

        for (uint256 i = 0; i < totalItemCount; i++) {
            if (
                idToMarketItem[i + 1].seller == _seller &&
                idToMarketItem[i + 1].cancelled == false &&
                idToMarketItem[i + 1].isSold == false //&&
                //idToMarketItem[i + 1].tokenContract == _tokenContract
            ) {
                itemCount += 1; // No dynamic length. Predefined length has to be made
            }
        }

        MarketItem[] memory marketItems = new MarketItem[](itemCount);
        for (uint256 i = 0; i < totalItemCount; i++) {
            if (
                idToMarketItem[i + 1].seller == _seller &&
                idToMarketItem[i + 1].cancelled == false &&
                idToMarketItem[i + 1].isSold == false //&&
                //idToMarketItem[i + 1].tokenContract == _tokenContract
            ) {
                uint256 currentId = idToMarketItem[i + 1].itemId;
                MarketItem storage currentItem = idToMarketItem[currentId];
                marketItems[currentIndex] = currentItem;
                currentIndex += 1;
            }
        }
        return marketItems;
    }

       // returns all itemsby seller and
    function getMarketItemsBySellerByPage(address _seller, uint256 _from , uint256 _to)
        external
        view
        returns (MarketItem[] memory)
    {
        require(_from < _itemIds.current() && _to <= _itemIds.current(), "Page out of range.");

        uint256 itemCount = 0;
        uint256 currentIndex = 0;

        for (uint256 i = _from; i <= _to; i++) {
            if (
                idToMarketItem[i].seller == _seller &&
                idToMarketItem[i].cancelled == false &&
                idToMarketItem[i].isSold == false //&&
            ) {
                itemCount += 1; // No dynamic length. Predefined length has to be made
            }
        }

        MarketItem[] memory marketItems = new MarketItem[](itemCount);
        for (uint256 i =  _from; i <= _to; i++) {
            if (
                idToMarketItem[i].seller == _seller &&
                idToMarketItem[i].cancelled == false &&
                idToMarketItem[i].isSold == false //&&
            ) {
                uint256 currentId = idToMarketItem[i].itemId;
                MarketItem storage currentItem = idToMarketItem[currentId];
                marketItems[currentIndex] = currentItem;
                currentIndex += 1;
            }
        }
        return marketItems;
    }

    // Get items by category
    // This could be used with different collections
    function getItemsByCategory(string calldata category)
        external
        view
        returns (MarketItem[] memory)
    {
        uint256 totalItemCount = _itemIds.current();
        uint256 itemCount = 0;
        uint256 currentIndex = 0;

        for (uint256 i = 0; i < totalItemCount; i++) {
            if (
                keccak256(abi.encodePacked(idToMarketItem[i + 1].category)) ==
                keccak256(abi.encodePacked(category)) &&
                idToMarketItem[i + 1].buyer == address(0) &&
                idToMarketItem[i + 1].cancelled == false &&
                idToMarketItem[i + 1].isSold == false
            ) {
                itemCount += 1;
            }
        }

        MarketItem[] memory marketItems = new MarketItem[](itemCount);
        for (uint256 i = 0; i < totalItemCount; i++) {
            if (
                keccak256(abi.encodePacked(idToMarketItem[i + 1].category)) ==
                keccak256(abi.encodePacked(category)) &&
                idToMarketItem[i + 1].buyer == address(0) &&
                idToMarketItem[i + 1].cancelled == false &&
                idToMarketItem[i + 1].isSold == false
            ) {
                uint256 currentId = idToMarketItem[i + 1].itemId;
                MarketItem storage currentItem = idToMarketItem[currentId];
                marketItems[currentIndex] = currentItem;
                currentIndex += 1;
            }
        }
        return marketItems;
    }

       // returns the total number of items sold
    function getItemsSold() external view returns (uint256) {
        return _itemsSold.current();
    }

    // returns the current number of listed items
    function numberOfItemsListed() external view returns (uint256) {
        uint256 unsoldItemCount = _itemIds.current() -
            (_itemsSold.current() + _itemsCancelled.current());
        return unsoldItemCount;
    }



    // Offers functions
    // make offer
    // cancel offer
    // accept offer
    // offersByItem
    // offersByBidder


    function makeItemOffer(uint256 _itemId) public payable nonReentrant {
        require(
            idToMarketItem[_itemId].tokenContract != address(0x0) &&
                idToMarketItem[_itemId].isSold == false &&
                idToMarketItem[_itemId].cancelled == false,
            "Invalid item id."
        );
        require(msg.value > 0, "Can't offer nothing.");

        _offerIds.increment();
        uint256 offerId = _offerIds.current();

        MarketOffer memory offer = MarketOffer(
            offerId,
            _itemId,
            payable(msg.sender),
            msg.value,
            block.timestamp,
            false,
            false
        );

        offerIdToMarketOffer[offerId] = offer;
        itemIdToMarketOfferIds[_itemId].push(offerId);
        bidderToMarketOfferIds[msg.sender].push(offerId);

        emit ItemOfferCreated(
            _itemId,
            idToMarketItem[_itemId].tokenContract,
            idToMarketItem[_itemId].seller,
            msg.sender,
            msg.value
        );
    }

    function acceptItemOffer(uint256 _offerId) public nonReentrant {
        uint256 itemId = offerIdToMarketOffer[_offerId].itemId;

        require(idToMarketItem[itemId].seller == msg.sender, "Not item seller");

        require(
            offerIdToMarketOffer[_offerId].accepted == false &&
                offerIdToMarketOffer[_offerId].cancelled == false,
            "Already accepted or cancelled."
        );

        uint256 price = offerIdToMarketOffer[_offerId].offerAmount;
        address bidder = payable(offerIdToMarketOffer[_offerId].bidder);

        uint256 fees = SafeMath.div(price, 100).mul(saleFeePercentage);

        // fees and payment
        if (discountManager != address(0x0)) {
            // how much discount does this user get?
            uint256 feeDiscountPercent = IDiscountManager(discountManager)
                .getDiscount(msg.sender);
            fees = fees.div(100).mul(feeDiscountPercent);
        }

        uint256 saleAmount = price.sub(fees);
        payable(msg.sender).transfer(saleAmount);
        if (fees > 0) {
            accumulatedFee+=fees;
        }

        transferAnyToken(
            idToMarketItem[itemId].tokenType,
            idToMarketItem[itemId].tokenContract,
            address(this),
            offerIdToMarketOffer[_offerId].bidder,
            idToMarketItem[itemId].tokenId,
            idToMarketItem[itemId].amount
        );

        offerIdToMarketOffer[_offerId].accepted = true;
        
        idToMarketItem[itemId].isSold = true;
        idToMarketItem[itemId].buyer = offerIdToMarketOffer[_offerId].bidder;

        _itemsSold.increment();

        emit MarketSaleCreated(
            itemId,
            idToMarketItem[itemId].tokenContract,
            idToMarketItem[itemId].tokenId,
            msg.sender,
            bidder,
            idToMarketItem[itemId].category,
            price
        );

        volumeTraded = volumeTraded.add(price);
    }

    function canceItemOffer(uint256 _offerId) public nonReentrant {
        require(
            offerIdToMarketOffer[_offerId].bidder == msg.sender &&
                offerIdToMarketOffer[_offerId].cancelled == false,
            "Wrong bidder or offer is already cancelled"
        );
        require(
            offerIdToMarketOffer[_offerId].accepted == false,
            "Already accepted."
        );

        address bidder = offerIdToMarketOffer[_offerId].bidder;

        offerIdToMarketOffer[_offerId].cancelled = true;
        payable(bidder).transfer(offerIdToMarketOffer[_offerId].offerAmount);

        //TODO emit
    }

     function getOffersByBidder(address _bidder)
        external
        view
        returns (MarketOffer[] memory)
    {
        uint256 openOfferCount = 0;
        uint256[] memory itemOfferIds = bidderToMarketOfferIds[_bidder];

        for (uint256 i = 0; i < itemOfferIds.length; i++) {
            if (
                offerIdToMarketOffer[itemOfferIds[i]].accepted == false &&
                offerIdToMarketOffer[itemOfferIds[i]].cancelled == false
            ) {
                openOfferCount++;
            }
        }

        MarketOffer[] memory openOffers = new MarketOffer[](openOfferCount);
        uint256 currentIndex = 0;
        for (uint256 i = 0; i < itemOfferIds.length; i++) {
            if (
                offerIdToMarketOffer[itemOfferIds[i]].accepted == false &&
                offerIdToMarketOffer[itemOfferIds[i]].cancelled == false
            ) {
                MarketOffer memory currentItem = offerIdToMarketOffer[
                    itemOfferIds[i]
                ];
                openOffers[currentIndex] = currentItem;
                currentIndex += 1;
            }
        }

        return openOffers;
    }

     function getTotalOffersMadeByBidder(address _bidder) external view returns (uint256){
         return bidderToMarketOfferIds[_bidder].length;
     }

     function getOpenOffersByBidderByPage(address _bidder, uint256 _from , uint256 _to)
        external
        view
        returns (MarketOffer[] memory)
    {
        uint256 openOfferCount = 0;
        uint256[] memory itemOfferIds = bidderToMarketOfferIds[_bidder];

        for (uint256 i = _from; i <= _to; i++) {
            if (
                offerIdToMarketOffer[itemOfferIds[i]].accepted == false &&
                offerIdToMarketOffer[itemOfferIds[i]].cancelled == false
            ) {
                openOfferCount++;
            }
        }

        MarketOffer[] memory openOffers = new MarketOffer[](openOfferCount);
        uint256 currentIndex = 0;
        for (uint256 i = _from; i <= _to; i++) {
            if (
                offerIdToMarketOffer[itemOfferIds[i]].accepted == false &&
                offerIdToMarketOffer[itemOfferIds[i]].cancelled == false
            ) {
                MarketOffer memory currentItem = offerIdToMarketOffer[
                    itemOfferIds[i]
                ];
                openOffers[currentIndex] = currentItem;
                currentIndex += 1;
            }
        }

        return openOffers;
    }

    function getItemOffers(uint256 _itemId)
        external
        view
        returns (MarketOffer[] memory)
    {
        uint256 openOfferCount = 0;
        uint256[] memory itemOfferIds = itemIdToMarketOfferIds[_itemId];

        for (uint256 i = 0; i < itemOfferIds.length; i++) {
            if (
                offerIdToMarketOffer[itemOfferIds[i]].accepted == false &&
                offerIdToMarketOffer[itemOfferIds[i]].cancelled == false
            ) {
                openOfferCount++;
            }
        }

        MarketOffer[] memory openOffers = new MarketOffer[](openOfferCount);
        uint256 currentIndex = 0;
        for (uint256 i = 0; i < itemOfferIds.length; i++) {
            if (
                offerIdToMarketOffer[itemOfferIds[i]].accepted == false &&
                offerIdToMarketOffer[itemOfferIds[i]].cancelled == false
            ) {
                MarketOffer memory currentItem = offerIdToMarketOffer[
                    itemOfferIds[i]
                ];
                openOffers[currentIndex] = currentItem;
                currentIndex += 1;
            }
        }

        return openOffers;
    }

    // administration functions
    function setSalePercentageFee(uint256 _amount) public onlyOwner {
        require(_amount <= 5, "5% maximum fee allowed.");
        saleFeePercentage = _amount;
    }

    function setOwner(address _owner) public onlyOwner {
        require(_owner != address(0x0), "0x0 address not permitted");
        owner = payable(_owner);
    }

    function setDiscountManager(address _discountManager) public onlyOwner {
        require(_discountManager != address(0x0), "0x0 address not permitted");
        discountManager = _discountManager;
    }

    function setSourceContractApproved(address _tokenContract, bool _approved) external onlyOwner {
        approvedSourceContracts[_tokenContract]=_approved;
    }


    // IERC1155Receiver implementations

    function onERC1155Received(
        address,
        address,
        uint256,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155Received.selector;
    }

    function onERC1155BatchReceived(
        address,
        address,
        uint256[] memory,
        uint256[] memory,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155BatchReceived.selector;
    }


    function supportsInterface(bytes4 interfaceId) override external pure returns (bool){
            return interfaceId == type(IERC1155Receiver).interfaceId
            || true;
    }

    function withdraw_all() external onlyClevel {
        require (accumulatedFee > 0);
        uint256 amountB = SafeMath.div(accumulatedFee,100).mul(walletBPercentage);
        uint256 amountA = accumulatedFee.sub(amountB);
        accumulatedFee = 0;
        payable(walletA).transfer(amountA);
        payable(walletB).transfer(amountB);
    }

    function setWalletA(address _walletA) external onlyOwner {
        require (_walletA != address(0x0), "Invalid wallet");
        walletA = _walletA;
    }

    function setWalletB(address _walletB) external onlyOwner {
        require (_walletB != address(0x0), "Invalid wallet.");
        walletB = _walletB;
    }

    function setWalletBPercentage(uint256 _percentage) external onlyOwner {
        require (_percentage>walletBPercentage && _percentage<=100, "Invalid new slice.");
        walletBPercentage = _percentage;
    }

}

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

library SafeMath {
    /**
     * @dev Multiplies two numbers, throws on overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }
        uint256 c = a * b;
        assert(c / a == b);
        return c;
    }

    /**
     * @dev Integer division of two numbers, truncating the quotient.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        // assert(b > 0); // Solidity automatically throws when dividing by 0
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold
        return c;
    }

    /**
     * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        assert(b <= a);
        return a - b;
    }

    /**
     * @dev Adds two numbers, throws on overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        assert(c >= a);
        return c;
    }
}

Read Contract

_itemIds 0x34a7f193 → uint256
accumulatedFee 0xf8ce3164 → uint256
approvedSourceContracts 0x6a6e4c38 → bool
bidderToMarketOfferIds 0xa7fa49c5 → uint256
discountManager 0x7ee87a27 → address
getItemOffers 0x43b555dd → tuple[]
getItemsByCategory 0x95478fbf → tuple[]
getItemsSold 0xc4b15141 → uint256
getMarketItems 0x29aa3a42 → tuple[]
getMarketItemsByPage 0x2aa74ce4 → tuple[]
getMarketItemsBySeller 0x023d20b0 → tuple[]
getMarketItemsBySellerByPage 0x450defaa → tuple[]
getOffersByBidder 0x11199285 → tuple[]
getOpenOffersByBidderByPage 0xaad48c17 → tuple[]
getTotalOffersMadeByBidder 0x71029ffd → uint256
idToMarketItem 0xe61a70c0 → uint256, address, uint8, uint256, uint256, address, address, string, uint256, bool, bool
itemIdToMarketOfferIds 0x0761b9bd → uint256
numberOfItemsListed 0xb027a725 → uint256
offerIdToMarketOffer 0xa28ad112 → uint256, uint256, address, uint256, uint256, bool, bool
owner 0x8da5cb5b → address
saleFeePercentage 0x7be3f006 → uint256
supportsInterface 0x01ffc9a7 → bool
volumeTraded 0xb1433f7f → uint256

Write Contract 16 functions

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

acceptItemOffer 0x1e7c9e18
uint256 _offerId
canceItemOffer 0x4a63421c
uint256 _offerId
cancelMarketItem 0xa6e22b02
uint256 itemId
createMarketItem 0x46c4a388
address _tokenContract
uint8 _tokenType
uint256 _tokenId
uint256 _amount
uint256 _price
string _category
createMarketSale 0xbe9af536
uint256 itemId
makeItemOffer 0x166117e8
uint256 _itemId
onERC1155BatchReceived 0xbc197c81
address
address
uint256[]
uint256[]
bytes
returns: bytes4
onERC1155Received 0xf23a6e61
address
address
uint256
uint256
bytes
returns: bytes4
setDiscountManager 0x17ce4f1e
address _discountManager
setOwner 0x13af4035
address _owner
setSalePercentageFee 0x01839ee3
uint256 _amount
setSourceContractApproved 0x2211fec4
address _tokenContract
bool _approved
setWalletA 0x4c89b86c
address _walletA
setWalletB 0x96cbf2e9
address _walletB
setWalletBPercentage 0x2a983a04
uint256 _percentage
withdraw_all 0xdd473d2b
No parameters

Token Balances (1)

View Transfers →
WETH 0

Recent Transactions

No transactions found for this address