Forkchoice Ethereum Mainnet

Address Contract Verified

Address 0xa65C55fe5430185D190FFc4B92F2e55615Dfd428
Balance 0 ETH
Nonce 1
Code Size 20575 bytes
Indexed Transactions 0 (1 on-chain, 1.3% indexed)
External Etherscan · Sourcify

Contract Bytecode

20575 bytes
0x608060405234801561000f575f5ffd5b50600436106101f9575f3560e01c80636f9caaef11610118578063b8027844116100ab578063dafe6cd51161007a578063dafe6cd51461058d578063df97fabb146105a9578063efaf4614146105c5578063f2fde38b146105f5578063f5e6897314610611576101f9565b8063b802784414610517578063c192ac8a14610535578063c8122a9f14610553578063d06942391461056f576101f9565b8063873673cd116100e7578063873673cd1461047b5780638da5cb5b14610499578063b40b2ebf146104b7578063b7a19f7b146104e7576101f9565b80636f9caaef1461041b578063715018a61461044b578063817e3670146104555780638456cb5914610471576101f9565b80633c94bf9b116101905780635275868d1161015f5780635275868d146103955780635c975abb146103b15780635f707c0c146103cf57806364913477146103ff576101f9565b80633c94bf9b1461031f5780633f4ba83a1461033d578063499fc4ff146103475780634c7203d114610365576101f9565b80632122496d116101cc5780632122496d146102975780632157abbb146102b557806327601006146102e55780632f940c7014610303576101f9565b8063039e90b0146101fd57806307a09b451461022d5780630c18eeab146102495780631fd1322814610267575b5f5ffd5b61021760048036038101906102129190613dc9565b61062f565b6040516102249190613f00565b60405180910390f35b61024760048036038101906102429190613f7a565b610760565b005b610251610890565b60405161025e9190613fb4565b60405180910390f35b610281600480360381019061027c9190613f7a565b6108b8565b60405161028e9190613fdc565b60405180910390f35b61029f6108fe565b6040516102ac919061409d565b60405180910390f35b6102cf60048036038101906102ca91906140bd565b610954565b6040516102dc91906142c8565b60405180910390f35b6102ed610cde565b6040516102fa9190613fb4565b60405180910390f35b61031d600480360381019061031891906142e8565b610d06565b005b610327610ed0565b6040516103349190613fdc565b60405180910390f35b610345610ed9565b005b61034f610eeb565b60405161035c9190613fdc565b60405180910390f35b61037f600480360381019061037a9190613f7a565b610ef4565b60405161038c9190613fdc565b60405180910390f35b6103af60048036038101906103aa9190614350565b610f3a565b005b6103b9611005565b6040516103c6919061439d565b60405180910390f35b6103e960048036038101906103e49190613dc9565b61101b565b6040516103f6919061439d565b60405180910390f35b61041960048036038101906104149190613f7a565b61102c565b005b61043560048036038101906104309190613f7a565b61115c565b6040516104429190613fdc565b60405180910390f35b6104536111a2565b005b61046f600480360381019061046a91906143e0565b6111dd565b005b6104796118d0565b005b6104836118e2565b6040516104909190613fb4565b60405180910390f35b6104a161190a565b6040516104ae9190613fb4565b60405180910390f35b6104d160048036038101906104cc919061455c565b611932565b6040516104de9190613fdc565b60405180910390f35b61050160048036038101906104fc91906140bd565b611b50565b60405161050e9190614725565b60405180910390f35b61051f611e74565b60405161052c9190613fb4565b60405180910390f35b61053d611e9c565b60405161054a919061409d565b60405180910390f35b61056d60048036038101906105689190614745565b611fe9565b005b6105776121e8565b6040516105849190613fdc565b60405180910390f35b6105a760048036038101906105a291906143e0565b6121f1565b005b6105c360048036038101906105be91906147d8565b6128e6565b005b6105df60048036038101906105da91906140bd565b612ed5565b6040516105ec91906142c8565b60405180910390f35b61060f600480360381019061060a9190613f7a565b61325f565b005b6106196132e3565b604051610626919061487c565b60405180910390f35b610637613c57565b610640826136cf565b610676576040517f7894709d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025f8381526020019081526020015f206040518060a00160405290815f820180546106a1906148c2565b80601f01602080910402602001604051908101604052809291908181526020018280546106cd906148c2565b80156107185780601f106106ef57610100808354040283529160200191610718565b820191905f5260205f20905b8154815290600101906020018083116106fb57829003601f168201915b50505050508152602001600182015481526020016002820154815260200160038201548152602001600482015f9054906101000a900460ff1615151515815250509050919050565b6107686136ef565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036107cd576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508160075f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f0bd95e9875e5a1f5cc8477eaaca6550a66783d42e212fb7741a331797511ae8860405160405180910390a35050565b5f60065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b5f600a5f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b6060600380548060200260200160405190810160405280929190818152602001828054801561094a57602002820191905f5260205f20905b815481526020019060010190808311610936575b5050505050905090565b60605f8214806109645750606482115b1561099b576040517fe5b7db2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60145f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20805480602002602001604051908101604052809291908181526020018280548015610a2157602002820191905f5260205f20905b815481526020019060010190808311610a0d575b505050505090508051841115610a63576040517f01da157200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80518403610ac7575f67ffffffffffffffff811115610a8557610a84614438565b5b604051908082528060200260200182016040528015610abe57816020015b610aab613c84565b815260200190600190039081610aa35790505b50915050610cd7565b5f8385610ad4919061491f565b90508151811115610ae457815190505b5f8582610af19190614952565b67ffffffffffffffff811115610b0a57610b09614438565b5b604051908082528060200260200182016040528015610b4357816020015b610b30613c84565b815260200190600190039081610b285790505b5090505f8690505b82811015610ccf576013848281518110610b6857610b67614985565b5b602002602001015181548110610b8157610b80614985565b5b905f5260205f2090600602016040518060c00160405290815f8201548152602001600182015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600282015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160038201548152602001600482015f9054906101000a900460ff166001811115610c7957610c7861415d565b5b6001811115610c8b57610c8a61415d565b5b8152602001600582015481525050828883610ca69190614952565b81518110610cb757610cb6614985565b5b60200260200101819052508080600101915050610b4b565b508093505050505b9392505050565b5f60085f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610d0e6136ef565b5f8203610d47576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610dac576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b818173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610de69190613fb4565b602060405180830381865afa158015610e01573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e2591906149c6565b1015610e5d576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e8833838373ffffffffffffffffffffffffffffffffffffffff166137769092919063ffffffff16565b813373ffffffffffffffffffffffffffffffffffffffff167f5fafa99d0643513820be26656b45130b01e1c03062e1266bf36f88cbd3bd969560405160405180910390a35050565b5f600c54905090565b610ee16136ef565b610ee96137f5565b565b5f600e54905090565b5f600b5f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b610f426136ef565b610f4b826136cf565b610f81576040517f7894709d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60025f8481526020019081526020015f20905081816004015f6101000a81548160ff021916908315150217905550805f01604051610fc09190614a8d565b6040518091039020837f81d237e2ff455f5ec7759a2e795539c65e945ff24f2c23458c26246c577b358984604051610ff8919061439d565b60405180910390a3505050565b5f600160149054906101000a900460ff16905090565b5f611025826136cf565b9050919050565b6110346136ef565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611099576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60085f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508160085f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f86e5a79b116b1b58296614b8323eb315c7f0d67c5786fe97e11afc17fcb5b61960405160405180910390a35050565b5f60095f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d490614afd565b60405180910390fd5b6111e5613857565b6111ed61389b565b60075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611273576040517fea8e4eb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036112d8576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8203611311576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f1b810361134c576040517fdfa1a40800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611356815f6138dc565b1561138d576040517fb1fb6bd000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a0823160075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b81526004016114099190613fb4565b602060405180830381865afa158015611424573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061144891906149c6565b90505f60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e60075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16306040518363ffffffff1660e01b81526004016114c8929190614b1b565b602060405180830381865afa1580156114e3573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061150791906149c6565b905083821015611543576040517fc91e29d600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8381101561157d576040517f48afe6cb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160155f8581526020019081526020015f205f6101000a81548160ff0219169083151502179055505f601180549050905060116040518060c001604052808681526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1681526020018781526020015f60018111156116135761161261415d565b5b815260200142815250908060018154018082558091505060019003905f5260205f2090600602015f909190919091505f820151815f01556020820151816001015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040820151816002015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550606082015181600301556080820151816004015f6101000a81548160ff0219169083600181111561170a5761170961415d565b5b021790555060a08201518160050155505060125f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081908060018154018082558091505060019003905f5260205f20015f909190919091505584600a5f8873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546117c8919061491f565b9250508190555084600d5f8282546117e0919061491f565b9250508190555061185660075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16878760055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16613987909392919063ffffffff16565b8573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16857f3ee3066bce8f3083621c940bbbbdf881bcf530b8dc16b5ea627dc36e8c61fd32885f426040516118b893929190614b51565b60405180910390a45050506118cb613a09565b505050565b6118d86136ef565b6118e0613a12565b565b5f60055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b5f61193b6136ef565b5f855103611975576040517f5494dac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f84036119ae576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f83036119e7576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8203611a20576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f600454905060045f815480929190611a3890614b86565b91905055506040518060a001604052808781526020018681526020018581526020018481526020016001151581525060025f8381526020019081526020015f205f820151815f019081611a8b9190614d5b565b506020820151816001015560408201518160020155606082015181600301556080820151816004015f6101000a81548160ff021916908315150217905550905050600381908060018154018082558091505060019003905f5260205f20015f909190919091505585604051611b009190614e5a565b6040518091039020817f095100285fc89e19f0813eff4c67fd0394b13c10ee8c3baaa97bf64e1e67a146878787604051611b3c93929190614e70565b60405180910390a380915050949350505050565b60605f821480611b605750606482115b15611b97576040517fe5b7db2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60105f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20805480602002602001604051908101604052809291908181526020018280548015611c1d57602002820191905f5260205f20905b815481526020019060010190808311611c09575b505050505090508051841115611c5f576040517f01da157200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80518403611cc3575f67ffffffffffffffff811115611c8157611c80614438565b5b604051908082528060200260200182016040528015611cba57816020015b611ca7613cf2565b815260200190600190039081611c9f5790505b50915050611e6d565b5f8385611cd0919061491f565b90508151811115611ce057815190505b5f8582611ced9190614952565b67ffffffffffffffff811115611d0657611d05614438565b5b604051908082528060200260200182016040528015611d3f57816020015b611d2c613cf2565b815260200190600190039081611d245790505b5090505f8690505b82811015611e6557600f848281518110611d6457611d63614985565b5b602002602001015181548110611d7d57611d7c614985565b5b905f5260205f209060080201604051806101000160405290815f82015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820154815260200160068201548152602001600782015481525050828883611e3c9190614952565b81518110611e4d57611e4c614985565b5b60200260200101819052508080600101915050611d47565b508093505050505b9392505050565b5f60075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60605f5f90505f5f90505b600380549050811015611efa57611ed960038281548110611ecb57611eca614985565b5b905f5260205f200154613a74565b15611eed578180611ee990614b86565b9250505b8080600101915050611ea7565b505f8167ffffffffffffffff811115611f1657611f15614438565b5b604051908082528060200260200182016040528015611f445781602001602082028036833780820191505090505b5090505f5f90505f5f90505b600380549050811015611fdf57611f8260038281548110611f7457611f73614985565b5b905f5260205f200154613a74565b15611fd25760038181548110611f9b57611f9a614985565b5b905f5260205f200154838381518110611fb757611fb6614985565b5b6020026020010181815250508180611fce90614b86565b9250505b8080600101915050611f50565b5081935050505090565b611ff16136ef565b5f850361202a576040517f5494dac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f845103612064576040517f5494dac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f830361209d576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f82036120d6576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f810361210f576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612118856136cf565b61214e576040517f7894709d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60025f8781526020019081526020015f20905084815f0190816121729190614d5b565b508381600101819055508281600201819055508181600301819055508460405161219c9190614e5a565b6040518091039020867f2d6a300173e09dfdf9fb3027824e22736831fa95f6b0fc9b1d13adc0639cd1e68686866040516121d893929190614e70565b60405180910390a3505050505050565b5f600d54905090565b6121f9613857565b61220161389b565b60075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612287576040517fea8e4eb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036122ec576040517fe6c4247b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8203612325576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f1b8103612360576040517fdfa1a40800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61236b8160016138dc565b156123a2576040517fb1fb6bd000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a0823160075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b815260040161241e9190613fb4565b602060405180830381865afa158015612439573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061245d91906149c6565b90505f60065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e60075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16306040518363ffffffff1660e01b81526004016124dd929190614b1b565b602060405180830381865afa1580156124f8573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061251c91906149c6565b905083821015612558576040517fc91e29d600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83811015612592576040517f48afe6cb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160165f8581526020019081526020015f205f6101000a81548160ff0219169083151502179055505f601380549050905060136040518060c001604052808681526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1681526020018781526020016001808111156126285761262761415d565b5b815260200142815250908060018154018082558091505060019003905f5260205f2090600602015f909190919091505f820151815f01556020820151816001015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040820151816002015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550606082015181600301556080820151816004015f6101000a81548160ff0219169083600181111561271f5761271e61415d565b5b021790555060a08201518160050155505060145f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081908060018154018082558091505060019003905f5260205f20015f909190919091505584600b5f8873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8282546127dd919061491f565b9250508190555084600e5f8282546127f5919061491f565b9250508190555061286b60075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16878760065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16613987909392919063ffffffff16565b8573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16857f3ee3066bce8f3083621c940bbbbdf881bcf530b8dc16b5ea627dc36e8c61fd32886001426040516128ce93929190614b51565b60405180910390a45050506128e1613a09565b505050565b6128ee613857565b6128f661389b565b5f820361292f576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8103612968576040517f5494dac800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60025f8381526020019081526020015f2090505f8160030154036129b9576040517f7894709d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b806004015f9054906101000a900460ff16612a00576040517f1bdee15b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f816003015484612a119190614ea5565b90505f6509184e72a000905080821115612a57576040517f2c5211c600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f836001015486612a689190614ea5565b90508260055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401612ac59190613fb4565b602060405180830381865afa158015612ae0573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612b0491906149c6565b1015612b3c576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8260055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e33306040518363ffffffff1660e01b8152600401612b99929190614b1b565b602060405180830381865afa158015612bb4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612bd891906149c6565b1015612c10576040517f13be252b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612c7f3360085f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff168560055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16613987909392919063ffffffff16565b8260095f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f828254612ccb919061491f565b9250508190555082600c5f828254612ce3919061491f565b925050819055505f600f805490509050600f6040518061010001604052803373ffffffffffffffffffffffffffffffffffffffff168152602001898152602001888152602001876003015481526020018760010154815260200186815260200184815260200142815250908060018154018082558091505060019003905f5260205f2090600802015f909190919091505f820151815f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e08201518160070155505060105f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081908060018154018082558091505060019003905f5260205f20015f909190919091505585873373ffffffffffffffffffffffffffffffffffffffff167fcff07ec99bc47992d852052457549c47317af989a1ea1b8857a85890845a51a6885f0189600301548a600101548a8942604051612ebc96959493929190614f67565b60405180910390a45050505050612ed1613a09565b5050565b60605f821480612ee55750606482115b15612f1c576040517fe5b7db2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60125f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20805480602002602001604051908101604052809291908181526020018280548015612fa257602002820191905f5260205f20905b815481526020019060010190808311612f8e575b505050505090508051841115612fe4576040517f01da157200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80518403613048575f67ffffffffffffffff81111561300657613005614438565b5b60405190808252806020026020018201604052801561303f57816020015b61302c613c84565b8152602001906001900390816130245790505b50915050613258565b5f8385613055919061491f565b9050815181111561306557815190505b5f85826130729190614952565b67ffffffffffffffff81111561308b5761308a614438565b5b6040519080825280602002602001820160405280156130c457816020015b6130b1613c84565b8152602001906001900390816130a95790505b5090505f8690505b828110156132505760118482815181106130e9576130e8614985565b5b60200260200101518154811061310257613101614985565b5b905f5260205f2090600602016040518060c00160405290815f8201548152602001600182015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600282015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160038201548152602001600482015f9054906101000a900460ff1660018111156131fa576131f961415d565b5b600181111561320c5761320b61415d565b5b81526020016005820154815250508288836132279190614952565b8151811061323857613237614985565b5b602002602001018190525080806001019150506130cc565b508093505050505b9392505050565b6132676136ef565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036132d7575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016132ce9190613fb4565b60405180910390fd5b6132e081613ab2565b50565b6132eb613d45565b5f73ffffffffffffffffffffffffffffffffffffffff1660075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1603613383576040518060a001604052805f73ffffffffffffffffffffffffffffffffffffffff1681526020015f81526020015f81526020015f81526020015f81525090506136cc565b6040518060a0016040528060075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a0823160075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b81526004016134469190613fb4565b602060405180830381865afa158015613461573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061348591906149c6565b815260200160055f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e60075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16306040518363ffffffff1660e01b8152600401613507929190614b1b565b602060405180830381865afa158015613522573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061354691906149c6565b815260200160065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a0823160075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b81526004016135c69190613fb4565b602060405180830381865afa1580156135e1573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061360591906149c6565b815260200160065f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e60075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16306040518363ffffffff1660e01b8152600401613687929190614b1b565b602060405180830381865afa1580156136a2573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906136c691906149c6565b81525090505b90565b5f5f60025f8481526020019081526020015f206003015414159050919050565b6136f7613b75565b73ffffffffffffffffffffffffffffffffffffffff1661371561190a565b73ffffffffffffffffffffffffffffffffffffffff161461377457613738613b75565b6040517f118cdaa700000000000000000000000000000000000000000000000000000000815260040161376b9190613fb4565b60405180910390fd5b565b6137f0838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040516024016137a9929190614fcd565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613b7c565b505050565b6137fd613c17565b5f600160146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa613840613b75565b60405161384d9190613fb4565b60405180910390a1565b60025f5403613892576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025f81905550565b6138a3611005565b156138da576040517fd93c066500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b5f5f60018111156138f0576138ef61415d565b5b8260018111156139035761390261415d565b5b0361392d5760155f8481526020019081526020015f205f9054906101000a900460ff169050613981565b6001808111156139405761393f61415d565b5b8260018111156139535761395261415d565b5b0361397d5760165f8481526020019081526020015f205f9054906101000a900460ff169050613981565b5f90505b92915050565b613a03848573ffffffffffffffffffffffffffffffffffffffff166323b872dd8686866040516024016139bc93929190614ff4565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613b7c565b50505050565b60015f81905550565b613a1a61389b565b60018060146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613a5d613b75565b604051613a6a9190613fb4565b60405180910390a1565b5f5f60025f8481526020019081526020015f2090505f816003015414158015613aaa5750806004015f9054906101000a900460ff165b915050919050565b5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508160015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f33905090565b5f5f60205f8451602086015f885af180613b9b576040513d5f823e3d81fd5b3d92505f519150505f8214613bb4576001811415613bcf565b5f8473ffffffffffffffffffffffffffffffffffffffff163b145b15613c1157836040517f5274afe7000000000000000000000000000000000000000000000000000000008152600401613c089190613fb4565b60405180910390fd5b50505050565b613c1f611005565b613c55576040517f8dfc202b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b6040518060a00160405280606081526020015f81526020015f81526020015f81526020015f151581525090565b6040518060c001604052805f81526020015f73ffffffffffffffffffffffffffffffffffffffff1681526020015f73ffffffffffffffffffffffffffffffffffffffff1681526020015f81526020015f6001811115613ce657613ce561415d565b5b81526020015f81525090565b6040518061010001604052805f73ffffffffffffffffffffffffffffffffffffffff1681526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81526020015f81525090565b6040518060a001604052805f73ffffffffffffffffffffffffffffffffffffffff1681526020015f81526020015f81526020015f81526020015f81525090565b5f604051905090565b5f5ffd5b5f5ffd5b5f819050919050565b613da881613d96565b8114613db2575f5ffd5b50565b5f81359050613dc381613d9f565b92915050565b5f60208284031215613dde57613ddd613d8e565b5b5f613deb84828501613db5565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f613e3682613df4565b613e408185613dfe565b9350613e50818560208601613e0e565b613e5981613e1c565b840191505092915050565b613e6d81613d96565b82525050565b5f8115159050919050565b613e8781613e73565b82525050565b5f60a083015f8301518482035f860152613ea78282613e2c565b9150506020830151613ebc6020860182613e64565b506040830151613ecf6040860182613e64565b506060830151613ee26060860182613e64565b506080830151613ef56080860182613e7e565b508091505092915050565b5f6020820190508181035f830152613f188184613e8d565b905092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f613f4982613f20565b9050919050565b613f5981613f3f565b8114613f63575f5ffd5b50565b5f81359050613f7481613f50565b92915050565b5f60208284031215613f8f57613f8e613d8e565b5b5f613f9c84828501613f66565b91505092915050565b613fae81613f3f565b82525050565b5f602082019050613fc75f830184613fa5565b92915050565b613fd681613d96565b82525050565b5f602082019050613fef5f830184613fcd565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f6140298383613e64565b60208301905092915050565b5f602082019050919050565b5f61404b82613ff5565b6140558185613fff565b93506140608361400f565b805f5b83811015614090578151614077888261401e565b975061408283614035565b925050600181019050614063565b5085935050505092915050565b5f6020820190508181035f8301526140b58184614041565b905092915050565b5f5f5f606084860312156140d4576140d3613d8e565b5b5f6140e186828701613f66565b93505060206140f286828701613db5565b925050604061410386828701613db5565b9150509250925092565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f819050919050565b61414881614136565b82525050565b61415781613f3f565b82525050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b6002811061419b5761419a61415d565b5b50565b5f8190506141ab8261418a565b919050565b5f6141ba8261419e565b9050919050565b6141ca816141b0565b82525050565b60c082015f8201516141e45f85018261413f565b5060208201516141f7602085018261414e565b50604082015161420a604085018261414e565b50606082015161421d6060850182613e64565b50608082015161423060808501826141c1565b5060a082015161424360a0850182613e64565b50505050565b5f61425483836141d0565b60c08301905092915050565b5f602082019050919050565b5f6142768261410d565b6142808185614117565b935061428b83614127565b805f5b838110156142bb5781516142a28882614249565b97506142ad83614260565b92505060018101905061428e565b5085935050505092915050565b5f6020820190508181035f8301526142e0818461426c565b905092915050565b5f5f604083850312156142fe576142fd613d8e565b5b5f61430b85828601613db5565b925050602061431c85828601613f66565b9150509250929050565b61432f81613e73565b8114614339575f5ffd5b50565b5f8135905061434a81614326565b92915050565b5f5f6040838503121561436657614365613d8e565b5b5f61437385828601613db5565b92505060206143848582860161433c565b9150509250929050565b61439781613e73565b82525050565b5f6020820190506143b05f83018461438e565b92915050565b6143bf81614136565b81146143c9575f5ffd5b50565b5f813590506143da816143b6565b92915050565b5f5f5f606084860312156143f7576143f6613d8e565b5b5f61440486828701613f66565b935050602061441586828701613db5565b9250506040614426868287016143cc565b9150509250925092565b5f5ffd5b5f5ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61446e82613e1c565b810181811067ffffffffffffffff8211171561448d5761448c614438565b5b80604052505050565b5f61449f613d85565b90506144ab8282614465565b919050565b5f67ffffffffffffffff8211156144ca576144c9614438565b5b6144d382613e1c565b9050602081019050919050565b828183375f83830152505050565b5f6145006144fb846144b0565b614496565b90508281526020810184848401111561451c5761451b614434565b5b6145278482856144e0565b509392505050565b5f82601f83011261454357614542614430565b5b81356145538482602086016144ee565b91505092915050565b5f5f5f5f6080858703121561457457614573613d8e565b5b5f85013567ffffffffffffffff81111561459157614590613d92565b5b61459d8782880161452f565b94505060206145ae87828801613db5565b93505060406145bf87828801613db5565b92505060606145d087828801613db5565b91505092959194509250565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61010082015f82015161461a5f85018261414e565b50602082015161462d6020850182613e64565b5060408201516146406040850182613e64565b5060608201516146536060850182613e64565b5060808201516146666080850182613e64565b5060a082015161467960a0850182613e64565b5060c082015161468c60c0850182613e64565b5060e082015161469f60e0850182613e64565b50505050565b5f6146b08383614605565b6101008301905092915050565b5f602082019050919050565b5f6146d3826145dc565b6146dd81856145e6565b93506146e8836145f6565b805f5b838110156147185781516146ff88826146a5565b975061470a836146bd565b9250506001810190506146eb565b5085935050505092915050565b5f6020820190508181035f83015261473d81846146c9565b905092915050565b5f5f5f5f5f60a0868803121561475e5761475d613d8e565b5b5f61476b88828901613db5565b955050602086013567ffffffffffffffff81111561478c5761478b613d92565b5b6147988882890161452f565b94505060406147a988828901613db5565b93505060606147ba88828901613db5565b92505060806147cb88828901613db5565b9150509295509295909350565b5f5f604083850312156147ee576147ed613d8e565b5b5f6147fb85828601613db5565b925050602061480c85828601613db5565b9150509250929050565b60a082015f82015161482a5f85018261414e565b50602082015161483d6020850182613e64565b5060408201516148506040850182613e64565b5060608201516148636060850182613e64565b5060808201516148766080850182613e64565b50505050565b5f60a08201905061488f5f830184614816565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f60028204905060018216806148d957607f821691505b6020821081036148ec576148eb614895565b5b50919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61492982613d96565b915061493483613d96565b925082820190508082111561494c5761494b6148f2565b5b92915050565b5f61495c82613d96565b915061496783613d96565b925082820390508181111561497f5761497e6148f2565b5b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f815190506149c081613d9f565b92915050565b5f602082840312156149db576149da613d8e565b5b5f6149e8848285016149b2565b91505092915050565b5f81905092915050565b5f819050815f5260205f209050919050565b5f8154614a19816148c2565b614a2381866149f1565b9450600182165f8114614a3d5760018114614a5257614a84565b60ff1983168652811515820286019350614a84565b614a5b856149fb565b5f5b83811015614a7c57815481890152600182019150602081019050614a5d565b838801955050505b50505092915050565b5f614a988284614a0d565b915081905092915050565b5f82825260208201905092915050565b7f52656e6f756e6365206f776e6572736869702069732064697361626c656400005f82015250565b5f614ae7601e83614aa3565b9150614af282614ab3565b602082019050919050565b5f6020820190508181035f830152614b1481614adb565b9050919050565b5f604082019050614b2e5f830185613fa5565b614b3b6020830184613fa5565b9392505050565b614b4b816141b0565b82525050565b5f606082019050614b645f830186613fcd565b614b716020830185614b42565b614b7e6040830184613fcd565b949350505050565b5f614b9082613d96565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203614bc257614bc16148f2565b5b600182019050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302614c177fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82614bdc565b614c218683614bdc565b95508019841693508086168417925050509392505050565b5f819050919050565b5f614c5c614c57614c5284613d96565b614c39565b613d96565b9050919050565b5f819050919050565b614c7583614c42565b614c89614c8182614c63565b848454614be8565b825550505050565b5f5f905090565b614ca0614c91565b614cab818484614c6c565b505050565b5b81811015614cce57614cc35f82614c98565b600181019050614cb1565b5050565b601f821115614d1357614ce4816149fb565b614ced84614bcd565b81016020851015614cfc578190505b614d10614d0885614bcd565b830182614cb0565b50505b505050565b5f82821c905092915050565b5f614d335f1984600802614d18565b1980831691505092915050565b5f614d4b8383614d24565b9150826002028217905092915050565b614d6482613df4565b67ffffffffffffffff811115614d7d57614d7c614438565b5b614d8782546148c2565b614d92828285614cd2565b5f60209050601f831160018114614dc3575f8415614db1578287015190505b614dbb8582614d40565b865550614e22565b601f198416614dd1866149fb565b5f5b82811015614df857848901518255600182019150602085019450602081019050614dd3565b86831015614e155784890151614e11601f891682614d24565b8355505b6001600288020188555050505b505050505050565b5f614e3482613df4565b614e3e81856149f1565b9350614e4e818560208601613e0e565b80840191505092915050565b5f614e658284614e2a565b915081905092915050565b5f606082019050614e835f830186613fcd565b614e906020830185613fcd565b614e9d6040830184613fcd565b949350505050565b5f614eaf82613d96565b9150614eba83613d96565b9250828202614ec881613d96565b91508282048414831517614edf57614ede6148f2565b5b5092915050565b5f8154614ef2816148c2565b614efc8186614aa3565b9450600182165f8114614f165760018114614f2c57614f5e565b60ff198316865281151560200286019350614f5e565b614f35856149fb565b5f5b83811015614f5657815481890152600182019150602081019050614f37565b808801955050505b50505092915050565b5f60c0820190508181035f830152614f7f8189614ee6565b9050614f8e6020830188613fcd565b614f9b6040830187613fcd565b614fa86060830186613fcd565b614fb56080830185613fcd565b614fc260a0830184613fcd565b979650505050505050565b5f604082019050614fe05f830185613fa5565b614fed6020830184613fcd565b9392505050565b5f6060820190506150075f830186613fa5565b6150146020830185613fa5565b6150216040830184613fcd565b94935050505056fea26469706673582212207718cbc61f9a01d67e7d1e3dde09c4c2cac0f568da266b266a717075ccffb07864736f6c634300081e0033

Verified Source Code Full Match

Compiler: v0.8.30+commit.73712a01 EVM: prague Optimization: No
5_power2.sol 778 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;

import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

/**
 * @title PowerContract
 * @dev Computing power purchase contract with USDT payment, referral system, and wallet allocation
 * @author RWA Contract Team
 */
contract PowerContract is ReentrancyGuard, Ownable, Pausable {
    using SafeERC20 for IERC20;
    
    /**
     * @dev Miner model information structure
     */
    struct MinerModel {
        string model;                  // Model name
        uint256 computingPower;        // Computing power
        uint256 powerConsumption;      // Power consumption
        uint256 price;                 // Price
        bool active;                   // Whether enabled
    }
    
    // Miner model mapping (using id as key)
    mapping(uint256 => MinerModel) private minerModels;
    uint256[] private modelIds;  // List of all model ids
    uint256 private nextModelId;  // Next available model ID
    
    address private usdtToken;  // USDT token address
    address private wbtcToken;  // WBTC token address
    
    address private financeWallet;  // Finance wallet
    address private multisigWallet;  // Multisig wallet
    
    struct FinanceWalletInfo {
        address wallet;
        uint256 usdtBalance;
        uint256 usdtAllowance;
        uint256 wbtcBalance;
        uint256 wbtcAllowance;
    }
    
    mapping(address => uint256) private usdtPurchasedAmount;  // User USDT purchase amount
    mapping(address => uint256) private usdtWithdrawalAmount;  // User USDT withdrawal amount
    mapping(address => uint256) private wbtcWithdrawalAmount;  // User WBTC withdrawal amount

    uint256 private totalPurchaseAmount;  // Total purchase amount
    uint256 private totalUsdtWithdrawalAmount;  // Total USDT withdrawal amount
    uint256 private totalWbtcWithdrawalAmount;  // Total WBTC withdrawal amount

    
    enum TokenType { USDT, WBTC }
    
    struct PurchaseRecord {
        address user;
        uint256 quantity;
        uint256 id;
        uint256 unitPrice;
        uint256 unitComputingPower;
        uint256 totalPrice;
        uint256 totalComputingPower;
        uint256 timestamp;
    }
    
    struct WithdrawalRecord {
        bytes32 id;
        address sender;
        address recipient;
        uint256 amount;
        TokenType tokenType;
        uint256 timestamp;
    }
    
    PurchaseRecord[] private usdtPurchaseRecords;  // USDT purchase record details
    mapping(address => uint256[]) private usdtPurchaseHistory;  // User USDT purchase record id list mapping
    
    WithdrawalRecord[] private usdtWithdrawalRecords;  // USDT withdrawal record details
    mapping(address => uint256[]) private usdtWithdrawalHistory;  // User USDT withdrawal record id list mapping
    WithdrawalRecord[] private wbtcWithdrawalRecords;  // WBTC withdrawal record details
    mapping(address => uint256[]) private wbtcWithdrawalHistory;  // User WBTC withdrawal record id list mapping
    
    mapping(bytes32 => bool) private usedUsdtIds;  // Whether USDT withdrawal record id is already used
    mapping(bytes32 => bool) private usedWbtcIds;  // Whether WBTC withdrawal record id is already used
    
    event MultisigWalletUpdated(address indexed oldWallet, address indexed newWallet); 
    
    event ComputingPowerPurchased(
        address indexed user,
        uint256 indexed quantity,
        uint256 indexed id,
        string model,
        uint256 unitPrice,
        uint256 unitComputingPower,
        uint256 totalPrice,
        uint256 totalComputingPower,
        uint256 timestamp
    );  
    
    event MinerModelAdded(uint256 indexed id, string indexed model, uint256 computingPower, uint256 powerConsumption, uint256 price);
    event MinerModelUpdated(uint256 indexed id, string indexed model, uint256 computingPower, uint256 powerConsumption, uint256 price);
    event MinerModelActivated(uint256 indexed id, string indexed model, bool active);
    
    event EmergencyWithdraw(address indexed to, uint256 indexed amount);
    
    event FinanceWalletUpdated(address indexed oldWallet, address indexed newWallet);
    
    event PaymentProcessed(
        bytes32 indexed id,
        address indexed sender,
        address indexed recipient,
        uint256 amount,
        TokenType tokenType,
        uint256 timestamp
    );
    
    error InvalidAddress();
    error InvalidAmount();
    error InsufficientBalance();
    error InsufficientAllowance();
    error OnlyIntegerAmount();
    error InvalidPageSize();
    error InvalidOffset();
    error InsufficientFinanceWalletBalance();
    error InsufficientFinanceWalletAllowance();
    error NotAuthorized();
    error DuplicateId();
    error InvalidId();
    error InvalidModelKey();
    error MinerModelNotActive();
    error MinerModelAlreadyExists();
    error MinerModelNotFound();
    
    /**
     * @dev Constructor
     * @param _usdtToken USDT token contract address
     * @param _wbtcToken WBTC token contract address
     * @param _multisigWallet Multisig wallet address for receiving funds
     * @param _financeWallet Finance wallet address
     */
    constructor(
        address _usdtToken,
        address _wbtcToken,
        address _multisigWallet,
        address _financeWallet
    ) Ownable(msg.sender) {
        if (_usdtToken == address(0)) revert InvalidAddress();
        if (_wbtcToken == address(0)) revert InvalidAddress();
        if (_multisigWallet == address(0)) revert InvalidAddress();
        if (_financeWallet == address(0)) revert InvalidAddress();
        
        usdtToken = _usdtToken;
        wbtcToken = _wbtcToken;
        multisigWallet = _multisigWallet;
        financeWallet = _financeWallet;
        
        // Add first miner model with ID 1
        uint256 id1 = 1;
        minerModels[id1] = MinerModel({
            model: "S19 XP+ Hyd",
            computingPower: 256,
            powerConsumption: 4896,
            price: 3072000000,
            active: false
        });
        modelIds.push(id1);
        emit MinerModelAdded(id1, "S19 XP+ Hyd", 256, 4896, 3072000000);
        
        // Add second miner model with ID 2
        uint256 id2 = 2;
        minerModels[id2] = MinerModel({
            model: "S21e Hyd",
            computingPower: 288,
            powerConsumption: 4896,
            price: 3544000000,
            active: true
        });
        modelIds.push(id2);
        emit MinerModelAdded(id2, "S21e Hyd", 288, 4896, 3544000000);
        
        // Next model ID starts from 3
        nextModelId = 3;
    }
    
    /**
     * @notice Set multisig wallet address
     * @param _multisigWallet Multisig wallet address
     */
    function setMultisigWallet(address _multisigWallet) external onlyOwner {
        if (_multisigWallet == address(0)) revert InvalidAddress();
        
        address oldWallet = multisigWallet;
        multisigWallet = _multisigWallet;
        
        emit MultisigWalletUpdated(oldWallet, _multisigWallet);
    }
    
    /**
     * @notice Set finance wallet address
     * @param _financeWallet Finance wallet address
     */
    function setFinanceWallet(address _financeWallet) external onlyOwner {
        if (_financeWallet == address(0)) revert InvalidAddress();
        
        address oldWallet = financeWallet;
        financeWallet = _financeWallet;
        
        emit FinanceWalletUpdated(oldWallet, _financeWallet);
    }
    
    /**
     * @notice Process USDT payment to a recipient using pre-authorized amount (finance wallet only)
     * @param _recipient Recipient address
     * @param _amount Amount to transfer (USDT, 6 decimals)
     * @param _id Unique payment ID (hash)
     */
    function paymentUsdt(address _recipient, uint256 _amount, bytes32 _id) external nonReentrant whenNotPaused {
        if (msg.sender != financeWallet) revert NotAuthorized();
        if (_recipient == address(0)) revert InvalidAddress();
        if (_amount == 0) revert InvalidAmount();
        if (_id == bytes32(0)) revert InvalidId();
        if (_isIdAlreadyUsed(_id, TokenType.USDT)) revert DuplicateId();
        
        // Check finance wallet balance and allowance
        uint256 financeBalance = IERC20(usdtToken).balanceOf(financeWallet);
        uint256 financeAllowance = IERC20(usdtToken).allowance(financeWallet, address(this));
        
        if (financeBalance < _amount) revert InsufficientFinanceWalletBalance();
        if (financeAllowance < _amount) revert InsufficientFinanceWalletAllowance();
        
        // Mark ID as used
        usedUsdtIds[_id] = true;
        
        // Record USDT withdrawal history
        uint256 recordId = usdtWithdrawalRecords.length;
        usdtWithdrawalRecords.push(WithdrawalRecord({
            id: _id,
            sender: msg.sender,
            recipient: _recipient,
            amount: _amount,
            tokenType: TokenType.USDT,
            timestamp: block.timestamp
        }));

        usdtWithdrawalHistory[_recipient].push(recordId);
        
        // Update user and global USDT withdrawal amounts
        usdtWithdrawalAmount[_recipient] += _amount;
        totalUsdtWithdrawalAmount += _amount;
        
        // Perform external call last
        IERC20(usdtToken).safeTransferFrom(financeWallet, _recipient, _amount);
        
        emit PaymentProcessed(
            _id,
            msg.sender,
            _recipient,
            _amount,
            TokenType.USDT,
            block.timestamp
        );
    }
    
    /**
     * @notice Process WBTC payment to a recipient using pre-authorized amount (finance wallet only)
     * @param _recipient Recipient address
     * @param _amount Amount to transfer (WBTC, 8 decimals)
     * @param _id Unique payment ID (hash)
     */
    function paymentWbtc(address _recipient, uint256 _amount, bytes32 _id) external nonReentrant whenNotPaused {
        if (msg.sender != financeWallet) revert NotAuthorized();
        if (_recipient == address(0)) revert InvalidAddress();
        if (_amount == 0) revert InvalidAmount();
        if (_id == bytes32(0)) revert InvalidId();
        if (_isIdAlreadyUsed(_id, TokenType.WBTC)) revert DuplicateId();
        
        // Check finance wallet balance and allowance
        uint256 financeBalance = IERC20(wbtcToken).balanceOf(financeWallet);
        uint256 financeAllowance = IERC20(wbtcToken).allowance(financeWallet, address(this));
        
        if (financeBalance < _amount) revert InsufficientFinanceWalletBalance();
        if (financeAllowance < _amount) revert InsufficientFinanceWalletAllowance();
        
        // Update all state before external call to prevent reentrancy attacks
        // Mark ID as used
        usedWbtcIds[_id] = true;
        
        // Record WBTC withdrawal history
        uint256 recordId = wbtcWithdrawalRecords.length;
        wbtcWithdrawalRecords.push(WithdrawalRecord({
            id: _id,
            sender: msg.sender,
            recipient: _recipient,
            amount: _amount,
            tokenType: TokenType.WBTC,
            timestamp: block.timestamp
        }));
        wbtcWithdrawalHistory[_recipient].push(recordId);
        
        // Update user and global WBTC withdrawal amounts
        wbtcWithdrawalAmount[_recipient] += _amount;
        totalWbtcWithdrawalAmount += _amount;
        
        // Perform external call last
        IERC20(wbtcToken).safeTransferFrom(financeWallet, _recipient, _amount);
        
        emit PaymentProcessed(
            _id,
            msg.sender,
            _recipient,
            _amount,
            TokenType.WBTC,
            block.timestamp
        );
    }
    
    /**
     * @dev Internal computing power purchase function
     * @param _quantity Miner quantity
     * @param _id Model id
     */
    function purchaseComputingPowerWithModel(uint256 _quantity, uint256 _id) external nonReentrant whenNotPaused {
        // Check if parameters are valid
        if (_quantity == 0) revert InvalidAmount();
        if (_id == 0) revert InvalidModelKey();

        // Check if model exists and is active
        MinerModel storage model = minerModels[_id];
        if (model.price == 0) revert MinerModelNotFound();
        if (!model.active) revert MinerModelNotActive();
        
        // Calculate total amount = miner quantity × unit price
        uint256 totalAmount = _quantity * model.price;
        
        uint256 maxPurchaseAmount = 10_000_000 * 10**6;
        if (totalAmount > maxPurchaseAmount) revert InvalidAmount();
        
        // Calculate computing power = miner quantity × single miner computing power
        uint256 computingPower = _quantity * model.computingPower;
        
        if (IERC20(usdtToken).balanceOf(msg.sender) < totalAmount) revert InsufficientBalance();
        if (IERC20(usdtToken).allowance(msg.sender, address(this)) < totalAmount) revert InsufficientAllowance();
        
        // Transfer funds directly from user to multisig wallet, avoiding contract intermediate storage
        IERC20(usdtToken).safeTransferFrom(msg.sender, multisigWallet, totalAmount);
        
        usdtPurchasedAmount[msg.sender] += totalAmount;
        totalPurchaseAmount += totalAmount;
        uint256 recordId = usdtPurchaseRecords.length;
        usdtPurchaseRecords.push(PurchaseRecord({
            user: msg.sender,
            quantity: _quantity,
            id: _id,
            unitPrice: model.price,
            unitComputingPower: model.computingPower,
            totalPrice: totalAmount,
            totalComputingPower: computingPower,
            timestamp: block.timestamp
        }));
        usdtPurchaseHistory[msg.sender].push(recordId);
        
        emit ComputingPowerPurchased(
            msg.sender,
            _quantity,
            _id,
            model.model,
            model.price,
            model.computingPower,
            totalAmount,
            computingPower,
            block.timestamp
        );
    }
    
    
    /**
     * @notice Add a new miner model (only owner)
     * @param _model Model name
     * @param _computingPower Computing power for this model
     * @param _powerConsumption Power consumption for this model
     * @param _price Price for this model
     * @return The generated model id
     */
    function addMinerModel(string memory _model, uint256 _computingPower, uint256 _powerConsumption, uint256 _price) external onlyOwner returns (uint256) {
        if (bytes(_model).length == 0) revert InvalidModelKey();
        if (_computingPower == 0) revert InvalidAmount();
        if (_powerConsumption == 0) revert InvalidAmount();
        if (_price == 0) revert InvalidAmount();
        
        uint256 newId = nextModelId;
        nextModelId++;
        
        minerModels[newId] = MinerModel({
            model: _model,
            computingPower: _computingPower,
            powerConsumption: _powerConsumption,
            price: _price,
            active: true
        });
        
        modelIds.push(newId);
        
        emit MinerModelAdded(newId, _model, _computingPower, _powerConsumption, _price);
        
        return newId;
    }
    
    /**
     * @notice Update miner model (only owner)
     * @param _id Model id
     * @param _model Model name
     * @param _computingPower New computing power
     * @param _powerConsumption New power consumption
     * @param _price New price
     */
    function updateMinerModel(uint256 _id, string memory _model, uint256 _computingPower, uint256 _powerConsumption, uint256 _price) external onlyOwner {
        if (_id == 0) revert InvalidModelKey();
        if (bytes(_model).length == 0) revert InvalidModelKey();
        if (_computingPower == 0) revert InvalidAmount();
        if (_powerConsumption == 0) revert InvalidAmount();
        if (_price == 0) revert InvalidAmount();
        
        if (!_modelExists(_id)) revert MinerModelNotFound();
        
        MinerModel storage model = minerModels[_id];
        model.model = _model;
        model.computingPower = _computingPower;
        model.powerConsumption = _powerConsumption;
        model.price = _price;
        
        emit MinerModelUpdated(_id, _model, _computingPower, _powerConsumption, _price);
    }
    
    /**
     * @notice Activate or deactivate a miner model (only owner)
     * @param _id Model id
     * @param _active Active status
     */
    function setMinerModelActive(uint256 _id, bool _active) external onlyOwner {
        if (!_modelExists(_id)) revert MinerModelNotFound();
        
        MinerModel storage model = minerModels[_id];
        model.active = _active;
        
        emit MinerModelActivated(_id, model.model, _active);
    }
    
    /**
     * @notice Get miner model information
     * @param _id Model id
     * @return Miner model information
     */
    function getMinerModel(uint256 _id) external view returns (MinerModel memory) {
        if (!_modelExists(_id)) revert MinerModelNotFound();
        
        return minerModels[_id];
    }
    
    /**
     * @notice Get all model ids
     * @return Array of all model ids
     */
    function getAllModelIds() external view returns (uint256[] memory) {
        return modelIds;
    }
    
    /**
     * @notice Get all active model ids
     * @return Array of active model ids
     */
    function getActiveModelIds() external view returns (uint256[] memory) {
        uint256 activeCount = 0;
        
        // First pass: count active models
        for (uint256 i = 0; i < modelIds.length; i++) {
            if (_modelIsActive(modelIds[i])) {
                activeCount++;
            }
        }
        
        // Second pass: populate array with active model ids
        uint256[] memory activeModelIds = new uint256[](activeCount);
        uint256 index = 0;
        for (uint256 i = 0; i < modelIds.length; i++) {
            if (_modelIsActive(modelIds[i])) {
                activeModelIds[index] = modelIds[i];
                index++;
            }
        }
        
        return activeModelIds;
    }
    
    /**
     * @notice Check if a model exists
     * @param _id Model id
     * @return Whether the model exists
     */
    function modelExists(uint256 _id) external view returns (bool) {
        return _modelExists(_id);
    }
    
    /**
     * @notice Query user purchase history with pagination
     * @param _user User address
     * @param _offset Offset
     * @param _limit Limit count
     * @return Purchase record array
     */
    function getPurchaseHistory(address _user, uint256 _offset, uint256 _limit) 
        external view returns (PurchaseRecord[] memory) {
        if (_limit == 0 || _limit > 100) revert InvalidPageSize();
        
        uint256[] memory recordIds = usdtPurchaseHistory[_user];
        if (_offset > recordIds.length) revert InvalidOffset();
        
        if (_offset == recordIds.length) {
            return new PurchaseRecord[](0);
        }
        
        uint256 end = _offset + _limit;
        if (end > recordIds.length) {
            end = recordIds.length;
        }
        
        PurchaseRecord[] memory records = new PurchaseRecord[](end - _offset);
        for (uint256 i = _offset; i < end; i++) {
            records[i - _offset] = usdtPurchaseRecords[recordIds[i]];
        }
        
        return records;
    }
    
    /**
     * @notice Get user's total purchase amount
     * @param _user User address
     * @return Total purchase amount
     */
    function getUsdtPurchasedAmount(address _user) external view returns (uint256) {
        return usdtPurchasedAmount[_user];
    }
    
    /**
     * @notice Get total purchase amount across all users
     * @return Total purchase amount across the entire network
     */
    function getTotalPurchaseAmount() external view returns (uint256) {
        return totalPurchaseAmount;
    }
    
    /**
     * @notice Get total USDT withdrawal amount across all users
     * @return Total USDT withdrawal amount across the entire network
     */
    function getTotalUsdtWithdrawalAmount() external view returns (uint256) {
        return totalUsdtWithdrawalAmount;
    }
    
    /**
     * @notice Get total WBTC withdrawal amount across all users
     * @return Total WBTC withdrawal amount across the entire network
     */
    function getTotalWbtcWithdrawalAmount() external view returns (uint256) {
        return totalWbtcWithdrawalAmount;
    }
    
    /**
     * @notice Query user USDT withdrawal history with pagination
     * @param _user User address
     * @param _offset Offset
     * @param _limit Limit count
     * @return USDT withdrawal record array
     */
    function getUserUsdtWithdrawalHistory(address _user, uint256 _offset, uint256 _limit) 
        external view returns (WithdrawalRecord[] memory) {
        if (_limit == 0 || _limit > 100) revert InvalidPageSize();
        
        uint256[] memory recordIds = usdtWithdrawalHistory[_user];
        if (_offset > recordIds.length) revert InvalidOffset();
        
        if (_offset == recordIds.length) {
            return new WithdrawalRecord[](0);
        }
        
        uint256 end = _offset + _limit;
        if (end > recordIds.length) {
            end = recordIds.length;
        }
        
        WithdrawalRecord[] memory records = new WithdrawalRecord[](end - _offset);
        for (uint256 i = _offset; i < end; i++) {
            records[i - _offset] = usdtWithdrawalRecords[recordIds[i]];
        }
        
        return records;
    }
    
    /**
     * @notice Query user WBTC withdrawal history with pagination
     * @param _user User address
     * @param _offset Offset
     * @param _limit Limit count
     * @return WBTC withdrawal record array
     */
    function getUserWbtcWithdrawalHistory(address _user, uint256 _offset, uint256 _limit) 
        external view returns (WithdrawalRecord[] memory) {
        if (_limit == 0 || _limit > 100) revert InvalidPageSize();
        
        uint256[] memory recordIds = wbtcWithdrawalHistory[_user];
        if (_offset > recordIds.length) revert InvalidOffset();
        
        if (_offset == recordIds.length) {
            return new WithdrawalRecord[](0);
        }
        
        uint256 end = _offset + _limit;
        if (end > recordIds.length) {
            end = recordIds.length;
        }
        
        WithdrawalRecord[] memory records = new WithdrawalRecord[](end - _offset);
        for (uint256 i = _offset; i < end; i++) {
            records[i - _offset] = wbtcWithdrawalRecords[recordIds[i]];
        }
        
        return records;
    }
    
    /**
     * @notice Get user's total USDT withdrawal amount (from stored amount)
     * @param _user User address
     * @return Total USDT withdrawal amount
     */
    function getUserUsdtWithdrawalAmount(address _user) external view returns (uint256) {
        return usdtWithdrawalAmount[_user];
    }
    
    /**
     * @notice Get user's total WBTC withdrawal amount (from stored amount)
     * @param _user User address
     * @return Total WBTC withdrawal amount
     */
    function getUserWbtcWithdrawalAmount(address _user) external view returns (uint256) {
        return wbtcWithdrawalAmount[_user];
    }
    
    /**
     * @notice Get multisig wallet address
     * @return Multisig wallet address
     */
    function getMultisigWallet() external view returns (address) {
        return multisigWallet;
    }
    
    /**
     * @notice Emergency pause contract
     */
    function pause() external onlyOwner {
        _pause();
    }
    
    /**
     * @notice Resume contract operation
     */
    function unpause() external onlyOwner {
        _unpause();
    }
    
    /**
     * @notice Emergency withdraw any ERC20 token to owner (admin only)
     * @param _amount Withdrawal amount
     * @param _tokenAddress ERC20 token contract address
     */
    function emergencyWithdraw(uint256 _amount, address _tokenAddress) external onlyOwner {
        if (_amount == 0) revert InvalidAmount();
        if (_tokenAddress == address(0)) revert InvalidAddress();
        
        if (IERC20(_tokenAddress).balanceOf(address(this)) < _amount) revert InsufficientBalance();
        
        IERC20(_tokenAddress).safeTransfer(msg.sender, _amount);
        emit EmergencyWithdraw(msg.sender, _amount);
    }
    
    /**
     * @notice Get USDT token contract address
     * @return USDT token contract address
     */
    function getUSDTToken() external view returns (address) {
        return usdtToken;
    }
    
    /**
     * @notice Get WBTC token contract address
     * @return WBTC token contract address
     */
    function getWBTCToken() external view returns (address) {
        return wbtcToken;
    }
    
    /**
     * @notice Get finance wallet address
     * @return Finance wallet address
     */
    function getFinanceWallet() external view returns (address) {
        return financeWallet;
    }
    
    /**
     * @notice Get finance wallet information (address, USDT and WBTC balances and allowances)
     * @return Finance wallet information including both USDT and WBTC data
     */
    function getFinanceWalletInfo() external view returns (FinanceWalletInfo memory) {
        if (financeWallet == address(0)) {
            return FinanceWalletInfo({
                wallet: address(0),
                usdtBalance: 0,
                usdtAllowance: 0,
                wbtcBalance: 0,
                wbtcAllowance: 0
            });
        }
        
        return FinanceWalletInfo({
            wallet: financeWallet,
            usdtBalance: IERC20(usdtToken).balanceOf(financeWallet),
            usdtAllowance: IERC20(usdtToken).allowance(financeWallet, address(this)),
            wbtcBalance: IERC20(wbtcToken).balanceOf(financeWallet),
            wbtcAllowance: IERC20(wbtcToken).allowance(financeWallet, address(this))
        });
    }
    
    /**
     * @notice Disabled function - renounceOwnership is not allowed
     * @dev This function is overridden to prevent renouncing ownership
     */
    function renounceOwnership() public pure override {
        revert("Renounce ownership is disabled");
    }    
    
    /**
     * @dev Check if payment ID already exists in withdrawal records for specific token type
     * @param _id Payment ID to check (hash)
     * @param _tokenType Token type to check (USDT or WBTC)
     * @return Whether ID already exists for the specified token type
     */
    function _isIdAlreadyUsed(bytes32 _id, TokenType _tokenType) internal view returns (bool) {
        if (_tokenType == TokenType.USDT) {
            return usedUsdtIds[_id];
        } else if (_tokenType == TokenType.WBTC) {
            return usedWbtcIds[_id];
        }
        return false;
    }
    
    /**
     * @dev Check if a miner model exists by checking if price is non-zero
     * @param _id Model id to check
     * @return Whether the model exists
     */
    function _modelExists(uint256 _id) internal view returns (bool) {
        return minerModels[_id].price != 0;
    }
    
    /**
     * @dev Check if a miner model exists and is active
     * @param _id Model id to check
     * @return Whether the model exists and is active
     */
    function _modelIsActive(uint256 _id) internal view returns (bool) {
        MinerModel storage model = minerModels[_id];
        return model.price != 0 && model.active;
    }
}

SafeERC20.sol 212 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    /**
     * @dev An operation with an ERC-20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)

pragma solidity >=0.4.16;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
interface IERC20 {
    /**
     * @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 Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}
Pausable.sol 112 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    bool private _paused;

    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

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

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

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

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

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
ReentrancyGuard.sol 87 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

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

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

    uint256 private _status;

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

    constructor() {
        _status = NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

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

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

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

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

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}
IERC1363.sol 86 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)

pragma solidity >=0.6.2;

import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}
IERC165.sol 6 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)

pragma solidity >=0.4.16;

import {IERC165} from "../utils/introspection/IERC165.sol";
IERC20.sol 6 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)

pragma solidity >=0.4.16;

import {IERC20} from "../token/ERC20/IERC20.sol";
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)

pragma solidity >=0.4.16;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * 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[ERC 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);
}

Read Contract

getActiveModelIds 0xc192ac8a → uint256[]
getAllModelIds 0x2122496d → uint256[]
getFinanceWallet 0xb8027844 → address
getFinanceWalletInfo 0xf5e68973 → tuple
getMinerModel 0x039e90b0 → tuple
getMultisigWallet 0x27601006 → address
getPurchaseHistory 0xb7a19f7b → tuple[]
getTotalPurchaseAmount 0x3c94bf9b → uint256
getTotalUsdtWithdrawalAmount 0xd0694239 → uint256
getTotalWbtcWithdrawalAmount 0x499fc4ff → uint256
getUSDTToken 0x873673cd → address
getUsdtPurchasedAmount 0x6f9caaef → uint256
getUserUsdtWithdrawalAmount 0x1fd13228 → uint256
getUserUsdtWithdrawalHistory 0xefaf4614 → tuple[]
getUserWbtcWithdrawalAmount 0x4c7203d1 → uint256
getUserWbtcWithdrawalHistory 0x2157abbb → tuple[]
getWBTCToken 0x0c18eeab → address
modelExists 0x5f707c0c → bool
owner 0x8da5cb5b → address
paused 0x5c975abb → bool
renounceOwnership 0x715018a6

Write Contract 12 functions

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

addMinerModel 0xb40b2ebf
string _model
uint256 _computingPower
uint256 _powerConsumption
uint256 _price
returns: uint256
emergencyWithdraw 0x2f940c70
uint256 _amount
address _tokenAddress
pause 0x8456cb59
No parameters
paymentUsdt 0x817e3670
address _recipient
uint256 _amount
bytes32 _id
paymentWbtc 0xdafe6cd5
address _recipient
uint256 _amount
bytes32 _id
purchaseComputingPowerWithModel 0xdf97fabb
uint256 _quantity
uint256 _id
setFinanceWallet 0x07a09b45
address _financeWallet
setMinerModelActive 0x5275868d
uint256 _id
bool _active
setMultisigWallet 0x64913477
address _multisigWallet
transferOwnership 0xf2fde38b
address newOwner
unpause 0x3f4ba83a
No parameters
updateMinerModel 0xc8122a9f
uint256 _id
string _model
uint256 _computingPower
uint256 _powerConsumption
uint256 _price

Recent Transactions

This address has 1 on-chain transactions, but only 1.3% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →