Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x9ffc3bCDe7B68C46a6dC34f0718009925c1867cB
Balance 0 ETH
Nonce 1
Code Size 18823 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

18823 bytes
0x608060405234801561001057600080fd5b50600436106101585760003560e01c8063a9059cbb116100c3578063ceb35b0f1161007c578063ceb35b0f1461088f578063d4bf51a714610982578063dd62ed3e14610a89578063e9e211bd14610b01578063ee8ca3b514610bde578063f691b71a14610c2057610158565b8063a9059cbb14610645578063abd108ba146106ab578063b07ed3a9146106f5578063b187bd261461073f578063b1d3e05e14610761578063c8e369bf1461077f57610158565b8063521cb59011610115578063521cb590146104095780635dd882dd1461044f57806370a082311461046d5780638456cb59146104c557806391c40bf7146104cf57806395d89b41146105c257610158565b806306fdde031461015d578063095ea7b3146101e057806318160ddd1461024657806323b872dd146102645780632c2df742146102ea578063313ce567146103e5575b600080fd5b610165610dbe565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a557808201518184015260208101905061018a565b50505050905090810190601f1680156101d25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61022c600480360360408110156101f657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610df7565b604051808215151515815260200191505060405180910390f35b61024e61107a565b6040518082815260200191505060405180910390f35b6102d06004803603606081101561027a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611124565b604051808215151515815260200191505060405180910390f35b6103e36004803603606081101561030057600080fd5b810190808035906020019064010000000081111561031d57600080fd5b82018360208201111561032f57600080fd5b8035906020019184600183028401116401000000008311171561035157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113dc565b005b6103ed6116ea565b604051808260ff1660ff16815260200191505060405180910390f35b6104356004803603602081101561041f57600080fd5b81019080803590602001909291905050506116ef565b604051808215151515815260200191505060405180910390f35b6104576117d9565b6040518082815260200191505060405180910390f35b6104af6004803603602081101561048357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117e3565b6040518082815260200191505060405180910390f35b6104cd6118c6565b005b6105a8600480360360408110156104e557600080fd5b810190808035906020019064010000000081111561050257600080fd5b82018360208201111561051457600080fd5b8035906020019184600183028401116401000000008311171561053657600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061196f565b604051808215151515815260200191505060405180910390f35b6105ca611e64565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561060a5780820151818401526020810190506105ef565b50505050905090810190601f1680156106375780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6106916004803603604081101561065b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611e9d565b604051808215151515815260200191505060405180910390f35b6106b3612120565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106fd61214a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6107476121f4565b604051808215151515815260200191505060405180910390f35b61076961220a565b6040518082815260200191505060405180910390f35b6108386004803603602081101561079557600080fd5b81019080803590602001906401000000008111156107b257600080fd5b8201836020820111156107c457600080fd5b803590602001918460018302840111640100000000831117156107e657600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050612214565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561087b578082015181840152602081019050610860565b505050509050019250505060405180910390f35b610968600480360360408110156108a557600080fd5b81019080803590602001906401000000008111156108c257600080fd5b8201836020820111156108d457600080fd5b803590602001918460018302840111640100000000831117156108f657600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612234565b604051808215151515815260200191505060405180910390f35b610a6f6004803603608081101561099857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156109df57600080fd5b8201836020820111156109f157600080fd5b80359060200191846001830284011164010000000083111715610a1357600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019092919050505061267f565b604051808215151515815260200191505060405180910390f35b610aeb60048036036040811015610a9f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612c62565b6040518082815260200191505060405180910390f35b610bc460048036036040811015610b1757600080fd5b8101908080359060200190640100000000811115610b3457600080fd5b820183602082011115610b4657600080fd5b80359060200191846001830284011164010000000083111715610b6857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050612d7a565b604051808215151515815260200191505060405180910390f35b610c0a60048036036020811015610bf457600080fd5b8101908080359060200190929190505050613263565b6040518082815260200191505060405180910390f35b610da4600480360360a0811015610c3657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190640100000000811115610c7d57600080fd5b820183602082011115610c8f57600080fd5b80359060200191846001830284011164010000000083111715610cb157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190640100000000811115610d1457600080fd5b820183602082011115610d2657600080fd5b80359060200191846001830284011164010000000083111715610d4857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290803590602001909291905050506133bb565b604051808215151515815260200191505060405180910390f35b6040518060400160405280600981526020017f48756f626920444f54000000000000000000000000000000000000000000000081525081565b60008060009054906101000a900460ff1615610e7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f697420697320706175736564206e6f770000000000000000000000000000000081525060200191505060405180910390fd5b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166311a02e483386866040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610f5a57600080fd5b505af1158015610f6e573d6000803e3d6000fd5b505050506040513d6020811015610f8457600080fd5b810190808051906020019092919050505090508061100a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f617070726f7665206661696c656400000000000000000000000000000000000081525060200191505060405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a3600191505092915050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c4e41b226040518163ffffffff1660e01b815260040160206040518083038186803b1580156110e457600080fd5b505afa1580156110f8573d6000803e3d6000fd5b505050506040513d602081101561110e57600080fd5b8101908080519060200190929190505050905090565b60008060009054906101000a900460ff16156111a8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f697420697320706175736564206e6f770000000000000000000000000000000081525060200191505060405180910390fd5b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638d7e3ef3338787876040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001945050505050602060405180830381600087803b1580156112bb57600080fd5b505af11580156112cf573d6000803e3d6000fd5b505050506040513d60208110156112e557600080fd5b810190808051906020019092919050505090508061136b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f7472616e7366657246726f6d206661696c65640000000000000000000000000081525060200191505060405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b6000809054906101000a900460ff1661145d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f6974206973206e6f7420706175736564206e6f7700000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611500576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f77726f6e6720616464726573730000000000000000000000000000000000000081525060200191505060405180910390fd5b600061150d848484613b53565b905080156116e4576000846040516020018082805190602001908083835b6020831061154e578051825260208201915060208101905060208303925061152b565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040528051906020012090507f397bc5b97f629151e68146caedba62f10b47e426b38db589771a288c0861f18260001b8114156115fc5782600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506116e2565b7fe41d88711b08bdcd7556c5d2d24e0da6fa1f614cf2055f4d7e10206017cd168060001b8114156116e157600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b0d80346846040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1580156116c857600080fd5b505af11580156116dc573d6000803e3d6000fd5b505050505b5b505b50505050565b601281565b600061171e7f02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c060001b33613f8b565b611790576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f6e6c7920757365206f776e657220746f2063616c6c0000000000000000000081525060200191505060405180910390fd5b61179982614056565b7f468b360fa155a4c5fdf0cb38ce238407e41508a56023e7536088c21b2cd64139826040518082815260200191505060405180910390a160019050919050565b6000600454905090565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561188457600080fd5b505afa158015611898573d6000803e3d6000fd5b505050506040513d60208110156118ae57600080fd5b81019080805190602001909291905050509050919050565b6118f37f0cc58340b26c619cd4edc70f833d3f4d9d26f3ae7d5ef2965f81fe5495049a4f60001b33613f8b565b611965576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f77726f6e67207573657220746f2070617573657200000000000000000000000081525060200191505060405180910390fd5b61196d61408f565b565b600061199e7f02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c060001b33613f8b565b611a10576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f6e6c7920757365206f776e657220746f2063616c6c0000000000000000000081525060200191505060405180910390fd5b6000611a1b84614102565b90507fe41d88711b08bdcd7556c5d2d24e0da6fa1f614cf2055f4d7e10206017cd168060001b8114158015611a7357507f397bc5b97f629151e68146caedba62f10b47e426b38db589771a288c0861f18260001b8114155b611ae5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f77726f6e6720636c61737300000000000000000000000000000000000000000081525060200191505060405180910390fd5b611aef8184613f8b565b611b61576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f6e6f20737563682061646472657373206578697374000000000000000000000081525060200191505060405180910390fd5b7f02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c060001b811415611c0c57600454611b98826141fd565b11611c0b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f696e7375666669656e636520616464726573736573000000000000000000000081525060200191505060405180910390fd5b5b6000848460405160200180807f64726f7041646472657373000000000000000000000000000000000000000000815250600b0183805190602001908083835b60208310611c6e5780518252602082019150602081019050602083039250611c4b565b6001836020036101000a0380198251168184511680821785525050505050509050018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b815260140192505050604051602081830303815290604052805190602001209050611ceb8133614220565b600454611cf7826141fd565b10611e5757611d0682856143ab565b7fb02ddf2800cd4468f7eb14268a7c9f1b6e816aa425ed542d13d8d3a96fa445668585866040518080602001806020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381038352600b8152602001807f64726f7041646472657373000000000000000000000000000000000000000000815250602001838103825286818151815260200191508051906020019080838360005b83811015611e06578082015181840152602081019050611deb565b50505050905090810190601f168015611e335780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a1611e4c81614056565b600192505050611e5e565b6000925050505b92915050565b6040518060400160405280600481526020017f48444f540000000000000000000000000000000000000000000000000000000081525081565b60008060009054906101000a900460ff1615611f21576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f697420697320706175736564206e6f770000000000000000000000000000000081525060200191505060405180910390fd5b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637ea560783386866040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561200057600080fd5b505af1158015612014573d6000803e3d6000fd5b505050506040513d602081101561202a57600080fd5b81019080805190602001909291905050509050806120b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f7472616e73666572206661696c6564000000000000000000000000000000000081525060200191505060405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b07ed3a96040518163ffffffff1660e01b815260040160206040518083038186803b1580156121b457600080fd5b505afa1580156121c8573d6000803e3d6000fd5b505050506040513d60208110156121de57600080fd5b8101908080519060200190929190505050905090565b60008060009054906101000a900460ff16905090565b6000600554905090565b6060600061222183614102565b905061222c816145d2565b915050919050565b60006122637f02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c060001b33613f8b565b6122d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f6e6c7920757365206f776e657220746f2063616c6c0000000000000000000081525060200191505060405180910390fd5b60006122e084614102565b90507fe41d88711b08bdcd7556c5d2d24e0da6fa1f614cf2055f4d7e10206017cd168060001b811415801561233857507f397bc5b97f629151e68146caedba62f10b47e426b38db589771a288c0861f18260001b8114155b6123aa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f77726f6e6720636c61737300000000000000000000000000000000000000000081525060200191505060405180910390fd5b6123b48184613f8b565b15612427576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f61646472657373206578697374656420616c726561647900000000000000000081525060200191505060405180910390fd5b6000848460405160200180807f6164644164647265737300000000000000000000000000000000000000000000815250600a0183805190602001908083835b602083106124895780518252602082019150602081019050602083039250612466565b6001836020036101000a0380198251168184511680821785525050505050509050018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b8152601401925050506040516020818303038152906040528051906020012090506125068133614220565b600454612512826141fd565b10612672576125218285614220565b7fb02ddf2800cd4468f7eb14268a7c9f1b6e816aa425ed542d13d8d3a96fa445668585866040518080602001806020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381038352600a8152602001807f6164644164647265737300000000000000000000000000000000000000000000815250602001838103825286818151815260200191508051906020019080838360005b83811015612621578082015181840152602081019050612606565b50505050905090810190601f16801561264e5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a161266781614056565b600192505050612679565b6000925050505b92915050565b60008060009054906101000a900460ff1615612703576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f697420697320706175736564206e6f770000000000000000000000000000000081525060200191505060405180910390fd5b6127307f46a52cf33029de9f84853745a87af28464c80bf0346df1b32e205fc73319f62260001b33613f8b565b6127a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f77726f6e67206f70657261746f7200000000000000000000000000000000000081525060200191505060405180910390fd5b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ac1348f786888787336005546040518763ffffffff1660e01b8152600401808781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825286818151815260200191508051906020019080838360005b838110156128af578082015181840152602081019050612894565b50505050905090810190601f1680156128dc5780820380516001836020036101000a031916815260200191505b50975050505050505050602060405180830381600087803b15801561290057600080fd5b505af1158015612914573d6000803e3d6000fd5b505050506040513d602081101561292a57600080fd5b810190808051906020019092919050505090506001811415612a3a578573ffffffffffffffffffffffffffffffffffffffff167f0416081e24ea042d7f2160192c1d6bef74c76f5f4fffeb36c5dcc9e4a5dcf9b486863360405180848152602001806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b838110156129f95780820151818401526020810190506129de565b50505050905090810190601f168015612a265780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a2612c55565b6003811415612c54578573ffffffffffffffffffffffffffffffffffffffff167f0416081e24ea042d7f2160192c1d6bef74c76f5f4fffeb36c5dcc9e4a5dcf9b486863360405180848152602001806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818151815260200191508051906020019080838360005b83811015612af6578082015181840152602081019050612adb565b50505050905090810190601f168015612b235780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a28573ffffffffffffffffffffffffffffffffffffffff167fe7cd4ce7f2a465edc730269a1305e8a48bad821e8fb7e152ec413829c01a53c486866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612bb2578082015181840152602081019050612b97565b50505050905090810190601f168015612bdf5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a28573ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a35b5b6001915050949350505050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c7c7e9ea84846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015612d3757600080fd5b505afa158015612d4b573d6000803e3d6000fd5b505050506040513d6020811015612d6157600080fd5b8101908080519060200190929190505050905092915050565b6000612da97f02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c060001b33613f8b565b612e1b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f6e6c7920757365206f776e657220746f2063616c6c0000000000000000000081525060200191505060405180910390fd5b6000612e2684614102565b90507f46a52cf33029de9f84853745a87af28464c80bf0346df1b32e205fc73319f62260001b811480612e7b57507f02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c060001b81145b612eed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f77726f6e6720636c61737300000000000000000000000000000000000000000081525060200191505060405180910390fd5b7f02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c060001b811415612fba57612f447f02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c060001b6141fd565b831115612fb9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f6e756d206c6172676572207468616e2065786973746564206f776e657273000081525060200191505060405180910390fd5b5b6000848460405160200180807f726573657452657175697265644e756d0000000000000000000000000000000081525060100183805190602001908083835b6020831061301c5780518252602082019150602081019050602083039250612ff9565b6001836020036101000a0380198251168184511680821785525050505050509050018281526020019250505060405160208183030381529060405280519060200120905061306a8133614220565b600454613076826141fd565b106132575761308481614056565b60008090507f02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c060001b8314156130c557600454905084600481905550613170565b7f46a52cf33029de9f84853745a87af28464c80bf0346df1b32e205fc73319f62260001b8314156131015760055490508460058190555061316f565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f77726f6e6720636c61737300000000000000000000000000000000000000000081525060200191505060405180910390fd5b5b7fce49fc04234925e87b95750e0e50cac6d4ffcf8a696e3316b3e13bedc84ee7a8868287604051808060200180602001858152602001848152602001838103835260108152602001807f726573657452657175697265644e756d00000000000000000000000000000000815250602001838103825286818151815260200191508051906020019080838360005b838110156132185780820151818401526020810190506131fd565b50505050905090810190601f1680156132455780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a1505b60019250505092915050565b60006132927f46a52cf33029de9f84853745a87af28464c80bf0346df1b32e205fc73319f62260001b33613f8b565b613304576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f77726f6e67206f70657261746f7200000000000000000000000000000000000081525060200191505060405180910390fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ee8ca3b5836040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561337957600080fd5b505af115801561338d573d6000803e3d6000fd5b505050506040513d60208110156133a357600080fd5b81019080805190602001909291905050509050919050565b60008060009054906101000a900460ff161561343f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f697420697320706175736564206e6f770000000000000000000000000000000081525060200191505060405180910390fd5b61346c7f46a52cf33029de9f84853745a87af28464c80bf0346df1b32e205fc73319f62260001b33613f8b565b6134de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f77726f6e67206f70657261746f7200000000000000000000000000000000000081525060200191505060405180910390fd5b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323d3eb368888888888336005546040518863ffffffff1660e01b8152600401808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200187815260200180602001806020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001838103835288818151815260200191508051906020019080838360005b838110156135f05780820151818401526020810190506135d5565b50505050905090810190601f16801561361d5780820380516001836020036101000a031916815260200191505b50838103825287818151815260200191508051906020019080838360005b8381101561365657808201518184015260208101905061363b565b50505050905090810190601f1680156136835780820380516001836020036101000a031916815260200191505b509950505050505050505050602060405180830381600087803b1580156136a957600080fd5b505af11580156136bd573d6000803e3d6000fd5b505050506040513d60208110156136d357600080fd5b810190808051906020019092919050505090506001811415613850578673ffffffffffffffffffffffffffffffffffffffff167ff5577aec900779fdc4060207f95a90077d57e4ac39af49c805a073b9b1b852ea878688336040518085815260200180602001806020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838103835286818151815260200191508051906020019080838360005b838110156137a757808201518184015260208101905061378c565b50505050905090810190601f1680156137d45780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561380d5780820151818401526020810190506137f2565b50505050905090810190601f16801561383a5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a2613b45565b6003811415613b44578673ffffffffffffffffffffffffffffffffffffffff167ff5577aec900779fdc4060207f95a90077d57e4ac39af49c805a073b9b1b852ea878688336040518085815260200180602001806020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838103835286818151815260200191508051906020019080838360005b838110156139115780820151818401526020810190506138f6565b50505050905090810190601f16801561393e5780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b8381101561397757808201518184015260208101905061395c565b50505050905090810190601f1680156139a45780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a28673ffffffffffffffffffffffffffffffffffffffff167fe7fe72e51b458dcd29475a3be9675669af7aa5c3d7e9161fdb6cbba71803dd50878688604051808481526020018060200180602001838103835285818151815260200191508051906020019080838360005b83811015613a3a578082015181840152602081019050613a1f565b50505050905090810190601f168015613a675780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b83811015613aa0578082015181840152602081019050613a85565b50505050905090810190601f168015613acd5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef886040518082815260200191505060405180910390a35b5b600191505095945050505050565b6000613b827f02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c060001b33613f8b565b613bf4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f6f6e6c7920757365206f776e657220746f2063616c6c0000000000000000000081525060200191505060405180910390fd5b6000613bff85614102565b9050613c0b8184613f8b565b15613c7e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f61646472657373206578697374656420616c726561647900000000000000000081525060200191505060405180910390fd5b613c888185613f8b565b613cfa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f61646472657373206e6f7420657869737465640000000000000000000000000081525060200191505060405180910390fd5b600085858560405160200180807f6d6f646966794164647265737300000000000000000000000000000000000000815250600d0184805190602001908083835b60208310613d5d5780518252602082019150602081019050602083039250613d3a565b6001836020036101000a0380198251168184511680821785525050505050509050018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014019350505050604051602081830303815290604052805190602001209050613e108133614220565b600454613e1c826141fd565b10613f7d57613e2c828686614676565b7fb02ddf2800cd4468f7eb14268a7c9f1b6e816aa425ed542d13d8d3a96fa445668686866040518080602001806020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381038352600d8152602001807f6d6f646966794164647265737300000000000000000000000000000000000000815250602001838103825286818151815260200191508051906020019080838360005b83811015613f2c578082015181840152602081019050613f11565b50505050905090810190601f168015613f595780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a1613f7281614056565b600192505050613f84565b6000925050505b9392505050565b600080600090505b600260008581526020019081526020016000206002018054905081101561404a578273ffffffffffffffffffffffffffffffffffffffff16600260008681526020019081526020016000206002018281548110613fec57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561403d576001915050614050565b8080600101915050613f93565b50600090505b92915050565b60026000828152602001908152602001600020600080820160009055600182016000905560028201600061408a91906148e0565b505050565b6000809054906101000a900460ff16156000806101000a81548160ff0219169083151502179055507f0619930b74b56b9cdbdbd8709cef274ec3e9ed0616d7e996599558acccac8e6e6000809054906101000a900460ff16604051808215151515815260200191505060405180910390a1565b600080826040516020018082805190602001908083835b6020831061413c5780518252602082019150602081019050602083039250614119565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040528051906020012090506141828161488a565b6141f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f696e76616c696420636c6173730000000000000000000000000000000000000081525060200191505060405180910390fd5b80915050919050565b600060026000838152602001908152602001600020600201805490509050919050565b61422a8282613f8b565b1561429d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f647570206164647265737320616464656400000000000000000000000000000081525060200191505060405180910390fd5b60015460026000848152602001908152602001600020600201805490501061432d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f746f6f206d616e7920616464726573736573000000000000000000000000000081525060200191505060405180910390fd5b600260008381526020019081526020016000206002018190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b60008090505b600260008481526020019081526020016000206002018054905081101561455f578173ffffffffffffffffffffffffffffffffffffffff1660026000858152602001908152602001600020600201828154811061440a57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415614552576002600084815260200190815260200160002060020160016002600086815260200190815260200160002060020180549050038154811061448e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166002600085815260200190815260200160002060020182815481106144da57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506002600084815260200190815260200160002060020180548091906001900361454b9190614901565b50506145ce565b80806001019150506143b1565b506040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f6e6f74206578697374206164647265737300000000000000000000000000000081525060200191505060405180910390fd5b5050565b60606002600083815260200190815260200160002060020180548060200260200160405190810160405280929190818152602001828054801561466a57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311614620575b50505050509050919050565b6146808382613f8b565b156146f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f647570206164647265737320616464656400000000000000000000000000000081525060200191505060405180910390fd5b60008090505b6002600085815260200190815260200160002060020180549050811015614816578273ffffffffffffffffffffffffffffffffffffffff1660026000868152602001908152602001600020600201828154811061475257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561480957816002600086815260200190815260200160002060020182815481106147bb57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050614885565b80806001019150506146f9565b506040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f6e6f74206578697374206164647265737300000000000000000000000000000081525060200191505060405180910390fd5b505050565b600080600090505b6003805490508110156148d55782600382815481106148ad57fe5b906000526020600020015414156148c85760019150506148db565b8080600101915050614892565b50600090505b919050565b50805460008255906000526020600020908101906148fe919061492d565b50565b81548183558181111561492857818360005260206000209182019101614927919061492d565b5b505050565b61494f91905b8082111561494b576000816000905550600101614933565b5090565b9056fea265627a7a72315820c2cf5813c90c67da1377aabd962a47f4836335bd0ca0b0235040a132c0f482c364736f6c63430005110032

Verified Source Code Partial Match

Compiler: v0.5.17+commit.d19bba13 EVM: istanbul Optimization: No
Pausable.sol 28 lines
pragma solidity ^0.5.11;

contract Pausable {

    bool private pauseState = true;

    event PauseChangedTo(bool pauseState);

    function doPause() internal {
        pauseState = !pauseState;
        emit PauseChangedTo(pauseState);
    }

    function isPaused() public view returns (bool) {
        return pauseState;
    }

    modifier whenPaused() {
        require(pauseState, "it is not paused now");
        _;
    }

    modifier whenNotPaused() {
        require(!pauseState, "it is paused now");
        _;
    }

}
SafeMath.sol 21 lines
// solium-disable linebreak-style
pragma solidity ^0.5.11;

library SafeMath {
    function safeAdd(uint a, uint b) public pure returns (uint c) {
        c = a + b;
        require(c >= a,"");
    }
    function safeSub(uint a, uint b) public pure returns (uint c) {
        require(b <= a,"");
        c = a - b;
    }
    function safeMul(uint a, uint b) public pure returns (uint c) {
        c = a * b;
        require(a == 0 || c / a == b,"");
    }
    function safeDiv(uint a, uint b) public pure returns (uint c) {
        require(b > 0,"");
        c = a / b;
    }
}
Container.sol 71 lines
pragma solidity ^0.5.11;

contract Container{
    struct Item{
        uint256 itemType;
        uint256 status;
        address[] addresses;
    }
    uint256 MaxItemAdressNum = 255;

    mapping (bytes32 => Item) private container;

    function itemAddressExists(bytes32 id, address oneAddress) internal view returns(bool){
        for(uint256 i = 0; i < container[id].addresses.length; i++){
            if(container[id].addresses[i] == oneAddress)
                return true;
        }
        return false;
    }
    function getItemAddresses(bytes32 id) internal view returns(address[] memory){
        return container[id].addresses;
    }

    function getItemInfo(bytes32 id) internal view returns(uint256, uint256, uint256){
        return (container[id].itemType, container[id].status, container[id].addresses.length);
    }

    function getItemAddressCount(bytes32 id) internal view returns(uint256){
        return container[id].addresses.length;
    }

    function setItemInfo(bytes32 id, uint256 itemType, uint256 status) internal{
        container[id].itemType = itemType;
        container[id].status = status;
    }

    function addItemAddress(bytes32 id, address oneAddress) internal{
        require(!itemAddressExists(id, oneAddress), "dup address added");
        require(container[id].addresses.length < MaxItemAdressNum, "too many addresses");
        container[id].addresses.push(oneAddress);
    }
    function removeItemAddresses(bytes32 id) internal{
        container[id].addresses.length = 0;
    }

    function removeOneItemAddress(bytes32 id, address oneAddress) internal{
        for(uint256 i = 0; i < container[id].addresses.length; i++){
            if(container[id].addresses[i] == oneAddress){
                container[id].addresses[i] = container[id].addresses[container[id].addresses.length - 1];
                container[id].addresses.length--;
                return;
            }
        }
        revert("not exist address");
    }

    function removeItem(bytes32 id) internal{
        delete container[id];
    }

    function replaceItemAddress(bytes32 id, address oneAddress, address anotherAddress) internal{
        require(!itemAddressExists(id,anotherAddress),"dup address added");
        for(uint256 i = 0; i < container[id].addresses.length; i++){
            if(container[id].addresses[i] == oneAddress){
                container[id].addresses[i] = anotherAddress;
                return;
            }
        }
        revert("not exist address");
    }
}
HDOTAdmin.sol 156 lines
pragma solidity ^0.5.11;

import "./Container.sol";

contract HDOTAdmin is Container{

    bytes32 internal constant OWNERHASH = 0x02016836a56b71f0d02689e69e326f4f4c1b9057164ef592671cf0d37c8040c0;
    bytes32 internal constant OPERATORHASH = 0x46a52cf33029de9f84853745a87af28464c80bf0346df1b32e205fc73319f622;
    bytes32 internal constant PAUSERHASH = 0x0cc58340b26c619cd4edc70f833d3f4d9d26f3ae7d5ef2965f81fe5495049a4f;
    bytes32 internal constant STOREHASH = 0xe41d88711b08bdcd7556c5d2d24e0da6fa1f614cf2055f4d7e10206017cd1680;
    bytes32 internal constant LOGICHASH = 0x397bc5b97f629151e68146caedba62f10b47e426b38db589771a288c0861f182;
    uint256 internal constant MAXUSERNUM = 255;
    bytes32[] private classHashArray;

    uint256 internal ownerRequireNum;
    uint256 internal operatorRequireNum;

    event AdminChanged(string TaskType, string class, address oldAddress, address newAddress);
    event AdminRequiredNumChanged(string TaskType, string class, uint256 previousNum, uint256 requiredNum);
    event AdminTaskDropped(bytes32 taskHash);

    function initAdmin(address owner0, address owner1, address owner2) internal{
        addItemAddress(OWNERHASH, owner0);
        addItemAddress(OWNERHASH, owner1);
        addItemAddress(OWNERHASH, owner2);
        addItemAddress(LOGICHASH, address(0x0));
        addItemAddress(STOREHASH, address(0x1));

        classHashArray.push(OWNERHASH);
        classHashArray.push(OPERATORHASH);
        classHashArray.push(PAUSERHASH);
        classHashArray.push(STOREHASH);
        classHashArray.push(LOGICHASH);
        ownerRequireNum = 2;
        operatorRequireNum = 2;
    }

    function classHashExist(bytes32 aHash) private view returns(bool){
        for(uint256 i = 0; i < classHashArray.length; i++)
            if(classHashArray[i] == aHash) return true;
        return false;
    }
    function getAdminAddresses(string memory class) public view returns(address[] memory) {
        bytes32 classHash = getClassHash(class);
        return getItemAddresses(classHash);
    }
    function getOwnerRequiredNum() public view returns(uint256){
        return ownerRequireNum;
    }
    function getOperatorRequiredNum() public view returns(uint256){
        return operatorRequireNum;
    }

    function resetRequiredNum(string memory class, uint256 requiredNum)
        public onlyOwner returns(bool){
        bytes32 classHash = getClassHash(class);
        require((classHash == OPERATORHASH) || (classHash == OWNERHASH),"wrong class");
        if (classHash == OWNERHASH)
            require(requiredNum <= getItemAddressCount(OWNERHASH),"num larger than existed owners");

        bytes32 taskHash = keccak256(abi.encodePacked("resetRequiredNum", class, requiredNum));
        addItemAddress(taskHash, msg.sender);

        if(getItemAddressCount(taskHash) >= ownerRequireNum){
            removeItem(taskHash);
            uint256 previousNum = 0;
            if (classHash == OWNERHASH){
                previousNum = ownerRequireNum;
                ownerRequireNum = requiredNum;
            }
            else if(classHash == OPERATORHASH){
                previousNum = operatorRequireNum;
                operatorRequireNum = requiredNum;
            }else{
                revert("wrong class");
            }
            emit AdminRequiredNumChanged("resetRequiredNum", class, previousNum, requiredNum);
        }
        return true;
    }


    function modifyAddress(string memory class, address oldAddress, address newAddress)
        internal onlyOwner returns(bool){
        bytes32 classHash = getClassHash(class);
        require(!itemAddressExists(classHash,newAddress),"address existed already");
        require(itemAddressExists(classHash,oldAddress),"address not existed");
        bytes32 taskHash = keccak256(abi.encodePacked("modifyAddress", class, oldAddress, newAddress));
        addItemAddress(taskHash, msg.sender);
        if(getItemAddressCount(taskHash) >= ownerRequireNum){
            replaceItemAddress(classHash, oldAddress, newAddress);
            emit AdminChanged("modifyAddress", class, oldAddress, newAddress);
            removeItem(taskHash);
            return true;
        }
        return false;
    }

    function getClassHash(string memory class) private view returns (bytes32){
        bytes32 classHash = keccak256(abi.encodePacked(class));
        require(classHashExist(classHash), "invalid class");
        return classHash;
    }

    function dropAddress(string memory class, address oneAddress)
        public onlyOwner returns(bool){
        bytes32 classHash = getClassHash(class);
        require(classHash != STOREHASH && classHash != LOGICHASH, "wrong class");
        require(itemAddressExists(classHash, oneAddress), "no such address exist");

        if(classHash == OWNERHASH)
            require(getItemAddressCount(classHash) > ownerRequireNum, "insuffience addresses");

        bytes32 taskHash = keccak256(abi.encodePacked("dropAddress", class, oneAddress));
        addItemAddress(taskHash, msg.sender);
        if(getItemAddressCount(taskHash) >= ownerRequireNum){
            removeOneItemAddress(classHash, oneAddress);
            emit AdminChanged("dropAddress", class, oneAddress, oneAddress);
            removeItem(taskHash);
            return true;
        }
        return false;

    }

    function addAddress(string memory class, address oneAddress)
        public onlyOwner returns(bool){
        bytes32 classHash = getClassHash(class);
        require(classHash != STOREHASH && classHash != LOGICHASH, "wrong class");
        require(!itemAddressExists(classHash,oneAddress),"address existed already");

        bytes32 taskHash = keccak256(abi.encodePacked("addAddress", class, oneAddress));
        addItemAddress(taskHash, msg.sender);
        if(getItemAddressCount(taskHash) >= ownerRequireNum){
            addItemAddress(classHash, oneAddress);
            emit AdminChanged("addAddress", class, oneAddress, oneAddress);
            removeItem(taskHash);
            return true;
        }
        return false;
    }


    function dropTask(bytes32 taskHash)
    public onlyOwner returns (bool){
        removeItem(taskHash);
        emit AdminTaskDropped(taskHash);
        return true;
    }

    modifier onlyOwner() {
        require(itemAddressExists(OWNERHASH, msg.sender), "only use owner to call");
        _;
    }

}
HDOTLogic.sol 165 lines
pragma solidity ^0.5.11;

import "./SafeMath.sol";
import "./HDOTStorage.sol";

contract HDOTLogic {

    using SafeMath for uint256;

    string public constant name = "HDOTLogic";

    uint256 public constant TASKINIT = 0;
    uint256 public constant TASKPROCESSING = 1;
    uint256 public constant TASKCANCELLED = 2;
    uint256 public constant TASKDONE = 3;
    uint256 public constant MINTTASK = 1;
    uint256 public constant BURNTASK = 2;

    address private caller;
    HDOTStorage private store;

    constructor(address aCaller) public{
        caller = aCaller;
    }

    modifier onlyCaller(){
        require(msg.sender == caller, "only main contract can call");
        _;
    }

    function mintLogic(uint256 value,address to,string calldata proof,
        bytes32 taskHash, address supportAddress, uint256 requireNum)
        external onlyCaller returns(uint256){
        require(to != address(0), "cannot be burned from zero address");
        require(value > 0, "value need > 0");
        require(taskHash == keccak256((abi.encodePacked(to,value,proof))),"taskHash is wrong");
        uint256 status = supportTask(MINTTASK, taskHash, supportAddress, requireNum);

        if( status == TASKDONE){
            uint256 totalSupply = store.getTotalSupply();
            uint256 balanceTo = store.balanceOf(to);
            balanceTo = balanceTo.safeAdd(value);
            totalSupply = totalSupply.safeAdd(value);
            store.setBalance(to,balanceTo);
            store.setTotalSupply(totalSupply);
        }
        return status;
    }

    function burnLogic(address from, uint256 value,string calldata dotAddress,
        string calldata proof,bytes32 taskHash, address supportAddress, uint256 requireNum)
        external onlyCaller returns(uint256){

        uint256 balance = store.balanceOf(from);
        require(balance >= value,"sender address not have enough HDOT");
        require(value > 0, "value need > 0");
        require(taskHash == keccak256((abi.encodePacked(from,value,dotAddress,proof))),"taskHash is wrong");
        uint256 status = supportTask(BURNTASK, taskHash, supportAddress, requireNum);

        if ( status == TASKDONE ){
            uint256 totalSupply = store.getTotalSupply();
            totalSupply = totalSupply.safeSub(value);
            balance = balance.safeSub(value);
            store.setBalance(from,balance);
            store.setTotalSupply(totalSupply);

        }
        return status;
    }

    function transferLogic(address sender,address to,uint256 value) external onlyCaller returns(bool) {
        require(to != address(0), "cannot transfer to address zero");
        require(sender != to, "sender need != to");
        require(value > 0, "value need > 0");
        require(address(store) != address(0), "dataStore address error");

        uint256 balanceFrom = store.balanceOf(sender);
        uint256 balanceTo = store.balanceOf(to);
        require(value <= balanceFrom, "insufficient funds");
        balanceFrom = balanceFrom.safeSub(value);
        balanceTo = balanceTo.safeAdd(value);
        store.setBalance(sender,balanceFrom);
        store.setBalance(to,balanceTo);
        return true;
    }

    function transferFromLogic(address sender,address from,address to,uint256 value) external onlyCaller returns(bool) {
        require(from != address(0), "cannot transfer from address zero");
        require(to != address(0), "cannot transfer to address zero");
        require(value > 0, "can not tranfer zero Token");
        require(from!=to,"from and to can not be be the same ");
        require(address(store) != address(0), "dataStore address error");

        uint256 balanceFrom = store.balanceOf(from);
        uint256 balanceTo = store.balanceOf(to);
        uint256 allowedvalue = store.getAllowed(from,sender);

        require(value <= allowedvalue, "insufficient allowance");
        require(value <= balanceFrom, "insufficient funds");

        balanceFrom = balanceFrom.safeSub(value);
        balanceTo = balanceTo.safeAdd(value);
        allowedvalue = allowedvalue.safeSub(value);

        store.setBalance(from,balanceFrom);
        store.setBalance(to,balanceTo);
        store.setAllowed(from,sender,allowedvalue);
        return true;
    }

    function approveLogic(address sender,address spender,uint256 value)  external onlyCaller returns(bool success){
        require(spender != address(0), "spender address zero");
        require(value > 0, "value need > 0");
        require(address(store) != address(0), "dataStore address error");

        store.setAllowed(sender,spender,value);
        return true;
    }

    function resetStoreLogic(address storeAddress) external onlyCaller {
        store = HDOTStorage(storeAddress);
    }

    function getTotalSupply() public view returns (uint256 supply) {
        return store.getTotalSupply();
    }

    function balanceOf(address owner) public view returns (uint256 balance) {
        return store.balanceOf(owner);
    }

    function getAllowed(address owner, address spender) public view returns (uint256 remaining){
        return store.getAllowed(owner,spender);
    }

    function getStoreAddress() public view returns(address){
        return address(store);
    }

    function supportTask(uint256 taskType, bytes32 taskHash, address oneAddress, uint256 requireNum) private returns(uint256){
        require(!store.supporterExists(taskHash, oneAddress), "supporter already exists");
        (uint256 theTaskType,uint256 theTaskStatus,uint256 theSupporterNum) = store.getTaskInfo(taskHash);
        require(theTaskStatus < TASKDONE, "wrong status");

        if (theTaskStatus != TASKINIT)
            require(theTaskType == taskType, "task type not match");
        store.addSupporter(taskHash, oneAddress);
        theSupporterNum++;
        if(theSupporterNum >= requireNum)
            theTaskStatus = TASKDONE;
        else
            theTaskStatus = TASKPROCESSING;
        store.setTaskInfo(taskHash, taskType, theTaskStatus);
        return theTaskStatus;
    }

    function cancelTask(bytes32 taskHash)  external onlyCaller returns(uint256){
        (uint256 theTaskType,uint256 theTaskStatus,uint256 theSupporterNum) = store.getTaskInfo(taskHash);
        require(theTaskStatus == TASKPROCESSING, "wrong status");
        if(theSupporterNum > 0) store.removeAllSupporter(taskHash);
        theTaskStatus = TASKCANCELLED;
        store.setTaskInfo(taskHash, theTaskType, theTaskStatus);
        return theTaskStatus;
    }
}
HDOTToken.sol 121 lines
pragma solidity ^0.5.11;

import "./IERC20Token.sol";
import "./HDOTAdmin.sol";
import "./HDOTLogic.sol";
import "./HDOTStorage.sol";
import "./Pausable.sol";

contract HDOTToken is IERC20Token,Pausable, HDOTAdmin{
    string public constant name = "Huobi DOT";

    string public constant symbol = "HDOT";

    uint8 public constant decimals = 18;

    HDOTLogic private logic;

    event Burning(address indexed from, uint256 value, string proof, string  dotAddress, address burner);
    event Burned(address indexed from, uint256 value, string proof, string  dotAddress);
    event Minting(address indexed to, uint256 value, string proof, address  minter);
    event Minted(address indexed to, uint256 value, string proof);

    constructor(address owner0, address owner1, address owner2) public{
        initAdmin(owner0, owner1, owner2);
    }


    function totalSupply() public view returns (uint256 supply) {
        return logic.getTotalSupply();
    }

    function balanceOf(address owner) public view returns (uint256 balance) {
        return logic.balanceOf(owner);
    }

    function mint(address to, uint256 value, string memory proof,bytes32 taskHash) public whenNotPaused returns(bool){
        require(itemAddressExists(OPERATORHASH, msg.sender), "wrong operator");
        uint256 status = logic.mintLogic(value,to,proof,taskHash, msg.sender, operatorRequireNum);
        if (status == 1){
            emit Minting(to, value, proof, msg.sender);
        }else if (status == 3) {
            emit Minting(to, value, proof, msg.sender);
            emit Minted(to, value, proof);
            emit Transfer(address(0x0),to,value);
        }
        return true;
    }


    function burn(address from,uint256 value,string memory dotAddress,string memory proof, bytes32 taskHash)
    public whenNotPaused returns(bool){
        require(itemAddressExists(OPERATORHASH, msg.sender), "wrong operator");
        uint256 status = logic.burnLogic(from,value,dotAddress,proof,taskHash, msg.sender, operatorRequireNum);
        if (status == 1){
           emit Burning(from, value, proof,dotAddress, msg.sender);
        }else if (status == 3) {
           emit Burning(from, value, proof,dotAddress,  msg.sender);
           emit Burned(from, value, proof,dotAddress);
           emit Transfer(from, address(0x0),value);
        }
        return true;
    }

    function cancelTask(bytes32 taskHash)  public returns(uint256){
        require(itemAddressExists(OPERATORHASH, msg.sender), "wrong operator");
        return logic.cancelTask(taskHash);
    }

    function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
        bool flag = logic.transferLogic(msg.sender,to,value);
        require(flag, "transfer failed");
        emit Transfer(msg.sender,to,value);
        return true;
    }

    function transferFrom(address from, address to, uint256 value) public whenNotPaused  returns (bool){
        bool flag = logic.transferFromLogic(msg.sender,from,to,value);
        require(flag,"transferFrom failed");
        emit Transfer(from, to, value);
        return true;
    }


    function approve(address spender, uint256 value) public whenNotPaused returns (bool){
        bool flag = logic.approveLogic(msg.sender,spender,value);
        require(flag, "approve failed");
        emit Approval(msg.sender, spender, value);
        return true;
    }

    function allowance(address owner, address spender) public view returns (uint256 remaining){
        return logic.getAllowed(owner,spender);
    }

    function modifyAdminAddress(string memory class, address oldAddress, address newAddress) public whenPaused{
        require(newAddress != address(0x0), "wrong address");
        bool flag = modifyAddress(class, oldAddress, newAddress);
        if(flag){
            bytes32 classHash = keccak256(abi.encodePacked(class));
            if(classHash == LOGICHASH){
                logic = HDOTLogic(newAddress);
            }else if(classHash == STOREHASH){
                logic.resetStoreLogic(newAddress);
            }
        }
    }

    function getLogicAddress() public view returns(address){
        return address(logic);
    }

    function getStoreAddress() public view returns(address){
        return logic.getStoreAddress();
    }

    function pause() public{
        require(itemAddressExists(PAUSERHASH, msg.sender), "wrong user to pauser");
        doPause();
    }

}
HDOTStorage.sol 73 lines
pragma solidity ^0.5.11;

import "./Container.sol";

contract HDOTStorage is Container{

    string public constant name = "HDOTStorage";

    address private caller;

    constructor(address aCaller) public{
        totalSupply = 0;
        caller = aCaller;
    }
    uint256 public totalSupply;

    mapping (address => uint256) private balances;

    mapping (address => mapping (address => uint256)) private allowed;

    function supporterExists(bytes32 taskHash, address user) public view returns(bool){
        return itemAddressExists(taskHash, user);
    }

    function setTaskInfo(bytes32 taskHash, uint256 taskType, uint256 status) external onlyCaller{
        setItemInfo(taskHash, taskType, status);
    }

    function getTaskInfo(bytes32 taskHash) public view returns(uint256, uint256, uint256){
        return getItemInfo(taskHash);
    }

    function addSupporter(bytes32 taskHash, address oneAddress) external onlyCaller{
        addItemAddress(taskHash, oneAddress);
    }

    function removeAllSupporter(bytes32 taskHash) external onlyCaller{
        removeItemAddresses(taskHash);
    }

    modifier onlyCaller() {
        require(msg.sender == caller, "only use main main contract to call");
        _;
    }

    function getTotalSupply() external view returns(uint256) {
        return totalSupply;
    }

    function setTotalSupply(uint256 amount) external onlyCaller {
        totalSupply = amount;
    }

    function balanceOf(address account) external view returns(uint256) {
        return balances[account];
    }

    function setBalance(address account,uint256 amount) external onlyCaller {
        require(account != address(0),"account address error");
        balances[account] = amount;
    }

    function getAllowed(address owner,address spender) external view returns(uint256) {
        return allowed[owner][spender];
    }

    function setAllowed(address owner,address spender,uint256 amount) external onlyCaller {
        require(owner != address(0),"owner address error");
        require(spender != address(0),"spender address error");
        require(amount <= balances[owner], "owner balance need >= amount");
        allowed[owner][spender] = amount;
    }
}
IERC20Token.sol 37 lines
pragma solidity ^0.5.11;

contract IERC20Token {
    function totalSupply() public view returns (uint256 supply);
    /// @param owner The address from which the balance will be retrieved
    /// @return The balance
    //solium-disable security/enforce-explicit-visibility
    function balanceOf(address owner) public view returns (uint256 balance);

    /// @notice send `value` token to `to` from `msg.sender`
    /// @param to The address of the recipient
    /// @param value The amount of token to be transferred
    /// @return Whether the transfer was successful or not
    function transfer(address to, uint256 value) public returns (bool success);

    /// @notice send `value` token to `to` from `from` on the condition it is approved by `from`
    /// @param from The address of the sender
    /// @param to The address of the recipient
    /// @param value The amount of token to be transferred
    /// @return Whether the transfer was successful or not
    function transferFrom(address from, address to, uint256 value) public returns (bool success);

    /// @notice `msg.sender` approves `spender` to spend `value` tokens
    /// @param spender The address of the account able to transfer the tokens
    /// @param value The amount of tokens to be approved for transfer
    /// @return Whether the approval was successful or not
    function approve(address spender, uint256 value) public returns (bool success);

    /// @param owner The address of the account owning tokens
    /// @param spender The address of the account able to transfer the tokens
    /// @return Amount of remaining tokens allowed to spent
    function allowance(address owner, address spender) public view returns (uint256 remaining);

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);

}

Read Contract

allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
getAdminAddresses 0xc8e369bf → address[]
getLogicAddress 0xabd108ba → address
getOperatorRequiredNum 0xb1d3e05e → uint256
getOwnerRequiredNum 0x5dd882dd → uint256
getStoreAddress 0xb07ed3a9 → address
isPaused 0xb187bd26 → bool
name 0x06fdde03 → string
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256

Write Contract 12 functions

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

addAddress 0xceb35b0f
string class
address oneAddress
returns: bool
approve 0x095ea7b3
address spender
uint256 value
returns: bool
burn 0xf691b71a
address from
uint256 value
string dotAddress
string proof
bytes32 taskHash
returns: bool
cancelTask 0xee8ca3b5
bytes32 taskHash
returns: uint256
dropAddress 0x91c40bf7
string class
address oneAddress
returns: bool
dropTask 0x521cb590
bytes32 taskHash
returns: bool
mint 0xd4bf51a7
address to
uint256 value
string proof
bytes32 taskHash
returns: bool
modifyAdminAddress 0x2c2df742
string class
address oldAddress
address newAddress
pause 0x8456cb59
No parameters
resetRequiredNum 0xe9e211bd
string class
uint256 requiredNum
returns: bool
transfer 0xa9059cbb
address to
uint256 value
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 value
returns: bool

Recent Transactions

No transactions found for this address