From d5ef1dc478d2ae63f86706d345c22d31cd3c4549 Mon Sep 17 00:00:00 2001 From: yiqi Date: Thu, 11 Aug 2022 16:00:52 +0800 Subject: [PATCH 01/66] Initial commit for bridge oracle client. --- AElf.Contracts.PortAll.sln | 80 +- .../AElf.Client.Bridge.csproj | 18 + .../AElfClientBridgeModule.cs | 18 + modules/AElf.Client.Bridge/BridgeOptions.cs | 6 + .../AElf.Client.Core/AElf.Client.Core.csproj | 25 + .../AElfClientAbpConstants.cs | 6 + modules/AElf.Client.Core/AElfClientModule.cs | 31 + .../AElfClientService.Blockchain.cs | 51 + .../AElfClientService.Send.cs | 64 + .../AElfClientService.View.cs | 68 + .../ContractService.ttinclude | 59 + .../AElf.Client.Core/ContractServiceBase.cs | 55 + .../Extensions/EventExtensions.cs | 12 + modules/AElf.Client.Core/GlobalUsings.cs | 1 + .../AElf.Client.Core/IAElfAccountProvider.cs | 134 + .../AElf.Client.Core/IAElfClientProvider.cs | 81 + .../AElf.Client.Core/IAElfClientService.cs | 25 + .../Infrastructure/IKeyDirectoryProvider.cs | 6 + .../Infrastructure/KeyDirectoryProvider.cs | 24 + .../Options/AElfAccountOptions.cs | 15 + .../Options/AElfClientConfigOptions.cs | 10 + .../Options/AElfClientOptions.cs | 15 + .../Options/AElfContractOptions.cs | 7 + .../Options/AElfMinerAccountOptions.cs | 6 + .../AElf.Client.Core/Profile/CommonProfile.cs | 27 + .../Profile/MerklePathProfile.cs | 16 + .../Profile/TransactionProfile.cs | 78 + .../AElf.Client.Core/SendTransactionResult.cs | 7 + .../AElf.Client.MerkleTree.csproj | 33 + .../AElfClientMerkleTreeModule.cs | 16 + .../ContractService.ttinclude | 84 + .../MerkleTreeContract.tt | 84 + .../AElf.Client.Oracle.csproj | 33 + .../AElfClientOracleModule.cs | 18 + .../ContractService.ttinclude | 59 + modules/AElf.Client.Oracle/OracleOptions.cs | 6 + modules/AElf.Client.Oracle/OracleService.tt | 54 + .../AElf.Client.Protobuf.csproj | 94 + .../AElf.Client.Protobuf/Protobuf/acs0.proto | 234 + .../AElf.Client.Protobuf/Protobuf/acs1.proto | 53 + .../AElf.Client.Protobuf/Protobuf/acs10.proto | 80 + .../AElf.Client.Protobuf/Protobuf/acs11.proto | 31 + .../AElf.Client.Protobuf/Protobuf/acs13.proto | 21 + .../AElf.Client.Protobuf/Protobuf/acs2.proto | 30 + .../AElf.Client.Protobuf/Protobuf/acs3.proto | 207 + .../AElf.Client.Protobuf/Protobuf/acs4.proto | 70 + .../AElf.Client.Protobuf/Protobuf/acs5.proto | 51 + .../AElf.Client.Protobuf/Protobuf/acs6.proto | 22 + .../AElf.Client.Protobuf/Protobuf/acs7.proto | 292 + .../AElf.Client.Protobuf/Protobuf/acs8.proto | 35 + .../AElf.Client.Protobuf/Protobuf/acs9.proto | 52 + .../Protobuf/aedpos_contract.proto | 440 + .../Protobuf/aelf/core.proto | 147 + .../Protobuf/aelf/options.proto | 38 + .../Protobuf/association_contract.proto | 144 + .../Protobuf/authority_info.proto | 10 + .../Protobuf/basic_contract_zero.proto | 71 + .../Protobuf/bridge_contract.proto | 207 + .../Protobuf/callback_input.proto | 9 + .../Protobuf/configuration_contract.proto | 52 + .../Protobuf/cross_chain_contract.proto | 266 + .../Protobuf/economic_contract.proto | 62 + .../Protobuf/election_contract.proto | 522 + .../Protobuf/kernel.proto | 183 + .../Protobuf/merkle_tree_contract.proto | 219 + .../Protobuf/nft_contract.proto | 505 + .../Protobuf/oracle_contract.proto | 380 + .../Protobuf/parliament_contract.proto | 148 + .../Protobuf/profit_contract.proto | 370 + .../Protobuf/receipt_maker.proto | 35 + .../Protobuf/referendum_contract.proto | 129 + .../Protobuf/regiment_contract.proto | 152 + .../Protobuf/report_contract.proto | 313 + .../Protobuf/token_contract.proto | 782 ++ .../Protobuf/token_contract_impl.proto | 240 + .../Protobuf/token_converter_contract.proto | 193 + .../Protobuf/token_holder_contract.proto | 132 + .../Protobuf/transaction_fee.proto | 47 + .../Protobuf/treasury_contract.proto | 149 + .../Protobuf/vote_contract.proto | 311 + .../Protobuf/whitelist_contract.proto | 581 ++ .../AElf.Client.Report.csproj | 33 + .../AElfClientReportModule.cs | 12 + .../ContractService.ttinclude | 58 + modules/AElf.Client.Report/ReportService.tt | 54 + modules/AElf.Client/AElf.Client.csproj | 22 + modules/AElf.Client/AElfClient.Block.cs | 44 + modules/AElf.Client/AElfClient.Chain.cs | 69 + modules/AElf.Client/AElfClient.Client.cs | 265 + modules/AElf.Client/AElfClient.Net.cs | 80 + modules/AElf.Client/AElfClient.Transaction.cs | 165 + modules/AElf.Client/AElfClient.cs | 39 + modules/AElf.Client/AElfClientBuilder.cs | 73 + modules/AElf.Client/AElfClientConstants.cs | 15 + modules/AElf.Client/Dto/BlockBodyDto.cs | 8 + modules/AElf.Client/Dto/BlockDto.cs | 12 + modules/AElf.Client/Dto/BlockHeaderDto.cs | 24 + modules/AElf.Client/Dto/ChainStatusDto.cs | 28 + .../Dto/CreateRawTransactionInput.cs | 78 + .../Dto/CreateRawTransactionOutput.cs | 6 + .../Dto/ExecuteRawTransactionDto.cs | 14 + .../AElf.Client/Dto/ExecuteTransactionDto.cs | 9 + modules/AElf.Client/Dto/LogEventDto.cs | 12 + modules/AElf.Client/Dto/MerklePathDto.cs | 12 + modules/AElf.Client/Dto/NetworkInfoOutput.cs | 19 + modules/AElf.Client/Dto/PeerDto.cs | 24 + .../Dto/SendRawTransactionInput.cs | 19 + .../Dto/SendRawTransactionOutput.cs | 8 + .../AElf.Client/Dto/SendTransactionInput.cs | 9 + .../AElf.Client/Dto/SendTransactionOutput.cs | 6 + .../AElf.Client/Dto/SendTransactionsInput.cs | 9 + modules/AElf.Client/Dto/TaskQueueInfoDto.cs | 8 + modules/AElf.Client/Dto/TransactionDto.cs | 18 + .../Dto/TransactionPoolStatusOutput.cs | 7 + .../AElf.Client/Dto/TransactionResultDto.cs | 24 + modules/AElf.Client/EndpointType.cs | 10 + .../Exception/AElfClientException.cs | 9 + modules/AElf.Client/Exception/Error.cs | 35 + .../Extensions/StringExtensions.cs | 14 + .../TransactionResultDtoExtension.cs | 37 + modules/AElf.Client/GlobalUsings.cs | 1 + modules/AElf.Client/Helper/EndpointHelper.cs | 95 + modules/AElf.Client/Model/KeyPairInfo.cs | 9 + modules/AElf.Client/Services/HttpService.cs | 232 + .../AElf.Client/Services/IBlockAppService.cs | 12 + .../AElf.Client/Services/IChainAppService.cs | 15 + .../AElf.Client/Services/IClientService.cs | 13 + .../AElf.Client/Services/INetAppService.cs | 14 + .../Services/ITransactionAppService.cs | 27 + modules/AElf.Client/TransactionBuilder.cs | 60 + .../AElf.Nethereum.Core.csproj | 20 + .../AElfNethereumClientModule.cs | 23 + .../Options/EthereumAccountOptions.cs | 15 + .../Options/EthereumClientConfigOptions.cs | 7 + .../Options/EthereumContractOptions.cs | 13 + .../AElf.EventHandler.csproj | 9 +- src/AElf.EventHandler/Dto/Acs0c.cs | 273 - src/AElf.EventHandler/Dto/Acs0g.cs | 3657 ------- src/AElf.EventHandler/Dto/Acs1c.cs | 37 - src/AElf.EventHandler/Dto/Acs1g.cs | 612 -- src/AElf.EventHandler/Dto/AedposContractc.cs | 159 - src/AElf.EventHandler/Dto/AedposContractg.cs | 5772 ----------- src/AElf.EventHandler/Dto/AuthorityInfog.cs | 217 - src/AElf.EventHandler/Dto/BridgeContractc.cs | 230 - src/AElf.EventHandler/Dto/BridgeContractg.cs | 3653 ------- src/AElf.EventHandler/Dto/CallbackInputg.cs | 258 - .../Dto/IntegerAggregatorContractc.cs | 77 - .../Dto/IntegerAggregatorContractg.cs | 428 - src/AElf.EventHandler/Dto/LotteryContractc.cs | 308 - src/AElf.EventHandler/Dto/LotteryContractg.cs | 3171 ------ src/AElf.EventHandler/Dto/MTGeneratorc.cs | 157 - src/AElf.EventHandler/Dto/MTGeneratorg.cs | 1776 ---- .../Dto/MTRecorderContractc.cs | 215 - .../Dto/MTRecorderContractg.cs | 1842 ---- src/AElf.EventHandler/Dto/OracleContractc.cs | 571 -- src/AElf.EventHandler/Dto/OracleContractg.cs | 8705 ----------------- .../Dto/OracleUserContractc.cs | 90 - .../Dto/OracleUserContractg.cs | 950 -- src/AElf.EventHandler/Dto/ReceiptInfo.cs | 26 - src/AElf.EventHandler/Dto/ReceiptMakerg.cs | 333 - src/AElf.EventHandler/Dto/ReportContractc.cs | 365 - src/AElf.EventHandler/Dto/ReportContractg.cs | 5524 ----------- .../EventHandlerAppHostedService.cs | 87 +- .../EventHandlerAppModule.cs | 94 +- src/AElf.EventHandler/Helpers/DrawHelper.cs | 47 - .../Managers/AccountManager.cs | 133 - .../Managers/KeyAccount/AElfKeyStore.cs | 246 - .../Managers/KeyAccount/Account.cs | 23 - .../Managers/KeyAccount/AccountCache.cs | 89 - .../Managers/KeyAccount/IKeyStore.cs | 9 - .../Managers/KeyAccount/Password.cs | 19 - src/AElf.EventHandler/Managers/NodeManager.cs | 383 - .../Managers/TransactionManager.cs | 125 - src/AElf.EventHandler/Managers/Web3Manager.cs | 88 +- .../Options/ConfigOptions.cs | 7 +- .../Options/ContractAbiOptions.cs | 9 - .../Options/ContractAddressOptions.cs | 15 - .../Options/EthereumConfigOptions.cs | 4 - .../Options/LotteryOptions.cs | 13 - .../AggregateDataReceivedLogEventProcessor.cs | 3 +- .../ContractDeployedLogEventProcessor.cs | 35 +- .../Processors/ILogEventProcessor.cs | 2 +- ...IrreversibleBlockFoundLogEventProcessor.cs | 264 +- .../Processors/LogEventProcessorBase.cs | 11 +- .../QueryCompletedLogEventProcessor.cs | 36 +- .../QueryCreatedLogEventProcessor.cs | 123 +- .../QueryDataRecordedLogEventProcessor.cs | 34 +- .../ReportConfirmedLogEventProcessor.cs | 175 +- .../ReportProposedLogEventProcessor.cs | 87 +- ...ntCommitmentsCollectedLogEventProcessor.cs | 95 +- src/AElf.EventHandler/Program.cs | 71 +- .../Providers/IDataProvider.cs | 506 +- .../ILatestQueriedReceiptCountProvider.cs | 11 +- .../ISignatureRecoverableInfoProvider.cs | 88 +- .../LatestQueriedReceiptCountProvider.cs | 27 +- .../TransactionResultListEventHandler.cs | 7 +- src/AElf.EventHandler/appsettings.json | 162 +- 197 files changed, 12383 insertions(+), 41545 deletions(-) create mode 100644 modules/AElf.Client.Bridge/AElf.Client.Bridge.csproj create mode 100644 modules/AElf.Client.Bridge/AElfClientBridgeModule.cs create mode 100644 modules/AElf.Client.Bridge/BridgeOptions.cs create mode 100644 modules/AElf.Client.Core/AElf.Client.Core.csproj create mode 100644 modules/AElf.Client.Core/AElfClientAbpConstants.cs create mode 100644 modules/AElf.Client.Core/AElfClientModule.cs create mode 100644 modules/AElf.Client.Core/AElfClientService.Blockchain.cs create mode 100644 modules/AElf.Client.Core/AElfClientService.Send.cs create mode 100644 modules/AElf.Client.Core/AElfClientService.View.cs create mode 100644 modules/AElf.Client.Core/ContractService.ttinclude create mode 100644 modules/AElf.Client.Core/ContractServiceBase.cs create mode 100644 modules/AElf.Client.Core/Extensions/EventExtensions.cs create mode 100644 modules/AElf.Client.Core/GlobalUsings.cs create mode 100644 modules/AElf.Client.Core/IAElfAccountProvider.cs create mode 100644 modules/AElf.Client.Core/IAElfClientProvider.cs create mode 100644 modules/AElf.Client.Core/IAElfClientService.cs create mode 100644 modules/AElf.Client.Core/Infrastructure/IKeyDirectoryProvider.cs create mode 100644 modules/AElf.Client.Core/Infrastructure/KeyDirectoryProvider.cs create mode 100644 modules/AElf.Client.Core/Options/AElfAccountOptions.cs create mode 100644 modules/AElf.Client.Core/Options/AElfClientConfigOptions.cs create mode 100644 modules/AElf.Client.Core/Options/AElfClientOptions.cs create mode 100644 modules/AElf.Client.Core/Options/AElfContractOptions.cs create mode 100644 modules/AElf.Client.Core/Options/AElfMinerAccountOptions.cs create mode 100644 modules/AElf.Client.Core/Profile/CommonProfile.cs create mode 100644 modules/AElf.Client.Core/Profile/MerklePathProfile.cs create mode 100644 modules/AElf.Client.Core/Profile/TransactionProfile.cs create mode 100644 modules/AElf.Client.Core/SendTransactionResult.cs create mode 100644 modules/AElf.Client.MerkleTree/AElf.Client.MerkleTree.csproj create mode 100644 modules/AElf.Client.MerkleTree/AElfClientMerkleTreeModule.cs create mode 100644 modules/AElf.Client.MerkleTree/ContractService.ttinclude create mode 100644 modules/AElf.Client.MerkleTree/MerkleTreeContract.tt create mode 100644 modules/AElf.Client.Oracle/AElf.Client.Oracle.csproj create mode 100644 modules/AElf.Client.Oracle/AElfClientOracleModule.cs create mode 100644 modules/AElf.Client.Oracle/ContractService.ttinclude create mode 100644 modules/AElf.Client.Oracle/OracleOptions.cs create mode 100644 modules/AElf.Client.Oracle/OracleService.tt create mode 100644 modules/AElf.Client.Protobuf/AElf.Client.Protobuf.csproj create mode 100644 modules/AElf.Client.Protobuf/Protobuf/acs0.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/acs1.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/acs10.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/acs11.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/acs13.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/acs2.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/acs3.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/acs4.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/acs5.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/acs6.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/acs7.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/acs8.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/acs9.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/aedpos_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/aelf/core.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/aelf/options.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/association_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/authority_info.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/basic_contract_zero.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/bridge_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/callback_input.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/configuration_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/cross_chain_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/economic_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/election_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/kernel.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/merkle_tree_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/nft_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/oracle_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/parliament_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/profit_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/receipt_maker.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/referendum_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/regiment_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/report_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/token_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/token_contract_impl.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/token_converter_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/token_holder_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/transaction_fee.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/treasury_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/vote_contract.proto create mode 100644 modules/AElf.Client.Protobuf/Protobuf/whitelist_contract.proto create mode 100644 modules/AElf.Client.Report/AElf.Client.Report.csproj create mode 100644 modules/AElf.Client.Report/AElfClientReportModule.cs create mode 100644 modules/AElf.Client.Report/ContractService.ttinclude create mode 100644 modules/AElf.Client.Report/ReportService.tt create mode 100644 modules/AElf.Client/AElf.Client.csproj create mode 100644 modules/AElf.Client/AElfClient.Block.cs create mode 100644 modules/AElf.Client/AElfClient.Chain.cs create mode 100644 modules/AElf.Client/AElfClient.Client.cs create mode 100644 modules/AElf.Client/AElfClient.Net.cs create mode 100644 modules/AElf.Client/AElfClient.Transaction.cs create mode 100644 modules/AElf.Client/AElfClient.cs create mode 100644 modules/AElf.Client/AElfClientBuilder.cs create mode 100644 modules/AElf.Client/AElfClientConstants.cs create mode 100644 modules/AElf.Client/Dto/BlockBodyDto.cs create mode 100644 modules/AElf.Client/Dto/BlockDto.cs create mode 100644 modules/AElf.Client/Dto/BlockHeaderDto.cs create mode 100644 modules/AElf.Client/Dto/ChainStatusDto.cs create mode 100644 modules/AElf.Client/Dto/CreateRawTransactionInput.cs create mode 100644 modules/AElf.Client/Dto/CreateRawTransactionOutput.cs create mode 100644 modules/AElf.Client/Dto/ExecuteRawTransactionDto.cs create mode 100644 modules/AElf.Client/Dto/ExecuteTransactionDto.cs create mode 100644 modules/AElf.Client/Dto/LogEventDto.cs create mode 100644 modules/AElf.Client/Dto/MerklePathDto.cs create mode 100644 modules/AElf.Client/Dto/NetworkInfoOutput.cs create mode 100644 modules/AElf.Client/Dto/PeerDto.cs create mode 100644 modules/AElf.Client/Dto/SendRawTransactionInput.cs create mode 100644 modules/AElf.Client/Dto/SendRawTransactionOutput.cs create mode 100644 modules/AElf.Client/Dto/SendTransactionInput.cs create mode 100644 modules/AElf.Client/Dto/SendTransactionOutput.cs create mode 100644 modules/AElf.Client/Dto/SendTransactionsInput.cs create mode 100644 modules/AElf.Client/Dto/TaskQueueInfoDto.cs create mode 100644 modules/AElf.Client/Dto/TransactionDto.cs create mode 100644 modules/AElf.Client/Dto/TransactionPoolStatusOutput.cs create mode 100644 modules/AElf.Client/Dto/TransactionResultDto.cs create mode 100644 modules/AElf.Client/EndpointType.cs create mode 100644 modules/AElf.Client/Exception/AElfClientException.cs create mode 100644 modules/AElf.Client/Exception/Error.cs create mode 100644 modules/AElf.Client/Extensions/StringExtensions.cs create mode 100644 modules/AElf.Client/Extensions/TransactionResultDtoExtension.cs create mode 100644 modules/AElf.Client/GlobalUsings.cs create mode 100644 modules/AElf.Client/Helper/EndpointHelper.cs create mode 100644 modules/AElf.Client/Model/KeyPairInfo.cs create mode 100644 modules/AElf.Client/Services/HttpService.cs create mode 100644 modules/AElf.Client/Services/IBlockAppService.cs create mode 100644 modules/AElf.Client/Services/IChainAppService.cs create mode 100644 modules/AElf.Client/Services/IClientService.cs create mode 100644 modules/AElf.Client/Services/INetAppService.cs create mode 100644 modules/AElf.Client/Services/ITransactionAppService.cs create mode 100644 modules/AElf.Client/TransactionBuilder.cs create mode 100644 modules/AElf.Nethereum.Core/AElf.Nethereum.Core.csproj create mode 100644 modules/AElf.Nethereum.Core/AElfNethereumClientModule.cs create mode 100644 modules/AElf.Nethereum.Core/Options/EthereumAccountOptions.cs create mode 100644 modules/AElf.Nethereum.Core/Options/EthereumClientConfigOptions.cs create mode 100644 modules/AElf.Nethereum.Core/Options/EthereumContractOptions.cs delete mode 100644 src/AElf.EventHandler/Dto/Acs0c.cs delete mode 100644 src/AElf.EventHandler/Dto/Acs0g.cs delete mode 100644 src/AElf.EventHandler/Dto/Acs1c.cs delete mode 100644 src/AElf.EventHandler/Dto/Acs1g.cs delete mode 100644 src/AElf.EventHandler/Dto/AedposContractc.cs delete mode 100644 src/AElf.EventHandler/Dto/AedposContractg.cs delete mode 100644 src/AElf.EventHandler/Dto/AuthorityInfog.cs delete mode 100644 src/AElf.EventHandler/Dto/BridgeContractc.cs delete mode 100644 src/AElf.EventHandler/Dto/BridgeContractg.cs delete mode 100644 src/AElf.EventHandler/Dto/CallbackInputg.cs delete mode 100644 src/AElf.EventHandler/Dto/IntegerAggregatorContractc.cs delete mode 100644 src/AElf.EventHandler/Dto/IntegerAggregatorContractg.cs delete mode 100644 src/AElf.EventHandler/Dto/LotteryContractc.cs delete mode 100644 src/AElf.EventHandler/Dto/LotteryContractg.cs delete mode 100644 src/AElf.EventHandler/Dto/MTGeneratorc.cs delete mode 100644 src/AElf.EventHandler/Dto/MTGeneratorg.cs delete mode 100644 src/AElf.EventHandler/Dto/MTRecorderContractc.cs delete mode 100644 src/AElf.EventHandler/Dto/MTRecorderContractg.cs delete mode 100644 src/AElf.EventHandler/Dto/OracleContractc.cs delete mode 100644 src/AElf.EventHandler/Dto/OracleContractg.cs delete mode 100644 src/AElf.EventHandler/Dto/OracleUserContractc.cs delete mode 100644 src/AElf.EventHandler/Dto/OracleUserContractg.cs delete mode 100644 src/AElf.EventHandler/Dto/ReceiptInfo.cs delete mode 100644 src/AElf.EventHandler/Dto/ReceiptMakerg.cs delete mode 100644 src/AElf.EventHandler/Dto/ReportContractc.cs delete mode 100644 src/AElf.EventHandler/Dto/ReportContractg.cs delete mode 100644 src/AElf.EventHandler/Helpers/DrawHelper.cs delete mode 100644 src/AElf.EventHandler/Managers/AccountManager.cs delete mode 100644 src/AElf.EventHandler/Managers/KeyAccount/AElfKeyStore.cs delete mode 100644 src/AElf.EventHandler/Managers/KeyAccount/Account.cs delete mode 100644 src/AElf.EventHandler/Managers/KeyAccount/AccountCache.cs delete mode 100644 src/AElf.EventHandler/Managers/KeyAccount/IKeyStore.cs delete mode 100644 src/AElf.EventHandler/Managers/KeyAccount/Password.cs delete mode 100644 src/AElf.EventHandler/Managers/NodeManager.cs delete mode 100644 src/AElf.EventHandler/Managers/TransactionManager.cs delete mode 100644 src/AElf.EventHandler/Options/ContractAbiOptions.cs delete mode 100644 src/AElf.EventHandler/Options/ContractAddressOptions.cs delete mode 100644 src/AElf.EventHandler/Options/LotteryOptions.cs diff --git a/AElf.Contracts.PortAll.sln b/AElf.Contracts.PortAll.sln index 76b7320a..2554916b 100644 --- a/AElf.Contracts.PortAll.sln +++ b/AElf.Contracts.PortAll.sln @@ -16,8 +16,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Boilerplate.TestBase", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Contracts.Oracle", "contract\AElf.Contracts.Oracle\AElf.Contracts.Oracle.csproj", "{AC06E580-EFC8-4D3F-BA4A-B2D2D1F65B9F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AElf.Contracts.Oracle.Tests", "test\AElf.Contracts.Oracle.Tests\AElf.Contracts.Oracle.Tests.csproj", "{3631B538-C617-4FCE-9C9B-1D1B5F290A7F}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Boilerplate.ContractPatcher", "src\AElf.Boilerplate.ContractPatcher\AElf.Boilerplate.ContractPatcher.csproj", "{DCC207EA-842A-4B54-858B-295CAA8947D5}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Contracts.OracleUser", "contract\AElf.Contracts.OracleUser\AElf.Contracts.OracleUser.csproj", "{1A8F790C-4172-426C-83E3-2B49589782AB}" @@ -46,11 +44,28 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Contracts.TokenLockRec EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Contracts.Lottery", "contract\AElf.Contracts.Lottery\AElf.Contracts.Lottery.csproj", "{BDB841AC-3230-4EBF-A735-EEF30CDE20ED}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Contracts.Lottery.Tests", "test\AElf.Contracts.Lottery.Tests\AElf.Contracts.Lottery.Tests.csproj", "{073D711D-9F38-472D-ACE2-9830A222768C}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.TokenSwap", "src\AElf.TokenSwap\AElf.TokenSwap.csproj", "{AFFFAFFC-992F-4A88-95A8-C395D04B36D3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Contracts.Bridge.Tests", "test\AElf.Contracts.Bridge.Tests\AElf.Contracts.Bridge.Tests.csproj", "{463F5276-2D88-4A66-AA45-688F1920E1D7}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "modules", "modules", "{FDE8EA32-0CD6-464B-A974-B6C3A3FB7039}" + ProjectSection(SolutionItems) = preProject + modules\AElf.Nethereum.Core\obj\Debug\net6.0\.NETCoreApp,Version = v6.0.AssemblyAttributes.cs = modules\AElf.Nethereum.Core\obj\Debug\net6.0\.NETCoreApp,Version=v6.0.AssemblyAttributes.cs + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Client", "modules\AElf.Client\AElf.Client.csproj", "{45B743E6-3B58-4AFA-9782-EA67015C9CD3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Client.Core", "modules\AElf.Client.Core\AElf.Client.Core.csproj", "{8E6296BA-D3A6-4C23-837C-8A40A6BE3822}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Client.Oracle", "modules\AElf.Client.Oracle\AElf.Client.Oracle.csproj", "{EA90104B-835D-4700-B0CD-93045173C033}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Client.Protobuf", "modules\AElf.Client.Protobuf\AElf.Client.Protobuf.csproj", "{60CE45CF-3CF2-47DD-BE40-DB5585A5B0DE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Client.Report", "modules\AElf.Client.Report\AElf.Client.Report.csproj", "{E4400680-1754-48A9-BEE9-8A6BC79302C2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Client.MerkleTree", "modules\AElf.Client.MerkleTree\AElf.Client.MerkleTree.csproj", "{538194EF-9329-4C90-8BD9-0E6EFDFEF691}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Nethereum.Core", "modules\AElf.Nethereum.Core\AElf.Nethereum.Core.csproj", "{4175F31E-5ED6-4B67-973C-51B0C44BE74B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Client.Bridge", "modules\AElf.Client.Bridge\AElf.Client.Bridge.csproj", "{ADD0EBAC-F957-4D59-AF43-C10D31DFB2DA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -58,10 +73,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3631B538-C617-4FCE-9C9B-1D1B5F290A7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3631B538-C617-4FCE-9C9B-1D1B5F290A7F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3631B538-C617-4FCE-9C9B-1D1B5F290A7F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3631B538-C617-4FCE-9C9B-1D1B5F290A7F}.Release|Any CPU.Build.0 = Release|Any CPU {9484A7A9-CA57-4FF4-9FD8-27BFEF92EDBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9484A7A9-CA57-4FF4-9FD8-27BFEF92EDBC}.Debug|Any CPU.Build.0 = Debug|Any CPU {9484A7A9-CA57-4FF4-9FD8-27BFEF92EDBC}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -126,24 +137,47 @@ Global {BDB841AC-3230-4EBF-A735-EEF30CDE20ED}.Debug|Any CPU.Build.0 = Debug|Any CPU {BDB841AC-3230-4EBF-A735-EEF30CDE20ED}.Release|Any CPU.ActiveCfg = Release|Any CPU {BDB841AC-3230-4EBF-A735-EEF30CDE20ED}.Release|Any CPU.Build.0 = Release|Any CPU - {073D711D-9F38-472D-ACE2-9830A222768C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {073D711D-9F38-472D-ACE2-9830A222768C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {073D711D-9F38-472D-ACE2-9830A222768C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {073D711D-9F38-472D-ACE2-9830A222768C}.Release|Any CPU.Build.0 = Release|Any CPU {AFFFAFFC-992F-4A88-95A8-C395D04B36D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AFFFAFFC-992F-4A88-95A8-C395D04B36D3}.Debug|Any CPU.Build.0 = Debug|Any CPU {AFFFAFFC-992F-4A88-95A8-C395D04B36D3}.Release|Any CPU.ActiveCfg = Release|Any CPU {AFFFAFFC-992F-4A88-95A8-C395D04B36D3}.Release|Any CPU.Build.0 = Release|Any CPU - {463F5276-2D88-4A66-AA45-688F1920E1D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {463F5276-2D88-4A66-AA45-688F1920E1D7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {463F5276-2D88-4A66-AA45-688F1920E1D7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {463F5276-2D88-4A66-AA45-688F1920E1D7}.Release|Any CPU.Build.0 = Release|Any CPU + {45B743E6-3B58-4AFA-9782-EA67015C9CD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {45B743E6-3B58-4AFA-9782-EA67015C9CD3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {45B743E6-3B58-4AFA-9782-EA67015C9CD3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {45B743E6-3B58-4AFA-9782-EA67015C9CD3}.Release|Any CPU.Build.0 = Release|Any CPU + {8E6296BA-D3A6-4C23-837C-8A40A6BE3822}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E6296BA-D3A6-4C23-837C-8A40A6BE3822}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E6296BA-D3A6-4C23-837C-8A40A6BE3822}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E6296BA-D3A6-4C23-837C-8A40A6BE3822}.Release|Any CPU.Build.0 = Release|Any CPU + {EA90104B-835D-4700-B0CD-93045173C033}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EA90104B-835D-4700-B0CD-93045173C033}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EA90104B-835D-4700-B0CD-93045173C033}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EA90104B-835D-4700-B0CD-93045173C033}.Release|Any CPU.Build.0 = Release|Any CPU + {60CE45CF-3CF2-47DD-BE40-DB5585A5B0DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {60CE45CF-3CF2-47DD-BE40-DB5585A5B0DE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {60CE45CF-3CF2-47DD-BE40-DB5585A5B0DE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {60CE45CF-3CF2-47DD-BE40-DB5585A5B0DE}.Release|Any CPU.Build.0 = Release|Any CPU + {E4400680-1754-48A9-BEE9-8A6BC79302C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E4400680-1754-48A9-BEE9-8A6BC79302C2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E4400680-1754-48A9-BEE9-8A6BC79302C2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E4400680-1754-48A9-BEE9-8A6BC79302C2}.Release|Any CPU.Build.0 = Release|Any CPU + {538194EF-9329-4C90-8BD9-0E6EFDFEF691}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {538194EF-9329-4C90-8BD9-0E6EFDFEF691}.Debug|Any CPU.Build.0 = Debug|Any CPU + {538194EF-9329-4C90-8BD9-0E6EFDFEF691}.Release|Any CPU.ActiveCfg = Release|Any CPU + {538194EF-9329-4C90-8BD9-0E6EFDFEF691}.Release|Any CPU.Build.0 = Release|Any CPU + {4175F31E-5ED6-4B67-973C-51B0C44BE74B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4175F31E-5ED6-4B67-973C-51B0C44BE74B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4175F31E-5ED6-4B67-973C-51B0C44BE74B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4175F31E-5ED6-4B67-973C-51B0C44BE74B}.Release|Any CPU.Build.0 = Release|Any CPU + {ADD0EBAC-F957-4D59-AF43-C10D31DFB2DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ADD0EBAC-F957-4D59-AF43-C10D31DFB2DA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ADD0EBAC-F957-4D59-AF43-C10D31DFB2DA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ADD0EBAC-F957-4D59-AF43-C10D31DFB2DA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {3631B538-C617-4FCE-9C9B-1D1B5F290A7F} = {DBC47323-E6A2-42A2-A624-CE2EE6139567} {AC06E580-EFC8-4D3F-BA4A-B2D2D1F65B9F} = {5C980166-C987-470D-AEE0-3858A170A903} {F72731A8-5803-4362-834F-0C066E64D4CD} = {21D85A91-5BB8-4912-8107-49435A461AAC} {DCC207EA-842A-4B54-858B-295CAA8947D5} = {21D85A91-5BB8-4912-8107-49435A461AAC} @@ -160,9 +194,15 @@ Global {4F30B2D8-432C-4686-81B5-9ADFE905B2B9} = {5C980166-C987-470D-AEE0-3858A170A903} {B0145883-39B3-440E-9BA1-D80F13701E5C} = {5C980166-C987-470D-AEE0-3858A170A903} {BDB841AC-3230-4EBF-A735-EEF30CDE20ED} = {5C980166-C987-470D-AEE0-3858A170A903} - {073D711D-9F38-472D-ACE2-9830A222768C} = {DBC47323-E6A2-42A2-A624-CE2EE6139567} {AFFFAFFC-992F-4A88-95A8-C395D04B36D3} = {21D85A91-5BB8-4912-8107-49435A461AAC} - {463F5276-2D88-4A66-AA45-688F1920E1D7} = {DBC47323-E6A2-42A2-A624-CE2EE6139567} + {45B743E6-3B58-4AFA-9782-EA67015C9CD3} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039} + {8E6296BA-D3A6-4C23-837C-8A40A6BE3822} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039} + {EA90104B-835D-4700-B0CD-93045173C033} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039} + {60CE45CF-3CF2-47DD-BE40-DB5585A5B0DE} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039} + {E4400680-1754-48A9-BEE9-8A6BC79302C2} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039} + {538194EF-9329-4C90-8BD9-0E6EFDFEF691} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039} + {4175F31E-5ED6-4B67-973C-51B0C44BE74B} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039} + {ADD0EBAC-F957-4D59-AF43-C10D31DFB2DA} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {D7426B41-E959-40E4-9ED8-ED8D9C50F133} diff --git a/modules/AElf.Client.Bridge/AElf.Client.Bridge.csproj b/modules/AElf.Client.Bridge/AElf.Client.Bridge.csproj new file mode 100644 index 00000000..3100d67f --- /dev/null +++ b/modules/AElf.Client.Bridge/AElf.Client.Bridge.csproj @@ -0,0 +1,18 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + diff --git a/modules/AElf.Client.Bridge/AElfClientBridgeModule.cs b/modules/AElf.Client.Bridge/AElfClientBridgeModule.cs new file mode 100644 index 00000000..6540b08e --- /dev/null +++ b/modules/AElf.Client.Bridge/AElfClientBridgeModule.cs @@ -0,0 +1,18 @@ +using AElf.Client.Core; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Modularity; + +namespace AElf.Client.Bridge; + +[DependsOn( + typeof(AElfClientModule), + typeof(CoreAElfModule) +)] +public class AElfClientBridgeModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + var configuration = context.Services.GetConfiguration(); + Configure(configuration.GetSection("Bridge")); + } +} \ No newline at end of file diff --git a/modules/AElf.Client.Bridge/BridgeOptions.cs b/modules/AElf.Client.Bridge/BridgeOptions.cs new file mode 100644 index 00000000..9269f006 --- /dev/null +++ b/modules/AElf.Client.Bridge/BridgeOptions.cs @@ -0,0 +1,6 @@ +namespace AElf.Client.Bridge; + +public class BridgeOptions +{ + +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/AElf.Client.Core.csproj b/modules/AElf.Client.Core/AElf.Client.Core.csproj new file mode 100644 index 00000000..1399c1a6 --- /dev/null +++ b/modules/AElf.Client.Core/AElf.Client.Core.csproj @@ -0,0 +1,25 @@ + + + + net6.0 + enable + enable + AElf.Client.Core + AElf C# sdk with abp module. + AElf + true + AElf.Client.Core + + + + + + + + + + + + + + diff --git a/modules/AElf.Client.Core/AElfClientAbpConstants.cs b/modules/AElf.Client.Core/AElfClientAbpConstants.cs new file mode 100644 index 00000000..2db31b01 --- /dev/null +++ b/modules/AElf.Client.Core/AElfClientAbpConstants.cs @@ -0,0 +1,6 @@ +namespace AElf.Client.Core; + +public class AElfClientAbpConstants +{ + public const int DefaultWaitMilliseconds = 100; +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/AElfClientModule.cs b/modules/AElf.Client.Core/AElfClientModule.cs new file mode 100644 index 00000000..f038d333 --- /dev/null +++ b/modules/AElf.Client.Core/AElfClientModule.cs @@ -0,0 +1,31 @@ +using AElf.Client.Core.Options; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Autofac; +using Volo.Abp.AutoMapper; +using Volo.Abp.Modularity; + +namespace AElf.Client.Core; + +[DependsOn( + typeof(AbpAutofacModule), + typeof(AbpAutoMapperModule) + )] +public class AElfClientModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + var configuration = context.Services.GetConfiguration(); + Configure(options => { configuration.GetSection("AElfClient").Bind(options); }); + Configure(options => { configuration.GetSection("AElfAccount").Bind(options); }); + Configure(options => { configuration.GetSection("AElfClientConfig").Bind(options); }); + Configure(options => { configuration.GetSection("AElfMinerAccount").Bind(options); }); + + context.Services.AddAutoMapperObjectMapper(); + + Configure(options => + { + options.AddMaps(); + }); + } +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/AElfClientService.Blockchain.cs b/modules/AElf.Client.Core/AElfClientService.Blockchain.cs new file mode 100644 index 00000000..7aa6d244 --- /dev/null +++ b/modules/AElf.Client.Core/AElfClientService.Blockchain.cs @@ -0,0 +1,51 @@ +using AElf.Client.Dto; +using Microsoft.Extensions.Logging; + +namespace AElf.Client.Core; + +public partial class AElfClientService +{ + public async Task GetTransactionResultAsync(string transactionId, string clientAlias) + { + var aelfClient = _aelfClientProvider.GetClient(alias: clientAlias); + var result = await aelfClient.GetTransactionResultAsync(transactionId); + var i = 0; + while (i < 10) + { + if (result!.Status == TransactionResultStatus.Mined.ToString().ToUpper()) + { + break; + } + + if (result.Status == TransactionResultStatus.Failed.ToString().ToUpper() || + result.Status == TransactionResultStatus.NodeValidationFailed.ToString().ToUpper()) + { + break; + } + + await Task.Delay(AElfClientAbpConstants.DefaultWaitMilliseconds); + result = await aelfClient.GetTransactionResultAsync(transactionId); + i++; + } + + return _objectMapper.Map(result!); + } + + public async Task GetChainStatusAsync(string clientAlias) + { + var aelfClient = _aelfClientProvider.GetClient(alias: clientAlias); + return await aelfClient.GetChainStatusAsync(); + } + + public async Task GetMerklePathByTransactionIdAsync(string transactionId, string clientAlias) + { + var aelfClient = _aelfClientProvider.GetClient(alias: clientAlias); + var merklePathDto = await aelfClient.GetMerklePathByTransactionIdAsync(transactionId); + if (merklePathDto == null) + { + Logger.LogError("Cannot get merkle path of transaction {TransactionId}", transactionId); + } + + return _objectMapper.Map(merklePathDto); + } +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/AElfClientService.Send.cs b/modules/AElf.Client.Core/AElfClientService.Send.cs new file mode 100644 index 00000000..bed5e988 --- /dev/null +++ b/modules/AElf.Client.Core/AElfClientService.Send.cs @@ -0,0 +1,64 @@ +using AElf.Client.Dto; +using Castle.Core.Logging; +using Google.Protobuf; + +namespace AElf.Client.Core; + +public partial class AElfClientService +{ + public async Task SendAsync(string contractAddress, string methodName, IMessage parameter, + string clientAlias, string? alias = null, string? address = null) + { + var aelfClient = _aelfClientProvider.GetClient(alias: clientAlias); + var aelfAccount = SetAccount(alias, address); + var tx = new TransactionBuilder(aelfClient) + .UsePrivateKey(aelfAccount) + .UseContract(contractAddress) + .UseMethod(methodName) + .UseParameter(parameter) + .Build(); + await PerformSendAsync(aelfClient, tx); + return tx; + } + + public async Task SendSystemAsync(string systemContractName, string methodName, IMessage parameter, + string clientAlias, string? alias = null, string? address = null) + { + var aelfClient = _aelfClientProvider.GetClient(alias: clientAlias); + var aelfAccount = SetAccount(alias, address); + var tx = new TransactionBuilder(aelfClient) + .UsePrivateKey(aelfAccount) + .UseSystemContract(systemContractName) + .UseMethod(methodName) + .UseParameter(parameter) + .Build(); + await PerformSendAsync(aelfClient, tx); + return tx; + } + + private static async Task PerformSendAsync(AElfClient aelfClient, Transaction tx) + { + var result = await aelfClient.SendTransactionAsync(new SendTransactionInput + { + RawTransaction = tx.ToByteArray().ToHex() + }); + } + + private byte[] SetAccount(string? alias, string? address) + { + byte[] aelfAccount; + if (!string.IsNullOrWhiteSpace(address)) + { + _aelfAccountProvider.SetPrivateKey(address, _aelfAccountProvider.GetDefaultPassword()); + aelfAccount = _aelfAccountProvider.GetPrivateKey(null, address); + } + else + { + if (string.IsNullOrWhiteSpace(alias)) + alias = _clientConfigOptions.AccountAlias; + aelfAccount = _aelfAccountProvider.GetPrivateKey(alias); + } + + return aelfAccount; + } +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/AElfClientService.View.cs b/modules/AElf.Client.Core/AElfClientService.View.cs new file mode 100644 index 00000000..35f4e232 --- /dev/null +++ b/modules/AElf.Client.Core/AElfClientService.View.cs @@ -0,0 +1,68 @@ +using AElf.Client.Dto; +using AElf.Client.Core.Options; +using Google.Protobuf; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.Extensions.Options; +using Volo.Abp.DependencyInjection; +using Volo.Abp.ObjectMapping; + +namespace AElf.Client.Core; + +public partial class AElfClientService : IAElfClientService, ITransientDependency +{ + private readonly IAElfClientProvider _aelfClientProvider; + private readonly IAElfAccountProvider _aelfAccountProvider; + private readonly IObjectMapper _objectMapper; + private readonly AElfClientConfigOptions _clientConfigOptions; + + public ILogger Logger { get; set; } + + public AElfClientService(IAElfClientProvider aelfClientProvider, IAElfAccountProvider aelfAccountProvider, + IObjectMapper objectMapper, IOptionsSnapshot clientConfigOptions) + { + _aelfClientProvider = aelfClientProvider; + _aelfAccountProvider = aelfAccountProvider; + _objectMapper = objectMapper; + _clientConfigOptions = clientConfigOptions.Value; + + Logger = NullLogger.Instance; + } + + public async Task ViewAsync(string contractAddress, string methodName, IMessage parameter, + string clientAlias, string accountAlias = "Default") + { + var aelfClient = _aelfClientProvider.GetClient(alias: clientAlias); + var aelfAccount = _aelfAccountProvider.GetPrivateKey(alias: accountAlias); + var tx = new TransactionBuilder(aelfClient) + .UsePrivateKey(aelfAccount) + .UseContract(contractAddress) + .UseMethod(methodName) + .UseParameter(parameter) + .Build(); + return await PerformViewAsync(aelfClient, tx); + } + + public async Task ViewSystemAsync(string systemContractName, string methodName, IMessage parameter, + string clientAlias, string accountAlias = "Default") + { + var aelfClient = _aelfClientProvider.GetClient(alias: clientAlias); + var privateKey = _aelfAccountProvider.GetPrivateKey(alias: accountAlias); + var tx = new TransactionBuilder(aelfClient) + .UsePrivateKey(privateKey) + .UseSystemContract(systemContractName) + .UseMethod(methodName) + .UseParameter(parameter) + .Build(); + return await PerformViewAsync(aelfClient, tx); + } + + private async Task PerformViewAsync(AElfClient aelfClient, Transaction tx) + { + var result = await aelfClient.ExecuteTransactionAsync(new ExecuteTransactionDto + { + RawTransaction = tx.ToByteArray().ToHex() + }); + return ByteArrayHelper.HexStringToByteArray(result); + } +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/ContractService.ttinclude b/modules/AElf.Client.Core/ContractService.ttinclude new file mode 100644 index 00000000..37fdd911 --- /dev/null +++ b/modules/AElf.Client.Core/ContractService.ttinclude @@ -0,0 +1,59 @@ +<#@ template language="C#"#> +<#@ output extension=".g.cs"#> +<#@ import namespace="System.Collections.Generic" #> +<#+ + public string ContractName = ""; + + public List ContractMethodInfoList = new() + { + // new ContractMethodInfo("Query"), + // new ContractMethodInfo("Commit"), + // new ContractMethodInfo("Reveal"), + // new ContractMethodInfo("CancelQuery", "Hash") + }; + + public class ContractMethodInfo + { + public ContractMethodInfo(string methodName) + { + MethodName = methodName; + } + + public ContractMethodInfo(string methodName, string parameterTypeName) + { + MethodName = methodName; + _parameterTypeName = parameterTypeName; + } + + public string MethodName { get; set; } + private string _parameterTypeName; + + public string ParameterTypeName + { + get => _parameterTypeName ?? $"{MethodName}Input"; + set => _parameterTypeName = value; + } + + public string InputName => ConvertMethodNameToInputName(MethodName); + } + + /// + /// Generates text for a given sequence of items, automatically adding the necessary spacing + /// + public void GenerateTextForItems(IReadOnlyList items, Action factory) + { + for (int i = 0; i < items.Count; i++) + { + // Insert a blank line after the first item + if (i > 0) WriteLine(""); + + // Invoke the factory with the current item + factory(items [i]); + } + } + + public static string ConvertMethodNameToInputName(string methodName) + { + return $"{char.ToLowerInvariant(methodName[0])}{methodName.Substring(1)}Input"; + } +#> diff --git a/modules/AElf.Client.Core/ContractServiceBase.cs b/modules/AElf.Client.Core/ContractServiceBase.cs new file mode 100644 index 00000000..3120bbf5 --- /dev/null +++ b/modules/AElf.Client.Core/ContractServiceBase.cs @@ -0,0 +1,55 @@ +using Google.Protobuf; +using Microsoft.Extensions.Logging; +using Volo.Abp.Threading; + +namespace AElf.Client.Core; + +public class ContractServiceBase +{ + private readonly IAElfClientService _clientService; + protected string SmartContractName { get; } + protected Address? ContractAddress { get; set; } + + public ILogger Logger { get; set; } + + protected ContractServiceBase(IAElfClientService clientService, string smartContractName) + { + _clientService = clientService; + SmartContractName = smartContractName; + } + + protected ContractServiceBase(IAElfClientService clientService, Address contractAddress) + { + _clientService = clientService; + ContractAddress = contractAddress; + } + + protected async Task PerformSendTransactionAsync(string methodName, IMessage parameter, + string useClientAlias, string? smartContractName = null) + { + if (smartContractName == null) + { + smartContractName = SmartContractName; + } + + if (ContractAddress != null) + { + return await _clientService.SendAsync(ContractAddress.ToBase58(), methodName, parameter, useClientAlias); + } + + return await _clientService.SendSystemAsync(smartContractName, methodName, parameter, useClientAlias); + } + + protected async Task PerformGetTransactionResultAsync(string transactionId, + string useClientAlias) + { + TransactionResult txResult; + do + { + txResult = await _clientService.GetTransactionResultAsync(transactionId, useClientAlias); + } while (txResult.Status == TransactionResultStatus.Pending); + + Logger.LogInformation("{TxResult}", txResult); + return txResult; + } +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/Extensions/EventExtensions.cs b/modules/AElf.Client.Core/Extensions/EventExtensions.cs new file mode 100644 index 00000000..768f27e4 --- /dev/null +++ b/modules/AElf.Client.Core/Extensions/EventExtensions.cs @@ -0,0 +1,12 @@ +using Google.Protobuf; + +namespace AElf.Client.Core.Extensions; + +public static class EventExtensions +{ + public static void MergeFrom(this T eventData, LogEvent log) where T : IMessage + { + foreach (var bs in log.Indexed) eventData.MergeFrom(bs); + eventData.MergeFrom(log.NonIndexed); + } +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/GlobalUsings.cs b/modules/AElf.Client.Core/GlobalUsings.cs new file mode 100644 index 00000000..e2e7f5ce --- /dev/null +++ b/modules/AElf.Client.Core/GlobalUsings.cs @@ -0,0 +1 @@ +global using AElf.Types; \ No newline at end of file diff --git a/modules/AElf.Client.Core/IAElfAccountProvider.cs b/modules/AElf.Client.Core/IAElfAccountProvider.cs new file mode 100644 index 00000000..ba8781a1 --- /dev/null +++ b/modules/AElf.Client.Core/IAElfAccountProvider.cs @@ -0,0 +1,134 @@ +using AElf.Client.Core.Infrastructure; +using AElf.Client.Core.Options; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.Extensions.Options; +using Nethereum.KeyStore; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Threading; + +namespace AElf.Client.Core; + +public interface IAElfAccountProvider +{ + byte[] GetPrivateKey(string? alias = null, string? address = null); + void SetPrivateKey(byte[] privateKey, string? alias = null, string? address = null); + void SetPrivateKey(string address, string password, string? alias = null); + string GetDefaultPassword(); +} + +public class AElfAccountProvider : Dictionary, IAElfAccountProvider, ISingletonDependency +{ + private readonly IKeyDirectoryProvider _keyDirectoryProvider; + private readonly AElfAccountOptions _aelfAccountOptions; + private readonly string _aelfMinerAccountPassword; + + private readonly KeyStoreService _keyStoreService; + + public ILogger Logger { get; set; } + + public AElfAccountProvider(IKeyDirectoryProvider keyDirectoryProvider, + IOptionsSnapshot aelfAccountOptions, + IOptionsSnapshot aelfMinerAccountOptions) + { + Logger = NullLogger.Instance; + _keyDirectoryProvider = keyDirectoryProvider; + _aelfAccountOptions = aelfAccountOptions.Value; + _aelfMinerAccountPassword = aelfMinerAccountOptions.Value.DefaultPassword; + var defaultPrivateKey = ByteArrayHelper.HexStringToByteArray(AElfClientConstants.DefaultPrivateKey); + SetPrivateKey(defaultPrivateKey, "Default", Address.FromPublicKey(defaultPrivateKey).ToBase58()); + _keyStoreService = new KeyStoreService(); + + foreach (var accountConfig in aelfAccountOptions.Value.AccountConfigList) + { + if (string.IsNullOrWhiteSpace(accountConfig.PrivateKey)) + { + var keyFilePath = GetKeyFileFullPath(accountConfig.Address, aelfAccountOptions.Value.KeyDirectory); + var privateKey = AsyncHelper.RunSync(() => Task.Run(() => + { + using var textReader = File.OpenText(keyFilePath); + var json = textReader.ReadToEnd(); + return _keyStoreService.DecryptKeyStoreFromJson(accountConfig.Password, json); + })); + SetPrivateKey(privateKey, accountConfig.Alias, accountConfig.Address); + } + else + { + var privateKey = ByteArrayHelper.HexStringToByteArray(accountConfig.PrivateKey); + SetPrivateKey(privateKey, accountConfig.Alias, Address.FromPublicKey(privateKey).ToBase58()); + } + } + } + + public string GetDefaultPassword() + { + return _aelfMinerAccountPassword; + } + + public byte[] GetPrivateKey(string? alias = null, string? address = null) + { + var keys = Keys + .WhereIf(!alias.IsNullOrWhiteSpace(), a => a.Alias == alias) + .WhereIf(!address.IsNullOrWhiteSpace(), a => a.Address == address) + .ToList(); + if (keys.Count != 1) + { + throw new AElfClientException($"Failed to get private key of {alias} - {address}."); + } + + return this[keys.Single()]; + } + + public void SetPrivateKey(byte[] privateKey, string? alias = null, string? address = null) + { + TryAdd(new AElfAccountInfo + { + Alias = alias, + Address = address + }, privateKey); + } + + public void SetPrivateKey(string address, string password, string? alias = null) + { + var keyFilePath = GetKeyFileFullPath(address, _aelfAccountOptions.KeyDirectory); + var privateKey = AsyncHelper.RunSync(() => Task.Run(() => + { + using var textReader = File.OpenText(keyFilePath); + var json = textReader.ReadToEnd(); + return _keyStoreService.DecryptKeyStoreFromJson(password, json); + })); + + var keys = Keys + .WhereIf(!alias.IsNullOrWhiteSpace(), a => a.Alias == alias) + .WhereIf(!address.IsNullOrWhiteSpace(), a => a.Address == address) + .ToList(); + + if (keys.Count == 1) return; + TryAdd(new AElfAccountInfo + { + Alias = alias, + Address = address + }, privateKey); + } + + private string GetKeyFileFullPath(string address, string configuredKeyDirectory) + { + var dirPath = GetKeystoreDirectoryPath(configuredKeyDirectory); + var filePath = Path.Combine(dirPath, address); + var filePathWithExtension = Path.ChangeExtension(filePath, ".json"); + return filePathWithExtension; + } + + private string GetKeystoreDirectoryPath(string? configuredKeyDirectory) + { + return string.IsNullOrWhiteSpace(configuredKeyDirectory) + ? Path.Combine(_keyDirectoryProvider.GetAppDataPath(), "keys") + : configuredKeyDirectory; + } +} + +public class AElfAccountInfo +{ + public string? Alias { get; set; } + public string? Address { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/IAElfClientProvider.cs b/modules/AElf.Client.Core/IAElfClientProvider.cs new file mode 100644 index 00000000..a0f1794c --- /dev/null +++ b/modules/AElf.Client.Core/IAElfClientProvider.cs @@ -0,0 +1,81 @@ +using AElf.Client.Core.Options; +using Microsoft.Extensions.Options; +using Volo.Abp.DependencyInjection; + +namespace AElf.Client.Core; + +public interface IAElfClientProvider +{ + AElfClient GetClient(string? alias = null, string? environment = null, int? chainId = null, string? chainType = null); + + void SetClient(AElfClient client, string? environment = null, int? chainId = null, string? chainType = null, + string? alias = null); +} + +public class AElfClientProvider : Dictionary, IAElfClientProvider, ISingletonDependency +{ + public AElfClientProvider(IOptionsSnapshot aelfClientOptions, + IOptionsSnapshot aelfClientConfigOptions) + { + var useCamelCase = aelfClientConfigOptions.Value.CamelCase; + var clientBuilder = new AElfClientBuilder(); + SetClient(clientBuilder.UsePublicEndpoint(EndpointType.MainNetMainChain).UseCamelCase(useCamelCase).Build(), + "MainNet", AElfClientConstants.MainChainId, "MainChain", EndpointType.MainNetMainChain.ToString()); + SetClient(clientBuilder.UsePublicEndpoint(EndpointType.MainNetSideChain1).UseCamelCase(useCamelCase).Build(), + "MainNet", AElfClientConstants.SideChainId2, "SideChain", EndpointType.MainNetSideChain1.ToString()); + SetClient(clientBuilder.UsePublicEndpoint(EndpointType.TestNetMainChain).UseCamelCase(useCamelCase).Build(), + "TestNet", AElfClientConstants.MainChainId, "MainChain", EndpointType.TestNetMainChain.ToString()); + SetClient(clientBuilder.UsePublicEndpoint(EndpointType.TestNetSideChain2).UseCamelCase(useCamelCase).Build(), + "MainNet", AElfClientConstants.SideChainId2, "SideChain", EndpointType.TestNetSideChain2.ToString()); + SetClient(clientBuilder.UsePublicEndpoint(EndpointType.Local).UseCamelCase(useCamelCase).Build(), "Local", + AElfClientConstants.MainChainId, "MainChain", EndpointType.Local.ToString()); + + foreach (var clientConfig in aelfClientOptions.Value.ClientConfigList) + { + var client = clientBuilder + .UseEndpoint(clientConfig.Endpoint) + .ManagePeerInfo(clientConfig.UserName, clientConfig.Password) + .SetHttpTimeout(clientConfig.Timeout) + .Build(); + SetClient(client, alias: clientConfig.Alias); + } + } + + public AElfClient GetClient(string? alias = null, string? environment = null, int? chainId = null, + string? chainType = null) + { + var keys = Keys + .WhereIf(!alias.IsNullOrWhiteSpace(), c => c.Alias == alias) + .WhereIf(!environment.IsNullOrWhiteSpace(), c => c.Environment == environment) + .WhereIf(chainId.HasValue, c => c.ChainId == chainId) + .WhereIf(!chainType.IsNullOrWhiteSpace(), c => c.ChainType == chainType) + .ToList(); + if (keys.Count != 1) + { + throw new AElfClientException( + $"Failed to get client of {alias} - {environment} - {chainId} - {chainType}."); + } + + return this[keys.Single()]; + } + + public void SetClient(AElfClient client, string? environment = null, int? chainId = null, string? chainType = null, + string? alias = null) + { + TryAdd(new AElfClientInfo + { + Environment = environment, + ChainId = chainId, + ChainType = chainType, + Alias = alias + }, client); + } +} + +public class AElfClientInfo +{ + public string? Environment { get; set; } + public int? ChainId { get; set; } + public string? ChainType { get; set; } + public string? Alias { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/IAElfClientService.cs b/modules/AElf.Client.Core/IAElfClientService.cs new file mode 100644 index 00000000..2c1c7703 --- /dev/null +++ b/modules/AElf.Client.Core/IAElfClientService.cs @@ -0,0 +1,25 @@ +using AElf.Client.Dto; +using Google.Protobuf; + +namespace AElf.Client.Core; + +public interface IAElfClientService +{ + Task ViewAsync(string contractAddress, string methodName, IMessage parameter, string clientAlias, + string accountAlias = "Default"); + + Task ViewSystemAsync(string systemContractName, string methodName, IMessage parameter, + string clientAlias, string accountAlias = "Default"); + + Task SendAsync(string contractAddress, string methodName, IMessage parameter, + string clientAlias, string? accountAlias = null, string? accountAddress = null); + + Task SendSystemAsync(string systemContractName, string methodName, IMessage parameter, + string clientAlias, string? accountAlias = null, string? accountAddress = null); + + Task GetTransactionResultAsync(string transactionId, string clientAlias); + + Task GetChainStatusAsync(string clientAlias); + + Task GetMerklePathByTransactionIdAsync(string transactionId, string clientAlias); +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/Infrastructure/IKeyDirectoryProvider.cs b/modules/AElf.Client.Core/Infrastructure/IKeyDirectoryProvider.cs new file mode 100644 index 00000000..77ef3415 --- /dev/null +++ b/modules/AElf.Client.Core/Infrastructure/IKeyDirectoryProvider.cs @@ -0,0 +1,6 @@ +namespace AElf.Client.Core.Infrastructure; + +public interface IKeyDirectoryProvider +{ + string GetAppDataPath(); +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/Infrastructure/KeyDirectoryProvider.cs b/modules/AElf.Client.Core/Infrastructure/KeyDirectoryProvider.cs new file mode 100644 index 00000000..789672b6 --- /dev/null +++ b/modules/AElf.Client.Core/Infrastructure/KeyDirectoryProvider.cs @@ -0,0 +1,24 @@ +using Volo.Abp.DependencyInjection; + +namespace AElf.Client.Core.Infrastructure; + +public class KeyDirectoryProvider : IKeyDirectoryProvider, ISingletonDependency +{ + private const string ApplicationFolderName = "aelf"; + private string _appDataPath; + + public string GetAppDataPath() + { + if (string.IsNullOrWhiteSpace(_appDataPath)) + { + _appDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), ApplicationFolderName); + + if (!Directory.Exists(_appDataPath)) + { + Directory.CreateDirectory(_appDataPath); + } + } + + return _appDataPath; + } +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/Options/AElfAccountOptions.cs b/modules/AElf.Client.Core/Options/AElfAccountOptions.cs new file mode 100644 index 00000000..a49e606b --- /dev/null +++ b/modules/AElf.Client.Core/Options/AElfAccountOptions.cs @@ -0,0 +1,15 @@ +namespace AElf.Client.Core.Options; + +public class AElfAccountOptions +{ + public string KeyDirectory { get; set; } + public List AccountConfigList { get; set; } = new(); +} + +public class AccountConfig +{ + public string Alias { get; set; } + public string Address { get; set; } + public string Password { get; set; } + public string PrivateKey { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/Options/AElfClientConfigOptions.cs b/modules/AElf.Client.Core/Options/AElfClientConfigOptions.cs new file mode 100644 index 00000000..816a4ef8 --- /dev/null +++ b/modules/AElf.Client.Core/Options/AElfClientConfigOptions.cs @@ -0,0 +1,10 @@ +namespace AElf.Client.Core.Options; + +public class AElfClientConfigOptions +{ + public string ClientAlias { get; set; } = "TestNetSideChain2"; + public string MainChainClientAlias { get; set; } = "TestNetMainChain"; + public string SideChainClientAlias { get; set; } = "TestNetSideChain2"; + public string AccountAlias { get; set; } = "Default"; + public bool CamelCase { get; set; } = false; +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/Options/AElfClientOptions.cs b/modules/AElf.Client.Core/Options/AElfClientOptions.cs new file mode 100644 index 00000000..ae612ddb --- /dev/null +++ b/modules/AElf.Client.Core/Options/AElfClientOptions.cs @@ -0,0 +1,15 @@ +namespace AElf.Client.Core.Options; + +public class AElfClientOptions +{ + public List ClientConfigList { get; set; } = new(); +} + +public class ClientConfig +{ + public string Alias { get; set; } + public string Endpoint { get; set; } + public string? UserName { get; set; } + public string? Password { get; set; } + public int Timeout { get; set; } = 60; +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/Options/AElfContractOptions.cs b/modules/AElf.Client.Core/Options/AElfContractOptions.cs new file mode 100644 index 00000000..1e2428fe --- /dev/null +++ b/modules/AElf.Client.Core/Options/AElfContractOptions.cs @@ -0,0 +1,7 @@ +namespace AElf.Client.Core.Options; + +public class AElfContractOptions +{ + public string ContractDirectory { get; set; } + public Dictionary ContractAddressList { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/Options/AElfMinerAccountOptions.cs b/modules/AElf.Client.Core/Options/AElfMinerAccountOptions.cs new file mode 100644 index 00000000..3be3b5d6 --- /dev/null +++ b/modules/AElf.Client.Core/Options/AElfMinerAccountOptions.cs @@ -0,0 +1,6 @@ +namespace AElf.Client.Core.Options; + +public class AElfMinerAccountOptions +{ + public string DefaultPassword { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/Profile/CommonProfile.cs b/modules/AElf.Client.Core/Profile/CommonProfile.cs new file mode 100644 index 00000000..3bacaa97 --- /dev/null +++ b/modules/AElf.Client.Core/Profile/CommonProfile.cs @@ -0,0 +1,27 @@ +using Google.Protobuf; + +namespace AElf.Client.Core; + +public class CommonProfile : AutoMapper.Profile +{ + public CommonProfile() + { + CreateMap() + .ConvertUsing(s => s == null ? null : s.ToHex()); + + CreateMap() + .ConvertUsing(s => Hash.LoadFromHex(s)); + + CreateMap() + .ConvertUsing(s => s.ToBase58()); + + CreateMap() + .ConvertUsing(s => Address.FromBase58(s)); + + CreateMap() + .ConvertUsing(s => s.ToBase64()); + + CreateMap() + .ConvertUsing(s => ByteString.CopyFromUtf8(s)); + } +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/Profile/MerklePathProfile.cs b/modules/AElf.Client.Core/Profile/MerklePathProfile.cs new file mode 100644 index 00000000..8a9bf65a --- /dev/null +++ b/modules/AElf.Client.Core/Profile/MerklePathProfile.cs @@ -0,0 +1,16 @@ +using AElf.Client.Dto; +using AutoMapper; + +namespace AElf.Client.Core; + +public class MerklePathProfile : Profile +{ + public MerklePathProfile() + { + CreateMap(); + CreateMap(); + + CreateMap(); + CreateMap(); + } +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/Profile/TransactionProfile.cs b/modules/AElf.Client.Core/Profile/TransactionProfile.cs new file mode 100644 index 00000000..f7766233 --- /dev/null +++ b/modules/AElf.Client.Core/Profile/TransactionProfile.cs @@ -0,0 +1,78 @@ +using AElf.Client.Dto; +using AutoMapper; +using Google.Protobuf; +using Volo.Abp.AutoMapper; + +namespace AElf.Client.Core; + +public class TransactionProfile : Profile +{ + public const string ErrorTrace = "WithMetrics"; + + public TransactionProfile() + { + CreateMap(); + CreateMap(); + + CreateMap() + .ForMember(d => d.ReturnValue, opt => opt.MapFrom(s => s.ReturnValue.ToHex(false))) + .ForMember(d => d.Bloom, + opt => opt.MapFrom(s => + s.Status == TransactionResultStatus.NotExisted + ? null + : s.Bloom.Length == 0 + ? ByteString.CopyFrom(new byte[256]).ToBase64() + : s.Bloom.ToBase64())) + .ForMember(d => d.Status, opt => opt.MapFrom(s => s.Status.ToString().ToUpper())) + .ForMember(d => d.Error, opt => opt.MapFrom()) + .Ignore(d => d.Transaction) + .Ignore(d => d.TransactionSize); + + TransactionResultStatus status; + CreateMap() + .ForMember(d => d.ReturnValue, + opt => opt.MapFrom(s => ByteString.CopyFrom(ByteArrayHelper.HexStringToByteArray(s.ReturnValue)))) + .ForMember(d => d.BlockHash, opt => opt.MapFrom(s => Hash.LoadFromHex(s.BlockHash))) + .ForMember(d => d.Bloom, opt => opt.MapFrom(s => + s.Status.ToUpper() == TransactionResultStatus.NotExisted.ToString().ToUpper() + ? null + : string.IsNullOrEmpty(s.Bloom) + ? ByteString.Empty + : ByteString.FromBase64(s.Bloom))) + .ForMember(d => d.Status, + opt => opt.MapFrom(s => + Enum.TryParse($"{s.Status[0]}{s.Status.Substring(1).ToLower()}", out status) + ? status + : TransactionResultStatus.NotExisted)) + .ForMember(d => d.Logs, opt => opt.MapFrom(s => s.Logs)) + .Ignore(d => d.Error) + .Ignore(d => d.Bloom); + + CreateMap() + .ForMember(d => d.Indexed, opt => opt.MapFrom(s => s.Indexed.Select(ByteString.FromBase64))) + .ForMember(d => d.NonIndexed, opt => opt.MapFrom(s => ByteString.FromBase64(s.NonIndexed))); + CreateMap(); + } +} + +public class TransactionErrorResolver : IValueResolver +{ + public string Resolve(TransactionResult source, TransactionResultDto destination, string destMember, + ResolutionContext context) + { + var errorTraceNeeded = (bool)context.Items[TransactionProfile.ErrorTrace]; + return TakeErrorMessage(source.Error, errorTraceNeeded); + } + + public static string TakeErrorMessage(string transactionResultError, bool errorTraceNeeded) + { + if (string.IsNullOrWhiteSpace(transactionResultError)) + return null; + + if (errorTraceNeeded) + return transactionResultError; + + using var stringReader = new StringReader(transactionResultError); + return stringReader.ReadLine(); + } +} \ No newline at end of file diff --git a/modules/AElf.Client.Core/SendTransactionResult.cs b/modules/AElf.Client.Core/SendTransactionResult.cs new file mode 100644 index 00000000..057d94ea --- /dev/null +++ b/modules/AElf.Client.Core/SendTransactionResult.cs @@ -0,0 +1,7 @@ +namespace AElf.Client.Core; + +public class SendTransactionResult +{ + public TransactionResult TransactionResult { get; set; } + public Transaction Transaction { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client.MerkleTree/AElf.Client.MerkleTree.csproj b/modules/AElf.Client.MerkleTree/AElf.Client.MerkleTree.csproj new file mode 100644 index 00000000..e13af04b --- /dev/null +++ b/modules/AElf.Client.MerkleTree/AElf.Client.MerkleTree.csproj @@ -0,0 +1,33 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + + + TextTemplatingFileGenerator + MerkleTreeContract.g.cs + + + + + + True + True + MerkleTreeService.tt + + + + diff --git a/modules/AElf.Client.MerkleTree/AElfClientMerkleTreeModule.cs b/modules/AElf.Client.MerkleTree/AElfClientMerkleTreeModule.cs new file mode 100644 index 00000000..81c8f8ac --- /dev/null +++ b/modules/AElf.Client.MerkleTree/AElfClientMerkleTreeModule.cs @@ -0,0 +1,16 @@ +using AElf.Client.Core; +using Volo.Abp.Modularity; + +namespace AElf.Client.MerkleTree; + +[DependsOn( + typeof(AElfClientModule), + typeof(CoreAElfModule) +)] +public class AElfClientMerkleTreeModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + base.ConfigureServices(context); + } +} \ No newline at end of file diff --git a/modules/AElf.Client.MerkleTree/ContractService.ttinclude b/modules/AElf.Client.MerkleTree/ContractService.ttinclude new file mode 100644 index 00000000..eeb31d7a --- /dev/null +++ b/modules/AElf.Client.MerkleTree/ContractService.ttinclude @@ -0,0 +1,84 @@ +<#@ template language="C#"#> +<#@ output extension=".g.cs"#> +<#@ import namespace="System.Collections.Generic" #> +<#+ + public string ContractName = "MerkleTreeContract"; + + public List ContractActionMethodInfoList = new() + { + new ContractActionMethodInfo("CreateSpace"), + + }; + + public List ContractViewMethodInfoList = new() + { + new ContractViewMethodInfo("GetLastLeafIndex", "Int64Value"), + }; + + public class ContractActionMethodInfo + { + public ContractActionMethodInfo(string methodName) + { + MethodName = methodName; + } + + public ContractActionMethodInfo(string methodName, string parameterTypeName) + { + MethodName = methodName; + _parameterTypeName = parameterTypeName; + } + + public string MethodName { get; set; } + private string _parameterTypeName; + + public string ParameterTypeName + { + get => _parameterTypeName ?? $"{MethodName}Input"; + set => _parameterTypeName = value; + } + + public string InputName => ConvertMethodNameToInputName(MethodName); + } + + public class ContractViewMethodInfo + { + public ContractViewMethodInfo(string methodName, string returnTypeName) + { + MethodName = methodName; + ReturnTypeName = returnTypeName; + } + + public string MethodName { get; set; } + public string ReturnTypeName { get; set; } + + private string _parameterTypeName; + + public string ParameterTypeName + { + get => _parameterTypeName ?? $"{MethodName}Input"; + set => _parameterTypeName = value; + } + + public string InputName => ConvertMethodNameToInputName(MethodName); + } + + /// + /// Generates text for a given sequence of items, automatically adding the necessary spacing + /// + public void GenerateTextForItems(IReadOnlyList items, Action factory) + { + for (int i = 0; i < items.Count; i++) + { + // Insert a blank line after the first item + if (i > 0) WriteLine(""); + + // Invoke the factory with the current item + factory(items [i]); + } + } + + public static string ConvertMethodNameToInputName(string methodName) + { + return $"{char.ToLowerInvariant(methodName[0])}{methodName.Substring(1)}Input"; + } +#> diff --git a/modules/AElf.Client.MerkleTree/MerkleTreeContract.tt b/modules/AElf.Client.MerkleTree/MerkleTreeContract.tt new file mode 100644 index 00000000..506b6c64 --- /dev/null +++ b/modules/AElf.Client.MerkleTree/MerkleTreeContract.tt @@ -0,0 +1,84 @@ +<#@include file="ContractService.ttinclude" #><#@ import namespace="System.Diagnostics.Contracts" #> +using AElf.Client.Core; +using AElf.Client.Core.Options; +using AElf.Contracts.<#=ContractName#>; +using AElf.Types; +using Microsoft.Extensions.Options; +using Volo.Abp.DependencyInjection; +using Google.Protobuf.WellKnownTypes; +using Google.Protobuf; + +namespace AElf.Client.<#=ContractName#>; + +public interface I<#=ContractName#>Service +{ +<# + GenerateTextForItems(ContractActionMethodInfoList, item => + { +#> + Task <#=item.MethodName#>Async(<#=item.ParameterTypeName#> <#=item.InputName#>); +<# + }); +#> + +<# + GenerateTextForItems(ContractViewMethodInfoList, item => + { +#> + Task<<#=item.ReturnTypeName#>> <#=item.MethodName#>Async(<#=item.ParameterTypeName#> <#=item.InputName#>); +<# + }); +#> +} + +public class <#=ContractName#>Service : ContractServiceBase, I<#=ContractName#>Service, ITransientDependency +{ + private readonly IAElfClientService _clientService; + private readonly AElfClientConfigOptions _clientConfigOptions; + private readonly AElfContractOptions _contractOptions; + + protected <#=ContractName#>Service(IAElfClientService clientService, + IOptionsSnapshot clientConfigOptions, + IOptionsSnapshot contractOptions) : base(clientService, + Address.FromBase58(contractOptions.Value.ContractAddressList["<#=ContractName#>ContractAddress"])) + { + _clientService = clientService; + _clientConfigOptions = clientConfigOptions.Value; + _contractOptions = contractOptions.Value; + } + +<# + GenerateTextForItems(ContractActionMethodInfoList, item => + { +#> + public async Task <#=item.MethodName#>Async(<#=item.ParameterTypeName#> <#=item.InputName#>) + { + var useClientAlias = _clientConfigOptions.ClientAlias; + var tx = await PerformSendTransactionAsync("<#=item.MethodName#>", <#=item.InputName#>, useClientAlias); + return new SendTransactionResult + { + Transaction = tx, + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), useClientAlias) + }; + } +<# + }); +#> + +<# + GenerateTextForItems(ContractViewMethodInfoList, item => + { +#> + public async Task<<#=item.ReturnTypeName#>> <#=item.MethodName#>Async(<#=item.ParameterTypeName#> <#=item.InputName#>) + { + var useClientAlias = _clientConfigOptions.ClientAlias; + var result = await _clientService.ViewAsync(_contractOptions.ContractAddressList["<#=ContractName#>Address"], "<#=item.MethodName#>", + <#=item.InputName#>, useClientAlias); + var actualResult = new <#=item.ReturnTypeName#>(); + actualResult.MergeFrom(result); + return actualResult; + } +<# + }); +#> +} \ No newline at end of file diff --git a/modules/AElf.Client.Oracle/AElf.Client.Oracle.csproj b/modules/AElf.Client.Oracle/AElf.Client.Oracle.csproj new file mode 100644 index 00000000..a927f044 --- /dev/null +++ b/modules/AElf.Client.Oracle/AElf.Client.Oracle.csproj @@ -0,0 +1,33 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + + + TextTemplatingFileGenerator + OracleService.g.cs + + + + + + True + True + OracleService.tt + + + + diff --git a/modules/AElf.Client.Oracle/AElfClientOracleModule.cs b/modules/AElf.Client.Oracle/AElfClientOracleModule.cs new file mode 100644 index 00000000..d2982800 --- /dev/null +++ b/modules/AElf.Client.Oracle/AElfClientOracleModule.cs @@ -0,0 +1,18 @@ +using AElf.Client.Core; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Modularity; + +namespace AElf.Client.Oracle; + +[DependsOn( + typeof(AElfClientModule), + typeof(CoreAElfModule) +)] +public class AElfClientOracleModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + var configuration = context.Services.GetConfiguration(); + Configure(configuration.GetSection("Oracle")); + } +} \ No newline at end of file diff --git a/modules/AElf.Client.Oracle/ContractService.ttinclude b/modules/AElf.Client.Oracle/ContractService.ttinclude new file mode 100644 index 00000000..6ef56bb8 --- /dev/null +++ b/modules/AElf.Client.Oracle/ContractService.ttinclude @@ -0,0 +1,59 @@ +<#@ template language="C#"#> +<#@ output extension=".g.cs"#> +<#@ import namespace="System.Collections.Generic" #> +<#+ + public string ContractName = "Oracle"; + + public List ContractMethodInfoList = new() + { + new ContractMethodInfo("Query"), + new ContractMethodInfo("Commit"), + new ContractMethodInfo("Reveal"), + new ContractMethodInfo("CancelQuery", "Hash") + }; + + public class ContractMethodInfo + { + public ContractMethodInfo(string methodName) + { + MethodName = methodName; + } + + public ContractMethodInfo(string methodName, string parameterTypeName) + { + MethodName = methodName; + _parameterTypeName = parameterTypeName; + } + + public string MethodName { get; set; } + private string _parameterTypeName; + + public string ParameterTypeName + { + get => _parameterTypeName ?? $"{MethodName}Input"; + set => _parameterTypeName = value; + } + + public string InputName => ConvertMethodNameToInputName(MethodName); + } + + /// + /// Generates text for a given sequence of items, automatically adding the necessary spacing + /// + public void GenerateTextForItems(IReadOnlyList items, Action factory) + { + for (int i = 0; i < items.Count; i++) + { + // Insert a blank line after the first item + if (i > 0) WriteLine(""); + + // Invoke the factory with the current item + factory(items [i]); + } + } + + public static string ConvertMethodNameToInputName(string methodName) + { + return $"{char.ToLowerInvariant(methodName[0])}{methodName.Substring(1)}Input"; + } +#> diff --git a/modules/AElf.Client.Oracle/OracleOptions.cs b/modules/AElf.Client.Oracle/OracleOptions.cs new file mode 100644 index 00000000..d0f545b6 --- /dev/null +++ b/modules/AElf.Client.Oracle/OracleOptions.cs @@ -0,0 +1,6 @@ +namespace AElf.Client.Oracle; + +public class OracleOptions +{ + +} \ No newline at end of file diff --git a/modules/AElf.Client.Oracle/OracleService.tt b/modules/AElf.Client.Oracle/OracleService.tt new file mode 100644 index 00000000..074d3a95 --- /dev/null +++ b/modules/AElf.Client.Oracle/OracleService.tt @@ -0,0 +1,54 @@ +<#@include file="ContractService.ttinclude" #><#@ import namespace="System.Diagnostics.Contracts" #> +using AElf.Client.Core; +using AElf.Client.Core.Options; +using AElf.Contracts.<#=ContractName#>; +using AElf.Types; +using Microsoft.Extensions.Options; +using Volo.Abp.DependencyInjection; + +namespace AElf.Client.<#=ContractName#>; + +public interface I<#=ContractName#>Service +{ +<# + GenerateTextForItems(ContractMethodInfoList, item => + { +#> + Task <#=item.MethodName#>Async(<#=item.ParameterTypeName#> <#=item.InputName#>); +<# + }); +#> +} + +public class <#=ContractName#>Service : ContractServiceBase, I<#=ContractName#>Service, ITransientDependency +{ + private readonly IAElfClientService _clientService; + private readonly AElfClientConfigOptions _clientConfigOptions; + + protected <#=ContractName#>Service(IAElfClientService clientService, + IOptionsSnapshot clientConfigOptions, + IOptionsSnapshot contractOptions) : base(clientService, + Address.FromBase58(contractOptions.Value.ContractAddressList["<#=ContractName#>ContractAddress"])) + { + _clientService = clientService; + _clientConfigOptions = clientConfigOptions.Value; + } + +<# + GenerateTextForItems(ContractMethodInfoList, item => + { +#> + public async Task <#=item.MethodName#>Async(<#=item.ParameterTypeName#> <#=item.InputName#>) + { + var useClientAlias = _clientConfigOptions.ClientAlias; + var tx = await PerformSendTransactionAsync("<#=item.MethodName#>", <#=item.InputName#>, useClientAlias); + return new SendTransactionResult + { + Transaction = tx, + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), useClientAlias) + }; + } +<# + }); +#> +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/AElf.Client.Protobuf.csproj b/modules/AElf.Client.Protobuf/AElf.Client.Protobuf.csproj new file mode 100644 index 00000000..64669554 --- /dev/null +++ b/modules/AElf.Client.Protobuf/AElf.Client.Protobuf.csproj @@ -0,0 +1,94 @@ + + + + net6.0 + enable + enable + AElf.Client.Protobuf + Protobuf using by AElf C# sdk. + AElf + true + + + + + + + + + + + + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + + diff --git a/modules/AElf.Client.Protobuf/Protobuf/acs0.proto b/modules/AElf.Client.Protobuf/Protobuf/acs0.proto new file mode 100644 index 00000000..84606e7e --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/acs0.proto @@ -0,0 +1,234 @@ +/** + * AElf Standards ACS0(Contract Deployment Standard) + * + * Used to manage the deployment and update of contracts. + */ +syntax = "proto3"; + +package acs0; +option csharp_namespace = "AElf.Standards.ACS0"; + +import public "aelf/core.proto"; +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; + +service ACS0 { + // Deploy a system smart contract on chain and return the address of the system contract deployed. + rpc DeploySystemSmartContract (SystemContractDeploymentInput) returns (aelf.Address) { + } + + // Deploy a smart contract on chain and return the address of the contract deployed. + rpc DeploySmartContract (ContractDeploymentInput) returns (aelf.Address) { + } + + // Update a smart contract on chain. + rpc UpdateSmartContract (ContractUpdateInput) returns (aelf.Address) { + } + + // Create a proposal to deploy a new contract and returns the id of the proposed contract. + rpc ProposeNewContract (ContractDeploymentInput) returns (aelf.Hash) { + } + + // Create a proposal to check the code of a contract and return the id of the proposed contract. + rpc ProposeContractCodeCheck (ContractCodeCheckInput) returns (aelf.Hash) { + } + + // Create a proposal to update the specified contract + // and return the id of the proposed contract. + rpc ProposeUpdateContract (ContractUpdateInput) returns (aelf.Hash) { + } + + // Release the contract proposal which has been approved. + rpc ReleaseApprovedContract (ReleaseContractInput) returns (google.protobuf.Empty) { + } + + // Release the proposal which has passed the code check. + rpc ReleaseCodeCheckedContract (ReleaseContractInput) returns (google.protobuf.Empty) { + } + + // Validate whether the input system contract exists. + rpc ValidateSystemContractAddress(ValidateSystemContractAddressInput) returns (google.protobuf.Empty){ + } + + // Set authority of contract deployment. + rpc SetContractProposerRequiredState (google.protobuf.BoolValue) returns (google.protobuf.Empty) { + } + + // Get the current serial number of genesis contract + // (corresponds to the serial number that will be given to the next deployed contract). + rpc CurrentContractSerialNumber (google.protobuf.Empty) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + + // Get detailed information about the specified contract. + rpc GetContractInfo (aelf.Address) returns (ContractInfo) { + option (aelf.is_view) = true; + } + + // Get author of the specified contract. + rpc GetContractAuthor (aelf.Address) returns (aelf.Address) { + option (aelf.is_view) = true; + } + + // Get the code hash of the contract about the specified address. + rpc GetContractHash (aelf.Address) returns (aelf.Hash) { + option (aelf.is_view) = true; + } + + // Get the address of a system contract by its name. + rpc GetContractAddressByName (aelf.Hash) returns (aelf.Address) { + option (aelf.is_view) = true; + } + + // Get the registration of a smart contract by its address. + rpc GetSmartContractRegistrationByAddress (aelf.Address) returns (aelf.SmartContractRegistration) { + option (aelf.is_view) = true; + } + + // Get the registration of a smart contract by code hash. + rpc GetSmartContractRegistrationByCodeHash (aelf.Hash) returns (aelf.SmartContractRegistration) { + option (aelf.is_view) = true; + } + + rpc GetContractCodeHashListByDeployingBlockHeight (google.protobuf.Int64Value) returns (ContractCodeHashList) { + option (aelf.is_view) = true; + } +} + +message ContractInfo +{ + // The serial number of the contract. + int64 serial_number = 1; + // The author of the contract, this is the person who deployed the contract. + aelf.Address author = 2; + // The category of contract code(0: C#). + sint32 category = 3; + // The hash of the contract code. + aelf.Hash code_hash = 4; + // Whether it is a system contract. + bool is_system_contract = 5; + // The version of the current contract. + int32 version = 6; +} + +message ContractDeploymentInput { + // The category of contract code(0: C#). + sint32 category = 1; + // The byte array of the contract code. + bytes code = 2; +} + +message SystemContractDeploymentInput { + message SystemTransactionMethodCall { + // The method name of system transaction. + string method_name = 1; + // The params of system transaction method. + bytes params = 2; + } + message SystemTransactionMethodCallList { + // The list of system transactions. + repeated SystemTransactionMethodCall value = 1; + } + // The category of contract code(0: C#). + sint32 category = 1; + // The byte array of the contract code. + bytes code = 2; + // The name of the contract. It has to be unique. + aelf.Hash name = 3; + // An initial list of transactions for the system contract, + // which is executed in sequence when the contract is deployed. + SystemTransactionMethodCallList transaction_method_call_list = 4; +} + +message ContractUpdateInput { + // The contract address that needs to be updated. + aelf.Address address = 1; + // The byte array of the new contract code. + bytes code = 2; +} + +message ContractCodeCheckInput{ + // The byte array of the contract code to be checked. + bytes contract_input = 1; + // Whether the input contract is to be deployed or updated. + bool is_contract_deployment = 2; + // Method to call after code check complete(DeploySmartContract or UpdateSmartContract). + string code_check_release_method = 3; + // The id of the proposed contract. + aelf.Hash proposed_contract_input_hash = 4; + // The category of contract code(0: C#). + sint32 category = 5; + // Indicates if the contract is the system contract. + bool is_system_contract = 6; +} + +message ContractProposed +{ + option (aelf.is_event) = true; + // The id of the proposed contract. + aelf.Hash proposed_contract_input_hash = 1; +} + +message ContractDeployed +{ + option (aelf.is_event) = true; + // The author of the contract, this is the person who deployed the contract. + aelf.Address author = 1 [(aelf.is_indexed) = true]; + // The hash of the contract code. + aelf.Hash code_hash = 2 [(aelf.is_indexed) = true]; + // The address of the contract. + aelf.Address address = 3; + // The version of the current contract. + int32 version = 4; + // The name of the contract. It has to be unique. + aelf.Hash Name = 5; +} + +message CodeCheckRequired +{ + option (aelf.is_event) = true; + // The byte array of the contract code. + bytes code = 1; + // The id of the proposed contract. + aelf.Hash proposed_contract_input_hash = 2; + // The category of contract code(0: C#). + sint32 category = 3; + // Indicates if the contract is the system contract. + bool is_system_contract = 4; +} + +message CodeUpdated +{ + option (aelf.is_event) = true; + // The address of the updated contract. + aelf.Address address = 1 [(aelf.is_indexed) = true]; + // The byte array of the old contract code. + aelf.Hash old_code_hash = 2; + // The byte array of the new contract code. + aelf.Hash new_code_hash = 3; + // The version of the current contract. + int32 version = 4; +} + +message ValidateSystemContractAddressInput { + // The name hash of the contract. + aelf.Hash system_contract_hash_name = 1; + // The address of the contract. + aelf.Address address = 2; +} + +message ReleaseContractInput { + // The hash of the proposal. + aelf.Hash proposal_id = 1; + // The id of the proposed contract. + aelf.Hash proposed_contract_input_hash = 2; +} + +message ContractCodeHashList { + repeated aelf.Hash value = 1; +} + +message ContractCodeHashMap { + map value = 1; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/acs1.proto b/modules/AElf.Client.Protobuf/Protobuf/acs1.proto new file mode 100644 index 00000000..4894a1bc --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/acs1.proto @@ -0,0 +1,53 @@ +/** + * AElf Standards ACS1(Transaction Fee Standard) + * + * Used to manage the transaction fee. + */ +syntax = "proto3"; + +package acs1; + +import public "aelf/options.proto"; +import public "google/protobuf/empty.proto"; +import public "google/protobuf/wrappers.proto"; +import "aelf/core.proto"; +import "authority_info.proto"; + +option (aelf.identity) = "acs1"; +option csharp_namespace = "AElf.Standards.ACS1"; + +service MethodFeeProviderContract { + + // Set the method fees for the specified method. Note that this will override all fees of the method. + rpc SetMethodFee (MethodFees) returns (google.protobuf.Empty) { + } + + // Change the method fee controller, the default is parliament and default organization. + rpc ChangeMethodFeeController (AuthorityInfo) returns (google.protobuf.Empty) { + } + + // Query method fee information by method name. + rpc GetMethodFee (google.protobuf.StringValue) returns (MethodFees) { + option (aelf.is_view) = true; + } + + // Query the method fee controller. + rpc GetMethodFeeController (google.protobuf.Empty) returns (AuthorityInfo) { + option (aelf.is_view) = true; + } +} + +message MethodFees { + // The name of the method to be charged. + string method_name = 1; + // List of fees to be charged. + repeated MethodFee fees = 2; + bool is_size_fee_free = 3;// Optional based on the implementation of SetMethodFee method. +} + +message MethodFee { + // The token symbol of the method fee. + string symbol = 1; + // The amount of fees to be charged. + int64 basic_fee = 2; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/acs10.proto b/modules/AElf.Client.Protobuf/Protobuf/acs10.proto new file mode 100644 index 00000000..0b6f3240 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/acs10.proto @@ -0,0 +1,80 @@ +/** + * AElf Standards ACS10(Dividend Pool Standard) + * + * Used to construct a dividend pool in the contract. + */ +syntax = "proto3"; + +package acs10; + +import public "aelf/options.proto"; +import public "google/protobuf/empty.proto"; +import public "google/protobuf/wrappers.proto"; +import "aelf/core.proto"; + +option (aelf.identity) = "acs10"; +option csharp_namespace = "AElf.Standards.ACS10"; + +service DividendPoolContract { + // Donates tokens from the caller to the treasury. If the tokens are not native tokens in the current chain, + // they will be first converted to the native token. + rpc Donate (DonateInput) returns (google.protobuf.Empty) { + } + + // Release dividend pool according the period number. + rpc Release (ReleaseInput) returns (google.protobuf.Empty) { + } + + // Set the token symbols dividend pool supports. + rpc SetSymbolList (SymbolList) returns (google.protobuf.Empty) { + } + + // Query the token symbols dividend pool supports. + rpc GetSymbolList (google.protobuf.Empty) returns (SymbolList) { + option (aelf.is_view) = true; + } + + // Query the balance of undistributed tokens whose symbols are included in the symbol list. + rpc GetUndistributedDividends (google.protobuf.Empty) returns (Dividends) { + option (aelf.is_view) = true; + } + + // Query the dividend information according to the height. + rpc GetDividends (google.protobuf.Int64Value) returns (Dividends) { + option (aelf.is_view) = true; + } +} + +message DonateInput { + // The token symbol to donate. + string symbol = 1; + // The amount to donate. + int64 amount = 2; +} + +message ReleaseInput { + // The period number to release. + int64 period_number = 1; +} + +message SymbolList { + // The token symbol list. + repeated string value = 1; +} + +message Dividends { + // The dividends, symbol -> amount. + map value = 1; +} + +message DonationReceived { + option (aelf.is_event) = true; + // The address of donors. + aelf.Address from = 1; + // The address of dividend pool. + aelf.Address pool_contract = 2; + // The token symbol Donated. + string symbol = 3; + // The amount Donated. + int64 amount = 4; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/acs11.proto b/modules/AElf.Client.Protobuf/Protobuf/acs11.proto new file mode 100644 index 00000000..d7708a78 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/acs11.proto @@ -0,0 +1,31 @@ +/** + * AElf Standards ACS11(Consensus Standard) + * + * Used to customize consensus mechanisms for cross chain. + */ +syntax = "proto3"; + +package acs11; +import "aelf/options.proto"; +import "aelf/core.proto"; +import "google/protobuf/wrappers.proto"; +import "google/protobuf/empty.proto"; + +option (aelf.identity) = "acs11"; +option csharp_namespace = "AElf.Standards.ACS11"; + +service CrossChainInteractionContract { + // Update the consensus information of the side chain. + rpc UpdateInformationFromCrossChain (google.protobuf.BytesValue) returns (google.protobuf.Empty) { + } + + // Get the current miner list and consensus round information. + rpc GetChainInitializationInformation (google.protobuf.BytesValue) returns (google.protobuf.BytesValue) { + option (aelf.is_view) = true; + } + + // Verify that the input address is the current miner. + rpc CheckCrossChainIndexingPermission (aelf.Address) returns (google.protobuf.BoolValue) { + option (aelf.is_view) = true; + } +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/acs13.proto b/modules/AElf.Client.Protobuf/Protobuf/acs13.proto new file mode 100644 index 00000000..2f80e12a --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/acs13.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package acs13; +import "aelf/options.proto"; +import "aelf/core.proto"; +import "google/protobuf/wrappers.proto"; + +option (aelf.identity) = "acs13"; +option csharp_namespace = "AElf.Standards.ACS13"; + +service OracleAggregatorContract { + rpc Aggregate (AggregateInput) returns (google.protobuf.StringValue) { + } +} + + +message AggregateInput { + repeated string results = 1; + repeated int32 frequencies = 2; + int32 aggregate_option = 3; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/acs2.proto b/modules/AElf.Client.Protobuf/Protobuf/acs2.proto new file mode 100644 index 00000000..637e66e1 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/acs2.proto @@ -0,0 +1,30 @@ +/** + * AElf Standards ACS2(Parallel Execution Standard) + * + * Used to provide information for parallel execution of transactions. + */ +syntax = "proto3"; + +package acs2; + +import "aelf/core.proto"; +import "aelf/options.proto"; + +option (aelf.identity) = "acs2"; +option csharp_namespace = "AElf.Standards.ACS2"; + +service ACS2Base { + // Gets the resource information that the transaction execution depends on. + rpc GetResourceInfo (aelf.Transaction) returns (ResourceInfo) { + option (aelf.is_view) = true; + } +} + +message ResourceInfo { + // The state path that depends on when writing. + repeated aelf.ScopedStatePath write_paths = 1; + // The state path that depends on when reading. + repeated aelf.ScopedStatePath read_paths = 2; + // Whether the transaction is not executed in parallel. + bool non_parallelizable = 3; +} diff --git a/modules/AElf.Client.Protobuf/Protobuf/acs3.proto b/modules/AElf.Client.Protobuf/Protobuf/acs3.proto new file mode 100644 index 00000000..65ee66e8 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/acs3.proto @@ -0,0 +1,207 @@ +/** + * AElf Standards ACS3(Contract Proposal Standard) + * + * Used for governance through proposals. + */ +syntax = "proto3"; + +package acs3; + +import public "aelf/core.proto"; +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import public "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option (aelf.identity) = "acs3"; +option csharp_namespace = "AElf.Standards.ACS3"; + +service AuthorizationContract { + // Create a proposal for which organization members can vote. + // When the proposal is released, a transaction will be sent to the specified contract. + // Return id of the newly created proposal. + rpc CreateProposal (CreateProposalInput) returns (aelf.Hash) { + } + + // Approve a proposal according to the proposal ID. + rpc Approve (aelf.Hash) returns (google.protobuf.Empty) { + } + + // Reject a proposal according to the proposal ID. + rpc Reject(aelf.Hash) returns (google.protobuf.Empty) { + } + + // Abstain a proposal according to the proposal ID. + rpc Abstain(aelf.Hash) returns (google.protobuf.Empty){ + } + + // Release a proposal according to the proposal ID and send a transaction to the specified contract. + rpc Release(aelf.Hash) returns (google.protobuf.Empty){ + } + + // Change the thresholds associated with proposals. + // All fields will be overwritten by the input value and this will affect all current proposals of the organization. + // Note: only the organization can execute this through a proposal. + rpc ChangeOrganizationThreshold(ProposalReleaseThreshold)returns(google.protobuf.Empty) { + } + + // Change the white list of organization proposer. + // This method overrides the list of whitelisted proposers. + rpc ChangeOrganizationProposerWhiteList(ProposerWhiteList) returns (google.protobuf.Empty){ + } + + // Create a proposal by system contracts, + // and return id of the newly created proposal. + rpc CreateProposalBySystemContract(CreateProposalBySystemContractInput) returns (aelf.Hash){ + } + + // Remove the specified proposal. If the proposal is in effect, the cleanup fails. + rpc ClearProposal(aelf.Hash) returns (google.protobuf.Empty){ + } + + // Get the proposal according to the proposal ID. + rpc GetProposal(aelf.Hash) returns (ProposalOutput) { + option (aelf.is_view) = true; + } + + // Check the existence of an organization. + rpc ValidateOrganizationExist(aelf.Address) returns (google.protobuf.BoolValue){ + option (aelf.is_view) = true; + } + + // Check if the proposer is whitelisted. + rpc ValidateProposerInWhiteList(ValidateProposerInWhiteListInput) returns (google.protobuf.BoolValue){ + option (aelf.is_view) = true; + } +} + +message CreateProposalInput { + // The name of the method to call after release. + string contract_method_name = 1; + // The address of the contract to call after release. + aelf.Address to_address = 2; + // The parameter of the method to be called after the release. + bytes params = 3; + // The timestamp at which this proposal will expire. + google.protobuf.Timestamp expired_time = 4; + // The address of the organization. + aelf.Address organization_address = 5; + // Url is used for proposal describing. + string proposal_description_url = 6; + // The token is for proposal id generation and with this token, proposal id can be calculated before proposing. + aelf.Hash token = 7; +} + +message ProposalOutput { + // The id of the proposal. + aelf.Hash proposal_id = 1; + // The method that this proposal will call when being released. + string contract_method_name = 2; + // The address of the target contract. + aelf.Address to_address = 3; + // The parameters of the release transaction. + bytes params = 4; + // The date at which this proposal will expire. + google.protobuf.Timestamp expired_time = 5; + // The address of this proposals organization. + aelf.Address organization_address = 6; + // The address of the proposer of this proposal. + aelf.Address proposer = 7; + // Indicates if this proposal is releasable. + bool to_be_released = 8; + // Approval count for this proposal. + int64 approval_count = 9; + // Rejection count for this proposal. + int64 rejection_count = 10; + // Abstention count for this proposal. + int64 abstention_count = 11; +} + +message ProposalReleaseThreshold { + // The value for the minimum approval threshold. + int64 minimal_approval_threshold = 1; + // The value for the maximal rejection threshold. + int64 maximal_rejection_threshold = 2; + // The value for the maximal abstention threshold. + int64 maximal_abstention_threshold = 3; + // The value for the minimal vote threshold. + int64 minimal_vote_threshold = 4; +} + +message ProposerWhiteList{ + // The address of the proposers + repeated aelf.Address proposers = 1; +} + +message OrganizationHashAddressPair{ + // The id of organization. + aelf.Hash organization_hash = 1; + // The address of organization. + aelf.Address organization_address = 2; +} + +message CreateProposalBySystemContractInput { + // The parameters of creating proposal. + acs3.CreateProposalInput proposal_input =1; + // The actor that trigger the call. + aelf.Address origin_proposer = 2; +} + +message ValidateProposerInWhiteListInput{ + // The address to search/check. + aelf.Address proposer = 1; + // The address of the organization. + aelf.Address organization_address = 2; +} + +message ProposalCreated{ + option (aelf.is_event) = true; + // The id of the created proposal. + aelf.Hash proposal_id = 1; + // The organization address of the created proposal. + aelf.Address organization_address=2 [(aelf.is_indexed) = true]; +} + +message ProposalReleased{ + option (aelf.is_event) = true; + // The id of the released proposal. + aelf.Hash proposal_id = 1; + // The organization address of the released proposal. + aelf.Address organization_address=2 [(aelf.is_indexed) = true]; +} + +message OrganizationCreated{ + option (aelf.is_event) = true; + // The address of the created organization. + aelf.Address organization_address = 1; +} + +message ReceiptCreated { + option (aelf.is_event) = true; + // The id of the proposal. + aelf.Hash proposal_id = 1; + // The sender address. + aelf.Address address = 2; + // The type of receipt(Approve, Reject or Abstain). + string receipt_type = 3; + // The timestamp of this method call. + google.protobuf.Timestamp time = 4; + // The address of the organization. + aelf.Address organization_address = 5 [(aelf.is_indexed) = true]; +} + +message OrganizationWhiteListChanged{ + option (aelf.is_event) = true; + // The organization address. + aelf.Address organization_address = 1; + // The new proposer whitelist. + ProposerWhiteList proposer_white_list = 2; +} + +message OrganizationThresholdChanged{ + option (aelf.is_event) = true; + // The organization address + aelf.Address organization_address = 1; + // The new release threshold. + ProposalReleaseThreshold proposer_release_threshold = 2; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/acs4.proto b/modules/AElf.Client.Protobuf/Protobuf/acs4.proto new file mode 100644 index 00000000..0328f538 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/acs4.proto @@ -0,0 +1,70 @@ +/** + * AElf Standards ACS4(Consensus Standard) + * + * Used to customize consensus mechanisms. + */ +syntax = "proto3"; + +package acs4; + +import "aelf/options.proto"; +import "aelf/core.proto"; +import "google/protobuf/wrappers.proto"; +import "google/protobuf/timestamp.proto"; + +option (aelf.identity) = "acs4"; +option csharp_namespace = "AElf.Standards.ACS4"; + +service ConsensusContract { + // Generate a consensus command based on the consensus contract state and the input public key. + rpc GetConsensusCommand (google.protobuf.BytesValue) returns (ConsensusCommand) { + option (aelf.is_view) = true; + } + + // Generate consensus extra data when a block is generated. + rpc GetConsensusExtraData (google.protobuf.BytesValue) returns (google.protobuf.BytesValue) { + option (aelf.is_view) = true; + } + + // Generate consensus system transactions when a block is generated. + // Each block will contain only one consensus transaction, which is used to write the latest consensus information + // to the State database. + rpc GenerateConsensusTransactions (google.protobuf.BytesValue) returns (TransactionList) { + option (aelf.is_view) = true; + } + + // Before executing the block, verify that the consensus information in the block header is correct. + rpc ValidateConsensusBeforeExecution (google.protobuf.BytesValue) returns (ValidationResult) { + option (aelf.is_view) = true; + } + + // After executing the block, verify that the state information written to the consensus is correct. + rpc ValidateConsensusAfterExecution (google.protobuf.BytesValue) returns (ValidationResult) { + option (aelf.is_view) = true; + } +} + +message ConsensusCommand { + // Time limit of mining next block. + int32 limit_milliseconds_of_mining_block = 1; + // Context of Hint is diverse according to the consensus protocol we choose, so we use bytes. + bytes hint = 2; + // The time of arrange mining. + google.protobuf.Timestamp arranged_mining_time = 3; + // The expiration time of mining. + google.protobuf.Timestamp mining_due_time = 4; +} + +message ValidationResult { + // Is successful. + bool success = 1; + // The error message. + string message = 2; + // Whether to trigger mining again. + bool is_re_trigger = 3; +} + +message TransactionList { + // Consensus system transactions. + repeated aelf.Transaction transactions = 1; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/acs5.proto b/modules/AElf.Client.Protobuf/Protobuf/acs5.proto new file mode 100644 index 00000000..f6de21ed --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/acs5.proto @@ -0,0 +1,51 @@ +/** + * AElf Standards ACS5(Method Calling Threshold Contract Standard) + * + * To avoid DDOS attacks, all contracts should theoretically implement AElf Standards ACS5, + * setting a threshold for expensive methods. There are two types of call thresholds: check balance only, + * and check balance and allowance at the same time. + */ +syntax = "proto3"; + +package acs5; + +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; + +option (aelf.identity) = "acs5"; +option csharp_namespace = "AElf.Standards.ACS5"; + +service ThresholdSettingContract { + // Set the threshold for method calling. + rpc SetMethodCallingThreshold (SetMethodCallingThresholdInput) returns (google.protobuf.Empty) { + } + + // Get the threshold for method calling. + rpc GetMethodCallingThreshold (google.protobuf.StringValue) returns (MethodCallingThreshold) { + option (aelf.is_view) = true; + } +} + +message MethodCallingThreshold { + // The threshold for method calling, token symbol -> amount. + map symbol_to_amount = 1; + // The type of threshold check. + ThresholdCheckType threshold_check_type = 2; +} + +message SetMethodCallingThresholdInput { + // The method name to check. + string method = 1; + // The threshold for method calling, token symbol -> amount. + map symbol_to_amount = 2; + // The type of threshold check. + ThresholdCheckType threshold_check_type = 3; +} + +enum ThresholdCheckType { + // Check balance only. + BALANCE = 0; + // Check balance and allowance at the same time. + ALLOWANCE = 1; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/acs6.proto b/modules/AElf.Client.Protobuf/Protobuf/acs6.proto new file mode 100644 index 00000000..f95ba5ed --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/acs6.proto @@ -0,0 +1,22 @@ +/** + * AElf Standards ACS6(Random Number Standard) + * + * Used to generate random number. + */ +syntax = "proto3"; + +package acs6; + +import "aelf/options.proto"; +import "aelf/core.proto"; +import "google/protobuf/wrappers.proto"; + +option (aelf.identity) = "acs6"; +option csharp_namespace = "AElf.Standards.ACS6"; + +service RandomNumberProviderContract { + // Get random number according to block height. + rpc GetRandomBytes (google.protobuf.BytesValue) returns (google.protobuf.BytesValue) { + option (aelf.is_view) = true; + } +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/acs7.proto b/modules/AElf.Client.Protobuf/Protobuf/acs7.proto new file mode 100644 index 00000000..2e9619d1 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/acs7.proto @@ -0,0 +1,292 @@ +/** + * AElf Standards ACS7(Contract CrossChain Standard) + * + * ACS7 is for cross chain related contract implementation. + */ +syntax = "proto3"; + +package acs7; + +import public "aelf/core.proto"; +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; +import public "google/protobuf/timestamp.proto"; + +option (aelf.identity) = "acs7"; +option csharp_namespace = "AElf.Standards.ACS7"; + +service ACS7 { + + // Propose once cross chain indexing. + rpc ProposeCrossChainIndexing(CrossChainBlockData) returns (google.protobuf.Empty) { + } + + // Release the proposed indexing if already approved. + rpc ReleaseCrossChainIndexingProposal(ReleaseCrossChainIndexingProposalInput) returns (google.protobuf.Empty) { + } + + // Request side chain creation. + rpc RequestSideChainCreation(SideChainCreationRequest) returns (google.protobuf.Empty){ + } + + // Release the side chain creation request if already approved and it will call the method CreateSideChain. + rpc ReleaseSideChainCreation(ReleaseSideChainCreationInput) returns (google.protobuf.Empty){ + } + + // Create the side chain and returns the newly created side chain ID. + // Only SideChainLifetimeController is permitted to invoke this method. + rpc CreateSideChain (CreateSideChainInput) returns (google.protobuf.Int32Value) { + } + + // Recharge for the specified side chain. + rpc Recharge (RechargeInput) returns (google.protobuf.Empty) { + } + + // Dispose a side chain according to side chain id. + // Only SideChainLifetimeController is permitted to invoke this method. + rpc DisposeSideChain (google.protobuf.Int32Value) returns (google.protobuf.Int32Value) { + } + + // Adjust side chain indexing fee. Only IndexingFeeController is permitted to invoke this method. + rpc AdjustIndexingFeePrice(AdjustIndexingFeeInput)returns(google.protobuf.Empty){ + } + + // Verify cross chain transaction. + rpc VerifyTransaction (VerifyTransactionInput) returns (google.protobuf.BoolValue) { + option (aelf.is_view) = true; + } + + // Gets all the side chain id and height of the current chain. + rpc GetSideChainIdAndHeight (google.protobuf.Empty) returns (ChainIdAndHeightDict) { + option (aelf.is_view) = true; + } + + // Get indexing information of side chains. + rpc GetSideChainIndexingInformationList (google.protobuf.Empty) returns (SideChainIndexingInformationList) { + option (aelf.is_view) = true; + } + + // Get id and recorded height of all chains. + rpc GetAllChainsIdAndHeight (google.protobuf.Empty) returns (ChainIdAndHeightDict) { + option (aelf.is_view) = true; + } + + // Get block data of indexed side chain according to height. + rpc GetIndexedSideChainBlockDataByHeight (google.protobuf.Int64Value) returns (IndexedSideChainBlockData) { + option (aelf.is_view) = true; + } + + // Get merkle path bound up with side chain according to height. + rpc GetBoundParentChainHeightAndMerklePathByHeight (google.protobuf.Int64Value) returns (CrossChainMerkleProofContext) { + option (aelf.is_view) = true; + } + + // Get initialization data for specified side chain. + rpc GetChainInitializationData (google.protobuf.Int32Value) returns (ChainInitializationData) { + option (aelf.is_view) = true; + } +} + +message SideChainBlockData { + // The height of side chain block. + int64 height = 1; + // The hash of side chain block. + aelf.Hash block_header_hash = 2; + // The merkle tree root computing from transactions status in side chain block. + aelf.Hash transaction_status_merkle_tree_root = 3; + // The id of side chain. + int32 chain_id = 4; +} + +message RechargeInput { + // The chain id to recharge. + int32 chain_id = 1; + // The amount to recharge. + int64 amount = 2; +} + +message ParentChainBlockData { + // The height of parent chain. + int64 height = 1; + // The merkle tree root computing from side chain roots. + CrossChainExtraData cross_chain_extra_data = 2; + // The parent chain id. + int32 chain_id = 3; + // The merkle tree root computing from transactions status in parent chain block. + aelf.Hash transaction_status_merkle_tree_root = 4; + // Indexed block height from side chain and merkle path for this side chain block + map indexed_merkle_path = 5; + // Extra data map. + map extra_data = 6; +} + +message CrossChainExtraData { + // Merkle tree root of side chain block transaction status root. + aelf.Hash transaction_status_merkle_tree_root = 1; +} + +message ChainIdAndHeightDict { + // A collection of chain ids and heights, where the key is the chain id and the value is the height. + map id_height_dict = 1; +} + +message SideChainIndexingInformationList { + // A list contains indexing information of side chains. + repeated SideChainIndexingInformation indexing_information_list = 1; +} + +message SideChainIndexingInformation { + // The side chain id. + int32 chain_id = 1; + // The indexed height. + int64 indexed_height = 2; +} + +message CrossChainBlockData { + // The side chain block data list to index. + repeated SideChainBlockData side_chain_block_data_list = 1; + // The parent chain block data list to index. + repeated ParentChainBlockData parent_chain_block_data_list = 2; +} + +message CrossChainMerkleProofContext { + // The height of parent chain bound up with side chain. + int64 bound_parent_chain_height = 1; + // The merkle path generated from parent chain. + aelf.MerklePath merkle_path_from_parent_chain = 2; +} + +message ChainInitializationData { + // The id of side chain. + int32 chain_id = 1; + // The side chain creator. + aelf.Address creator = 2; + // The timestamp for side chain creation. + google.protobuf.Timestamp creation_timestamp = 3; + // The height of side chain creation on parent chain. + int64 creation_height_on_parent_chain = 4; + // Creator privilege boolean flag: True if chain creator privilege preserved, otherwise false. + bool chain_creator_privilege_preserved = 5; + // Parent chain token contract address. + aelf.Address parent_chain_token_contract_address = 6; + // Initial consensus information. + ChainInitializationConsensusInfo chain_initialization_consensus_info = 7; + // The native token info. + bytes native_token_info_data = 8; + // The resource token information. + ResourceTokenInfo resource_token_info = 9; + // The chain primary token information. + ChainPrimaryTokenInfo chain_primary_token_info = 10; +} + +message ResourceTokenInfo{ + // The resource token information. + bytes resource_token_list_data = 1; + // The initial resource token amount. + map initial_resource_amount = 2; +} + +message ChainPrimaryTokenInfo{ + // The side chain primary token data. + bytes chain_primary_token_data = 1; + // The side chain primary token initial issue list. + repeated SideChainTokenInitialIssue side_chain_token_initial_issue_list = 2; +} + +message ChainInitializationConsensusInfo{ + // Initial consensus data. + bytes initial_consensus_data = 1; +} + +message SideChainCreationRequest { + // The cross chain indexing price. + int64 indexing_price = 1; + // Initial locked balance for a new side chain. + int64 locked_token_amount = 2; + // Creator privilege boolean flag: True if chain creator privilege preserved, otherwise false. + bool is_privilege_preserved = 3; + // Side chain token information. + SideChainTokenCreationRequest side_chain_token_creation_request = 4; + // A list of accounts and amounts that will be issued when the chain starts. + repeated SideChainTokenInitialIssue side_chain_token_initial_issue_list = 5; + // The initial rent resources. + map initial_resource_amount = 6; +} + +message SideChainTokenCreationRequest{ + // Token symbol of the side chain to be created + string side_chain_token_symbol = 1; + // Token name of the side chain to be created + string side_chain_token_name = 2; + // Token total supply of the side chain to be created + int64 side_chain_token_total_supply = 3; + // Token decimals of the side chain to be created + int32 side_chain_token_decimals = 4; +} + +message SideChainTokenInitialIssue{ + // The account that will be issued. + aelf.Address address = 1; + // The amount that will be issued. + int64 amount = 2; +} + +message IndexedParentChainBlockData { + // The height of the local chain when indexing the parent chain. + int64 local_chain_height = 1; + // Parent chain block data. + repeated acs7.ParentChainBlockData parent_chain_block_data_list = 2; +} + +message IndexedSideChainBlockData{ + // Side chain block data. + repeated acs7.SideChainBlockData side_chain_block_data_list = 1; +} + +message ReleaseCrossChainIndexingProposalInput{ + // List of chain ids to release. + repeated int32 chain_id_list = 1; +} + +message CreateSideChainInput{ + // The request information of the side chain creation. + SideChainCreationRequest side_chain_creation_request = 1; + // The proposer of the side chain creation. + aelf.Address proposer = 2; +} + +message ReleaseSideChainCreationInput { + // The proposal id of side chain creation. + aelf.Hash proposal_id = 1; +} + +message AdjustIndexingFeeInput{ + // The side chain id to adjust. + int32 side_chain_id = 1; + // The new price of indexing fee. + int64 indexing_fee = 2; +} + +message SideChainBlockDataIndexed{ + option (aelf.is_event) = true; +} + +message CrossChainIndexingDataProposedEvent{ + option (aelf.is_event) = true; + // Proposed cross chain data to be indexed. + acs7.CrossChainBlockData proposed_cross_chain_data = 1; + // The proposal id. + aelf.Hash proposal_id = 2; +} + +message VerifyTransactionInput { + // The cross chain transaction id to verify. + aelf.Hash transaction_id = 1; + // The merkle path of the transaction. + aelf.MerklePath path = 2; + // The height of parent chain that indexing this transaction. + int64 parent_chain_height = 3; + // The chain if to verify. + int32 verified_chain_id = 4; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/acs8.proto b/modules/AElf.Client.Protobuf/Protobuf/acs8.proto new file mode 100644 index 00000000..a711fdf4 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/acs8.proto @@ -0,0 +1,35 @@ +/** + * AElf Standards ACS8(Transaction Resource Token Fee Standard) + * + * ACS8 has some similarities to ACS1, both of them are charge transaction fee standard. + * The difference is that ACS1 charges the user a transaction fee, ACS8 charges the called contract, + * and the transaction fee charged by ACS8 is the specified four tokens: WRITE, READ, STORAGE, TRAFFIC. + * In another word, if a contract declares that it inherits from ACS8, each transaction in this contract will + * charge four kinds of resource token. + */ +syntax = "proto3"; + +package acs8; + +import public "aelf/options.proto"; +import public "google/protobuf/empty.proto"; + +option (aelf.identity) = "acs8"; +option csharp_namespace = "AElf.Standards.ACS8"; + +service ResourceConsumptionContract { + // Buy one of the four resource coins, which consumes the ELF balance in the contract account + // (you can recharge it yourself, or you can collect the user’s ELF tokens as a profit to be self-sufficient). + rpc BuyResourceToken (BuyResourceTokenInput) returns (google.protobuf.Empty) { + } +} + +message BuyResourceTokenInput { + // The symbol token you want to buy. + string symbol = 1; + // The amount you want to buy. + int64 amount = 2; + // Limit of cost. If the token required for buy exceeds this value, the buy will be abandoned. + // And 0 is no limit. + int64 pay_limit = 3; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/acs9.proto b/modules/AElf.Client.Protobuf/Protobuf/acs9.proto new file mode 100644 index 00000000..dedf8e2b --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/acs9.proto @@ -0,0 +1,52 @@ +/** + * AElf Standards ACS9 (Contract Profit Dividend Standard) + * + * Used for developers implement a profit divided mechanism on the AElf side chain. + */ +syntax = "proto3"; + +package acs9; + +import public "aelf/options.proto"; +import public "google/protobuf/empty.proto"; + +option (aelf.identity) = "acs9"; +option csharp_namespace = "AElf.Standards.ACS9"; + +service ContractProfitsContract { + // Used for the developer to collect the profits from the contract, + // and the profits will be distributed in this method. + rpc TakeContractProfits (TakeContractProfitsInput) returns (google.protobuf.Empty) { + } + + // Query the config of profit. + rpc GetProfitConfig (google.protobuf.Empty) returns (ProfitConfig) { + option (aelf.is_view) = true; + } + + // Query the profits of the contract so far. + rpc GetProfitsAmount (google.protobuf.Empty) returns (ProfitsMap) { + option (aelf.is_view) = true; + } +} + +message TakeContractProfitsInput { + // The token symbol to take. + string symbol = 1; + // The amount to take. + int64 amount = 2; +} + +message ProfitConfig { + // The portion of the profit that will be donated to the dividend pool each time the developer receives the profit. + int32 donation_parts_per_hundred = 1; + // The profit token symbol list. + repeated string profits_token_symbol_list = 2; + // The token symbol that the user can lock them to claim the profit. + string staking_token_symbol = 3; +} + +message ProfitsMap { + // The profits, token symbol -> amount. + map value = 1; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/aedpos_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/aedpos_contract.proto new file mode 100644 index 00000000..05546ab3 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/aedpos_contract.proto @@ -0,0 +1,440 @@ +/** + * AEDPoS contract. + */ +syntax = "proto3"; + +package AEDPoS; + +import "aelf/options.proto"; +import "aelf/core.proto"; +import "authority_info.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "AElf.Contracts.Consensus.AEDPoS"; + +service AEDPoSContract { + + option (aelf.csharp_state) = "AElf.Contracts.Consensus.AEDPoS.AEDPoSContractState"; + + // Initialize the consensus contract. + rpc InitialAElfConsensusContract (InitialAElfConsensusContractInput) returns (google.protobuf.Empty) { + } + + // Initializes the consensus information in the first round. + rpc FirstRound (Round) returns (google.protobuf.Empty) { + } + + // Update consensus information. + rpc UpdateValue (UpdateValueInput) returns (google.protobuf.Empty) { + } + + // Update consensus information, create a new round. + rpc NextRound (Round) returns (google.protobuf.Empty) { + } + + // Update consensus information, create a new term. + rpc NextTerm (Round) returns (google.protobuf.Empty) { + } + + // Update consensus tiny block information. + rpc UpdateTinyBlockInformation (TinyBlockInput) returns (google.protobuf.Empty) { + } + + // Set the maximum count of miners, by default, is unlimited. + // If you want to control the count of miners, you need to set it through parliament. + rpc SetMaximumMinersCount (google.protobuf.Int32Value) returns (google.protobuf.Empty) { + } + + // The authority information for SetMaximumMinersCount, by default, is governed by parliament. + rpc ChangeMaximumMinersCountController (AuthorityInfo) returns (google.protobuf.Empty) { + } + + // Election Contract can notify AEDPoS Contract to aware candidate replacement happened. + rpc RecordCandidateReplacement (RecordCandidateReplacementInput) returns (google.protobuf.Empty) { + } + + // Get the list of current miners. + rpc GetCurrentMinerList (google.protobuf.Empty) returns (MinerList) { + option (aelf.is_view) = true; + } + + // Get the list of current miners (hexadecimal format). + rpc GetCurrentMinerPubkeyList (google.protobuf.Empty) returns (PubkeyList) { + option (aelf.is_view) = true; + } + + // Get the list of current miners and current round number. + rpc GetCurrentMinerListWithRoundNumber (google.protobuf.Empty) returns (MinerListWithRoundNumber) { + option (aelf.is_view) = true; + } + + // Get information of the round according to round number. + rpc GetRoundInformation (google.protobuf.Int64Value) returns (Round) { + option (aelf.is_view) = true; + } + + // Get the current round number. + rpc GetCurrentRoundNumber (google.protobuf.Empty) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + + // Get the current round information. + rpc GetCurrentRoundInformation (google.protobuf.Empty) returns (Round) { + option (aelf.is_view) = true; + } + + // Get the previous round information. + rpc GetPreviousRoundInformation (google.protobuf.Empty) returns (Round) { + option (aelf.is_view) = true; + } + + // Get the current term number. + rpc GetCurrentTermNumber (google.protobuf.Empty) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + + // Get the welfare reward the current term. + rpc GetCurrentTermMiningReward (google.protobuf.Empty) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + + // Get the list of miners according to term number. + rpc GetMinerList (GetMinerListInput) returns (MinerList) { + option (aelf.is_view) = true; + } + + // Get the list of miner in previous term. + rpc GetPreviousMinerList (google.protobuf.Empty) returns (MinerList) { + option (aelf.is_view) = true; + } + + // Get the amount of mined blocks in previous term. + rpc GetMinedBlocksOfPreviousTerm (google.protobuf.Empty) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + + // Get the miner that produces the next block. + rpc GetNextMinerPubkey (google.protobuf.Empty) returns (google.protobuf.StringValue) { + option (aelf.is_view) = true; + } + + // Check to see if the account address is on the miner list for the current round. + rpc IsCurrentMiner (aelf.Address) returns (google.protobuf.BoolValue) { + option (aelf.is_view) = true; + } + + // Query the left time before the next election takes effects (seconds). + rpc GetNextElectCountDown (google.protobuf.Empty) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + + // Get term information according term number. + rpc GetPreviousTermInformation (google.protobuf.Int64Value) returns (Round) { + option (aelf.is_view) = true; + } + + // Get random hash (Keep this for compatibility). + rpc GetRandomHash (google.protobuf.Int64Value) returns (aelf.Hash) { + option (aelf.is_view) = true; + } + + // Get the maximum of tiny blocks produced by a miner each round. + rpc GetMaximumBlocksCount (google.protobuf.Empty) returns (google.protobuf.Int32Value) { + option (aelf.is_view) = true; + } + + // Get the maximum count of miners. + rpc GetMaximumMinersCount (google.protobuf.Empty) returns (google.protobuf.Int32Value) { + option (aelf.is_view) = true; + } + + // Get the authority information for SetMaximumMinersCount. + rpc GetMaximumMinersCountController (google.protobuf.Empty) returns (AuthorityInfo) { + option (aelf.is_view) = true; + } + + // Gets the list of miners in the main chain. + rpc GetMainChainCurrentMinerList (google.protobuf.Empty) returns (MinerList) { + option (aelf.is_view) = true; + } + + // Get the list of miners in the previous term. + rpc GetPreviousTermMinerPubkeyList (google.protobuf.Empty) returns (PubkeyList) { + option (aelf.is_view) = true; + } + + // Query the current mining reward for each block. + rpc GetCurrentMiningRewardPerBlock (google.protobuf.Empty) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } +} + +message InitialAElfConsensusContractInput { + // Whether not to change the term. + bool is_term_stay_one = 1; + // Is a side chain. + bool is_side_chain = 2; + // The number of seconds per term. + int64 period_seconds = 3; + // The interval second that increases the number of miners. + int64 miner_increase_interval = 4; +} + +message UpdateValueInput { + // Calculated from current in value. + aelf.Hash out_value = 1; + // Calculated from current in value and signatures of previous round. + aelf.Hash signature = 2; + // To ensure the values to update will be apply to correct round by comparing round id. + int64 round_id = 3; + // Publish previous in value for validation previous signature and previous out value. + aelf.Hash previous_in_value = 4; + // The actual mining time, miners must fill actual mining time when they do the mining. + google.protobuf.Timestamp actual_mining_time = 5; + // The supposed order of mining for the next round. + int32 supposed_order_of_next_round = 6; + // The tuning order of mining for the next round, miner public key -> order. + map tune_order_information = 7; + // The encrypted pieces of InValue. + map encrypted_pieces = 8; + // The decrypted pieces of InValue. + map decrypted_pieces = 9; + // The amount of produced blocks. + int64 produced_blocks = 10; + // The InValue in the previous round, miner public key -> InValue. + map miners_previous_in_values = 11; + // The irreversible block height that miner recorded. + int64 implied_irreversible_block_height = 12; +} + +message MinerList { + // The miners public key list. + repeated bytes pubkeys = 1; +} + +message PubkeyList { + // The miners public key list. + repeated string pubkeys = 1; +} + +message TermNumberLookUp { + // Term number -> Round number. + map map = 1; +} + +message Candidates { + // The candidate public keys. + repeated bytes pubkeys = 1; +} + +message Round { + // The round number. + int64 round_number = 1; + // Current miner information, miner public key -> miner information. + map real_time_miners_information = 2; + // The round number on the main chain + int64 main_chain_miners_round_number = 3; + // The time from chain start to current round (seconds). + int64 blockchain_age = 4; + // The miner public key that produced the extra block in the previous round. + string extra_block_producer_of_previous_round = 5; + // The current term number. + int64 term_number = 6; + // The height of the confirmed irreversible block. + int64 confirmed_irreversible_block_height = 7; + // The round number of the confirmed irreversible block. + int64 confirmed_irreversible_block_round_number = 8; + // Is miner list different from the the miner list in the previous round. + bool is_miner_list_just_changed = 9; + // The round id, calculated by summing block producers’ expecting time (second). + int64 round_id_for_validation = 10; +} + +message MinerInRound { + // The order of the miner producing block. + int32 order = 1; + // Is extra block producer in the current round. + bool is_extra_block_producer = 2; + // Generated by secret sharing and used for validation between miner. + aelf.Hash in_value = 3; + // Calculated from current in value. + aelf.Hash out_value = 4; + // Calculated from current in value and signatures of previous round. + aelf.Hash signature = 5; + // The expected mining time. + google.protobuf.Timestamp expected_mining_time = 6; + // The amount of produced blocks. + int64 produced_blocks = 7; + // The amount of missed time slots. + int64 missed_time_slots = 8; + // The public key of this miner. + string pubkey = 9; + // The InValue of the previous round. + aelf.Hash previous_in_value = 10; + // The supposed order of mining for the next round. + int32 supposed_order_of_next_round = 11; + // The final order of mining for the next round. + int32 final_order_of_next_round = 12; + // The actual mining time, miners must fill actual mining time when they do the mining. + repeated google.protobuf.Timestamp actual_mining_times = 13; + // The encrypted pieces of InValue. + map encrypted_pieces = 14; + // The decrypted pieces of InValue. + map decrypted_pieces = 15; + // The amount of produced tiny blocks. + int64 produced_tiny_blocks = 16; + // The irreversible block height that current miner recorded. + int64 implied_irreversible_block_height = 17; +} + +message AElfConsensusHeaderInformation { + // The sender public key. + bytes sender_pubkey = 1; + // The round information. + Round round = 2; + // The behaviour of consensus. + AElfConsensusBehaviour behaviour = 3; +} + +message AElfConsensusHint { + // The behaviour of consensus. + AElfConsensusBehaviour behaviour = 1; + // The round id. + int64 round_id = 2; + // The previous round id. + int64 previous_round_id = 3; +} + +enum AElfConsensusBehaviour { + UPDATE_VALUE = 0; + NEXT_ROUND = 1; + NEXT_TERM = 2; + NOTHING = 3; + TINY_BLOCK = 4; +} + +message AElfConsensusTriggerInformation { + // The miner public key. + bytes pubkey = 1; + // The InValue for current round. + aelf.Hash in_value = 2; + // The InValue for previous round. + aelf.Hash previous_in_value = 3; + // The behaviour of consensus. + AElfConsensusBehaviour behaviour = 4; + // The encrypted pieces of InValue. + map encrypted_pieces = 5; + // The decrypted pieces of InValue. + map decrypted_pieces = 6; + // The revealed InValues. + map revealed_in_values = 7; +} + +message TermInfo { + int64 term_number = 1; + int64 round_number = 2; +} + +message MinerListWithRoundNumber { + // The list of miners. + MinerList miner_list = 1; + // The round number. + int64 round_number = 2; +} + +message TinyBlockInput { + // The round id. + int64 round_id = 1; + // The actual mining time. + google.protobuf.Timestamp actual_mining_time = 2; + // Count of blocks currently produced + int64 produced_blocks = 3; +} + +message VoteMinersCountInput { + int32 miners_count = 1; + int64 amount = 2; +} + +message ConsensusInformation { + bytes value = 1; +} + +message GetMinerListInput { + // The term number. + int64 term_number = 1; +} + +message RandomNumberRequestInformation { + int64 target_round_number = 1;// The random hash is likely generated during this round. + int64 order = 2; + int64 expected_block_height = 3; +} + +message HashList { + repeated aelf.Hash values = 1; +} + +message LatestPubkeyToTinyBlocksCount { + // The miner public key. + string pubkey = 1; + // The count of blocks the miner produced. + int64 blocks_count = 2; +} + +message IrreversibleBlockFound { + option (aelf.is_event) = true; + // The irreversible block height found. + int64 irreversible_block_height = 1 [(aelf.is_indexed) = true]; +} + +message IrreversibleBlockHeightUnacceptable { + option (aelf.is_event) = true; + // Distance to the height of the last irreversible block. + int64 distance_to_irreversible_block_height = 1; +} + +message MiningInformationUpdated { + option (aelf.is_event) = true; + // The miner public key. + string pubkey = 1 [(aelf.is_indexed) = true]; + // The current block time. + google.protobuf.Timestamp mining_time = 2 [(aelf.is_indexed) = true]; + // The behaviour of consensus. + string behaviour = 3 [(aelf.is_indexed) = true]; + // The current block height. + int64 block_height = 4 [(aelf.is_indexed) = true]; + // The previous block hash. + aelf.Hash previous_block_hash = 5 [(aelf.is_indexed) = true]; +} + +message SecretSharingInformation { + option (aelf.is_event) = true; + // The previous round information. + Round previous_round = 1 [(aelf.is_indexed) = true]; + // The current round id. + int64 current_round_id = 2; + // The previous round id. + int64 previous_round_id = 3; +} + +message MiningRewardGenerated { + option (aelf.is_event) = true; + // The number of term the mining reward is generated. + int64 term_number = 1 [(aelf.is_indexed) = true]; + // The amount of mining reward. + int64 amount = 2; +} + +message MinerReplaced { + option (aelf.is_event) = true; + // The new miner public key. + string new_miner_pubkey = 1; +} + +message RecordCandidateReplacementInput { + string old_pubkey = 1; + string new_pubkey = 2; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/aelf/core.proto b/modules/AElf.Client.Protobuf/Protobuf/aelf/core.proto new file mode 100644 index 00000000..e4109962 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/aelf/core.proto @@ -0,0 +1,147 @@ +syntax = "proto3"; + +package aelf; + +option csharp_namespace = "AElf.Types"; + +message Transaction { + // The address of the sender of the transaction. + Address from = 1; + // The address of the contract when calling a contract. + Address to = 2; + // The height of the referenced block hash. + int64 ref_block_number = 3; + // The first four bytes of the referenced block hash. + bytes ref_block_prefix = 4; + // The name of a method in the smart contract at the To address. + string method_name = 5; + // The parameters to pass to the smart contract method. + bytes params = 6; + // When signing a transaction it’s actually a subset of the fields: from/to and the target method as well as + // the parameter that were given. It also contains the reference block number and prefix. + bytes signature = 10000; +} + +message StatePath { + // The partial path of the state path. + repeated string parts = 1; +} + +message ScopedStatePath { + // The scope address, which will be the contract address. + Address address = 1; + // The path of contract state. + StatePath path = 2; +} + +enum TransactionResultStatus { + // The execution result of the transaction does not exist. + NOT_EXISTED = 0; + // The transaction is in the transaction pool waiting to be packaged. + PENDING = 1; + // Transaction execution failed. + FAILED = 2; + // The transaction was successfully executed and successfully packaged into a block. + MINED = 3; + // When executed in parallel, there are conflicts with other transactions. + CONFLICT = 4; + // The transaction is waiting for validation. + PENDING_VALIDATION = 5; + // Transaction validation failed. + NODE_VALIDATION_FAILED = 6; +} + +message TransactionResult { + // The transaction id. + Hash transaction_id = 1; + // The transaction result status. + TransactionResultStatus status = 2; + // The log events. + repeated LogEvent logs = 3; + // Bloom filter for transaction logs. A transaction log event can be defined in the contract and stored + // in the bloom filter after the transaction is executed. Through this filter, we can quickly search for + // and determine whether a log exists in the transaction result. + bytes bloom = 4; + // The return value of the transaction execution. + bytes return_value = 5; + // The height of the block hat packages the transaction. + int64 block_number = 6; + // The hash of the block hat packages the transaction. + Hash block_hash = 7; + // Failed execution error message. + string error = 10; +} + +message LogEvent { + // The contract address. + Address address = 1; + // The name of the log event. + string name = 2; + // The indexed data, used to calculate bloom. + repeated bytes indexed = 3; + // The non indexed data. + bytes non_indexed = 4; +} + +message SmartContractRegistration { + // The category of contract code(0: C#). + sint32 category = 1; + // The byte array of the contract code. + bytes code = 2; + // The hash of the contract code. + Hash code_hash = 3; + // Whether it is a system contract. + bool is_system_contract = 4; + // The version of the current contract. + int32 version = 5; +} + +message TransactionExecutingStateSet { + // The changed states. + map writes = 1; + // The read states. + map reads = 2; + // The deleted states. + map deletes = 3; +} + +message Address +{ + bytes value = 1; +} + +message Hash +{ + bytes value = 1; +} + +message SInt32Value +{ + sint32 value = 1; +} + +message SInt64Value +{ + sint64 value = 1; +} + +message MerklePath { + // The merkle path nodes. + repeated MerklePathNode merkle_path_nodes = 1; +} + +message MerklePathNode{ + // The node hash. + Hash hash = 1; + // Whether it is a left child node. + bool is_left_child_node = 2; +} + +message BinaryMerkleTree { + // The leaf nodes. + repeated Hash nodes = 1; + // The root node hash. + Hash root = 2; + // The count of leaf node. + int32 leaf_count = 3; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/aelf/options.proto b/modules/AElf.Client.Protobuf/Protobuf/aelf/options.proto new file mode 100644 index 00000000..34058baf --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/aelf/options.proto @@ -0,0 +1,38 @@ +syntax = "proto3"; + +package aelf; + +import "google/protobuf/descriptor.proto"; + +option csharp_namespace = "AElf"; + +// All aelf custom options field numbers are like 50yxxx +// where y stands for the custom options type: +// 0 - FileOptions +// 1 - MessageOptions +// 2 - FieldOptions +// 3 - EnumOptions +// 4 - EnumValueOptions +// 5 - ServiceOptions +// 6 - MethodOptions + +extend google.protobuf.FileOptions { + string identity = 500001; +} + +extend google.protobuf.ServiceOptions { + repeated string base = 505001; + string csharp_state = 505030; +} + +extend google.protobuf.MethodOptions { + bool is_view = 506001; +} + +extend google.protobuf.MessageOptions { + bool is_event = 50100; +} + +extend google.protobuf.FieldOptions { + bool is_indexed = 502001; +} diff --git a/modules/AElf.Client.Protobuf/Protobuf/association_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/association_contract.proto new file mode 100644 index 00000000..2efb8210 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/association_contract.proto @@ -0,0 +1,144 @@ +/** + * Association contract. + */ +syntax = "proto3"; + +package Association; + +import "acs3.proto"; +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "AElf.Contracts.Association"; + +service AssociationContract { + + option (aelf.csharp_state) = "AElf.Contracts.Association.AssociationState"; + + // Create an organization and return its address. + rpc CreateOrganization (CreateOrganizationInput) returns (aelf.Address) { + } + + // Creates an organization by system contract and return its address. + rpc CreateOrganizationBySystemContract(CreateOrganizationBySystemContractInput) returns (aelf.Address){ + } + + // Add organization members. + rpc AddMember(aelf.Address) returns (google.protobuf.Empty){ + } + + // Remove organization members. + rpc RemoveMember(aelf.Address) returns (google.protobuf.Empty){ + } + + // Replace organization member with a new member. + rpc ChangeMember(ChangeMemberInput) returns (google.protobuf.Empty){ + } + + // Get the organization according to the organization address. + rpc GetOrganization (aelf.Address) returns (Organization) { + option (aelf.is_view) = true; + } + + // Calculate the input and return the organization address. + rpc CalculateOrganizationAddress(CreateOrganizationInput) returns (aelf.Address){ + option (aelf.is_view) = true; + } +} + +message CreateOrganizationInput{ + // Initial organization members. + OrganizationMemberList organization_member_list = 1; + // The threshold for releasing the proposal. + acs3.ProposalReleaseThreshold proposal_release_threshold = 2; + // The proposer whitelist. + acs3.ProposerWhiteList proposer_white_list = 3; + // The creation token is for organization address generation. + aelf.Hash creation_token = 4; +} + +message Organization{ + // The organization members. + OrganizationMemberList organization_member_list = 1; + // The threshold for releasing the proposal. + acs3.ProposalReleaseThreshold proposal_release_threshold = 2; + // The proposer whitelist. + acs3.ProposerWhiteList proposer_white_list = 3; + // The address of organization. + aelf.Address organization_address = 4; + // The organizations id. + aelf.Hash organization_hash = 5; + // The creation token is for organization address generation. + aelf.Hash creation_token = 6; +} + +message ProposalInfo { + // The proposal ID. + aelf.Hash proposal_id = 1; + // The method that this proposal will call when being released. + string contract_method_name = 2; + // The address of the target contract. + aelf.Address to_address = 3; + // The parameters of the release transaction. + bytes params = 4; + // The date at which this proposal will expire. + google.protobuf.Timestamp expired_time = 5; + // The address of the proposer of this proposal. + aelf.Address proposer = 6; + // The address of this proposals organization. + aelf.Address organization_address = 7; + // Address list of approved. + repeated aelf.Address approvals = 8; + // Address list of rejected. + repeated aelf.Address rejections = 9; + // Address list of abstained. + repeated aelf.Address abstentions = 10; + // Url is used for proposal describing. + string proposal_description_url = 11; +} + +message OrganizationMemberList { + // The address of organization members. + repeated aelf.Address organization_members = 1; +} + +message ChangeMemberInput{ + // The old member address. + aelf.Address old_member = 1; + // The new member address. + aelf.Address new_member = 2; +} + +message CreateOrganizationBySystemContractInput { + // The parameters of creating organization. + CreateOrganizationInput organization_creation_input = 1; + // The organization address callback method which replies the organization address to caller contract. + string organization_address_feedback_method = 2; +} + +message MemberAdded{ + option (aelf.is_event) = true; + // The added member address. + aelf.Address member = 1; + // The organization address. + aelf.Address organization_address = 2 [(aelf.is_indexed) = true]; +} + +message MemberRemoved{ + option (aelf.is_event) = true; + // The removed member address. + aelf.Address member = 1; + // The organization address. + aelf.Address organization_address = 2 [(aelf.is_indexed) = true]; +} + +message MemberChanged{ + option (aelf.is_event) = true; + // The old member address. + aelf.Address old_member = 1; + // The new member address. + aelf.Address new_member = 2; + // The organization address. + aelf.Address organization_address = 3 [(aelf.is_indexed) = true]; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/authority_info.proto b/modules/AElf.Client.Protobuf/Protobuf/authority_info.proto new file mode 100644 index 00000000..65302e8b --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/authority_info.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +import "aelf/core.proto"; + +message AuthorityInfo { + // The contract address of the controller. + aelf.Address contract_address = 1; + // The address of the owner of the contract. + aelf.Address owner_address = 2; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/basic_contract_zero.proto b/modules/AElf.Client.Protobuf/Protobuf/basic_contract_zero.proto new file mode 100644 index 00000000..5c14ec09 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/basic_contract_zero.proto @@ -0,0 +1,71 @@ +/** + * Genesis contract. + */ +syntax = "proto3"; + +package Zero; + +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "aelf/core.proto"; +import "google/protobuf/timestamp.proto"; +import "authority_info.proto"; + +option csharp_namespace = "AElf.Contracts.Genesis"; + +service BasicContractZero { + option (aelf.csharp_state) = "AElf.Contracts.Genesis.BasicContractZeroState"; + + // Initialize the genesis contract. + rpc Initialize (InitializeInput) returns (google.protobuf.Empty) { + } + + // Set initial controller address for CodeCheckController and ContractDeploymentController. + rpc SetInitialControllerAddress (aelf.Address) returns (google.protobuf.Empty) { + } + + // Modify the contract deployment controller authority. + // Note: Only old controller has permission to do this. + rpc ChangeContractDeploymentController (AuthorityInfo) returns (google.protobuf.Empty) { + } + + // Modify the contract code check controller authority. + // Note: Only old controller has permission to do this. + rpc ChangeCodeCheckController (AuthorityInfo) returns (google.protobuf.Empty) { + } + + // Query the ContractDeploymentController authority info. + rpc GetContractDeploymentController (google.protobuf.Empty) returns (AuthorityInfo) { + option (aelf.is_view) = true; + } + + // Query the CodeCheckController authority info. + rpc GetCodeCheckController(google.protobuf.Empty) returns (AuthorityInfo){ + option (aelf.is_view) = true; + } +} + +message InitializeInput{ + // Whether contract deployment/update requires authority. + bool contract_deployment_authority_required = 1; +} + +message ContractProposingInput{ + // The address of proposer for contract deployment/update. + aelf.Address proposer = 1; + // The status of proposal. + ContractProposingInputStatus status = 2; + // The expiration time of proposal. + google.protobuf.Timestamp expired_time = 3; +} + +enum ContractProposingInputStatus { + // Proposal is proposed. + PROPOSED = 0; + // Proposal is approved by parliament. + APPROVED = 1; + // Code check is proposed. + CODE_CHECK_PROPOSED = 2; + // Passed code checks. + CODE_CHECKED = 3; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/bridge_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/bridge_contract.proto new file mode 100644 index 00000000..47e8672b --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/bridge_contract.proto @@ -0,0 +1,207 @@ +syntax = "proto3"; + +import "aelf/core.proto"; +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "callback_input.proto"; +import "acs13.proto"; +import "receipt_maker.proto"; + +option csharp_namespace = "AElf.Contracts.Bridge"; + +service BridgeContract { + option (aelf.csharp_state) = "AElf.Contracts.Bridge.BridgeContractState"; + option (aelf.base) = "acs13.proto"; + option (aelf.base) = "receipt_maker.proto"; + + rpc Initialize (InitializeInput) returns (google.protobuf.Empty) {} + + rpc CreateSwap (CreateSwapInput) returns (aelf.Hash) { + } + rpc SwapToken (SwapTokenInput) returns (google.protobuf.Empty) { + } + rpc ChangeSwapRatio (ChangeSwapRatioInput) returns (google.protobuf.Empty) { + } + rpc Deposit (DepositInput) returns (google.protobuf.Empty) { + } + rpc Withdraw (WithdrawInput) returns (google.protobuf.Empty) { + } + rpc UpdateMerkleTree (UpdateMerkleTreeInput) returns (google.protobuf.Empty) { + } + rpc RecordReceiptHash (CallbackInput) returns (google.protobuf.Empty) { + } + + rpc ChangeMaximalLeafCount (google.protobuf.Int32Value) returns (google.protobuf.Empty) { + } + + // view methods + + rpc GetSwapInfo (aelf.Hash) returns (SwapInfo) { + option (aelf.is_view) = true; + } + rpc GetSwapPair (GetSwapPairInput) returns (SwapPair) { + option (aelf.is_view) = true; + } + rpc GetSwapAmounts (GetSwapAmountsInput) returns (SwapAmounts) { + option (aelf.is_view) = true; + } + rpc GetRegimentAddressByRecorderId (google.protobuf.Int64Value) returns (aelf.Address) { + option (aelf.is_view) = true; + } + rpc GetSwappedReceiptIdList (GetSwappedReceiptIdListInput) returns (ReceiptIdList) { + option (aelf.is_view) = true; + } + rpc GetSwappedReceiptInfoList (GetSwappedReceiptInfoListInput) returns (ReceiptInfoList) { + option (aelf.is_view) = true; + } +} + +message InitializeInput { + aelf.Address oracle_contract_address = 1; + aelf.Address merkle_tree_recorder_contract_address = 2; + aelf.Address regiment_contract_address = 3; + aelf.Address merkle_tree_generator_contract_address = 4; + int32 merkle_tree_leaf_limit = 5; +} + +message CreateSwapInput { + int32 origin_token_size_in_byte = 1; + bool origin_token_numeric_big_endian = 2; + repeated SwapTargetToken swap_target_token_list = 3; + aelf.Address regiment_address = 4; +} + +message SwapTargetToken { + string target_token_symbol = 1; + SwapRatio swap_ratio = 2; + int64 deposit_amount = 3; +} + +message SwapInfo { + aelf.Hash swap_id = 1; + int32 origin_token_size_in_byte = 2; + bool origin_token_numeric_big_endian = 3; + map swap_target_token_map = 4; + aelf.Address regiment_address = 5; + int64 recorder_id = 6; +} + +message SwapPair { + aelf.Hash swap_id = 1; + int32 origin_token_size_in_byte = 2; + bool origin_token_numeric_big_endian = 3; + string target_token_symbol = 4; + SwapRatio swap_ratio = 5; + int64 swapped_amount = 6; + int64 swapped_times = 7; + int64 deposit_amount = 8; +} + +message SwapRatio { + int64 origin_share = 1; + int64 target_share = 2; +} + +message ChangeSwapRatioInput { + aelf.Hash swap_id = 1; + SwapRatio swap_ratio = 2; + string target_token_symbol = 3; +} + +message SwapTokenInput { + aelf.Hash swap_id = 1; + int64 receipt_id = 2; + string origin_amount = 3; +} + +message DepositInput { + aelf.Hash swap_id = 1; + string target_token_symbol = 2; + int64 amount = 3; +} + +message GetSwapPairInput { + aelf.Hash swap_id = 1; + string target_token_symbol = 2; +} + +message GetSwapAmountsInput { + aelf.Hash swap_id = 1; + int64 receipt_id = 2; +} + +message SwapAmounts { + aelf.Address receiver = 1; + map received_amounts = 2; +} + +message WithdrawInput { + aelf.Hash swap_id = 1; + string target_token_symbol = 2; + int64 amount = 3; +} + +message ReceiptHashMap { + map value = 1; + int64 recorder_id = 2; +} + +message UpdateMerkleTreeInput { + int64 recorder_id = 1; + aelf.Address regiment_address = 2; +} + +message ReceiptIdList { + repeated int64 value = 1; +} + +message GetSwappedReceiptIdListInput { + aelf.Hash swap_id = 1; + aelf.Address receiver_address = 2; +} + +message GetSwappedReceiptInfoListInput { + aelf.Hash swap_id = 1; + aelf.Address receiving_address = 2; +} + +message ReceiptInfo { + int64 receipt_id = 1; + aelf.Hash receiving_tx_id = 2; + google.protobuf.Timestamp receiving_time = 3; + int64 amount = 4; + map amount_map = 5; +} + +message ReceiptInfoList { + repeated ReceiptInfo value = 1; +} + +message SendingInfo { + int64 receipt_id = 1; + string sending_tx_id = 2; + string sending_time = 3; +} + +// Events + +message SwapRatioChanged { + option (aelf.is_event) = true; + aelf.Hash swap_id = 1; + SwapRatio new_swap_ratio = 2; + string target_token_symbol = 3; +} + +message TokenSwapped { + option (aelf.is_event) = true; + aelf.Address address = 1; + int64 amount = 2; + string symbol = 3; +} + +message SwapPairAdded { + option (aelf.is_event) = true; + aelf.Hash swap_id = 1; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/callback_input.proto b/modules/AElf.Client.Protobuf/Protobuf/callback_input.proto new file mode 100644 index 00000000..c3898290 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/callback_input.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +import "aelf/core.proto"; + +message CallbackInput { + aelf.Hash query_id = 1; + bytes result = 2; + repeated aelf.Address oracle_nodes = 3; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/configuration_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/configuration_contract.proto new file mode 100644 index 00000000..041e7266 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/configuration_contract.proto @@ -0,0 +1,52 @@ +/** + * Configuration contract. + */ +syntax = "proto3"; + +package Configuration; + +import "aelf/core.proto"; +import "google/protobuf/wrappers.proto"; +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "authority_info.proto"; + +option csharp_namespace = "AElf.Contracts.Configuration"; + +service Configuration { + option (aelf.csharp_state) = "AElf.Contracts.Configuration.ConfigurationState"; + + // Add or update configuration. + rpc SetConfiguration (SetConfigurationInput) returns (google.protobuf.Empty) { + } + + // Change the method fee controller, the default is Parliament. + rpc ChangeConfigurationController (AuthorityInfo) returns (google.protobuf.Empty) { + } + + // Query the configuration by configuration’s key. + rpc GetConfiguration (google.protobuf.StringValue) returns (google.protobuf.BytesValue) { + option (aelf.is_view) = true; + } + + // Query the controller information + rpc GetConfigurationController (google.protobuf.Empty) returns (AuthorityInfo) { + option (aelf.is_view) = true; + } + +} + +message SetConfigurationInput { + // The configuration’s key. + string key = 1; + // The configuration’s value(binary data). + bytes value = 2; +} + +message ConfigurationSet { + option (aelf.is_event) = true; + // The configuration’s key. + string key = 1; + // The configuration’s value(binary data). + bytes value = 2; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/cross_chain_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/cross_chain_contract.proto new file mode 100644 index 00000000..5441a661 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/cross_chain_contract.proto @@ -0,0 +1,266 @@ +/** + * Cross-Chain contract. + */ +syntax = "proto3"; + +package CrossChain; + +import "acs7.proto"; +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; +import "authority_info.proto"; + +option csharp_namespace = "AElf.Contracts.CrossChain"; + +service CrossChainContract { + + option (aelf.csharp_state) = "AElf.Contracts.CrossChain.CrossChainContractState"; + + // Propose once cross chain indexing. + rpc Initialize (InitializeInput) returns (google.protobuf.Empty) { + } + + // Set the initial SideChainLifetimeController address which should be parliament organization by default. + rpc SetInitialSideChainLifetimeControllerAddress(aelf.Address) returns (google.protobuf.Empty){ + } + + // Set the initial CrossChainIndexingController address which should be parliament organization by default. + rpc SetInitialIndexingControllerAddress(aelf.Address) returns (google.protobuf.Empty){ + } + + // Change the cross chain indexing controller. + rpc ChangeCrossChainIndexingController(AuthorityInfo) returns (google.protobuf.Empty) { + } + + // Change the lifetime controller of the side chain. + rpc ChangeSideChainLifetimeController(AuthorityInfo) returns (google.protobuf.Empty) { + } + + // Change indexing fee adjustment controller for specific side chain. + rpc ChangeSideChainIndexingFeeController(ChangeSideChainIndexingFeeControllerInput) returns (google.protobuf.Empty){ + } + + // When the indexing proposal is released, clean up the pending proposal. + rpc AcceptCrossChainIndexingProposal(AcceptCrossChainIndexingProposalInput) returns (google.protobuf.Empty){ + } + + // Get the side chain creator address according to side chain id. + rpc GetSideChainCreator (google.protobuf.Int32Value) returns (aelf.Address) { + option (aelf.is_view) = true; + } + + // Get the current status of side chain according to side chain id. + rpc GetChainStatus (google.protobuf.Int32Value) returns (GetChainStatusOutput) { + option (aelf.is_view) = true; + } + + // Get the side chain height according to side chain id. + rpc GetSideChainHeight (google.protobuf.Int32Value) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + + // Get the height of parent chain. + rpc GetParentChainHeight (google.protobuf.Empty) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + + // Get the chain id of parent chain. + rpc GetParentChainId (google.protobuf.Empty) returns (google.protobuf.Int32Value) { + option (aelf.is_view) = true; + } + + // Get the balance of side chain indexing according to side chain id. + rpc GetSideChainBalance (google.protobuf.Int32Value) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + + // Get the fee debt of side chain indexing according to side chain id. + rpc GetSideChainIndexingFeeDebt (google.protobuf.Int32Value) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + + // Get the status of the current indexing proposal. + rpc GetIndexingProposalStatus (google.protobuf.Empty) returns (GetIndexingProposalStatusOutput) { + option (aelf.is_view) = true; + } + + // Get the side chain indexing fee price according to side chain id. + rpc GetSideChainIndexingFeePrice(google.protobuf.Int32Value) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + + // Get the lifetime controller of the side chain. + rpc GetSideChainLifetimeController(google.protobuf.Empty) returns (AuthorityInfo){ + option (aelf.is_view) = true; + } + + // Get the cross chain indexing controller. + rpc GetCrossChainIndexingController(google.protobuf.Empty) returns (AuthorityInfo){ + option (aelf.is_view) = true; + } + + // Get the indexing fee controller of side chain according to side chain id. + rpc GetSideChainIndexingFeeController(google.protobuf.Int32Value) returns (AuthorityInfo){ + option (aelf.is_view) = true; + } +} + +message InitializeInput { + // The id of parent chain. + int32 parent_chain_id = 1; + // The height of side chain created on parent chain. + int64 creation_height_on_parent_chain = 2; + // True if chain privilege needed, otherwise false. + bool is_privilege_preserved = 3; +} + +message SideChainCreatedEvent { + option (aelf.is_event) = true; + // The proposer who propose to create the side chain. + aelf.Address creator = 1; + // The created side chain id. + int32 chainId = 2; +} + +message Disposed { + option (aelf.is_event) = true; + // The disposed side chain id. + int32 chain_id = 1; +} + +message ProposedCrossChainIndexing{ + // The collection of chain indexing proposal, the key is chain id. + map chain_indexing_proposal_collections = 1; +} + +message ChainIndexingProposal{ + // The id of cross chain indexing proposal. + aelf.Hash proposal_id = 1; + // The proposer of cross chain indexing. + aelf.Address proposer = 2; + // The cross chain data proposed. + acs7.CrossChainBlockData proposed_cross_chain_block_data = 3; + // The status of of cross chain indexing proposal. + CrossChainIndexingProposalStatus status = 4; + // The chain id of the indexing. + int32 chain_id = 5; +} + +message GetIndexingProposalStatusOutput{ + // The collection of pending indexing proposal, the key is chain id. + map chain_indexing_proposal_status = 1; +} + +message PendingChainIndexingProposalStatus{ + // The id of cross chain indexing proposal. + aelf.Hash proposal_id = 1; + // The proposer of cross chain indexing. + aelf.Address proposer = 2; + // True if the proposal can be released, otherwise false. + bool to_be_released = 3; + // The cross chain data proposed. + acs7.CrossChainBlockData proposed_cross_chain_block_data = 4; + // The proposal expiration time. + google.protobuf.Timestamp expired_time = 5; +} + +message GetPendingCrossChainIndexingProposalOutput{ + // The proposal id of cross chain indexing. + aelf.Hash proposal_id = 1; + // The proposer of cross chain indexing proposal. + aelf.Address proposer = 2; + // True if the proposal can be released, otherwise false. + bool to_be_released = 3; + // The cross chain data proposed. + acs7.CrossChainBlockData proposed_cross_chain_block_data = 4; + // The proposal expiration time. + google.protobuf.Timestamp expired_time = 5; +} + +enum CrossChainIndexingProposalStatus{ + NON_PROPOSED = 0; + // The proposal is pending. + PENDING = 1; + // The proposal has been released. + ACCEPTED = 2; +} + +enum SideChainStatus +{ + // Currently no meaning. + FATAL = 0; + // The side chain is being indexed. + ACTIVE = 1; + // The side chain is in debt for indexing fee. + INDEXING_FEE_DEBT = 2; + // The side chain is disposed. + TERMINATED = 3; +} + +message SideChainInfo { + // The proposer who propose to create the side chain. + aelf.Address proposer = 1; + // The status of side chain. + SideChainStatus side_chain_status = 2; + // The side chain id. + int32 side_chain_id = 3; + // The time of side chain created. + google.protobuf.Timestamp creation_timestamp = 4; + // The height of side chain created on parent chain. + int64 creation_height_on_parent_chain = 5; + // The price of indexing fee. + int64 indexing_price = 6; + // True if chain privilege needed, otherwise false. + bool is_privilege_preserved = 7; + // creditor and amounts for the chain indexing fee debt + map arrears_info = 8; + // The controller of indexing fee. + AuthorityInfo indexing_fee_controller = 9; +} + +message GetChainStatusOutput{ + // The status of side chain. + SideChainStatus status = 1; +} + +message SideChainCreationRequestState{ + // The parameters of creating side chain. + acs7.SideChainCreationRequest side_chain_creation_request = 1; + // The expiration date of the proposal. + google.protobuf.Timestamp expired_time = 2; + // The proposer who proposed to create the side chain. + aelf.Address proposer = 3; +} + +message ChangeSideChainIndexingFeeControllerInput{ + // The side chain id. + int32 chain_id = 1; + // The changed controller of indexing fee. + AuthorityInfo authority_info = 2; +} + +message SideChainLifetimeControllerChanged{ + option (aelf.is_event) = true; + // The changed controller of side chain lifetime. + AuthorityInfo authority_info = 1; +} + +message CrossChainIndexingControllerChanged{ + option (aelf.is_event) = true; + // The changed controller of indexing. + AuthorityInfo authority_info = 1; +} + +message SideChainIndexingFeeControllerChanged{ + option (aelf.is_event) = true; + // The side chain id. + int32 chain_id = 1 [(aelf.is_indexed) = true]; + // The changed controller of side chain indexing fee. + AuthorityInfo authority_info = 2; +} + +message AcceptCrossChainIndexingProposalInput{ + // The chain id of accepted indexing. + int32 chain_id = 1; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/economic_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/economic_contract.proto new file mode 100644 index 00000000..943fe740 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/economic_contract.proto @@ -0,0 +1,62 @@ +/** + * Economic contract. + */ +syntax = "proto3"; + +package Economic; + +import "aelf/core.proto"; +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; + +option csharp_namespace = "AElf.Contracts.Economic"; + +service EconomicContract { + option (aelf.csharp_state) = "AElf.Contracts.Economic.EconomicContractState"; + + // Only ZeroContract is able to issue the native token. + rpc IssueNativeToken (IssueNativeTokenInput) returns (google.protobuf.Empty) { + } + + // It will initialize other contracts related to economic activities (For instance, create the native token). + // This transaction only can be send once because after the first sending, its state will be set to initialized. + rpc InitialEconomicSystem (InitialEconomicSystemInput) returns (google.protobuf.Empty) { + } +} + +message InitialEconomicSystemInput { + // The native token symbol. + string native_token_symbol = 1; + // The native token name. + string native_token_name = 2; + // The native token total supply. + int64 native_token_total_supply = 3; + // The accuracy of the native token. + int32 native_token_decimals = 4; + // It indicates if the token is burnable. + bool is_native_token_burnable = 5; + // It determines how much native token is used to reward the miners. + int64 mining_reward_total_amount = 6; + // todo : remove unused fields + int64 transaction_size_fee_unit_price = 7; +} + +message IssueNativeTokenInput { + // The amount of token. + int64 amount = 1; + // The memo. + string memo = 2; + // The recipient of the token. + aelf.Address to = 3; +} + +message IssueResourceTokenInput { + // The symbol of resource token. + string symbol = 1; + // The amount of resource token. + int64 amount = 2; + // The memo. + string memo = 3; + // The recipient of the token. + aelf.Address to = 4; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/election_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/election_contract.proto new file mode 100644 index 00000000..0337e7c4 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/election_contract.proto @@ -0,0 +1,522 @@ +/** + * Election contract. + */ +syntax = "proto3"; + +package Election; + +import "aelf/core.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/protobuf/empty.proto"; +import "aelf/options.proto"; +import "authority_info.proto"; + +option csharp_namespace = "AElf.Contracts.Election"; + +service ElectionContract { + + option (aelf.csharp_state) = "AElf.Contracts.Election.ElectionContractState"; + + // Initialize the election contract. + rpc InitialElectionContract (InitialElectionContractInput) returns (google.protobuf.Empty) { + } + + // Register a new voting item through vote contract. + rpc RegisterElectionVotingEvent (google.protobuf.Empty) returns (google.protobuf.Empty) { + } + + // Take snapshot according to term number, and distribute profits. + rpc TakeSnapshot (TakeElectionSnapshotInput) returns (google.protobuf.Empty) { + } + + // To be a block producer, a user should first register to be a candidate and lock some token as a deposit. + // If the data center is not full, the user will be added in automatically and get one weight + // for sharing bonus in the future. + rpc AnnounceElection (aelf.Address) returns (google.protobuf.Empty) { + } + + // A candidate is able to quit the election provided he is not currently elected. If you quit successfully, + // the candidate will get his locked tokens back and will not receive anymore bonus. + rpc QuitElection (google.protobuf.StringValue) returns (google.protobuf.Empty) { + } + + // Used for voting for a candidate to be elected. The tokens you vote with will be locked until the end time. + // According to the number of token you voted and its lock time, you can get corresponding weight for + // sharing the bonus in the future. And return the vote id. + rpc Vote (VoteMinerInput) returns (aelf.Hash) { + } + + // Before the end time, you are able to change your vote target to other candidates. + rpc ChangeVotingOption (ChangeVotingOptionInput) returns (google.protobuf.Empty) { + } + + rpc FixWelfareProfit (FixWelfareProfitInput) returns (google.protobuf.Empty) { + } + + rpc DisableWelfareFix (google.protobuf.Empty) returns (google.protobuf.Empty) { + } + + // After the lock time, your locked tokens will be unlocked and you can withdraw them according to the vote id. + rpc Withdraw (aelf.Hash) returns (google.protobuf.Empty) { + } + + // Update candidate information by consensus contract. + rpc UpdateCandidateInformation (UpdateCandidateInformationInput) returns (google.protobuf.Empty) { + } + + // Batch update candidate information by consensus contract. + rpc UpdateMultipleCandidateInformation (UpdateMultipleCandidateInformationInput) returns (google.protobuf.Empty) { + } + + // Update the count of miner by consensus contract. + rpc UpdateMinersCount (UpdateMinersCountInput) returns (google.protobuf.Empty) { + } + + // Set the treasury profit ids. + rpc SetTreasurySchemeIds (SetTreasurySchemeIdsInput) returns (google.protobuf.Empty) { + } + + // Set the weight of vote interest. + rpc SetVoteWeightInterest (VoteWeightInterestList) returns (google.protobuf.Empty) { + } + + // Set the weight of lock time and votes in the calculation of voting weight. + rpc SetVoteWeightProportion (VoteWeightProportion) returns (google.protobuf.Empty) { + } + + // Change the controller for the weight of vote interest. + rpc ChangeVoteWeightInterestController (AuthorityInfo) returns (google.protobuf.Empty) { + } + + // Candidate admin can replace candidate pubkey with a new pubkey. + rpc ReplaceCandidatePubkey (ReplaceCandidatePubkeyInput) returns (google.protobuf.Empty) { + } + + // Set admin address of candidate (mostly supply) + rpc SetCandidateAdmin (SetCandidateAdminInput) returns (google.protobuf.Empty) { + } + + rpc RemoveEvilNode (google.protobuf.StringValue) returns (google.protobuf.Empty) { + } + + // Views + + // Get all candidates’ public keys. + rpc GetCandidates (google.protobuf.Empty) returns (PubkeyList) { + option (aelf.is_view) = true; + } + + // Get all candidates whose number of votes is greater than 0. + rpc GetVotedCandidates (google.protobuf.Empty) returns (PubkeyList) { + option (aelf.is_view) = true; + } + + // Get a candidate’s information. + rpc GetCandidateInformation (google.protobuf.StringValue) returns (CandidateInformation) { + option (aelf.is_view) = true; + } + + // Get the victories of the latest term. + rpc GetVictories (google.protobuf.Empty) returns (PubkeyList) { + option (aelf.is_view) = true; + } + + // Get the snapshot of term according to term number. + rpc GetTermSnapshot (GetTermSnapshotInput) returns (TermSnapshot) { + option (aelf.is_view) = true; + } + + // Get the count of miner. + rpc GetMinersCount (google.protobuf.Empty) returns (google.protobuf.Int32Value) { + option (aelf.is_view) = true; + } + + // Get the election result according to term id. + rpc GetElectionResult (GetElectionResultInput) returns (ElectionResult) { + option (aelf.is_view) = true; + } + + // Get the voter information according to voter public key. + rpc GetElectorVote (google.protobuf.StringValue) returns (ElectorVote) { + option (aelf.is_view) = true; + } + + // Gets the voter information including the active voting records (excluding withdrawn voting records.). + rpc GetElectorVoteWithRecords (google.protobuf.StringValue) returns (ElectorVote) { + option (aelf.is_view) = true; + } + + // Gets the voter information including the active and withdrawn voting records. + rpc GetElectorVoteWithAllRecords (google.protobuf.StringValue) returns (ElectorVote) { + option (aelf.is_view) = true; + } + + // Get voting information for candidate according to the public key of the candidate. + rpc GetCandidateVote (google.protobuf.StringValue) returns (CandidateVote) { + option (aelf.is_view) = true; + } + + // Get voting information for candidate according to the public key of the candidate. + rpc GetCandidateVoteWithRecords (google.protobuf.StringValue) returns (CandidateVote) { + option (aelf.is_view) = true; + } + + // Get voting information for candidate according to the public key of the candidate + // (including the active and withdrawn voting records). + rpc GetCandidateVoteWithAllRecords (google.protobuf.StringValue) returns (CandidateVote) { + option (aelf.is_view) = true; + } + + // Get the total number of voters. + rpc GetVotersCount (google.protobuf.Empty) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + + // Get the total number of vote token. + rpc GetVotesAmount (google.protobuf.Empty) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + + // Get candidate information according to the index and length. + rpc GetPageableCandidateInformation (PageInformation) returns (GetPageableCandidateInformationOutput) { + option (aelf.is_view) = true; + } + + // Get the voting item id of miner election. + rpc GetMinerElectionVotingItemId (google.protobuf.Empty) returns (aelf.Hash) { + option (aelf.is_view) = true; + } + + // Get the data center ranking list. + rpc GetDataCenterRankingList (google.protobuf.Empty) returns (DataCenterRankingList) { + option (aelf.is_view) = true; + } + + // Get the weight of vote interest. + rpc GetVoteWeightSetting (google.protobuf.Empty) returns (VoteWeightInterestList) { + option (aelf.is_view) = true; + } + + // Get the weight of lock time and votes in the calculation of voting weight. + rpc GetVoteWeightProportion (google.protobuf.Empty) returns (VoteWeightProportion) { + option (aelf.is_view) = true; + } + + // Used to calculate the bonus weights that users can get by voting. + rpc GetCalculateVoteWeight (VoteInformation) returns (google.protobuf.Int64Value){ + option (aelf.is_view) = true; + } + + // Query the controller for the weight of vote interest. + rpc GetVoteWeightInterestController (google.protobuf.Empty) returns (AuthorityInfo) { + option (aelf.is_view) = true; + } + + // Inspect the evil nodes included in the specified miners and return to the replacement node. + rpc GetMinerReplacementInformation (GetMinerReplacementInformationInput) returns (MinerReplacementInformation) { + option (aelf.is_view) = true; + } + + // Query candidate admin. + rpc GetCandidateAdmin (google.protobuf.StringValue) returns (aelf.Address) { + option (aelf.is_view) = true; + } + + // Query the newest pubkey of an old pubkey. + rpc GetNewestPubkey (google.protobuf.StringValue) returns (google.protobuf.StringValue) { + option (aelf.is_view) = true; + } + + // Query the old pubkey. + rpc GetReplacedPubkey (google.protobuf.StringValue) returns (google.protobuf.StringValue) { + option (aelf.is_view) = true; + } +} + +message InitialElectionContractInput { + // Minimum number of seconds for locking. + int64 minimum_lock_time = 1; + // Maximum number of seconds for locking. + int64 maximum_lock_time = 2; + // The current miner list. + repeated string miner_list = 3; + // The number of seconds per term. + int64 time_each_term = 4; + // The interval second that increases the number of miners. + int64 miner_increase_interval = 5; +} + +message GetTermSnapshotInput { + // The term number. + int64 term_number = 1; +} + +message UpdateCandidateInformationInput { + // The candidate public key. + string pubkey = 1; + // The number of blocks recently produced. + int64 recently_produced_blocks = 2; + // The number of time slots recently missed. + int64 recently_missed_time_slots = 3; + // Is it a evil node. If true will remove the candidate. + bool is_evil_node = 4; +} + +message UpdateMultipleCandidateInformationInput { + // The candidate information to update. + repeated UpdateCandidateInformationInput value = 1; +} + +message TakeElectionSnapshotInput { + // The term number to take snapshot. + int64 term_number = 1; + // The number of mined blocks of this term. + int64 mined_blocks = 2; + // The end round number of this term. + int64 round_number = 3; +} + +message VoteMinerInput { + // The candidate public key. + string candidate_pubkey = 1; + // The amount token to vote. + int64 amount = 2; + // The end timestamp of this vote. + google.protobuf.Timestamp end_timestamp = 3; + // Used to generate vote id. + aelf.Hash token = 4; +} + +message ChangeVotingOptionInput { + // The vote id to change. + aelf.Hash vote_id = 1; + // The new candidate public key. + string candidate_pubkey = 2; + // Tokens will be locked another previous locking time if this is true. + bool is_reset_voting_time = 3; +} + +message FixWelfareProfitInput { + repeated FixWelfareProfitInfo fix_info_list = 1; +} + +message FixWelfareProfitInfo { + aelf.Hash vote_id = 1; + int64 start_period = 2; + int64 end_period = 3; +} + +message UpdateTermNumberInput { + // The term number. + int64 term_number = 1; +} + +message GetElectionResultInput { + // The term number. + int64 term_number = 1; +} + +message ElectionResult { + // The term number + int64 term_number = 1; + // The election result, candidates’ public key -> number of votes. + map results = 2; + // Whether an election is currently being held. + bool is_active = 3; +} + +message ElectorVote { + // The active voting record ids. + repeated aelf.Hash active_voting_record_ids = 1; + // The voting record ids that were withdrawn. + repeated aelf.Hash withdrawn_voting_record_ids = 2; + // The total number of active votes. + int64 active_voted_votes_amount = 3; + // The total number of votes (including the number of votes withdrawn). + int64 all_voted_votes_amount = 4; + // The active voting records. + repeated ElectionVotingRecord active_voting_records = 5; + // The voting records that were withdrawn. + repeated ElectionVotingRecord withdrawn_votes_records = 6; + // Public key for voter. + bytes pubkey = 7; +} + +message CandidateVote { + // The active voting record ids obtained. + repeated aelf.Hash obtained_active_voting_record_ids = 1; + // The active voting record ids that were withdrawn. + repeated aelf.Hash obtained_withdrawn_voting_record_ids = 2; + // The total number of active votes obtained. + int64 obtained_active_voted_votes_amount = 3; + // The total number of votes obtained. + int64 all_obtained_voted_votes_amount = 4; + // The active voting records. + repeated ElectionVotingRecord obtained_active_voting_records = 5; + // The voting records that were withdrawn. + repeated ElectionVotingRecord obtained_withdrawn_votes_records = 6; + // Public key for candidate. + bytes pubkey = 7; +} + +message CandidateInformation { + // Candidate’s public key. + string pubkey = 1; + // The number of terms that the candidate is elected. + repeated int64 terms = 2; + // The number of blocks the candidate has produced. + int64 produced_blocks = 3; + // The time slot for which the candidate failed to produce blocks. + int64 missed_time_slots = 4; + // The count of continual appointment. + int64 continual_appointment_count = 5; + // The transaction id when the candidate announced. + aelf.Hash announcement_transaction_id = 6; + // Indicate whether the candidate can be elected in the current term. + bool is_current_candidate = 7; +} + +message CandidateDetail { + // The candidate information. + CandidateInformation candidate_information = 1; + // The number of votes a candidate has obtained. + int64 obtained_votes_amount = 2; +} + +message ElectionVotingRecord { + // The address of voter. + aelf.Address voter = 1; + // The public key of candidate. + string candidate = 2; + // Amount of voting. + int64 amount = 3; + // The term number of voting. + int64 term_number = 4; + // The vote id. + aelf.Hash vote_id = 5; + // Vote lock time. + int64 lock_time = 6; + // The unlock timestamp. + google.protobuf.Timestamp unlock_timestamp = 7; + // The withdraw timestamp. + google.protobuf.Timestamp withdraw_timestamp = 8; + // The vote timestamp. + google.protobuf.Timestamp vote_timestamp = 9; + // Indicates if the vote has been withdrawn. + bool is_withdrawn = 10; + // Vote weight for sharing bonus. + int64 weight = 11; + // Whether vote others. + bool is_change_target = 12; +} + +message PageInformation { + // The start index. + int32 start = 1; + // The number of records. + int32 length = 2; +} + +message PubkeyList { + // Candidates’ public keys + repeated bytes value = 1; +} + +message TermSnapshot { + // The end round number of this term. + int64 end_round_number = 1; + // The number of blocks mined in this term. + int64 mined_blocks = 2; + // The election result, candidates’ public key -> number of votes. + map election_result = 3; +} + +message UpdateMinersCountInput { + // The count of miner. + int32 miners_count = 1; +} + +message GetPageableCandidateInformationOutput { + // The details of the candidates. + repeated CandidateDetail value = 1; +} + +message SetTreasurySchemeIdsInput { + // The scheme id of treasury reward. + aelf.Hash treasury_hash = 1; + // The scheme id of welfare reward. + aelf.Hash welfare_hash = 2; + // The scheme id of subsidy reward. + aelf.Hash subsidy_hash = 3; + // The scheme id of welcome reward. + aelf.Hash welcome_hash = 4; + // The scheme id of flexible reward. + aelf.Hash flexible_hash = 5; +} + +message DataCenterRankingList { + // The top n * 5 candidates with vote amount, candidate public key -> vote amount. + map data_centers = 1; +} + +message VoteWeightInterest{ + // Number of days locked. + int32 day = 1; + // Locked interest. + int32 interest = 2; + int32 capital = 3; +} + +message VoteWeightInterestList { + // The weight of vote interest. + repeated VoteWeightInterest vote_weight_interest_infos = 1; +} + +message VoteWeightProportion { + // The weight of lock time. + int32 time_proportion = 1; + // The weight of the votes cast. + int32 amount_proportion = 2; +} + +message VoteInformation{ + // Amount of voting. + int64 amount = 1; + // Vote lock time. + int64 lock_time = 2; +} + +message GetMinerReplacementInformationInput { + // The current miner list to inspect. + repeated string current_miner_list = 1; +} + +message MinerReplacementInformation { + // The alternative candidate public keys. + repeated string alternative_candidate_pubkeys = 1; + // The evil miner public keys. + repeated string evil_miner_pubkeys = 2; +} + +message ReplaceCandidatePubkeyInput { + string old_pubkey = 1; + string new_pubkey = 2; +} + +message SetCandidateAdminInput { + string pubkey = 1; + aelf.Address admin = 2; +} + +message EvilMinerDetected { + option (aelf.is_event) = true; + // The public key of evil miner. + string pubkey = 1; +} + +message CandidatePubkeyReplaced { + option (aelf.is_event) = true; + string old_pubkey = 1; + string new_pubkey = 2; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/kernel.proto b/modules/AElf.Client.Protobuf/Protobuf/kernel.proto new file mode 100644 index 00000000..4a9c404c --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/kernel.proto @@ -0,0 +1,183 @@ +syntax = "proto3"; + +package aelf; + +import "google/protobuf/timestamp.proto"; +import "aelf/core.proto"; + +option csharp_namespace = "AElf.Kernel"; + +enum TransactionStatus { + UNKNOWN_TRANSACTION_STATUS = 0; + TRANSACTION_EXECUTING = 1; + TRANSACTION_EXECUTED = 2; +} + +message StateValue { + bytes current_value = 1; + bytes original_value = 2; +} + +message StateChange { + StatePath state_path = 1; + StateValue state_value = 2; +} + +// For failed transactions, its status follows the Min of +// its own status and its inline transactions' +enum ExecutionStatus { + UNDEFINED = 0; + // Successful => + EXECUTED = 1; + + // Failed => + // Infrastructure reasons + CANCELED = -1; + SYSTEM_ERROR = -2; + + // Contract reasons + CONTRACT_ERROR = -10; + EXCEEDED_MAX_CALL_DEPTH = -11; + + // Pre-failed + PREFAILED = -99; + + // Post-failed + POSTFAILED = -199; +} + +message TransactionTrace { + Hash transaction_id = 1; + bytes return_value = 2; + string error = 3; + repeated Transaction pre_transactions = 4; + repeated TransactionTrace pre_traces = 5; + repeated Transaction inline_transactions = 6; + repeated TransactionTrace inline_traces = 7; + repeated Transaction post_transactions = 8; + repeated TransactionTrace post_traces = 9; + repeated LogEvent logs = 10; + int64 elapsed = 11; + ExecutionStatus execution_status = 12; + TransactionExecutingStateSet state_set = 13; +} + +message ExecutionReturnSet { + Hash transaction_id = 1; + TransactionResultStatus status = 2; + map state_changes = 3; + map state_accesses = 4; + bytes bloom = 5; + bytes return_value = 6; + map state_deletes = 7; + TransactionResult transaction_result = 8; +} + +message BlockHeaderList { + repeated BlockHeader headers = 1; +} + +message BlockHeader { + int32 version = 1; + int32 chain_id = 2; + Hash previous_block_hash = 3; + Hash merkle_tree_root_of_transactions = 4; + Hash merkle_tree_root_of_world_state = 5; + bytes bloom = 6; + int64 height = 7; + map extra_data = 8; + google.protobuf.Timestamp time = 9; + Hash merkle_tree_root_of_transaction_status = 10; + bytes signer_pubkey = 9999; + bytes signature = 10000; +} + +message BlockBody { + repeated Hash transaction_ids = 1; +} + +message Block { + BlockHeader header = 1; + BlockBody body = 2; +} + +message VersionedState { + string key = 1; + bytes value = 2; + int64 block_height = 3; + Hash block_hash = 4; + Hash origin_block_hash = 5; +} + +message BlockStateSet { + Hash block_hash = 1; + Hash previous_hash = 2; + int64 block_height = 3; + map changes = 4; + repeated string deletes = 5; + map block_executed_data = 6; +} + +enum ChainStateMergingStatus { + COMMON = 0; + MERGING = 1; + MERGED = 2; +} + +message ChainStateInfo { + int32 chain_id = 1; + Hash block_hash = 2; + int64 block_height = 3; + Hash merging_block_hash = 4; + ChainStateMergingStatus status = 5; +} + +enum ChainBlockLinkExecutionStatus { + EXECUTION_NONE = 0; + EXECUTION_SUCCESS = 1; + EXECUTION_FAILED = 2; +} + +message ChainBlockLink { + Hash block_hash = 1; + int64 height = 2; + Hash previous_block_hash = 3; + ChainBlockLinkExecutionStatus execution_status = 4; + bool is_irreversible_block = 5; + bool is_linked = 6; + bool is_light_block = 7; //no block body +} + +message Chain { + int32 id = 1; + Hash genesis_block_hash = 2; + Hash longest_chain_hash = 3; + int64 longest_chain_height = 4; + map branches = 5; + map not_linked_blocks = 6; + Hash last_irreversible_block_hash = 7; + int64 last_irreversible_block_height = 8; + Hash best_chain_hash = 9; + int64 best_chain_height = 10; +} + +message ChainBlockIndex { + Hash block_hash = 1; +} + +message BlockIndex{ + Hash block_hash = 1; + int64 block_height = 2; +} + +message TransactionBlockIndex { + Hash block_hash = 1; + int64 block_height = 2; + repeated BlockIndex previous_execution_block_index_list = 3; +} + +message SmartContractAddress{ + Address address = 1; + Hash block_hash = 2; + int64 block_height = 3; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/merkle_tree_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/merkle_tree_contract.proto new file mode 100644 index 00000000..1c89ead0 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/merkle_tree_contract.proto @@ -0,0 +1,219 @@ +syntax = "proto3"; + +import "aelf/core.proto"; +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; +import "acs1.proto"; +import "receipt_maker.proto"; + +option csharp_namespace = "AElf.Contracts.MerkleTreeContract"; + +service MerkleTreeContract { + option (aelf.csharp_state) = "AElf.Contracts.MerkleTreeContract.MerkleTreeContractState"; + option (aelf.base) = "acs1.proto"; + + rpc Initialize(InitializeInput) returns(google.protobuf.Empty){ + } + rpc CreateSpace(CreateSpaceInput) returns(google.protobuf.Empty){ + } + rpc RecordMerkleTree(RecordMerkleTreeInput) returns(google.protobuf.Empty){ + } + + // regiment related + + rpc CreateRegiment (CreateRegimentInput) returns (google.protobuf.Empty) { + } + rpc JoinRegiment (JoinRegimentInput) returns (google.protobuf.Empty) { + } + rpc LeaveRegiment (LeaveRegimentInput) returns (google.protobuf.Empty) { + } + rpc AddRegimentMember (AddRegimentMemberInput) returns (google.protobuf.Empty) { + } + rpc DeleteRegimentMember (DeleteRegimentMemberInput) returns (google.protobuf.Empty) { + } + rpc TransferRegimentOwnership (TransferRegimentOwnershipInput) returns (google.protobuf.Empty) { + } + rpc AddAdmins (AddAdminsInput) returns (google.protobuf.Empty) { + } + rpc DeleteAdmins (DeleteAdminsInput) returns (google.protobuf.Empty) { + } + + rpc ConstructMerkleTree(ConstructMerkleTreeInput) returns(MerkleTreeList){ + option (aelf.is_view) = true; + } + rpc GetMerklePath(GetMerklePathInput) returns(aelf.MerklePath){ + option (aelf.is_view) = true; + } + rpc MerkleProof(MerkleProofInput) returns(google.protobuf.BoolValue){ + option (aelf.is_view) = true; + } + rpc GetRegimentSpaceCount(aelf.Hash) returns(google.protobuf.Int64Value){ + option (aelf.is_view) = true; + } + rpc GetRegimentSpaceIdList(aelf.Hash) returns(HashList){ + option (aelf.is_view) = true; + } + rpc GetSpaceInfo(aelf.Hash) returns(SpaceInfo){ + option(aelf.is_view) = true; + } + rpc GetMerkleTreeByIndex(GetMerkleTreeByIndexInput) returns (MerkleTree){ + option (aelf.is_view) = true; + } + rpc GetMerkleTreeCountBySpace(aelf.Hash) returns(google.protobuf.Int64Value){ + option (aelf.is_view) = true; + } + rpc GetLastMerkleTreeIndex(aelf.Hash) returns (google.protobuf.Int64Value){ + option (aelf.is_view) = true; + } + rpc GetLastLeafIndex(GetLastLeafIndexInput) returns (google.protobuf.Int64Value){ + option (aelf.is_view) = true; + } + rpc GetFullTreeCount(aelf.Hash) returns(google.protobuf.Int64Value){ + option (aelf.is_view) = true; + } + rpc GetLeafLocatedMerkleTree(GetLeafLocatedMerkleTreeInput) returns(GetLeafLocatedMerkleTreeOutput){ + option (aelf.is_view) = true; + } + rpc GetRemainLeafCount(aelf.Hash) returns(google.protobuf.Int64Value){ + option (aelf.is_view) = true; + } +} + + +message SpaceInfo{ + int64 max_leaf_count = 1; + aelf.Hash operators = 2; +} + +message MerkleTree{ + aelf.Hash space_id = 1; + int64 merkle_tree_index = 2; + int64 first_leaf_index = 3; + int64 last_leaf_index = 4; + aelf.Hash merkle_tree_root = 5; + bool is_full_tree = 6; +} + +message MerkleTreeList{ + repeated MerkleTree value = 1; +} + +message HashList{ + repeated aelf.Hash value = 1; +} + +message InitializeInput{ + aelf.Address owner = 1; + aelf.Address regiment_contract_address = 2; +} + +message CreateSpaceInput{ + SpaceInfo value = 1; +} + +message ConstructMerkleTreeInput{ + aelf.Hash space_id = 1; + repeated aelf.Hash leaf_node_hash = 2; +} + +message RecordMerkleTreeInput{ + aelf.Hash space_id = 1; + repeated aelf.Hash leaf_node_hash = 2; +} + + +message GetMerkleTreeByIndexInput{ + aelf.Hash space_id = 1; + int64 merkle_tree_index = 2; +} + +message GetMerklePathInput{ + aelf.Hash space_id = 1; + int64 leaf_node_index = 2; + aelf.Address receipt_maker = 3; +} + +message MerkleProofInput{ + aelf.Hash space_id = 1; + aelf.Hash leaf_node = 2; + aelf.MerklePath merkle_path = 3; + int64 last_leaf_index = 4; +} + +message GetLastLeafIndexInput{ + aelf.Hash space_id = 1; +} + +message GetLeafLocatedMerkleTreeInput { + aelf.Hash space_id = 1; + int64 leaf_index = 2; +} + + +message GetLeafLocatedMerkleTreeOutput { + aelf.Hash space_id = 1; + int64 merkle_tree_index = 2; + int64 first_leaf_index = 3; + int64 last_leaf_index = 4; +} + +//Regiment +message CreateRegimentInput { + aelf.Address manager = 1; + repeated aelf.Address initial_member_list = 2; + bool is_approve_to_join = 3; +} + +message JoinRegimentInput { + aelf.Address regiment_address = 1; + aelf.Address new_member_address = 2; +} + +message LeaveRegimentInput { + aelf.Address regiment_address = 1; + aelf.Address leave_member_address = 2; +} + +message AddRegimentMemberInput { + aelf.Address regiment_address = 1; + aelf.Address new_member_address = 2; +} + +message DeleteRegimentMemberInput { + aelf.Address regiment_address = 1; + aelf.Address delete_member_address = 2; +} + +message TransferRegimentOwnershipInput { + aelf.Address regiment_address = 1; + aelf.Address new_manager_address = 2; + aelf.Address origin_sender_address = 3; +} + +message AddAdminsInput { + aelf.Address regiment_address = 1; + repeated aelf.Address new_admins = 2; + aelf.Address origin_sender_address = 3; +} + +message DeleteAdminsInput { + aelf.Address regiment_address = 1; + repeated aelf.Address delete_admins = 2; + aelf.Address origin_sender_address = 3; +} + +message SpaceCreated{ + option (aelf.is_event) = true; + aelf.Hash regiment_id = 1; + aelf.Hash space_id = 2; + SpaceInfo space_info = 3; +} + +message MerkleTreeRecorded{ + option (aelf.is_event) = true; + aelf.Address regiment_member_address = 1; + aelf.Hash space_id = 2; + int64 merkle_tree_index = 3; + int64 last_leaf_index = 4; +} diff --git a/modules/AElf.Client.Protobuf/Protobuf/nft_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/nft_contract.proto new file mode 100644 index 00000000..b3521f6f --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/nft_contract.proto @@ -0,0 +1,505 @@ +/** + * NFT contract. + */ +syntax = "proto3"; + +package nft; + +import "aelf/core.proto"; +import "aelf/options.proto"; +import "acs1.proto"; +import "transaction_fee.proto"; +import "authority_info.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "AElf.Contracts.NFT"; + +service NFTContract { + option (aelf.csharp_state) = "AElf.Contracts.NFT.NFTContractState"; + option (aelf.base) = "acs1.proto"; + + // Create a new nft protocol. + rpc Create (CreateInput) returns (google.protobuf.StringValue) { + } + rpc CrossChainCreate (CrossChainCreateInput) returns (google.protobuf.Empty) { + } + // Mint (Issue) an amount of nft. + rpc Mint (MintInput) returns (aelf.Hash) { + } + // Transfer nft to another address. + rpc Transfer (TransferInput) returns (google.protobuf.Empty) { + } + // Transfer nft from one address to another. + rpc TransferFrom (TransferFromInput) returns (google.protobuf.Empty) { + } + // Approve another address to transfer nft from own account. + rpc Approve (ApproveInput) returns (google.protobuf.Empty) { + } + // De-approve. + rpc UnApprove (UnApproveInput) returns (google.protobuf.Empty) { + } + // Approve or de-approve another address as the operator of all NFTs of a certain protocol. + rpc ApproveProtocol (ApproveProtocolInput) returns (google.protobuf.Empty) { + } + // Destroy nfts. + rpc Burn (BurnInput) returns (google.protobuf.Empty) { + } + // Lock several nfts and fts to mint one nft. + rpc Assemble (AssembleInput) returns (aelf.Hash) { + } + // Disassemble one assembled nft to get locked nfts and fts back. + rpc Disassemble (DisassembleInput) returns (google.protobuf.Empty) { + } + // Modify metadata of one nft. + rpc Recast (RecastInput) returns (google.protobuf.Empty) { + } + + rpc AddMinters (AddMintersInput) returns (google.protobuf.Empty) { + } + rpc RemoveMinters (RemoveMintersInput) returns (google.protobuf.Empty) { + } + + rpc AddNFTType (AddNFTTypeInput) returns (google.protobuf.Empty) { + } + rpc RemoveNFTType (google.protobuf.StringValue) returns (google.protobuf.Empty) { + } + + rpc GetNFTProtocolInfo (google.protobuf.StringValue) returns (NFTProtocolInfo) { + option (aelf.is_view) = true; + } + rpc GetNFTInfo (GetNFTInfoInput) returns (NFTInfo) { + option (aelf.is_view) = true; + } + rpc GetNFTInfoByTokenHash (aelf.Hash) returns (NFTInfo) { + option (aelf.is_view) = true; + } + rpc GetBalance (GetBalanceInput) returns (GetBalanceOutput) { + option (aelf.is_view) = true; + } + rpc GetBalanceByTokenHash (GetBalanceByTokenHashInput) returns (GetBalanceOutput) { + option (aelf.is_view) = true; + } + rpc GetAllowance (GetAllowanceInput) returns (GetAllowanceOutput) { + option (aelf.is_view) = true; + } + rpc GetAllowanceByTokenHash (GetAllowanceByTokenHashInput) returns (GetAllowanceOutput) { + option (aelf.is_view) = true; + } + rpc GetMinterList (google.protobuf.StringValue) returns (MinterList) { + option (aelf.is_view) = true; + } + rpc CalculateTokenHash (CalculateTokenHashInput) returns (aelf.Hash) { + option (aelf.is_view) = true; + } + rpc GetNFTTypes (google.protobuf.Empty) returns (NFTTypes) { + option (aelf.is_view) = true; + } + rpc GetOperatorList (GetOperatorListInput) returns (AddressList) { + option (aelf.is_view) = true; + } +} + +// Structs +message NFTTypes { + map value = 1; +} + +// Inputs +message CreateInput { + // The type of this nft protocol. + string nft_type = 1; + // The name of this nft protocol. + string protocol_name = 2; + // The total supply of the token. + int64 total_supply = 3; + // The address that created the token. + aelf.Address creator = 4; + // A flag indicating if this token is burnable. + bool is_burnable = 5; + // The chain id of the token. + int32 issue_chain_id = 6; + // The metadata of the token. + Metadata metadata = 7; + // Base Uri. + string base_uri = 8; + // Is token id can be reused. + bool is_token_id_reuse = 9; + // Initial minter list (creator will be added automatically) + MinterList minter_list = 10; +} + +message CrossChainCreateInput { + string symbol = 1; +} + +message TransferInput { + aelf.Address to = 1; + string symbol = 2; + int64 token_id = 3; + string memo = 4; + int64 amount = 5; +} + +message TransferFromInput { + aelf.Address from = 1; + aelf.Address to = 2; + string symbol = 3; + int64 token_id = 4; + string memo = 5; + int64 amount = 6; +} + +message ApproveInput { + aelf.Address spender = 1; + string symbol = 2; + int64 token_id = 3; + int64 amount = 4; +} + +message UnApproveInput { + aelf.Address spender = 1; + string symbol = 2; + int64 token_id = 3; + int64 amount = 4; +} + +message ApproveProtocolInput { + aelf.Address operator = 1; + string symbol = 2; + bool approved = 3; +} + +message AddressList { + repeated aelf.Address value = 1; +} + +message GetOperatorListInput { + string symbol = 1; + aelf.Address owner = 2; +} + +message BurnInput { + string symbol = 1; + int64 token_id = 2; + int64 amount = 3; +} + +message AssembleInput { + string symbol = 1; + aelf.Address owner = 2; + string uri = 3; + string alias = 4; + Metadata metadata = 5; + AssembledNfts assembled_nfts = 6; + AssembledFts assembled_fts = 7; + int64 token_id = 8; +} + +message DisassembleInput { + string symbol = 1; + int64 token_id = 2; + aelf.Address owner = 3; +} + +message MinterList { + repeated aelf.Address value = 1; +} + +message MintInput { + string symbol = 1; + aelf.Address owner = 2; + string uri = 3; + string alias = 4; + Metadata metadata = 5; + int64 quantity = 6; + int64 token_id = 7; +} + +message GetBalanceInput { + aelf.Address owner = 1; + string symbol = 2; + int64 token_id = 3; +} + +message GetBalanceByTokenHashInput { + aelf.Address owner = 1; + aelf.Hash token_hash = 2; +} + +message GetBalanceOutput { + aelf.Address owner = 1; + aelf.Hash token_hash = 2; + int64 balance = 3; +} + +message GetAllowanceInput { + string symbol = 1; + int64 token_id = 2; + aelf.Address owner = 3; + aelf.Address spender = 4; +} + +message GetAllowanceByTokenHashInput { + aelf.Hash token_hash = 1; + aelf.Address owner = 2; + aelf.Address spender = 3; +} + +message GetAllowanceOutput { + aelf.Hash token_hash = 1; + int64 allowance = 2; + aelf.Address owner = 3; + aelf.Address spender = 4; +} + +message CalculateTokenHashInput { + string symbol = 1; + int64 token_id = 2; +} + +message NFTProtocolInfo { + // The symbol of the token. + string symbol = 1; + // The minted number of the token. + int64 supply = 2; + // The total number of the token. + int64 total_supply = 3; + // The address that creat the token. + aelf.Address creator = 4; + // Base Uri. + string base_uri = 5; + // A flag indicating if this token is burnable. + bool is_burnable = 6; + // The chain to mint this token. + int32 issue_chain_id = 7; + // The metadata of the token. + Metadata metadata = 8; + // NFT Type. + string nft_type = 9; + // Protocol name, aka token name in MultiToken Contract. + string protocol_name = 10; + // Is token id can be reused. + bool is_token_id_reuse = 11; + int64 issued = 12; +} + +message NFTInfo { + // The symbol of the protocol this nft belongs to. + string symbol = 1; + // The name of the protocol this nft belongs to. + string protocol_name = 2; + // Actually is the order of this token. + int64 token_id = 3; + // The address that creat the base token. + aelf.Address creator = 4; + // The addresses that mint this token. + repeated aelf.Address minters = 5; + // The metadata of the token. + Metadata metadata = 6; + // Minted amount. + int64 quantity = 7; + // Token Uri. + string uri = 8; + // Base Uri. + string base_uri = 9; + // Alias + string alias = 10; + // Is burned. + bool is_burned = 11; + // NFT Type + string nft_type = 12; +} + +enum NFTType { + ANY = 0; + ART = 1; + MUSIC = 2; + DOMAIN_NAMES = 3; + VIRTUAL_WORLDS = 4; + TRADING_CARDS = 5; + COLLECTABLES = 6; + SPORTS = 7; + UTILITY = 8; + BADGES = 9; +} + +message Metadata { + map value = 1; +} + +message AddMintersInput { + MinterList minter_list = 1; + string symbol = 2; +} + +message RemoveMintersInput { + MinterList minter_list = 1; + string symbol = 2; +} + +message GetNFTInfoInput { + string symbol = 1; + int64 token_id = 2; +} + +message RecastInput { + string symbol = 1; + int64 token_id = 2; + string uri = 3; + string alias = 4; + Metadata metadata = 5; +} + +message AssembledNfts { + map value = 1; +} + +message AssembledFts { + map value = 1; +} + +message AddNFTTypeInput { + string full_name = 1; + string short_name = 2; +} + +// Events + +message NFTProtocolCreated { + option (aelf.is_event) = true; + // The symbol of this protocol. + string symbol = 1; + // The name of this protocol. + string protocol_name = 2; + // The total supply of the token. + int64 total_supply = 3; + // The address that created the token. + aelf.Address creator = 4; + // A flag indicating if this token is burnable. + bool is_burnable = 5; + // The chain id of the token. + int32 issue_chain_id = 6; + // The metadata of the token. + Metadata metadata = 7; + // Base Uri. + string base_uri = 8; + // Is token id can be reused. + bool is_token_id_reuse = 9; + string nft_type = 10; +} + +message NFTMinted { + option (aelf.is_event) = true; + // The symbol of this protocol. + string symbol = 1; + // The name of this protocol. + string protocol_name = 2; + // Actually is the order of this token. + int64 token_id = 3; + // The address that creat the base token. + aelf.Address creator = 4; + // The address that mint this token. + aelf.Address minter = 5; + // The metadata of the token. + Metadata metadata = 6; + // The current owner of this nft. + aelf.Address owner = 7; + // Token Uri. + string uri = 8; + // Base Uri. + string base_uri = 9; + // Alias + string alias = 10; + // NFT Type + string nft_type = 11; + // Quantity + int64 quantity = 12; + int64 total_quantity = 13; + aelf.Hash token_hash = 14; +} + +message Transferred { + option (aelf.is_event) = true; + aelf.Address from = 1 [(aelf.is_indexed) = true]; + aelf.Address to = 2 [(aelf.is_indexed) = true]; + string symbol = 3 [(aelf.is_indexed) = true]; + int64 token_id = 4 [(aelf.is_indexed) = true]; + int64 amount = 5; + string memo = 6; +} + +message Approved { + option (aelf.is_event) = true; + aelf.Address owner = 1 [(aelf.is_indexed) = true]; + aelf.Address spender = 2 [(aelf.is_indexed) = true]; + string symbol = 3 [(aelf.is_indexed) = true]; + int64 token_id = 4 [(aelf.is_indexed) = true]; + int64 amount = 5; +} + +message UnApproved { + option (aelf.is_event) = true; + aelf.Address owner = 1 [(aelf.is_indexed) = true]; + aelf.Address spender = 2 [(aelf.is_indexed) = true]; + string symbol = 3 [(aelf.is_indexed) = true]; + int64 token_id = 4 [(aelf.is_indexed) = true]; + int64 current_allowance = 5; +} + +message Burned { + option (aelf.is_event) = true; + aelf.Address burner = 1 [(aelf.is_indexed) = true]; + string symbol = 2 [(aelf.is_indexed) = true]; + int64 token_id = 3 [(aelf.is_indexed) = true]; + int64 amount = 4; +} + +message Recasted { + option (aelf.is_event) = true; + string symbol = 1 [(aelf.is_indexed) = true]; + int64 token_id = 2 [(aelf.is_indexed) = true]; + Metadata old_metadata = 3 [(aelf.is_indexed) = true]; + Metadata new_metadata = 4 [(aelf.is_indexed) = true]; + string alias = 5 [(aelf.is_indexed) = true]; + string uri = 6 [(aelf.is_indexed) = true]; +} + +message Assembled { + option (aelf.is_event) = true; + string symbol = 1 [(aelf.is_indexed) = true]; + int64 token_id = 2 [(aelf.is_indexed) = true]; + AssembledNfts assembled_nfts = 3 [(aelf.is_indexed) = true]; + AssembledFts assembled_fts = 4 [(aelf.is_indexed) = true]; +} + +message Disassembled { + option (aelf.is_event) = true; + string symbol = 1 [(aelf.is_indexed) = true]; + int64 token_id = 2 [(aelf.is_indexed) = true]; + AssembledNfts disassembled_nfts = 3 [(aelf.is_indexed) = true]; + AssembledFts disassembled_fts = 4 [(aelf.is_indexed) = true]; +} + +message NFTTypeAdded { + option (aelf.is_event) = true; + string full_name = 1; + string short_name = 2; +} + +message NFTTypeRemoved { + option (aelf.is_event) = true; + string short_name = 1; +} + +message MinterListAdded { + option (aelf.is_event) = true; + MinterList minter_list = 1; + string symbol = 2; +} + +message MinterListRemoved { + option (aelf.is_event) = true; + MinterList minter_list = 1; + string symbol = 2; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/oracle_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/oracle_contract.proto new file mode 100644 index 00000000..44846122 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/oracle_contract.proto @@ -0,0 +1,380 @@ +syntax = "proto3"; + +import "aelf/core.proto"; +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "AElf.Contracts.Oracle"; + +service OracleContract { + option (aelf.csharp_state) = "AElf.Contracts.Oracle.OracleContractState"; + + rpc Initialize (InitializeInput) returns (google.protobuf.Empty) {} + rpc InitializeAndCreateToken (InitializeInput) returns (google.protobuf.Empty) {} + + // base function + + rpc Query (QueryInput) returns (aelf.Hash) {} + + rpc Commit (CommitInput) returns (google.protobuf.Empty) {} + + rpc Reveal (RevealInput) returns (google.protobuf.Empty) {} + + rpc CancelQuery (aelf.Hash) returns (google.protobuf.Empty) {} + + rpc CreateQueryTask (CreateQueryTaskInput) returns (aelf.Hash) {} + + rpc TaskQuery (TaskQueryInput) returns (aelf.Hash) {} + + rpc CompleteQueryTask (CompleteQueryTaskInput) returns (google.protobuf.Empty) {} + + // controller + + rpc ChangeController (aelf.Address) returns (google.protobuf.Empty) {} + + // regiment related + + rpc CreateRegiment (CreateRegimentInput) returns (google.protobuf.Empty) {} + rpc JoinRegiment (JoinRegimentInput) returns (google.protobuf.Empty) {} + rpc LeaveRegiment (LeaveRegimentInput) returns (google.protobuf.Empty) {} + rpc AddRegimentMember (AddRegimentMemberInput) returns (google.protobuf.Empty) {} + rpc DeleteRegimentMember (DeleteRegimentMemberInput) returns (google.protobuf.Empty) {} + rpc TransferRegimentOwnership (TransferRegimentOwnershipInput) returns (google.protobuf.Empty) {} + rpc AddAdmins (AddAdminsInput) returns (google.protobuf.Empty) {} + rpc DeleteAdmins (DeleteAdminsInput) returns (google.protobuf.Empty) {} + + rpc LockTokens (LockTokensInput) returns (google.protobuf.Empty) {} + + rpc UnlockTokens (UnlockTokensInput) returns (google.protobuf.Empty) {} + + // config setting + + rpc SetThreshold (OracleNodeThreshold) returns (google.protobuf.Empty) {} + + rpc ChangeDefaultExpirationSeconds (google.protobuf.Int32Value) returns (google.protobuf.Empty) {} + + rpc EnableChargeFee (google.protobuf.Empty) returns (google.protobuf.Empty) {} + + rpc AddPostPayAddress (aelf.Address) returns (google.protobuf.Empty) {} + + rpc RemovePostPayAddress (aelf.Address) returns (google.protobuf.Empty) {} + + // view methods + + rpc GetController (google.protobuf.Empty) returns (aelf.Address) { + option (aelf.is_view) = true; + } + + rpc GetQueryRecord (aelf.Hash) returns (QueryRecord) { + option (aelf.is_view) = true; + } + + rpc GetCommitmentMap (aelf.Hash) returns (CommitmentMap) { + option (aelf.is_view) = true; + } + + rpc GetOracleTokenSymbol (google.protobuf.Empty) returns (google.protobuf.StringValue) { + option (aelf.is_view) = true; + } + + rpc GetLockedTokensAmount (aelf.Address) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + + rpc GetThreshold (google.protobuf.Empty) returns (OracleNodeThreshold) { + option (aelf.is_view) = true; + } + + rpc GetDefaultExpirationSeconds (google.protobuf.Empty) returns (google.protobuf.Int32Value) { + option (aelf.is_view) = true; + } + + rpc GetHelpfulNodeList (aelf.Hash) returns (AddressList) { + option (aelf.is_view) = true; + } + + rpc GetQueryTask (aelf.Hash) returns (QueryTask) { + option (aelf.is_view) = true; + } + + rpc GetRegimentMemberList (aelf.Address) returns (AddressList) { + option (aelf.is_view) = true; + } +} + +message InitializeInput { + int32 minimum_oracle_nodes_count = 1; + int32 default_reveal_threshold = 2; + int32 default_aggregate_threshold = 3; + int32 default_expiration_seconds = 4; + bool is_charge_fee = 5; + aelf.Address regiment_contract_address = 6; +} + +message QueryInput { + int64 payment = 1;// Maximum for this query option. + CallbackInfo callback_info = 2; + aelf.Address aggregator_contract_address = 3; + AddressList designated_node_list = 4;// Will be regiment address if count is 1. + QueryInfo query_info = 5; + int32 aggregate_threshold = 6; + string token = 7; + int32 aggregate_option = 8; + aelf.Hash task_id = 9; +} + +message CreateQueryTaskInput { + int64 each_payment = 1; + int32 supposed_query_times = 2; + QueryInfo query_info = 3; + google.protobuf.Timestamp end_time = 4; + CallbackInfo callback_info = 5; + aelf.Address aggregator_contract_address = 6; + int32 aggregate_option = 7; + int32 aggregate_threshold = 8; +} + +message TaskQueryInput { + aelf.Hash task_id = 1; +} + +message CompleteQueryTaskInput { + aelf.Hash task_id = 1; + AddressList designated_node_list = 2; + int32 aggregate_threshold = 3; +} + +message CallbackInfo { + aelf.Address contract_address = 1; + string method_name = 2; +} + +message AddressList { + repeated aelf.Address value = 1; +} + +message QueryRecord { + AddressList designated_node_list = 1; + aelf.Address aggregator_contract_address = 2; + google.protobuf.Timestamp expiration_timestamp = 3; + bool is_sufficient_commitments_collected = 4; + bool is_sufficient_data_collected = 5; + string final_result = 6; + int64 payment = 7; + CallbackInfo callback_info = 8; + aelf.Hash query_id = 9; + int32 aggregate_threshold = 10; + aelf.Address query_sender = 11; + bool is_commit_stage_finished = 12; + int32 commitments_count = 13; + bool is_cancelled = 14; + QueryInfo query_info = 15; + string token = 16; + DataRecords data_records = 17; + int32 aggregate_option = 18; + aelf.Hash task_id = 19; + bool is_paid_to_oracle_contract = 20; +} + +message CreateRegimentInput { + aelf.Address manager = 1; + repeated aelf.Address initial_member_list = 2; + bool is_approve_to_join = 3; +} + +message JoinRegimentInput { + aelf.Address regiment_address = 1; + aelf.Address new_member_address = 2; +} + +message LeaveRegimentInput { + aelf.Address regiment_address = 1; + aelf.Address leave_member_address = 2; +} + +message AddRegimentMemberInput { + aelf.Address regiment_address = 1; + aelf.Address new_member_address = 2; +} + +message DeleteRegimentMemberInput { + aelf.Address regiment_address = 1; + aelf.Address delete_member_address = 2; +} + +message TransferRegimentOwnershipInput { + aelf.Address regiment_address = 1; + aelf.Address new_manager_address = 2; + aelf.Address origin_sender_address = 3; +} + +message AddAdminsInput { + aelf.Address regiment_address = 1; + repeated aelf.Address new_admins = 2; + aelf.Address origin_sender_address = 3; +} + +message DeleteAdminsInput { + aelf.Address regiment_address = 1; + repeated aelf.Address delete_admins = 2; + aelf.Address origin_sender_address = 3; +} + +message QueryTask { + int64 each_payment = 1; + int32 supposed_query_times = 2; + QueryInfo query_info = 3; + google.protobuf.Timestamp end_time = 4; + AddressList designated_node_list = 5; + aelf.Address aggregator_contract_address = 6; + int32 actual_queried_times = 7; + CallbackInfo callback_info = 8; + aelf.Address creator = 9; + int32 aggregate_threshold = 10; + int32 aggregate_option = 11; + bool on_going = 12; +} + +message CommitInput { + aelf.Hash query_id = 1; + aelf.Hash commitment = 2; +} + +message RevealInput { + aelf.Hash query_id = 1; + string data = 2; + aelf.Hash salt = 3; +} + +message CommitmentMap { + map value = 1; +} + +message OracleNodeThreshold { + int32 minimum_oracle_nodes_count = 1; + int32 default_reveal_threshold = 2; + int32 default_aggregate_threshold = 3; +} + +message ResultList { + repeated string results = 1; + repeated int32 frequencies = 2; +} + +message DataRecord { + aelf.Address address = 1; + string data = 2; +} + +message DataRecords { + repeated DataRecord value = 1; +} + +message PlainResult { + DataRecords data_records = 1; + aelf.Address regiment_address = 2; + QueryInfo query_info = 3; + string token = 4; +} + +message LockTokensInput { + aelf.Address oracle_node_address = 1; + int64 lock_amount = 2; +} + +message UnlockTokensInput { + aelf.Address oracle_node_address = 1; + int64 withdraw_amount = 2; +} + +message QueryInfo { + string title = 1; + repeated string options = 2; +} + +// Events +message QueryCreated { + option (aelf.is_event) = true; + int64 payment = 1;// Maximum for this query option. + CallbackInfo callback_info = 2; + aelf.Address aggregator_contract_address = 3; + AddressList designated_node_list = 4;// Will be regiment address if count is 1. + QueryInfo query_info = 5; + int32 aggregate_threshold = 6; + aelf.Address query_sender = 7; + aelf.Hash query_id = 8; + string token = 9; + int32 maximum_permissible_deviation = 10; + int32 aggregate_option = 11; + aelf.Hash task_id = 12; +} + +message QueryTaskCreated { + option (aelf.is_event) = true; + int64 each_payment = 1; + int32 supposed_query_times = 2; + QueryInfo query_info = 3; + google.protobuf.Timestamp end_time = 4; + AddressList designated_node_list = 5; + aelf.Address aggregator_contract_address = 6; + CallbackInfo callback_info = 7; + aelf.Address creator = 8; + int32 aggregate_threshold = 9; + int32 aggregate_option = 10; +} + +message QueryCancelled { + option (aelf.is_event) = true; + aelf.Hash query_id = 1; +} + +message SufficientCommitmentsCollected { + option (aelf.is_event) = true; + aelf.Hash query_id = 1; +} + +message Committed { + option (aelf.is_event) = true; + aelf.Hash query_id = 1; + aelf.Address oracle_node_address = 2; + aelf.Hash commitment = 3; +} + +message CommitmentRevealed { + option (aelf.is_event) = true; + aelf.Hash query_id = 1; + aelf.Address oracle_node_address = 2; + aelf.Hash commitment = 3; + string reveal_data = 4; + aelf.Hash salt = 5; +} + +message CommitmentRevealFailed { + option (aelf.is_event) = true; + aelf.Hash query_id = 1; + aelf.Address oracle_node_address = 2; + aelf.Hash commitment = 3; + string reveal_data = 4; + aelf.Hash salt = 5; +} + +message QueryCompletedWithAggregation { + option (aelf.is_event) = true; + aelf.Hash query_id = 1; + string result = 2; +} + +message QueryCompletedWithoutAggregation { + option (aelf.is_event) = true; + aelf.Hash query_id = 1; + PlainResult result = 2; +} + +message TokenLocked { + option (aelf.is_event) = true; + aelf.Address oracle_node_address = 1; + aelf.Address from_address = 2; + int64 locked_amount = 3; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/parliament_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/parliament_contract.proto new file mode 100644 index 00000000..c7a8936e --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/parliament_contract.proto @@ -0,0 +1,148 @@ +/** + * Parliament contract. + */ +syntax = "proto3"; + +package Parliament; + +import "acs3.proto"; +import public "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "AElf.Contracts.Parliament"; + +service ParliamentContract { + + option (aelf.csharp_state) = "AElf.Contracts.Parliament.ParliamentState"; + + // Initialize parliament proposer whitelist and create the first parliament organization + // with specific proposer_authority_required. + rpc Initialize(InitializeInput) returns (google.protobuf.Empty) { + } + + // Create an organization and return its address. + rpc CreateOrganization (CreateOrganizationInput) returns (aelf.Address) { + } + + // Batch approval proposal. + rpc ApproveMultiProposals(ProposalIdList) returns (google.protobuf.Empty){ + } + + // Creates an organization by system contract and return its address. + rpc CreateOrganizationBySystemContract(CreateOrganizationBySystemContractInput) returns (aelf.Address){ + } + + // Creates an organization to handle emergency events. + rpc CreateEmergencyResponseOrganization (google.protobuf.Empty) returns (google.protobuf.Empty) { + } + + // Get the organization according to the organization address. + rpc GetOrganization (aelf.Address) returns (Organization) { + option (aelf.is_view) = true; + } + + // Get the default organization address. + rpc GetDefaultOrganizationAddress (google.protobuf.Empty) returns (aelf.Address) { + option (aelf.is_view) = true; + } + + // Validates if the provided address is a parliament member. + rpc ValidateAddressIsParliamentMember(aelf.Address) returns (google.protobuf.BoolValue){ + option (aelf.is_view) = true; + } + + // Returns the list of whitelisted proposers. + rpc GetProposerWhiteList(google.protobuf.Empty) returns (acs3.ProposerWhiteList){ + option (aelf.is_view) = true; + } + + // Filter still pending ones not yet voted by the sender from provided proposals. + rpc GetNotVotedPendingProposals(ProposalIdList) returns (ProposalIdList){ + option (aelf.is_view) = true; + } + + // Filter not yet voted ones by the sender from provided proposals. + rpc GetNotVotedProposals(ProposalIdList) returns (ProposalIdList){ + option (aelf.is_view) = true; + } + + // Calculates with input and return the organization address. + rpc CalculateOrganizationAddress(CreateOrganizationInput) returns (aelf.Address){ + option (aelf.is_view) = true; + } + + rpc GetEmergencyResponseOrganizationAddress (google.protobuf.Empty) returns (aelf.Address) { + option (aelf.is_view) = true; + } +} + +message CreateOrganizationInput { + // The threshold for releasing the proposal. + acs3.ProposalReleaseThreshold proposal_release_threshold = 1; + // Setting this to false will allow anyone creating proposals. + bool proposer_authority_required = 2; + // Setting this to true can allow parliament member to create proposals. + bool parliament_member_proposing_allowed = 3; + // The creation token is for organization address generation. + aelf.Hash creation_token = 4; +} + +message Organization { + // Indicates if proposals need authority to be created. + bool proposer_authority_required = 1; + // The organization address. + aelf.Address organization_address = 2; + // The organization id. + aelf.Hash organization_hash = 3; + // The threshold for releasing the proposal. + acs3.ProposalReleaseThreshold proposal_release_threshold = 4; + // Indicates if parliament member can propose to this organization. + bool parliament_member_proposing_allowed = 5; + // The creation token is for organization address generation. + aelf.Hash creation_token = 6; +} + +message ProposalInfo { + // The proposal ID. + aelf.Hash proposal_id = 1; + // The method that this proposal will call when being released. + string contract_method_name = 2; + // The address of the target contract. + aelf.Address to_address = 3; + // The parameters of the release transaction. + bytes params = 4; + // The date at which this proposal will expire. + google.protobuf.Timestamp expired_time = 5; + // The address of the proposer of this proposal. + aelf.Address proposer = 6; + // The address of this proposals organization. + aelf.Address organization_address = 7; + // Address list of approved. + repeated aelf.Address approvals = 8; + // Address list of rejected. + repeated aelf.Address rejections = 9; + // Address list of abstained. + repeated aelf.Address abstentions = 10; + // Url is used for proposal describing. + string proposal_description_url = 11; +} + +message InitializeInput{ + // Privileged proposer would be the first address in parliament proposer whitelist. + aelf.Address privileged_proposer = 1; + // The setting indicates if proposals need authority to be created for first/default parliament organization. + bool proposer_authority_required = 2; +} + +message ProposalIdList{ + // The list of proposal ids. + repeated aelf.Hash proposal_ids = 1; +} + +message CreateOrganizationBySystemContractInput { + // The parameters of creating organization. + CreateOrganizationInput organization_creation_input = 1; + // The organization address callback method which replies the organization address to caller contract. + string organization_address_feedback_method = 2; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/profit_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/profit_contract.proto new file mode 100644 index 00000000..745406dc --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/profit_contract.proto @@ -0,0 +1,370 @@ +/** + * Profit contract. + */ +syntax = "proto3"; + +package Profit; + +import "aelf/core.proto"; +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "AElf.Contracts.Profit"; + +service ProfitContract { + option (aelf.csharp_state) = "AElf.Contracts.Profit.ProfitContractState"; + + // Create a scheme for profit distribution, and return the created scheme id. + rpc CreateScheme (CreateSchemeInput) returns (aelf.Hash) { + } + + // Add beneficiary to scheme. + rpc AddBeneficiary (AddBeneficiaryInput) returns (google.protobuf.Empty) { + } + + // Remove beneficiary from scheme. + rpc RemoveBeneficiary (RemoveBeneficiaryInput) returns (google.protobuf.Empty) { + } + + // Batch add beneficiary to scheme. + rpc AddBeneficiaries (AddBeneficiariesInput) returns (google.protobuf.Empty) { + } + + // Batch remove beneficiary from scheme. + rpc RemoveBeneficiaries (RemoveBeneficiariesInput) returns (google.protobuf.Empty) { + } + + rpc FixProfitDetail (FixProfitDetailInput) returns (google.protobuf.Empty) { + } + + // Contribute profit to a scheme. + rpc ContributeProfits (ContributeProfitsInput) returns (google.protobuf.Empty) { + } + + // The beneficiary draws tokens from the scheme. + rpc ClaimProfits (ClaimProfitsInput) returns (google.protobuf.Empty) { + } + + // Distribute profits to schemes, including its sub scheme according to period and token symbol, + // should be called by the manager. + rpc DistributeProfits (DistributeProfitsInput) returns (google.protobuf.Empty) { + } + + // Add sub scheme to a scheme. + // This will effectively add the specified sub-scheme as a beneficiary of the parent scheme. + rpc AddSubScheme (AddSubSchemeInput) returns (google.protobuf.Empty) { + } + + // Remove sub scheme from a scheme. + rpc RemoveSubScheme (RemoveSubSchemeInput) returns (google.protobuf.Empty) { + } + + // Reset the manager of a scheme. + rpc ResetManager (ResetManagerInput) returns (google.protobuf.Empty) { + } + + // Get all schemes managed by the specified manager. + rpc GetManagingSchemeIds (GetManagingSchemeIdsInput) returns (CreatedSchemeIds) { + option (aelf.is_view) = true; + } + + // Get scheme according to scheme id. + rpc GetScheme (aelf.Hash) returns (Scheme) { + option (aelf.is_view) = true; + } + + // Get the virtual address of the number of period of the scheme. + rpc GetSchemeAddress (SchemePeriod) returns (aelf.Address) { + option (aelf.is_view) = true; + } + + // Query the distributed profit information for the specified period. + rpc GetDistributedProfitsInfo (SchemePeriod) returns (DistributedProfitsInfo) { + option (aelf.is_view) = true; + } + + // Query the beneficiary's profit information on the scheme. + rpc GetProfitDetails (GetProfitDetailsInput) returns (ProfitDetails) { + option (aelf.is_view) = true; + } + + // Query the amount of profit according to token symbol. (up to 10 periods). + rpc GetProfitAmount (GetProfitAmountInput) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + + // Query all profit (up to 10 periods). + rpc GetProfitsMap (ClaimProfitsInput) returns (ReceivedProfitsMap) { + option (aelf.is_view) = true; + } +} + +message CreateSchemeInput { + // Period of profit distribution. + int64 profit_receiving_due_period_count = 1; + // Whether all the schemes balance will be distributed during distribution each period. + bool is_release_all_balance_every_time_by_default = 2; + // Delay distribute period. + int32 delay_distribute_period_count = 3; + // The manager of this scheme, the default is the creator. + aelf.Address manager = 4; + // Whether you can directly remove the beneficiary. + bool can_remove_beneficiary_directly = 5; + // Use to generate scheme id. + aelf.Hash token = 6; +} + +message Scheme { + // The virtual address of the scheme. + aelf.Address virtual_address = 1; + // The total weight of the scheme. + int64 total_shares = 2; + // The manager of the scheme. + aelf.Address manager = 3; + // The current period. + int64 current_period = 4; + // Sub schemes information. + repeated SchemeBeneficiaryShare sub_schemes = 5; + // Whether you can directly remove the beneficiary. + bool can_remove_beneficiary_directly = 6; + // Period of profit distribution. + int64 profit_receiving_due_period_count = 7; + // Whether all the schemes balance will be distributed during distribution each period. + bool is_release_all_balance_every_time_by_default = 8; + // The is of the scheme. + aelf.Hash scheme_id = 9; + // Delay distribute period. + int32 delay_distribute_period_count = 10; + // Record the scheme's current total share for deferred distribution of benefits, period -> total shares. + map cached_delay_total_shares = 11; + // The received token symbols. + repeated string received_token_symbols = 12; +} + +message SchemeBeneficiaryShare { + // The id of the sub scheme. + aelf.Hash scheme_id = 1; + // The weight of the sub scheme. + int64 shares = 2; +} + +message AddBeneficiaryInput { + // The scheme id. + aelf.Hash scheme_id = 1; + // The beneficiary information. + BeneficiaryShare beneficiary_share = 2; + // The end period which the beneficiary receives the profit. + int64 start_period = 3; + int64 end_period = 4; + bool is_fix_profit_detail = 5; + aelf.Hash profit_detail_id = 6; +} + +message FixProfitDetailInput { + aelf.Hash scheme_id = 1; + BeneficiaryShare beneficiary_share = 2; + int64 start_period = 3; + int64 end_period = 4; + aelf.Hash profit_detail_id = 5; +} + +message RemoveBeneficiaryInput { + // The address of beneficiary. + aelf.Address beneficiary = 1; + // The scheme id. + aelf.Hash scheme_id = 2; + aelf.Hash profit_detail_id = 3; +} + +message AddBeneficiariesInput { + // The scheme id. + aelf.Hash scheme_id = 1; + // The beneficiary information. + repeated BeneficiaryShare beneficiary_shares = 2; + // The end period which the beneficiary receives the profit. + int64 end_period = 3; +} + +message RemoveBeneficiariesInput { + // The addresses of beneficiary. + repeated aelf.Address beneficiaries = 1; + // The scheme id. + aelf.Hash scheme_id = 2; +} + +message BeneficiaryShare { + // The address of beneficiary. + aelf.Address beneficiary = 1; + // The profit weight of the beneficiary in the scheme. + int64 shares = 2; +} + +message ClaimProfitsInput { + // The scheme id. + aelf.Hash scheme_id = 1; + // The address of beneficiary. + aelf.Address beneficiary = 2; +} + +message DistributeProfitsInput { + // The scheme id to distribute. + aelf.Hash scheme_id = 1; + // The period number to distribute, should be the current period. + int64 period = 2; + // The amount to distribute, symbol -> amount. + map amounts_map = 3; +} + +message ProfitDetails { + // The profit information. + repeated ProfitDetail details = 1; +} + +message ProfitDetail { + // The start period number. + int64 start_period = 1; + // The end period number. + int64 end_period = 2; + // The weight of the proceeds on the current period of the scheme. + int64 shares = 3; + // The last period number that the beneficiary received the profit. + int64 last_profit_period = 4; + // Whether the weight has been removed. + bool is_weight_removed = 5; + aelf.Hash id = 6; +} + +message ContributeProfitsInput { + // The scheme id to contribute. + aelf.Hash scheme_id = 1; + // The amount to contribute. + int64 amount = 2; + // The number of periods in which the income is used for dividends. + int64 period = 3; + // The token symbol to contribute. + string symbol = 4; +} + +message AddSubSchemeInput { + // The parent scheme id. + aelf.Hash scheme_id = 1; + // The sub scheme id. + aelf.Hash sub_scheme_id = 2; + // The profit weight of sub scheme. + int64 sub_scheme_shares = 3; +} + +message RemoveSubSchemeInput { + // The parent scheme id. + aelf.Hash scheme_id = 1; + // The sub scheme id. + aelf.Hash sub_scheme_id = 2; +} + +message DistributedProfitsInfo { + // The total amount of shares in this scheme at the current period. + int64 total_shares = 1; + // The contributed amount in this scheme at the current period. + map amounts_map = 2;//Token symbol -> Amount + // Whether released. + bool is_released = 3; +} + +message CreatedSchemeIds { + // The scheme ids. + repeated aelf.Hash scheme_ids = 1; +} + +message GetManagingSchemeIdsInput { + // The manager address. + aelf.Address manager = 1; +} + +message SchemePeriod { + // The scheme id. + aelf.Hash scheme_id = 1; + // The period number. + int64 period = 2; +} + +message GetProfitDetailsInput { + // The scheme id. + aelf.Hash scheme_id = 1; + // The address of beneficiary. + aelf.Address beneficiary = 2; +} + +message ResetManagerInput { + // The scheme id. + aelf.Hash scheme_id = 1; + // The address of new manager. + aelf.Address new_manager = 2; +} + +message GetProfitAmountInput { + // The scheme id. + aelf.Hash scheme_id = 1; + // The token symbol. + string symbol = 2; + // The beneficiary's address. + aelf.Address beneficiary = 3; +} + +message ReceivedProfitsMap { + // The collection of profits received, token symbol -> amount. + map value = 1; +} + +message ReceivedProfitsMapList { + repeated ReceivedProfitsMap value = 1; +} + +message SchemeCreated { + option (aelf.is_event) = true; + // The virtual address of the created scheme. + aelf.Address virtual_address = 1; + // The manager of the created scheme. + aelf.Address manager = 2; + // Period of profit distribution. + int64 profit_receiving_due_period_count = 3; + // Whether all the schemes balance will be distributed during distribution each period. + bool is_release_all_balance_every_time_by_default = 4; + // The id of the created scheme. + aelf.Hash scheme_id = 5; +} + +message ProfitsClaimed { + option (aelf.is_event) = true; + // The beneficiary's address claimed. + aelf.Address beneficiary = 1; + // The token symbol claimed. + string symbol = 2; + // The amount claimed. + int64 amount = 3; + // The period number claimed. + int64 period = 4; + // The shares of the claimer. + int64 claimer_shares = 5; + // The total shares at the current period. + int64 total_shares = 6; +} + +message ProfitDetailAdded { + option (aelf.is_event) = true; + int64 start_period = 1; + int64 end_period = 2; + int64 shares = 3; + bool is_weight_removed = 4; + aelf.Address beneficiary = 5; +} + +message DistributedPeriodInfoChanged { + option (aelf.is_event) = true; + aelf.Hash scheme_id = 1; + int64 period = 2; + int64 total_shares = 3; + ReceivedProfitsMapList profits_map_list = 4; + bool is_released = 5; + aelf.Address virtual_address = 6; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/receipt_maker.proto b/modules/AElf.Client.Protobuf/Protobuf/receipt_maker.proto new file mode 100644 index 00000000..3adefd56 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/receipt_maker.proto @@ -0,0 +1,35 @@ +syntax = "proto3"; + +import "aelf/core.proto"; +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "AElf.Contracts.ReceiptMakerContract"; + +service ReceiptMakerContract { + rpc GetReceiptCount(google.protobuf.Int64Value) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + rpc GetReceiptHash(GetReceiptHashInput) returns (aelf.Hash) { + option (aelf.is_view) = true; + } + rpc GetReceiptHashList(GetReceiptHashListInput) returns (GetReceiptHashListOutput) { + option (aelf.is_view) = true; + } +} + +message GetReceiptHashInput { + int64 recorder_id = 1; + int64 receipt_id = 2; +} + +message GetReceiptHashListInput { + int64 first_leaf_index = 1; + int64 last_leaf_index = 2; + int64 recorder_id = 3; +} + +message GetReceiptHashListOutput { + repeated aelf.Hash receipt_hash_list = 1; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/referendum_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/referendum_contract.proto new file mode 100644 index 00000000..82af016f --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/referendum_contract.proto @@ -0,0 +1,129 @@ +/** + * Referendum contract. + */ +syntax = "proto3"; + +package Referendum; + +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "aelf/core.proto"; +import "acs3.proto"; + +option csharp_namespace = "AElf.Contracts.Referendum"; + +service ReferendumContract { + + option (aelf.csharp_state) = "AElf.Contracts.Referendum.ReferendumState"; + + // Unlock the token used for voting according to proposal id. + rpc ReclaimVoteToken (aelf.Hash) returns (google.protobuf.Empty) { + } + + // Create an organization and return its address. + rpc CreateOrganization (CreateOrganizationInput) returns (aelf.Address) { + } + + // Creates an organization by system contract and return its address. + rpc CreateOrganizationBySystemContract (CreateOrganizationBySystemContractInput) returns (aelf.Address) { + } + + // Get the organization according to the organization address. + rpc GetOrganization (aelf.Address) returns (Organization) { + option (aelf.is_view) = true; + } + + // Calculate the input and return the organization address. + rpc CalculateOrganizationAddress (CreateOrganizationInput) returns (aelf.Address) { + option (aelf.is_view) = true; + } + + // Get the virtual address of a proposal based on the proposal id. + rpc GetProposalVirtualAddress (aelf.Hash) returns (aelf.Address) { + } +} + +message CreateOrganizationInput { + // The token used during proposal operations. + string token_symbol = 1; + // The threshold for releasing the proposal. + acs3.ProposalReleaseThreshold proposal_release_threshold = 2; + // The proposer whitelist. + acs3.ProposerWhiteList proposer_white_list = 3; + // The creation token is for organization address generation. + aelf.Hash creation_token = 4; +} + +message Organization { + // The threshold for releasing the proposal. + acs3.ProposalReleaseThreshold proposal_release_threshold = 1; + // The token used during proposal operations. + string token_symbol = 2; + // The address of organization. + aelf.Address organization_address = 3; + // The organizations id. + aelf.Hash organization_hash = 4; + // The proposer whitelist. + acs3.ProposerWhiteList proposer_white_list = 5; + // The creation token is for organization address generation. + aelf.Hash creation_token = 6; +} + +message Receipt { + // The amount of token locked. + int64 amount = 1; + // The symbol of token locked. + string token_symbol = 2; + // The lock id. + aelf.Hash lock_id = 3; +} + +message ProposalInfo { + // The proposal ID. + aelf.Hash proposal_id = 1; + // The method that this proposal will call when being released. + string contract_method_name = 2; + // The address of the target contract. + aelf.Address to_address = 3; + // The parameters of the release transaction. + bytes params = 4; + // The date at which this proposal will expire. + google.protobuf.Timestamp expired_time = 5; + // The address of the proposer of this proposal. + aelf.Address proposer = 6; + // The address of this proposals organization. + aelf.Address organization_address = 7; + // The count of approved. + int64 approval_count = 8; + // The count of rejected. + int64 rejection_count = 9; + // The count of abstained. + int64 abstention_count = 10; + // Url is used for proposal describing. + string proposal_description_url = 11; +} + +message CreateOrganizationBySystemContractInput { + // The parameters of creating organization. + CreateOrganizationInput organization_creation_input = 1; + // The organization address callback method which replies the organization address to caller contract. + string organization_address_feedback_method = 2; +} + +message ReferendumReceiptCreated { + option (aelf.is_event) = true; + // The id of the proposal. + aelf.Hash proposal_id = 1; + // The sender address. + aelf.Address address = 2; + // The symbol of token locked. + string symbol = 3; + // The amount of token locked. + int64 amount = 4; + // The type of receipt(Approve, Reject or Abstain). + string receipt_type = 5; + // The timestamp of this method call. + google.protobuf.Timestamp time = 6; + // The address of the organization. + aelf.Address organization_address = 7 [(aelf.is_indexed) = true]; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/regiment_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/regiment_contract.proto new file mode 100644 index 00000000..d320d9fc --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/regiment_contract.proto @@ -0,0 +1,152 @@ +syntax = "proto3"; + +import "aelf/core.proto"; +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "AElf.Contracts.Regiment"; + +service RegimentContract { + option (aelf.csharp_state) = "AElf.Contracts.Regiment.RegimentContractState"; + + // Actions (Can only performed by the Controller.) + rpc Initialize (InitializeInput) returns (google.protobuf.Empty) {} + + rpc CreateRegiment (CreateRegimentInput) returns (google.protobuf.Empty) {} + rpc JoinRegiment (JoinRegimentInput) returns (google.protobuf.Empty) {} + rpc LeaveRegiment (LeaveRegimentInput) returns (google.protobuf.Empty) {} + rpc AddRegimentMember (AddRegimentMemberInput) returns (google.protobuf.Empty) {} + rpc DeleteRegimentMember (DeleteRegimentMemberInput) returns (google.protobuf.Empty) {} + rpc TransferRegimentOwnership (TransferRegimentOwnershipInput) returns (google.protobuf.Empty) {} + rpc AddAdmins (AddAdminsInput) returns (google.protobuf.Empty) {} + rpc DeleteAdmins (DeleteAdminsInput) returns (google.protobuf.Empty) {} + + rpc ChangeController (aelf.Address) returns (google.protobuf.Empty) {} + rpc ResetConfig (RegimentContractConfig) returns (google.protobuf.Empty) {} + + // Views + rpc GetController (google.protobuf.Empty) returns (aelf.Address) { + option (aelf.is_view) = true; + } + rpc GetConfig (google.protobuf.Empty) returns (RegimentContractConfig) { + option (aelf.is_view) = true; + } + + rpc GetRegimentInfo (aelf.Address) returns (RegimentInfo) { + option (aelf.is_view) = true; + } + rpc IsRegimentMember (IsRegimentMemberInput) returns (google.protobuf.BoolValue) { + option (aelf.is_view) = true; + } + rpc GetRegimentMemberList (aelf.Address) returns (RegimentMemberList) { + option (aelf.is_view) = true; + } +} + +message InitializeInput { + aelf.Address Controller = 1;// The only address can perform action in this contract. + int32 member_join_limit = 2; + int32 regiment_limit = 3; + int32 maximum_admins_count = 4; +} + +message RegimentContractConfig { + int32 member_join_limit = 1; + int32 regiment_limit = 2; + int32 maximum_admins_count = 3; +} + +message CreateRegimentInput { + aelf.Address manager = 1; + repeated aelf.Address initial_member_list = 2; + bool is_approve_to_join = 3; +} + +message JoinRegimentInput { + aelf.Address regiment_address = 1; + aelf.Address new_member_address = 2; + aelf.Address origin_sender_address = 3; +} + +message LeaveRegimentInput { + aelf.Address regiment_address = 1; + aelf.Address leave_member_address = 2; + aelf.Address origin_sender_address = 3; +} + +message AddRegimentMemberInput { + aelf.Address regiment_address = 1; + aelf.Address new_member_address = 2; + aelf.Address origin_sender_address = 3; +} + +message DeleteRegimentMemberInput { + aelf.Address regiment_address = 1; + aelf.Address delete_member_address = 2; + aelf.Address origin_sender_address = 3; +} + +message RegimentInfo { + google.protobuf.Timestamp create_time = 1; + aelf.Address manager = 2; + repeated aelf.Address admins = 3; + bool is_approve_to_join = 4; +} + +message IsRegimentMemberInput { + aelf.Address address = 1; + aelf.Address regiment_address = 2; +} + +message RegimentMemberList { + repeated aelf.Address value = 1; +} + +message TransferRegimentOwnershipInput { + aelf.Address regiment_address = 1; + aelf.Address new_manager_address = 2; + aelf.Address origin_sender_address = 3; +} + +message AddAdminsInput { + aelf.Address regiment_address = 1; + repeated aelf.Address new_admins = 2; + aelf.Address origin_sender_address = 3; +} + +message DeleteAdminsInput { + aelf.Address regiment_address = 1; + repeated aelf.Address delete_admins = 2; + aelf.Address origin_sender_address = 3; +} + +// Events +message RegimentCreated { + option (aelf.is_event) = true; + google.protobuf.Timestamp create_time = 1; + aelf.Address manager = 2; + RegimentMemberList initial_member_list = 3; + aelf.Address regiment_address = 4; +} + +message NewMemberApplied { + option (aelf.is_event) = true; + aelf.Address regiment_address = 1; + aelf.Address apply_member_address = 2; +} + +message NewMemberAdded { + option (aelf.is_event) = true; + aelf.Address regiment_address = 1; + aelf.Address new_member_address = 2; + aelf.Address operator_address = 3; +} + +message RegimentMemberLeft { + option (aelf.is_event) = true; + aelf.Address regiment_address = 1; + aelf.Address left_member_address = 2; + aelf.Address operator_address = 3; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/report_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/report_contract.proto new file mode 100644 index 00000000..865dbd4e --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/report_contract.proto @@ -0,0 +1,313 @@ +syntax = "proto3"; + +import "aelf/core.proto"; +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "callback_input.proto"; + +option csharp_namespace = "AElf.Contracts.Report"; + +// the contract definition: a gRPC service definition. +service ReportContract { + option (aelf.csharp_state) = "AElf.Contracts.Report.ReportContractState"; + + rpc Initialize (InitializeInput) returns (google.protobuf.Empty) {} + + rpc QueryOracle (QueryOracleInput) returns (aelf.Hash) {} + + rpc CancelQueryOracle (aelf.Hash) returns (google.protobuf.Empty) {} + + rpc ConfirmReport (ConfirmReportInput) returns (google.protobuf.Empty) {} + + rpc RejectReport (RejectReportInput) returns (google.protobuf.Empty) {} + + rpc AdjustAmercementAmount (google.protobuf.Int64Value) returns (google.protobuf.Empty) {} + + rpc ProposeReport (CallbackInput) returns (Report) {} + + rpc MortgageTokens (google.protobuf.Int64Value) returns (google.protobuf.Empty) {} + + rpc WithdrawTokens (google.protobuf.Int64Value) returns (google.protobuf.Empty) {} + + // Observer management. + + rpc ApplyObserver (ApplyObserverInput) returns (google.protobuf.Empty) {} + + rpc QuitObserver (QuitObserverInput) returns (google.protobuf.Empty) {} + + rpc AdjustApplyObserverFee (google.protobuf.Int64Value) returns (google.protobuf.Empty) {} + + rpc AdjustReportFee (google.protobuf.Int64Value) returns (google.protobuf.Empty) {} + + // Offchain Aggregator Contract management. + + rpc RegisterOffChainAggregation (RegisterOffChainAggregationInput) returns (OffChainAggregationInfo) {} + + rpc BindOffChainAggregation (BindOffChainAggregationInput) returns (OffChainAggregationInfo) {} + + rpc AddOffChainQueryInfo (AddOffChainQueryInfoInput) returns (google.protobuf.Empty) {} + + rpc RemoveOffChainQueryInfo (RemoveOffChainQueryInfoInput) returns (google.protobuf.Empty) {} + + rpc ChangeOffChainQueryInfo (ChangeOffChainQueryInfoInput) returns (google.protobuf.Empty) {} + + rpc AddRegisterWhiteList (aelf.Address) returns (google.protobuf.Empty) {} + + rpc RemoveFromRegisterWhiteList (aelf.Address) returns (google.protobuf.Empty) {} + + rpc ChangeOracleContractAddress (aelf.Address) returns (google.protobuf.Empty) {} + + // Merkle tree style aggregator. + + rpc GetMerklePath (GetMerklePathInput) returns (aelf.MerklePath) { + option (aelf.is_view) = true; + } + + // View methods. + + rpc GetReport (GetReportInput) returns (Report) { + option (aelf.is_view) = true; + } + rpc GetSignature (GetSignatureInput) returns (google.protobuf.StringValue) { + option (aelf.is_view) = true; + } + rpc GetOffChainAggregationInfo (google.protobuf.StringValue) returns (OffChainAggregationInfo) { + option (aelf.is_view) = true; + } + rpc GetReportQueryRecord (aelf.Hash) returns (ReportQueryRecord) { + option (aelf.is_view) = true; + } + rpc GetCurrentRoundId (google.protobuf.StringValue) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + rpc GetRawReport (GetRawReportInput) returns (google.protobuf.StringValue) { + option (aelf.is_view) = true; + } + rpc GenerateRawReport (GenerateRawReportInput) returns (google.protobuf.StringValue) { + option (aelf.is_view) = true; + } + rpc GetSignatureMap (GetSignatureMapInput) returns (SignatureMap) { + option (aelf.is_view) = true; + } + rpc IsInRegisterWhiteList (aelf.Address) returns (google.protobuf.BoolValue) { + option (aelf.is_view) = true; + } + rpc IsObserver (IsObserverInput) returns (google.protobuf.BoolValue) { + option (aelf.is_view) = true; + } + rpc GetMortgagedTokenAmount (aelf.Address) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + rpc GetObserverList (aelf.Address) returns (ObserverList) { + option (aelf.is_view) = true; + } +} + +message InitializeInput { + aelf.Address oracle_contract_address = 1; + int64 report_fee = 2; + int64 apply_observer_fee = 3; + repeated aelf.Address initial_register_white_list = 4; + aelf.Address regiment_contract_address = 5; +} + +message QueryOracleInput { + int64 payment = 1; + string token = 2; + int32 aggregate_threshold = 3; + int32 node_index = 4; +} + +message ConfirmReportInput { + string token = 1; + int64 round_id = 2; + string signature = 3; +} + +message RejectReportInput { + string token = 1; + int64 round_id = 2; + repeated aelf.Address accusing_nodes = 3; +} + +message Report { + aelf.Hash query_id = 1; + int64 round_id = 2; + Observations observations = 3; + bytes aggregated_data = 4; + repeated ObserverList observers = 5; +} + +message ReportQueryRecord { + aelf.Address origin_query_sender = 1; + int64 paid_report_fee = 2; + bool is_rejected = 3; + bool is_all_node_confirmed = 4; + repeated aelf.Address confirmed_node_list = 5; + int64 payment = 6; +} + +message ObserverList { + repeated aelf.Address value = 1; +} + +message ProposeReportInput { + repeated aelf.Hash query_id_list = 1; +} + +message Observations { + repeated Observation value = 1; +} + +message Observation { + string key = 1; + string data = 2; +} + +message GetSignatureInput { + string token = 1; + int64 round_id = 2; + aelf.Address address = 3; +} + +message GetSignatureMapInput { + string token = 1; + int64 round_id = 2; +} + +message SignatureMap { + map value = 1; +} + +message OffChainAggregationInfo { + string token = 1; + OffChainQueryInfoList off_chain_query_info_list = 2; + aelf.Address regiment_address = 3; + bytes config_digest = 4; + int32 aggregate_threshold = 5; + aelf.Address aggregator_contract_address = 6; + repeated int64 round_ids = 7; + string chain_name = 8; + aelf.Address register = 9; + int32 aggregate_option = 10; +} + +message RegisterOffChainAggregationInput { + aelf.Address regiment_address = 1; + OffChainQueryInfoList off_chain_query_info_list = 2; + string token = 3; + bytes config_digest = 4; + int32 aggregate_threshold = 5; + aelf.Address aggregator_contract_address = 6; + string chain_name = 7; + aelf.Address register = 8; + int32 aggregate_option = 9; +} + +message BindOffChainAggregationInput { + repeated aelf.Hash task_id_list = 1; + string chain_name = 2; + string token = 3; + bytes config_digest = 4; +} + +message OffChainQueryInfo { + string title = 1; + repeated string options = 2; +} + +message GetReportInput { + string token = 1; + int64 round_id = 2; +} + +message GetMerklePathInput { + string token = 1; + int64 round_id = 2; + int32 node_index = 3; +} + +message GetRawReportInput{ + string token = 1; + int64 round_id = 2; +} + +message GenerateRawReportInput{ + Report report = 1; + bytes config_digest = 2; + aelf.Address organization = 3; +} + +message OffChainQueryInfoList { + repeated OffChainQueryInfo value = 1; +} + +message AddOffChainQueryInfoInput { + string token = 1; + OffChainQueryInfo off_chain_query_info = 2; +} + +message RemoveOffChainQueryInfoInput { + string token = 1; + int32 remove_node_index = 2; +} + +message ChangeOffChainQueryInfoInput { + string token = 1; + OffChainQueryInfo new_off_chain_query_info = 2; +} + +message ApplyObserverInput { + repeated aelf.Address regiment_address_list = 1; +} + +message QuitObserverInput { + repeated aelf.Address regiment_address_list = 1; +} + +message IsObserverInput { + aelf.Address regiment_address = 1; + aelf.Address oracle_node_address = 2; +} + +// Events + +message ReportProposed { + option (aelf.is_event) = true; + string raw_report = 1; + aelf.Address regiment_address = 2; + string token = 3; + int64 round_id = 4; +} + +message ReportConfirmed { + option (aelf.is_event) = true; + int64 round_id = 1; + string signature = 2; + aelf.Address regiment_address = 3; + string token = 4; + bool is_all_node_confirmed = 5; +} + +message OffChainAggregationRegistered { + option (aelf.is_event) = true; + string token = 1; + OffChainQueryInfoList off_chain_query_info_list = 2; + aelf.Address regiment_address = 3; + bytes config_digest = 4; + int32 aggregate_threshold = 5; + aelf.Address aggregator_contract_address = 6; + string chain_name = 7; + aelf.Address register = 8; + int32 aggregate_option = 9; +} + +message MerkleReportNodeAdded { + option (aelf.is_event) = true; + string token = 1; + int32 node_index = 2; + int64 node_round_id = 3; + string aggregated_data = 4; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/token_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/token_contract.proto new file mode 100644 index 00000000..90c19450 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/token_contract.proto @@ -0,0 +1,782 @@ +/** + * MultiToken contract. + */ +syntax = "proto3"; + +package token; + +import "aelf/core.proto"; +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "AElf.Contracts.MultiToken"; + +service TokenContract { + // Create a new token. + rpc Create (CreateInput) returns (google.protobuf.Empty) { + } + + // Issuing some amount of tokens to an address is the action of increasing that addresses balance + // for the given token. The total amount of issued tokens must not exceed the total supply of the token + // and only the issuer (creator) of the token can issue tokens. + // Issuing tokens effectively increases the circulating supply. + rpc Issue (IssueInput) returns (google.protobuf.Empty) { + } + + // Transferring tokens simply is the action of transferring a given amount of tokens from one address to another. + // The origin or source address is the signer of the transaction. + // The balance of the sender must be higher than the amount that is transferred. + rpc Transfer (TransferInput) returns (google.protobuf.Empty) { + } + + // The TransferFrom action will transfer a specified amount of tokens from one address to another. + // For this operation to succeed the from address needs to have approved (see allowances) enough tokens + // to Sender of this transaction. If successful the amount will be removed from the allowance. + rpc TransferFrom (TransferFromInput) returns (google.protobuf.Empty) { + } + + // The approve action increases the allowance from the Sender to the Spender address, + // enabling the Spender to call TransferFrom. + rpc Approve (ApproveInput) returns (google.protobuf.Empty) { + } + + // This is the reverse operation for Approve, it will decrease the allowance. + rpc UnApprove (UnApproveInput) returns (google.protobuf.Empty) { + } + + // This method can be used to lock tokens. + rpc Lock (LockInput) returns (google.protobuf.Empty) { + } + + // This is the reverse operation of locking, it un-locks some previously locked tokens. + rpc Unlock (UnlockInput) returns (google.protobuf.Empty) { + } + + // This action will burn the specified amount of tokens, removing them from the token’s Supply. + rpc Burn (BurnInput) returns (google.protobuf.Empty) { + } + + // Change the issuer of the specified token. Only the original issuer can change it. + rpc ChangeTokenIssuer (ChangeTokenIssuerInput) returns (google.protobuf.Empty) { + } + + // Set the primary token of side chain. + rpc SetPrimaryTokenSymbol (SetPrimaryTokenSymbolInput) returns (google.protobuf.Empty) { + } + + // This interface is used for cross-chain transfer. + rpc CrossChainTransfer (CrossChainTransferInput) returns (google.protobuf.Empty) { + } + + // This method is used to receive cross-chain transfers. + rpc CrossChainReceiveToken (CrossChainReceiveTokenInput) returns (google.protobuf.Empty) { + } + + // The side chain creates tokens. + rpc CrossChainCreateToken(CrossChainCreateTokenInput) returns (google.protobuf.Empty) { + } + + // When the side chain is started, the side chain is initialized with the parent chain information. + rpc InitializeFromParentChain (InitializeFromParentChainInput) returns (google.protobuf.Empty) { + } + + // Handle the transaction fees charged by ChargeTransactionFees. + rpc ClaimTransactionFees (TotalTransactionFeesMap) returns (google.protobuf.Empty) { + } + + // Used to collect transaction fees. + rpc ChargeTransactionFees (ChargeTransactionFeesInput) returns (ChargeTransactionFeesOutput) { + } + + // Check the token threshold. + rpc CheckThreshold (CheckThresholdInput) returns (google.protobuf.Empty) { + } + + // Initialize coefficients of every type of tokens supporting charging fee. + rpc InitialCoefficients (google.protobuf.Empty) returns (google.protobuf.Empty){ + } + + // Processing resource token received. + rpc DonateResourceToken (TotalResourceTokensMaps) returns (google.protobuf.Empty) { + } + + // A transaction resource fee is charged to implement the ACS8 standards. + rpc ChargeResourceToken (ChargeResourceTokenInput) returns (google.protobuf.Empty) { + } + + // Verify that the resource token are sufficient. + rpc CheckResourceToken (google.protobuf.Empty) returns (google.protobuf.Empty) { + } + + // Set the list of tokens to pay transaction fees. + rpc SetSymbolsToPayTxSizeFee (SymbolListToPayTxSizeFee) returns (google.protobuf.Empty){ + } + + // Update the coefficient of the transaction fee calculation formula. + rpc UpdateCoefficientsForSender (UpdateCoefficientsInput) returns (google.protobuf.Empty) { + } + + // Update the coefficient of the transaction fee calculation formula. + rpc UpdateCoefficientsForContract (UpdateCoefficientsInput) returns (google.protobuf.Empty) { + } + + // This method is used to initialize the governance organization for some functions, + // including: the coefficient of the user transaction fee calculation formula, + // the coefficient of the contract developer resource fee calculation formula, and the side chain rental fee. + rpc InitializeAuthorizedController (google.protobuf.Empty) returns (google.protobuf.Empty){ + } + + rpc ResetExternalInfo (ResetExternalInfoInput) returns (google.protobuf.Empty){ + } + + rpc AddAddressToCreateTokenWhiteList (aelf.Address) returns (google.protobuf.Empty) { + } + rpc RemoveAddressFromCreateTokenWhiteList (aelf.Address) returns (google.protobuf.Empty) { + } + + // Query token information. + rpc GetTokenInfo (GetTokenInfoInput) returns (TokenInfo) { + option (aelf.is_view) = true; + } + + // Query native token information. + rpc GetNativeTokenInfo (google.protobuf.Empty) returns (TokenInfo) { + option (aelf.is_view) = true; + } + + // Query resource token information. + rpc GetResourceTokenInfo (google.protobuf.Empty) returns (TokenInfoList) { + option (aelf.is_view) = true; + } + + // Query the balance at the specified address. + rpc GetBalance (GetBalanceInput) returns (GetBalanceOutput) { + option (aelf.is_view) = true; + } + + // Query the account's allowance for other addresses + rpc GetAllowance (GetAllowanceInput) returns (GetAllowanceOutput) { + option (aelf.is_view) = true; + } + + // Check whether the token is in the whitelist of an address, + // which can be called TransferFrom to transfer the token under the condition of not being credited. + rpc IsInWhiteList (IsInWhiteListInput) returns (google.protobuf.BoolValue) { + option (aelf.is_view) = true; + } + + // Query the information for a lock. + rpc GetLockedAmount (GetLockedAmountInput) returns (GetLockedAmountOutput) { + option (aelf.is_view) = true; + } + + // Query the address of receiving token in cross-chain transfer. + rpc GetCrossChainTransferTokenContractAddress (GetCrossChainTransferTokenContractAddressInput) returns (aelf.Address) { + option (aelf.is_view) = true; + } + + // Query the name of the primary Token. + rpc GetPrimaryTokenSymbol (google.protobuf.Empty) returns (google.protobuf.StringValue) { + option (aelf.is_view) = true; + } + + // Query the coefficient of the transaction fee calculation formula. + rpc GetCalculateFeeCoefficientsForContract (google.protobuf.Int32Value) returns (CalculateFeeCoefficients) { + option (aelf.is_view) = true; + } + + // Query the coefficient of the transaction fee calculation formula. + rpc GetCalculateFeeCoefficientsForSender (google.protobuf.Empty) returns (CalculateFeeCoefficients) { + option (aelf.is_view) = true; + } + + // Query tokens that can pay transaction fees. + rpc GetSymbolsToPayTxSizeFee (google.protobuf.Empty) returns (SymbolListToPayTxSizeFee){ + option (aelf.is_view) = true; + } + + // Query the hash of the last input of ClaimTransactionFees. + rpc GetLatestTotalTransactionFeesMapHash (google.protobuf.Empty) returns (aelf.Hash){ + option (aelf.is_view) = true; + } + + // Query the hash of the last input of DonateResourceToken. + rpc GetLatestTotalResourceTokensMapsHash (google.protobuf.Empty) returns (aelf.Hash){ + option (aelf.is_view) = true; + } + rpc IsTokenAvailableForMethodFee (google.protobuf.StringValue) returns (google.protobuf.BoolValue) { + option (aelf.is_view) = true; + } + rpc IsInCreateTokenWhiteList (aelf.Address) returns (google.protobuf.BoolValue) { + option (aelf.is_view) = true; + } + rpc GetReservedExternalInfoKeyList (google.protobuf.Empty) returns (StringList) { + option (aelf.is_view) = true; + } +} + +message TokenInfo { + // The symbol of the token.f + string symbol = 1; + // The full name of the token. + string token_name = 2; + // The current supply of the token. + int64 supply = 3; + // The total supply of the token. + int64 total_supply = 4; + // The precision of the token. + int32 decimals = 5; + // The address that created the token. + aelf.Address issuer = 6; + // A flag indicating if this token is burnable. + bool is_burnable = 7; + // The chain id of the token. + int32 issue_chain_id = 8; + // The amount of issued tokens. + int64 issued = 9; + // The external information of the token. + ExternalInfo external_info = 10; +} + +message ExternalInfo { + map value = 1; +} + +message CreateInput { + // The symbol of the token. + string symbol = 1; + // The full name of the token. + string token_name = 2; + // The total supply of the token. + int64 total_supply = 3; + // The precision of the token + int32 decimals = 4; + // The address that created the token. + aelf.Address issuer = 5; + // A flag indicating if this token is burnable. + bool is_burnable = 6; + // A whitelist address list used to lock tokens. + repeated aelf.Address lock_white_list = 7; + // The chain id of the token. + int32 issue_chain_id = 8; + // The external information of the token. + ExternalInfo external_info = 9; +} + +message SetPrimaryTokenSymbolInput { + // The symbol of the token. + string symbol = 1; +} + +message IssueInput { + // The token symbol to issue. + string symbol = 1; + // The token amount to issue. + int64 amount = 2; + // The memo. + string memo = 3; + // The target address to issue. + aelf.Address to = 4; +} + +message TransferInput { + // The receiver of the token. + aelf.Address to = 1; + // The token symbol to transfer. + string symbol = 2; + // The amount to to transfer. + int64 amount = 3; + // The memo. + string memo = 4; +} + +message LockInput { + // The one want to lock his token. + aelf.Address address = 1; + // Id of the lock. + aelf.Hash lock_id = 2; + // The symbol of the token to lock. + string symbol = 3; + // a memo. + string usage = 4; + // The amount of tokens to lock. + int64 amount = 5; +} + +message UnlockInput { + // The one want to un-lock his token. + aelf.Address address = 1; + // Id of the lock. + aelf.Hash lock_id = 2; + // The symbol of the token to un-lock. + string symbol = 3; + // a memo. + string usage = 4; + // The amount of tokens to un-lock. + int64 amount = 5; +} + +message TransferFromInput { + // The source address of the token. + aelf.Address from = 1; + // The destination address of the token. + aelf.Address to = 2; + // The symbol of the token to transfer. + string symbol = 3; + // The amount to transfer. + int64 amount = 4; + // The memo. + string memo = 5; +} + +message ApproveInput { + // The address that allowance will be increased. + aelf.Address spender = 1; + // The symbol of token to approve. + string symbol = 2; + // The amount of token to approve. + int64 amount = 3; +} + +message UnApproveInput { + // The address that allowance will be decreased. + aelf.Address spender = 1; + // The symbol of token to un-approve. + string symbol = 2; + // The amount of token to un-approve. + int64 amount = 3; +} + +message BurnInput { + // The symbol of token to burn. + string symbol = 1; + // The amount of token to burn. + int64 amount = 2; +} + +message ChargeResourceTokenInput { + // Collection of charge resource token, Symbol->Amount. + map cost_dic = 1; + // The sender of the transaction. + aelf.Address caller = 2; +} + +message TransactionFeeBill { + // The transaction fee dictionary, Symbol->fee. + map fees_map = 1; +} + +message CheckThresholdInput { + // The sender of the transaction. + aelf.Address sender = 1; + // The threshold to set, Symbol->Threshold. + map symbol_to_threshold = 2; + // Whether to check the allowance. + bool is_check_allowance = 3; +} + +message GetTokenInfoInput { + // The symbol of token. + string symbol = 1; +} + +message GetBalanceInput { + // The symbol of token. + string symbol = 1; + // The target address of the query. + aelf.Address owner = 2; +} + +message GetBalanceOutput { + // The symbol of token. + string symbol = 1; + // The target address of the query. + aelf.Address owner = 2; + // The balance of the owner. + int64 balance = 3; +} + +message GetAllowanceInput { + // The symbol of token. + string symbol = 1; + // The address of the token owner. + aelf.Address owner = 2; + // The address of the spender. + aelf.Address spender = 3; +} + +message GetAllowanceOutput { + // The symbol of token. + string symbol = 1; + // The address of the token owner. + aelf.Address owner = 2; + // The address of the spender. + aelf.Address spender = 3; + // The amount of allowance. + int64 allowance = 4; +} + +message CrossChainTransferInput { + // The receiver of transfer. + aelf.Address to = 1; + // The symbol of token. + string symbol = 2; + // The amount of token to transfer. + int64 amount = 3; + // The memo. + string memo = 4; + // The destination chain id. + int32 to_chain_id = 5; + // The chain id of the token. + int32 issue_chain_id = 6; +} + +message CrossChainReceiveTokenInput { + // The source chain id. + int32 from_chain_id = 1; + // The height of the transfer transaction. + int64 parent_chain_height = 2; + // The raw bytes of the transfer transaction. + bytes transfer_transaction_bytes = 3; + // The merkle path created from the transfer transaction. + aelf.MerklePath merkle_path = 4; +} + +message IsInWhiteListInput { + // The symbol of token. + string symbol = 1; + // The address to check. + aelf.Address address = 2; +} + +message SymbolToPayTxSizeFee{ + // The symbol of token. + string token_symbol = 1; + // The charge weight of primary token. + int32 base_token_weight = 2; + // The new added token charge weight. For example, the charge weight of primary Token is set to 1. + // The newly added token charge weight is set to 10. If the transaction requires 1 unit of primary token, + // the user can also pay for 10 newly added tokens. + int32 added_token_weight = 3; +} + +message SymbolListToPayTxSizeFee{ + // Transaction fee token information. + repeated SymbolToPayTxSizeFee symbols_to_pay_tx_size_fee = 1; +} + +message ChargeTransactionFeesInput { + // The method name of transaction. + string method_name = 1; + // The contract address of transaction. + aelf.Address contract_address = 2; + // The amount of transaction size fee. + int64 transaction_size_fee = 3; + // Transaction fee token information. + repeated SymbolToPayTxSizeFee symbols_to_pay_tx_size_fee = 4; +} + +message ChargeTransactionFeesOutput { + // Whether the charge was successful. + bool success = 1; + // The charging information. + string charging_information = 2; +} + +message CallbackInfo { + aelf.Address contract_address = 1; + string method_name = 2; +} + +message ExtraTokenListModified { + option (aelf.is_event) = true; + // Transaction fee token information. + SymbolListToPayTxSizeFee symbol_list_to_pay_tx_size_fee = 1; +} + +message GetLockedAmountInput { + // The address of the lock. + aelf.Address address = 1; + // The token symbol. + string symbol = 2; + // The id of the lock. + aelf.Hash lock_id = 3; +} + +message GetLockedAmountOutput { + // The address of the lock. + aelf.Address address = 1; + // The token symbol. + string symbol = 2; + // The id of the lock. + aelf.Hash lock_id = 3; + // The locked amount. + int64 amount = 4; +} + +message TokenInfoList { + // List of token information. + repeated TokenInfo value = 1; +} + +message GetCrossChainTransferTokenContractAddressInput { + // The chain id. + int32 chainId = 1; +} + +message CrossChainCreateTokenInput { + // The chain id of the chain on which the token was created. + int32 from_chain_id = 1; + // The height of the transaction that created the token. + int64 parent_chain_height = 2; + // The transaction that created the token. + bytes transaction_bytes = 3; + // The merkle path created from the transaction that created the transaction. + aelf.MerklePath merkle_path = 4; +} + +message InitializeFromParentChainInput { + // The amount of resource. + map resource_amount = 1; + // The token contract addresses. + map registered_other_token_contract_addresses = 2; + // The creator the side chain. + aelf.Address creator = 3; +} + +message UpdateCoefficientsInput { + // The specify pieces gonna update. + repeated int32 piece_numbers = 1; + // Coefficients of one single type. + CalculateFeeCoefficients coefficients = 2; +} + +enum FeeTypeEnum { + READ = 0; + STORAGE = 1; + WRITE = 2; + TRAFFIC = 3; + TX = 4; +} + +message CalculateFeePieceCoefficients { + // Coefficients of one single piece. + // The first char is its type: liner / power. + // The second char is its piece upper bound. + repeated int32 value = 1; +} + +message CalculateFeeCoefficients { + // The resource fee type, like READ, WRITE, etc. + int32 fee_token_type = 1; + // Coefficients of one single piece. + repeated CalculateFeePieceCoefficients piece_coefficients_list = 2; +} + +message AllCalculateFeeCoefficients { + // The coefficients of fee Calculation. + repeated CalculateFeeCoefficients value = 1; +} + +message TotalTransactionFeesMap +{ + // Token dictionary that charge transaction fee, Symbol->Amount. + map value = 1; + // The hash of the block processing the transaction. + aelf.Hash block_hash = 2; + // The height of the block processing the transaction. + int64 block_height = 3; +} + +message TotalResourceTokensMaps { + // Resource tokens to charge. + repeated ContractTotalResourceTokens value = 1; + // The hash of the block processing the transaction. + aelf.Hash block_hash = 2; + // The height of the block processing the transaction. + int64 block_height = 3; +} + +message ContractTotalResourceTokens { + // The contract address. + aelf.Address contract_address = 1; + // Resource tokens to charge. + TotalResourceTokensMap tokens_map = 2; +} + +message TotalResourceTokensMap +{ + // Resource token dictionary, Symbol->Amount. + map value = 1; +} + +message ChangeTokenIssuerInput +{ + // The token symbol. + string symbol = 1; + // The new token issuer for change. + aelf.Address new_token_Issuer = 2; +} + +message ResetExternalInfoInput { + string symbol = 1; + ExternalInfo external_info = 2; +} + +message StringList { + repeated string value = 1; +} + +message Transferred { + option (aelf.is_event) = true; + // The source address of the transferred token. + aelf.Address from = 1 [(aelf.is_indexed) = true]; + // The destination address of the transferred token. + aelf.Address to = 2 [(aelf.is_indexed) = true]; + // The symbol of the transferred token. + string symbol = 3 [(aelf.is_indexed) = true]; + // The amount of the transferred token. + int64 amount = 4; + // The memo. + string memo = 5; +} + +message Approved { + option (aelf.is_event) = true; + // The address of the token owner. + aelf.Address owner = 1 [(aelf.is_indexed) = true]; + // The address that allowance be increased. + aelf.Address spender = 2 [(aelf.is_indexed) = true]; + // The symbol of approved token. + string symbol = 3 [(aelf.is_indexed) = true]; + // The amount of approved token. + int64 amount = 4; +} + +message UnApproved { + option (aelf.is_event) = true; + // The address of the token owner. + aelf.Address owner = 1 [(aelf.is_indexed) = true]; + // The address that allowance be decreased. + aelf.Address spender = 2 [(aelf.is_indexed) = true]; + // The symbol of un-approved token. + string symbol = 3 [(aelf.is_indexed) = true]; + // The amount of un-approved token. + int64 amount = 4; +} + +message Burned +{ + option (aelf.is_event) = true; + // The address who wants to burn token. + aelf.Address burner = 1 [(aelf.is_indexed) = true]; + // The symbol of burned token. + string symbol = 2 [(aelf.is_indexed) = true]; + // The amount of burned token. + int64 amount = 3; +} + +message ChainPrimaryTokenSymbolSet { + option (aelf.is_event) = true; + // The symbol of token. + string token_symbol = 1; +} + +message CalculateFeeAlgorithmUpdated { + option (aelf.is_event) = true; + // All calculate fee coefficients after modification. + AllCalculateFeeCoefficients all_type_fee_coefficients = 1; +} + +message RentalCharged { + option (aelf.is_event) = true; + // The symbol of rental fee charged. + string symbol = 1; + // The amount of rental fee charged. + int64 amount = 2; +} + +message RentalAccountBalanceInsufficient { + option (aelf.is_event) = true; + // The symbol of insufficient rental account balance. + string symbol = 1; + // The balance of the account. + int64 amount = 2; +} + +message TokenCreated { + option (aelf.is_event) = true; + // The symbol of the token. + string symbol = 1; + // The full name of the token. + string token_name = 2; + // The total supply of the token. + int64 total_supply = 3; + // The precision of the token. + int32 decimals = 4; + // The address that created the token. + aelf.Address issuer = 5; + // A flag indicating if this token is burnable. + bool is_burnable = 6; + // The chain id of the token. + int32 issue_chain_id = 7; + // The external information of the token. + ExternalInfo external_info = 8; +} + +message Issued { + option (aelf.is_event) = true; + // The symbol of issued token. + string symbol = 1; + // The amount of issued token. + int64 amount = 2; + // The memo. + string memo = 3; + // The issued target address. + aelf.Address to = 4; +} + +message CrossChainTransferred { + option (aelf.is_event) = true; + // The source address of the transferred token. + aelf.Address from = 1; + // The destination address of the transferred token. + aelf.Address to = 2; + // The symbol of the transferred token. + string symbol = 3; + // The amount of the transferred token. + int64 amount = 4; + // The memo. + string memo = 5; + // The destination chain id. + int32 to_chain_id = 6; + // The chain id of the token. + int32 issue_chain_id = 7; +} + +message CrossChainReceived { + option (aelf.is_event) = true; + // The source address of the transferred token. + aelf.Address from = 1; + // The destination address of the transferred token. + aelf.Address to = 2; + // The symbol of the received token. + string symbol = 3; + // The amount of the received token. + int64 amount = 4; + // The memo. + string memo = 5; + // The destination chain id. + int32 from_chain_id = 6; + // The chain id of the token. + int32 issue_chain_id = 7; + // The parent chain height of the transfer transaction. + int64 parent_chain_height = 8; +} + +message ExternalInfoChanged { + option (aelf.is_event) = true; + string symbol = 1; + ExternalInfo external_info = 2; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/token_contract_impl.proto b/modules/AElf.Client.Protobuf/Protobuf/token_contract_impl.proto new file mode 100644 index 00000000..cfc91fcf --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/token_contract_impl.proto @@ -0,0 +1,240 @@ +/** + * MultiToken contract. + * + * The MultiToken contract is mainly used to manage the user's account and transaction fees related Settings. + * + * Implement AElf Standards ACS1 and ACS2. + */ +syntax = "proto3"; + +package tokenimpl; + +import "aelf/core.proto"; +import "acs1.proto"; +import "acs2.proto"; +import "token_contract.proto"; +// Because implementation uses this proto file. +import "transaction_fee.proto"; +import "authority_info.proto"; + +option csharp_namespace = "AElf.Contracts.MultiToken"; + +service TokenContractImpl { + option (aelf.csharp_state) = "AElf.Contracts.MultiToken.TokenContractState"; + option (aelf.base) = "acs1.proto"; + option (aelf.base) = "acs2.proto"; + option (aelf.base) = "token_contract.proto"; + + // Transfer resource tokens to designated contract address. + rpc AdvanceResourceToken (AdvanceResourceTokenInput) returns (google.protobuf.Empty) { + } + + // Take token from contract address. + rpc TakeResourceTokenBack (TakeResourceTokenBackInput) returns (google.protobuf.Empty) { + } + + // Register the token contract address for cross chain. + rpc RegisterCrossChainTokenContractAddress (RegisterCrossChainTokenContractAddressInput) returns (google.protobuf.Empty) { + } + + // Set the receiver address of the side chain transaction fee. + rpc SetFeeReceiver (aelf.Address) returns (google.protobuf.Empty) { + } + + // Validates if the token exist. + rpc ValidateTokenInfoExists(ValidateTokenInfoExistsInput) returns (google.protobuf.Empty){ + } + + // Update the rental unit price of the side chain. + rpc UpdateRental (UpdateRentalInput) returns (google.protobuf.Empty) { + } + + // Set the amount of resources fee per minute for the side chain. + rpc UpdateRentedResources (UpdateRentedResourcesInput) returns (google.protobuf.Empty) { + } + + // Transfer Token to the specified contract. + rpc TransferToContract (TransferToContractInput) returns (google.protobuf.Empty) { + } + + // Change the governance organization of side chain rental. + rpc ChangeSideChainRentalController (AuthorityInfo) returns (google.protobuf.Empty) { + } + + // Change the governance organization for tokens to pay transaction fees. + rpc ChangeSymbolsToPayTXSizeFeeController(AuthorityInfo) returns (google.protobuf.Empty){ + } + + // Change the governance organization for cross-chain token contract address registration. + rpc ChangeCrossChainTokenContractRegistrationController (AuthorityInfo) returns (google.protobuf.Empty) { + } + + // Change the governance organization of the coefficient of the user transaction fee calculation formula. + rpc ChangeUserFeeController (AuthorityInfo) returns (google.protobuf.Empty) { + } + + // Change the governance organization of the coefficient of the developer's transaction resource fee calculation formula. + rpc ChangeDeveloperController (AuthorityInfo) returns (google.protobuf.Empty) { + } + + // Get the address of fee receiver. + rpc GetFeeReceiver (google.protobuf.Empty) returns (aelf.Address){ + option (aelf.is_view) = true; + } + + // Query the amount of resources usage currently. + rpc GetResourceUsage (google.protobuf.Empty) returns (ResourceUsage) { + option (aelf.is_view) = true; + } + + // Query the governance organization for tokens to pay transaction fees. + rpc GetSymbolsToPayTXSizeFeeController(google.protobuf.Empty) returns (AuthorityInfo){ + option (aelf.is_view) = true; + } + + // Query the governance organization of the + rpc GetCrossChainTokenContractRegistrationController (google.protobuf.Empty) returns (AuthorityInfo) { + option (aelf.is_view) = true; + } + + // Query the governance organization that calculates the formula coefficient + // for the transaction cost the user sends the contract. + rpc GetUserFeeController(google.protobuf.Empty) returns (UserFeeController){ + option (aelf.is_view) = true; + } + + // Query the governing organization of the formula coefficients for calculating developer contract transaction fee. + rpc GetDeveloperFeeController (google.protobuf.Empty) returns (DeveloperFeeController) { + option (aelf.is_view) = true; + } + + // Query the organization that governs the side chain rental fee. + rpc GetSideChainRentalControllerCreateInfo (google.protobuf.Empty) returns (AuthorityInfo) { + option (aelf.is_view) = true; + } + + // Compute the virtual address for locking. + rpc GetVirtualAddressForLocking (GetVirtualAddressForLockingInput) returns (aelf.Address) { + option (aelf.is_view) = true; + } + + // Query how much resource tokens should be paid currently. + rpc GetOwningRental (google.protobuf.Empty) returns (OwningRental) { + option (aelf.is_view) = true; + } + + // Query the unit price of the side chain resource cost, resource cost = unit price * quantity, + // the quantity can be queried through GetResourceUsage. + rpc GetOwningRentalUnitValue (google.protobuf.Empty) returns (OwningRentalUnitValue) { + option (aelf.is_view) = true; + } +} + +message AdvanceResourceTokenInput { + // The contract address to transfer. + aelf.Address contract_address = 1; + // The resource token symbol to transfer. + string resource_token_symbol = 2; + // The amount of resource token to transfer. + int64 amount = 3; +} + +message TakeResourceTokenBackInput { + // The contract address to take back. + aelf.Address contract_address = 1; + // The resource token symbol to take back. + string resource_token_symbol = 2; + // The amount of resource token to take back. + int64 amount = 3; +} + +message RegisterCrossChainTokenContractAddressInput{ + // The source chain id. + int32 from_chain_id = 1; + // The parent chain height of the transaction. + int64 parent_chain_height = 2; + // The raw bytes of the transfer transaction. + bytes transaction_bytes = 3; + // The merkle path created from the transaction. + aelf.MerklePath merkle_path = 4; + // The token contract address. + aelf.Address token_contract_address = 5; +} + +message ValidateTokenInfoExistsInput{ + // The symbol of the token. + string symbol = 1; + // The full name of the token. + string token_name = 2; + // The total supply of the token. + int64 total_supply = 3; + // The precision of the token. + int32 decimals = 4; + // The address that created the token. + aelf.Address issuer = 5; + // A flag indicating if this token is burnable. + bool is_burnable = 6; + // The chain id of the token. + int32 issue_chain_id = 7; + // The external information of the token. + map external_info = 8; +} + +message UpdateRentalInput { + // The unit price of resource tokens, symbol -> unit price. + map rental = 1; +} + +message UpdateRentedResourcesInput { + // Amount of resource tokens consumed per minute, symbol -> resource consumption. + map resource_amount = 1; +} + +message ResourceUsage { + // The amount of resource tokens usage, symbol -> amount. + map value = 1; +} + +message GetVirtualAddressForLockingInput { + // The address of the lock. + aelf.Address address = 1; + // The id of the lock. + aelf.Hash lock_id = 2; +} + +message OwningRental { + // The amount of resource tokens owed, symbol -> amount. + map resource_amount = 1; +} + +message OwningRentalUnitValue { + // Resource unit price, symbol -> unit price. + map resource_unit_value = 1; +} + +message TransferToContractInput { + // The symbol of token. + string symbol = 1; + // The amount of token. + int64 amount = 2; + // The memo. + string memo = 3; +} + +message UserFeeController{ + // The association that governs the organization. + AuthorityInfo root_controller = 1; + // The parliament organization of members. + AuthorityInfo parliament_controller = 2; + // The referendum organization of members. + AuthorityInfo referendum_controller = 3; +} + +message DeveloperFeeController { + // The association that governs the organization. + AuthorityInfo root_controller = 1; + // The parliament organization of members. + AuthorityInfo parliament_controller = 2; + // The developer organization of members. + AuthorityInfo developer_controller = 3; +} diff --git a/modules/AElf.Client.Protobuf/Protobuf/token_converter_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/token_converter_contract.proto new file mode 100644 index 00000000..af6e99c1 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/token_converter_contract.proto @@ -0,0 +1,193 @@ +/** + * TokenConvert contract. + */ +syntax = "proto3"; + +package TokenConverter; + +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; +import "aelf/core.proto"; +import "authority_info.proto"; + +option csharp_namespace = "AElf.Contracts.TokenConverter"; + +service TokenConverterContract { + + option (aelf.csharp_state) = "AElf.Contracts.TokenConverter.TokenConverterContractState"; + + // Initialize TokenConvert contract. + rpc Initialize (InitializeInput) returns (google.protobuf.Empty) { + } + + rpc SetConnector (Connector) returns (google.protobuf.Empty) { + } + + // After establishing bancor model of token and base token, you can buy token through this method. + rpc Buy (BuyInput) returns (google.protobuf.Empty) { + } + + // After establishing bancor model of token and base token, you can sell token through this method. + rpc Sell (SellInput) returns (google.protobuf.Empty) { + } + + // Set the fee rate for buy/sell (fee amount = cost * feeRate). + rpc SetFeeRate (google.protobuf.StringValue) returns (google.protobuf.Empty) { + } + + // Before calling the EnableConnector, the connector controller can update the pair connector through this method. + rpc UpdateConnector(Connector) returns (google.protobuf.Empty){ + } + + // Add a pair connector for new token and the base token. + rpc AddPairConnector(PairConnectorParam) returns (google.protobuf.Empty){ + } + + // After adding a pair, you need to call this method to enable it before buy and sell token. + rpc EnableConnector (ToBeConnectedTokenInfo) returns (google.protobuf.Empty) { + } + + // Set the governance authority information for TokenConvert contract. + rpc ChangeConnectorController (AuthorityInfo) returns (google.protobuf.Empty) { + } + + // Query the pair connector according to token symbol. + rpc GetPairConnector (TokenSymbol) returns (PairConnector) { + option (aelf.is_view) = true; + } + + // Query the fee rate for buy/sell. + rpc GetFeeRate (google.protobuf.Empty) returns (google.protobuf.StringValue) { + option (aelf.is_view) = true; + } + + // Query the symbol of base token. + rpc GetBaseTokenSymbol (google.protobuf.Empty) returns (TokenSymbol) { + option (aelf.is_view) = true; + } + + // Query how much the base token need be deposited before enabling the connector. + rpc GetNeededDeposit(ToBeConnectedTokenInfo) returns (DepositInfo) { + option (aelf.is_view) = true; + } + + // Query how much the base token have been deposited. + rpc GetDepositConnectorBalance(google.protobuf.StringValue) returns (google.protobuf.Int64Value){ + option (aelf.is_view) = true; + } + + // Query the governance authority information for TokenConvert contract. + rpc GetControllerForManageConnector (google.protobuf.Empty) returns (AuthorityInfo) { + option (aelf.is_view) = true; + } + + // Query whether the token can be sold. + rpc IsSymbolAbleToSell (google.protobuf.StringValue) returns (google.protobuf.BoolValue) { + option (aelf.is_view) = true; + } +} + +message Connector { + // The token symbol. + string symbol = 1; + // The virtual balance for base token. + int64 virtual_balance = 2; + // The calculated weight value for this Connector. + string weight = 3; + // Whether to use Virtual Balance. + bool is_virtual_balance_enabled = 4; + // Whether the connector is enabled. + bool is_purchase_enabled = 5; + // Indicates its related connector, the pair connector includes a new created token connector and the base token connector. + string related_symbol = 6; + // Indicates if the connector is base token connector. + bool is_deposit_account = 7; +} + +message TokenSymbol { + // The token symbol. + string symbol = 1; +} + +message InitializeInput { + // Base token symbol, default is the native token symbol. + string base_token_symbol = 1; + // The fee rate for buy/sell. + string fee_rate = 2; + // The default added connectors. + repeated Connector connectors = 3; +} + +message BuyInput { + // The token symbol you want to buy. + string symbol = 1; + // The amount you want to buy. + int64 amount = 2; + // Limit of cost. If the token required for buy exceeds this value, the buy will be abandoned. + // And 0 is no limit. + int64 pay_limit = 3; +} + +message SellInput { + // The token symbol you want to sell. + string symbol = 1; + // The amount you want to sell. + int64 amount = 2; + // Limits on tokens obtained by selling. If the token obtained is less than this value, the sale will be abandoned. + // And 0 is no limit. + int64 receive_limit = 3; +} + +message TokenBought { + option (aelf.is_event) = true; + // The token symbol bought. + string symbol = 1 [(aelf.is_indexed) = true]; + // The amount bought. + int64 bought_amount = 2; + // The total cost of the base token. + int64 base_amount = 3; + // The fee amount. + int64 fee_amount =4; +} + +message TokenSold { + option (aelf.is_event) = true; + // The token symbol sold. + string symbol = 1 [(aelf.is_indexed) = true]; + // The amount sold. + int64 sold_amount = 2; + // The total received of the base token. + int64 base_amount = 3; + // The fee amount. + int64 fee_amount =4; +} +message PairConnectorParam { + // The token symbol. + string resource_connector_symbol = 1; + // The weight value of this token in the Bancor model. + string resource_weight = 2; + // This token corresponds to the value of base token. + int64 native_virtual_balance = 3; + // The weight value of base token in Bancor model. + string native_weight = 4; +} + +message ToBeConnectedTokenInfo{ + // The token symbol. + string token_symbol = 1; + // Specifies the number of tokens to convert to the TokenConvert contract. + int64 amount_to_token_convert = 2; +} +message DepositInfo{ + // How much more base Token is needed as the deposit. + int64 need_amount = 1; + // How many tokens are not on the TokenConvert address. + int64 amount_out_of_token_convert = 2; +} +message PairConnector{ + // The connector of the specified token. + Connector resource_connector = 1; + // The related connector. + Connector deposit_connector = 2; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/token_holder_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/token_holder_contract.proto new file mode 100644 index 00000000..53fd16c4 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/token_holder_contract.proto @@ -0,0 +1,132 @@ +/** + * TokenHolder contract. + */ +syntax = "proto3"; + +package TokenHolder; + +import "aelf/core.proto"; +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "AElf.Contracts.TokenHolder"; + +service TokenHolderContract { + + option (aelf.csharp_state) = "AElf.Contracts.TokenHolder.TokenHolderContractState"; + + // Create a scheme for distributing bonus. + rpc CreateScheme (CreateTokenHolderProfitSchemeInput) returns (google.protobuf.Empty) { + } + + // Add a beneficiary to a scheme. + rpc AddBeneficiary (AddTokenHolderBeneficiaryInput) returns (google.protobuf.Empty) { + } + + // Removes a beneficiary from a scheme. + // Note: amount > 0: update the weight of the beneficiary, amount = 0: remove the beneficiary. + rpc RemoveBeneficiary (RemoveTokenHolderBeneficiaryInput) returns (google.protobuf.Empty) { + } + + // Contribute profit to a scheme. + rpc ContributeProfits (ContributeProfitsInput) returns (google.protobuf.Empty) { + } + + // To distribute the profits of the scheme, the stakeholders of the project may go to receive dividends. + rpc DistributeProfits (DistributeProfitsInput) returns (google.protobuf.Empty) { + } + + // The user registers a bonus project. + rpc RegisterForProfits (RegisterForProfitsInput) returns (google.protobuf.Empty) { + } + + // After the lockup time expires, the user can withdraw token. + rpc Withdraw (aelf.Address) returns (google.protobuf.Empty) { + } + + // After DistributeProfits the holder can get his dividend. + rpc ClaimProfits (ClaimProfitsInput) returns (google.protobuf.Empty) { + } + + // Query the details of the specified scheme. + rpc GetScheme (aelf.Address) returns (TokenHolderProfitScheme) { + option (aelf.is_view) = true; + } + + // Query the dividends available to the holder. + rpc GetProfitsMap (ClaimProfitsInput) returns (ReceivedProfitsMap) { + option (aelf.is_view) = true; + } +} + +message CreateTokenHolderProfitSchemeInput { + // The token symbol. + string symbol = 1; + // Minimum lock time for holding token. + int64 minimum_lock_minutes = 2; + // Threshold setting for releasing dividends. + map auto_distribute_threshold = 3; +} + +message AddTokenHolderBeneficiaryInput { + // Beneficiary's address. + aelf.Address beneficiary = 1; + // The weight of the beneficiary's dividends in the scheme. + int64 shares = 2; +} + +message RemoveTokenHolderBeneficiaryInput { + // Beneficiary's address. + aelf.Address beneficiary = 1; + // The amount of weights to remove. + int64 amount = 2; +} + +message ContributeProfitsInput { + // The manager of the scheme. + aelf.Address scheme_manager = 1; + // The amount of token to contribute. + int64 amount = 2; + // The symbol of token to contribute. + string symbol = 3; +} + +message DistributeProfitsInput { + // The manager of the scheme. + aelf.Address scheme_manager = 1; + // The token to distribute, symbol -> amount. + map amounts_map = 2; +} + +message RegisterForProfitsInput { + // The manager of the scheme. + aelf.Address scheme_manager = 1; + // The amount of token holding. + int64 amount = 2; +} + +message ClaimProfitsInput { + // The manager of the scheme. + aelf.Address scheme_manager = 1; + // Beneficiary's address. + aelf.Address beneficiary = 2; +} + +message TokenHolderProfitScheme { + // The token symbol. + string symbol = 1; + // The scheme id. + aelf.Hash scheme_id = 2; + // The current dividend period. + int64 period = 3; + // Minimum lock time for holding token. + int64 minimum_lock_minutes = 4; + // Threshold setting for releasing dividends. + map auto_distribute_threshold = 5; +} + +message ReceivedProfitsMap { + // The amount of token the beneficiary can get, symbol -> amount. + map value = 1; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/transaction_fee.proto b/modules/AElf.Client.Protobuf/Protobuf/transaction_fee.proto new file mode 100644 index 00000000..ed4ed8bf --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/transaction_fee.proto @@ -0,0 +1,47 @@ +syntax = "proto3"; + +package aelf; + +import "aelf/core.proto"; +import "aelf/options.proto"; + +option csharp_namespace = "AElf.Contracts.MultiToken"; + +service TransactionFee { +} + +// Messages + +message TransactionSizeFeeSymbols +{ + repeated TransactionSizeFeeSymbol transaction_size_fee_symbol_list = 1; +} + +message TransactionSizeFeeSymbol +{ + string token_symbol = 1; + int32 base_token_weight = 2; + int32 added_token_weight = 3; +} + +// Events + +message TransactionFeeCharged { + option (aelf.is_event) = true; + string symbol = 1; + int64 amount = 2; +} + +message ResourceTokenCharged { + option (aelf.is_event) = true; + string symbol = 1; + int64 amount = 2; + aelf.Address contract_address = 3; +} + +message ResourceTokenOwned { + option (aelf.is_event) = true; + string symbol = 1; + int64 amount = 2; + aelf.Address contract_address = 3; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/treasury_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/treasury_contract.proto new file mode 100644 index 00000000..0ce87cfd --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/treasury_contract.proto @@ -0,0 +1,149 @@ +/** + * Treasury contract. + */ +syntax = "proto3"; + +package Treasury; + +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; +import "aelf/core.proto"; +import "authority_info.proto"; + +option csharp_namespace = "AElf.Contracts.Treasury"; + +service TreasuryContract { + option (aelf.csharp_state) = "AElf.Contracts.Treasury.TreasuryContractState"; + + // Initialize treasury contract. + rpc InitialTreasuryContract (google.protobuf.Empty) returns (google.protobuf.Empty) { + } + + // Initialize the sub-item of the bonus scheme. + rpc InitialMiningRewardProfitItem (google.protobuf.Empty) returns (google.protobuf.Empty) { + } + + // Donate all tokens owned by the sender. + rpc DonateAll (DonateAllInput) returns (google.protobuf.Empty) { + } + + // Set the dividend weight of the sub-item of the dividend item. + rpc SetDividendPoolWeightSetting (DividendPoolWeightSetting) returns (google.protobuf.Empty){ + } + + // Set the miner reward weight. + rpc SetMinerRewardWeightSetting (MinerRewardWeightSetting) returns (google.protobuf.Empty){ + } + + // Set the reward for mining. + rpc UpdateMiningReward (google.protobuf.Int64Value) returns (google.protobuf.Empty){ + } + + // Change the governance authority information for treasury contract. + rpc ChangeTreasuryController (AuthorityInfo) returns (google.protobuf.Empty) { + } + + // AEDPoS Contract can notify Treasury Contract to aware miner replacement happened. + rpc RecordMinerReplacement (RecordMinerReplacementInput) returns (google.protobuf.Empty) { + } + + // Used to estimate the revenue weight of 10000 tokens voted by users. + rpc GetWelfareRewardAmountSample (GetWelfareRewardAmountSampleInput) returns (GetWelfareRewardAmountSampleOutput) { + option (aelf.is_view) = true; + } + + // Get the scheme id of treasury. + rpc GetTreasurySchemeId (google.protobuf.Empty) returns (aelf.Hash) { + option (aelf.is_view) = true; + } + + // Query the weight percentage of dividend pool items. + rpc GetDividendPoolWeightProportion (google.protobuf.Empty) returns (DividendPoolWeightProportion) { + option (aelf.is_view) = true; + } + + // Query the weight percentage of the dividend item for miner. + rpc GetMinerRewardWeightProportion (google.protobuf.Empty) returns (MinerRewardWeightProportion) { + option (aelf.is_view) = true; + } + + // Query the governance authority information. + rpc GetTreasuryController (google.protobuf.Empty) returns (AuthorityInfo) { + option (aelf.is_view) = true; + } +} + +message GetWelfareRewardAmountSampleInput { + // Token lock time. + repeated int64 value = 1; +} + +message GetWelfareRewardAmountSampleOutput { + // The weight calculated. + repeated int64 value = 1; +} + +message DonateAllInput { + // The token symbol to donate. + string symbol = 1; +} + +message MinerReElectionInformation { + // The reappointment information for miner. + map continual_appointment_times = 1; +} + +message DividendPoolWeightSetting { + // The dividend weight for citizen. + int32 citizen_welfare_weight = 1; + // The dividend weight for backup nodes. + int32 backup_subsidy_weight = 2; + // The dividend weight for miners. + int32 miner_reward_weight = 3; +} + +message MinerRewardWeightSetting { + // The dividend weight for all current miners. + int32 basic_miner_reward_weight = 1; + // The dividend weight for new miners. + int32 welcome_reward_weight = 2; + // The dividend weight for the flexible scheme. + int32 flexible_reward_weight = 3; +} + +message SchemeProportionInfo { + // The scheme id. + aelf.Hash scheme_id = 1; + // Dividend weight percentage. + int32 proportion = 2; +} + +message DividendPoolWeightProportion { + // The proportion of citizen welfare. + SchemeProportionInfo citizen_welfare_proportion_info = 1; + // The proportion of candidate nodes. + SchemeProportionInfo backup_subsidy_proportion_info = 2; + // The proportion of miner + SchemeProportionInfo miner_reward_proportion_info = 3; +} + +message MinerRewardWeightProportion { + // The proportion of the basic income of the miner. + SchemeProportionInfo basic_miner_reward_proportion_info = 1; + // The proportion of the vote of the miner. + SchemeProportionInfo welcome_reward_proportion_info = 2; + // The proportion of the reappointment of the miner. + SchemeProportionInfo flexible_reward_proportion_info = 3; +} + +message RecordMinerReplacementInput { + string old_pubkey = 1; + string new_pubkey = 2; + int64 current_term_number = 3; + bool is_old_pubkey_evil = 4; +} + +message StringList { + repeated string value = 1; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/vote_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/vote_contract.proto new file mode 100644 index 00000000..2c7e0e64 --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/vote_contract.proto @@ -0,0 +1,311 @@ +/** + * Vote contract. + */ +syntax = "proto3"; + +package Vote; + +import "aelf/core.proto"; +import "google/protobuf/timestamp.proto"; +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; + +option csharp_namespace = "AElf.Contracts.Vote"; + +service VoteContract { + option (aelf.csharp_state) = "AElf.Contracts.Vote.VoteContractState"; + + // Create a voting activity. + rpc Register (VotingRegisterInput) returns (google.protobuf.Empty) { + } + + // After successfully creating a voting activity, others are able to vote. + rpc Vote (VoteInput) returns (google.protobuf.Empty) { + } + + // A voter can withdraw the token after the lock time. + rpc Withdraw (WithdrawInput) returns (google.protobuf.Empty) { + } + + // Save the result of the specified number of votes and generates a new round votes. + rpc TakeSnapshot (TakeSnapshotInput) returns (google.protobuf.Empty) { + } + + // Add an option to a voting activity. + rpc AddOption (AddOptionInput) returns (google.protobuf.Empty) { + } + + // Remove an option from a voting activity. + rpc RemoveOption (RemoveOptionInput) returns (google.protobuf.Empty) { + } + + // Add multiple options to a voting activity. + rpc AddOptions (AddOptionsInput) returns (google.protobuf.Empty) { + } + + // Remove multiple options from a voting activity. + rpc RemoveOptions (RemoveOptionsInput) returns (google.protobuf.Empty) { + } + + // Get a voting activity information. + rpc GetVotingItem (GetVotingItemInput) returns (VotingItem) { + option (aelf.is_view) = true; + } + + // Get a voting result according to the provided voting activity id and snapshot number. + rpc GetVotingResult (GetVotingResultInput) returns (VotingResult) { + option (aelf.is_view) = true; + } + + // Gets the latest result according to the voting activity id. + rpc GetLatestVotingResult (aelf.Hash) returns (VotingResult) { + option (aelf.is_view) = true; + } + + // Get the voting record according to vote id. + rpc GetVotingRecord (aelf.Hash) returns (VotingRecord) { + option (aelf.is_view) = true; + } + + // Get the voting record according to vote ids. + rpc GetVotingRecords (GetVotingRecordsInput) returns (VotingRecords) { + option (aelf.is_view) = true; + } + + // Get all voted information according to voter address. + rpc GetVotedItems (aelf.Address) returns (VotedItems) { + option (aelf.is_view) = true; + } + + // Get the vote ids according to voting activity id. + rpc GetVotingIds (GetVotingIdsInput) returns (VotedIds) { + option (aelf.is_view) = true; + } +} + +message VotingRegisterInput { + // The start time of the voting. + google.protobuf.Timestamp start_timestamp = 1; + // The end time of the voting. + google.protobuf.Timestamp end_timestamp = 2; + // The token symbol which will be accepted. + string accepted_currency = 3; + // Whether the vote will lock token. + bool is_lock_token = 4; + // The total number of snapshots of the vote. + int64 total_snapshot_number = 5; + // The list of options. + repeated string options = 6; +} + +message VotingItem { + // The voting activity id. + aelf.Hash voting_item_id = 1; + // The token symbol which will be accepted. + string accepted_currency = 2; + // Whether the vote will lock token. + bool is_lock_token = 3; + // The current snapshot number. + int64 current_snapshot_number = 4; + // The total snapshot number. + int64 total_snapshot_number = 5; + // The list of options. + repeated string options = 6; + // The register time of the voting activity. + google.protobuf.Timestamp register_timestamp = 7; + // The start time of the voting. + google.protobuf.Timestamp start_timestamp = 8; + // The end time of the voting. + google.protobuf.Timestamp end_timestamp = 9; + // The start time of current round of the voting. + google.protobuf.Timestamp current_snapshot_start_timestamp = 10; + // The sponsor address of the voting activity. + aelf.Address sponsor = 11; +} + +message VoteInput { + // The voting activity id. + aelf.Hash voting_item_id = 1; + // The address of voter. + aelf.Address voter = 2; + // The amount of vote. + int64 amount = 3; + // The option to vote. + string option = 4; + // The vote id. + aelf.Hash vote_id = 5; + // Whether vote others. + bool is_change_target = 6; +} + +message WithdrawInput { + // The vote id. + aelf.Hash vote_id = 1; +} + +message GetVotingResultInput { + // The voting activity id. + aelf.Hash voting_item_id = 1; + // The snapshot number. + int64 snapshot_number = 2; +} + +message VotingResult { + // The voting activity id. + aelf.Hash voting_item_id = 1; + // The voting result, option -> amount of votes, + map results = 2; + // The snapshot number. + int64 snapshot_number = 3; + // The total number of voters. + int64 voters_count = 4; + // The start time of this snapshot. + google.protobuf.Timestamp snapshot_start_timestamp = 5; + // The end time of this snapshot. + google.protobuf.Timestamp snapshot_end_timestamp = 6; + // Total votes received during the process of this snapshot. + int64 votes_amount = 7; +} + +message TakeSnapshotInput { + // The voting activity id. + aelf.Hash voting_item_id = 1; + // The snapshot number to take. + int64 snapshot_number = 2; +} + +message VotingRecord { + // The voting activity id. + aelf.Hash voting_item_id = 1; + // The address of voter. + aelf.Address voter = 2; + // The snapshot number. + int64 snapshot_number = 3; + // The amount of vote. + int64 amount = 4; + // The time of withdraw. + google.protobuf.Timestamp withdraw_timestamp = 5; + // The time of vote. + google.protobuf.Timestamp vote_timestamp = 6; + // Whether the vote had been withdrawn. + bool is_withdrawn = 7; + // The option voted. + string option = 8; + // Whether vote others. + bool is_change_target = 9; +} + +message AddOptionInput { + // The voting activity id. + aelf.Hash voting_item_id = 1; + // The new option to add. + string option = 2; +} + +message RemoveOptionInput { + // The voting activity id. + aelf.Hash voting_item_id = 1; + // The option to remove. + string option = 2; +} + +message AddOptionsInput { + // The voting activity id. + aelf.Hash voting_item_id = 1; + // The new options to add. + repeated string options = 2; +} + +message RemoveOptionsInput { + // The voting activity id. + aelf.Hash voting_item_id = 1; + // The options to remove. + repeated string options = 2; +} + +message VotedItems { + // The voted ids. + map voted_item_vote_ids = 1; +} + +message VotedIds { + // The active vote ids. + repeated aelf.Hash active_votes = 1; + // The withdrawn vote ids. + repeated aelf.Hash withdrawn_votes = 2; +} + +message GetVotingIdsInput { + // The address of voter. + aelf.Address voter = 1; + // The voting activity id. + aelf.Hash voting_item_id = 2; +} + +message GetVotingItemInput { + // The voting activity id. + aelf.Hash voting_item_id = 1; +} + +message GetVotingRecordsInput { + // The vote ids. + repeated aelf.Hash ids = 1; +} + +message VotingRecords { + // The voting records. + repeated VotingRecord records = 1; +} + +message Voted { + option (aelf.is_event) = true; + // The voting activity id. + aelf.Hash voting_item_id = 1; + // The address of voter. + aelf.Address voter = 2; + // The snapshot number. + int64 snapshot_number = 3; + // The amount of vote. + int64 amount = 4; + // The time of vote. + google.protobuf.Timestamp vote_timestamp = 5; + // The option voted. + string option = 6; + // The vote id. + aelf.Hash vote_id = 7; +} + +message Withdrawn { + option (aelf.is_event) = true; + // The vote id. + aelf.Hash vote_id = 1; + aelf.Hash voting_item_id = 2; + int64 amount = 3; + string option = 4; + aelf.Address voter = 5; +} + +message VotingItemRegistered { + option (aelf.is_event) = true; + // The voting activity id. + aelf.Hash voting_item_id = 1; + // The token symbol which will be accepted. + string accepted_currency = 2; + // Whether the vote will lock token. + bool is_lock_token = 3; + // The current snapshot number. + int64 current_snapshot_number = 4; + // The total number of snapshots of the vote. + int64 total_snapshot_number = 5; + // The register time of the voting activity. + google.protobuf.Timestamp register_timestamp = 6; + // The start time of the voting. + google.protobuf.Timestamp start_timestamp = 7; + // The end time of the voting. + google.protobuf.Timestamp end_timestamp = 8; + // The start time of current round of the voting. + google.protobuf.Timestamp current_snapshot_start_timestamp = 9; + // The sponsor address of the voting activity. + aelf.Address sponsor = 10; +} \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/whitelist_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/whitelist_contract.proto new file mode 100644 index 00000000..37ce7afd --- /dev/null +++ b/modules/AElf.Client.Protobuf/Protobuf/whitelist_contract.proto @@ -0,0 +1,581 @@ +syntax = "proto3"; + +package whitelist; + +import "aelf/core.proto"; +import "aelf/options.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; +import "acs1.proto"; + +option csharp_namespace = "AElf.Contracts.Whitelist"; + +service WhitelistContract { + option (aelf.csharp_state) = "AElf.Contracts.Whitelist.WhitelistContractState"; + option (aelf.base) = "acs1.proto"; + + rpc Initialize (google.protobuf.Empty) returns (google.protobuf.Empty) { + } + + //For Managers. + //Create whitelist. + rpc CreateWhitelist (CreateWhitelistInput) returns (aelf.Hash){ + } + + //Add tag info or extraInfo. + rpc AddExtraInfo (AddExtraInfoInput) returns (aelf.Hash){ + } + + //Add multiple addresses to an existing whitelist. + rpc AddAddressInfoListToWhitelist (AddAddressInfoListToWhitelistInput) returns (google.protobuf.Empty){ + } + + //Remove multiple addresses from an existing whitelist. + rpc RemoveAddressInfoListFromWhitelist (RemoveAddressInfoListFromWhitelistInput) returns (google.protobuf.Empty){ + } + + //Remove tag info. + rpc RemoveTagInfo (RemoveTagInfoInput) returns (google.protobuf.Empty){ + } + + //Disable whitelist according to the whitelist_id. + rpc DisableWhitelist (aelf.Hash) returns (google.protobuf.Empty){ + } + + //Re-enable whitelist according to the whitelist_id. + rpc EnableWhitelist (aelf.Hash) returns (google.protobuf.Empty){ + } + + //Update state: Whether the whitelist is allowed to be cloned. + rpc ChangeWhitelistCloneable(ChangeWhitelistCloneableInput) returns (google.protobuf.Empty){ + } + + //Update whitelist extraInfo according to the whitelist_id and extraInfo. + rpc UpdateExtraInfo (UpdateExtraInfoInput) returns (google.protobuf.Empty){ + } + + //Transfer Manager. + rpc TransferManager (TransferManagerInput) returns (google.protobuf.Empty){ + } + + //Add manager. + rpc AddManagers (AddManagersInput) returns (google.protobuf.Empty){ + } + + //Remove manager. + rpc RemoveManagers (RemoveManagersInput) returns (google.protobuf.Empty){ + } + + //Reset whitelist according to the whitelist_id and project_id. + rpc ResetWhitelist (ResetWhitelistInput) returns (google.protobuf.Empty){ + } + + + //For Subscribers. + //Subscribe whitelist. + rpc SubscribeWhitelist (SubscribeWhitelistInput) returns (aelf.Hash){ + } + + // Cancel subscribe according to the subscribe_id. + rpc UnsubscribeWhitelist (aelf.Hash) returns (google.protobuf.Empty){ + } + + //After used,address and extra info will be added into the consumedList. + rpc ConsumeWhitelist (ConsumeWhitelistInput) returns (google.protobuf.Empty){ + } + + //Clone whitelist. + rpc CloneWhitelist (CloneWhitelistInput) returns (aelf.Hash){ + } + + //Add subscribe whitelist manager. + rpc AddSubscribeManagers (AddSubscribeManagersInput) returns (google.protobuf.Empty){ + } + + //Remove subscribe whitelist manager. + rpc RemoveSubscribeManagers (RemoveSubscribeManagersInput) returns (google.protobuf.Empty){ + } + + + //Views. + //Get whitelist_id list according to the manager. + rpc GetWhitelistByManager (aelf.Address) returns (WhitelistIdList){ + option (aelf.is_view) = true; + } + + //Get existing whitelist according to the whitelist_id. + rpc GetWhitelist (aelf.Hash) returns (WhitelistInfo){ + option (aelf.is_view) = true; + } + + //Get whitelist detail extraInfo according to the whitelist_id. + rpc GetWhitelistDetail (aelf.Hash) returns(ExtraInfoList){ + option (aelf.is_view) = true; + } + + //Get whitelist id by project_id. + rpc GetWhitelistByProject(aelf.Hash) returns (WhitelistIdList){ + option (aelf.is_view) = true; + } + + //Get extraInfo according to the tag_id. + rpc GetExtraInfoByTag (GetExtraInfoByTagInput) returns (ExtraInfo){ + option (aelf.is_view) = true; + } + + //Get tag info according to the tag_info_id. + rpc GetTagInfoByHash (aelf.Hash) returns (TagInfo){ + option (aelf.is_view) = true; + } + + //Get tagInfoId list according to the whitelist_id and project_id. + rpc GetExtraInfoIdList(GetExtraInfoIdListInput) returns (HashList){ + option (aelf.is_view) = true; + } + + //Get tagId according to the whitelist_id and address. + rpc GetTagIdByAddress(GetTagIdByAddressInput) returns (aelf.Hash){ + option (aelf.is_view) = true; + } + + //Get TagInfo according to the address and whitelist_id. + rpc GetExtraInfoByAddress(GetExtraInfoByAddressInput) returns (TagInfo){ + option (aelf.is_view) = true; + } + + //Whether the address exists in the whitelist according to the whitelist_id and address. + rpc GetAddressFromWhitelist(GetAddressFromWhitelistInput) returns (google.protobuf.BoolValue){ + option (aelf.is_view) = true; + } + + //Whether the extraInfo (address+TagInfoId) exists in the whitelist according to the whitelist_id and address. + rpc GetExtraInfoFromWhitelist(GetExtraInfoFromWhitelistInput) returns (google.protobuf.BoolValue){ + option (aelf.is_view) = true; + } + + //Whether the tagInfo exists in the whitelist according to the whitelist_id,project_id,tagInfo(tagName,info). + rpc GetTagInfoFromWhitelist(GetTagInfoFromWhitelistInput) returns (google.protobuf.BoolValue){ + option (aelf.is_view) = true; + } + + //Get manager list according to the whitelist_id. + rpc GetManagerList(aelf.Hash) returns (AddressList){ + option (aelf.is_view) = true; + } + + //Get subscribe manager list according to the subscribe_id. + rpc GetSubscribeManagerList(aelf.Hash) returns (AddressList){ + option (aelf.is_view) = true; + } + + //Whether manager exist in whitelist. + rpc GetManagerExistFromWhitelist(GetManagerExistFromWhitelistInput) returns (google.protobuf.BoolValue){ + option (aelf.is_view) = true; + } + + //Get subscribe whitelist info according to the subscribe_id. + rpc GetSubscribeWhitelist (aelf.Hash) returns (SubscribeWhitelistInfo){ + option (aelf.is_view) = true; + } + + //Get subscribe_id list according to the manager. + rpc GetSubscribeIdByManager (aelf.Address) returns (HashList){ + option (aelf.is_view) = true; + } + + //Get consumed list according to the subscribe_id. + rpc GetConsumedList (aelf.Hash) returns (ConsumedList){ + option (aelf.is_view) = true; + } + + //After consumed,get available whitelist according to the subscribe_id. + rpc GetAvailableWhitelist (aelf.Hash) returns (ExtraInfoIdList){ + option (aelf.is_view) = true; + } + + //Whether the extraInfo exist in the available whitelist. + rpc GetFromAvailableWhitelist (GetFromAvailableWhitelistInput) returns (google.protobuf.BoolValue){ + option (aelf.is_view) = true; + } + + +} + +//Structs. + +message WhitelistInfo { + //The whitelist id. + aelf.Hash whitelist_id = 1; + //The project id. + aelf.Hash project_id = 2; + //The list of address and extra info in this whitelist. + ExtraInfoIdList extra_info_id_list = 3; + //Whether the whitelist is available. + bool is_available = 4; + //Whether the whiteList can be cloned. + bool is_cloneable = 5; + string remark = 6; + aelf.Hash clone_from = 7; + aelf.Address creator = 8; + AddressList manager = 9; + StrategyType strategy_type = 10; +} + +//Pricing strategy +message PriceTag{ + string symbol = 1; + int64 amount = 2; +} + +enum StrategyType{ + Basic = 0; + Price = 1; + Customize = 2; +} + +message ExtraInfoIdList { + repeated ExtraInfoId value = 1; +} + +message ExtraInfoId { + AddressList address_list = 1; + aelf.Hash id = 2; +} + +message ExtraInfoList { + repeated ExtraInfo value = 1; +} + +message ExtraInfo { + AddressList address_list = 1; + TagInfo info = 2; +} + +message TagInfo { + string tag_name = 1; + bytes info = 2; +} + +message TagInfoList{ + repeated TagInfo value = 1; +} + +message WhitelistIdList{ + repeated aelf.Hash whitelist_id = 1; +} + +message SubscribeWhitelistInfo { + //The subscribe id. + aelf.Hash subscribe_id = 1; + //The project id. + aelf.Hash project_id = 2; + //The whitelist id. + aelf.Hash whitelist_id = 3; + aelf.Address subscriber = 4; + //Manager list. + AddressList manager_list = 5; +} + +message ConsumedList { + //The subscribe id. + aelf.Hash subscribe_id = 1; + //The whitelist id. + aelf.Hash whitelist_id = 2; + //The consumed address and extra info list in this whitelist. + ExtraInfoIdList extra_info_id_list = 3; +} + +message AddressList { + repeated aelf.Address value = 1; +} + +message HashList{ + repeated aelf.Hash value = 1; +} + +//Inputs. + +//message InitializeInput{ +// +//} + +message CreateWhitelistInput { + ExtraInfoList extra_info_list = 1; + bool is_cloneable = 2; + string remark = 3; + aelf.Address creator = 4; + AddressList manager_list = 5; + aelf.Hash project_id = 6; + StrategyType strategy_type = 7; +} + +message AddAddressInfoListToWhitelistInput { + aelf.Hash whitelist_id = 1; + ExtraInfoIdList extra_info_id_list = 2; +} + +message RemoveAddressInfoListFromWhitelistInput{ + aelf.Hash whitelist_id = 1; + ExtraInfoIdList extra_info_id_list = 2; +} + +message ChangeWhitelistCloneableInput{ + aelf.Hash whitelist_id = 1; + bool is_cloneable = 2; +} + +message AddExtraInfoInput{ + aelf.Hash whitelist_id = 1; + aelf.Hash project_id = 2; + TagInfo tag_info = 3; + AddressList address_list = 4; +} + +message RemoveTagInfoInput{ + aelf.Hash whitelist_id = 1; + aelf.Hash project_id = 2; + aelf.Hash tag_id = 3; +} + +message UpdateExtraInfoInput{ + aelf.Hash whitelist_id = 1; + ExtraInfoId extra_info_list = 2; +} + +message SubscribeWhitelistInput{ + //The project id. + aelf.Hash project_id = 1; + //The whitelist id. + aelf.Hash whitelist_id = 2; + //Subscriber. + aelf.Address subscriber = 3; + //Manager list. + AddressList manager_list = 4; +} + +message ConsumeWhitelistInput{ + aelf.Hash subscribe_id = 1; + aelf.Hash whitelist_id = 2; + ExtraInfoId extra_info_id = 3; +} + +message CloneWhitelistInput{ + aelf.Hash whitelist_id = 1; + aelf.Address creator = 2; + AddressList manager_list = 3; + aelf.Hash project_id = 4; +} + +message TransferManagerInput{ + aelf.Hash whitelist_id = 1; + aelf.Address manager = 2; +} + +message GetFromAvailableWhitelistInput{ + aelf.Hash subscribe_id = 1; + ExtraInfoId extra_info_id = 2; +} + +message AddManagersInput{ + aelf.Hash whitelist_id = 1; + AddressList manager_list = 2; +} + +message AddSubscribeManagersInput{ + aelf.Hash subscribe_id = 1; + AddressList manager_list = 2; +} + +message RemoveManagersInput{ + aelf.Hash whitelist_id = 1; + AddressList manager_list = 2; +} + +message RemoveSubscribeManagersInput{ + aelf.Hash subscribe_id = 1; + AddressList manager_list = 2; +} + +message GetTagIdByAddressInput{ + aelf.Hash whitelist_id = 1; + aelf.Address address = 2; +} + +message GetExtraInfoByAddressInput{ + aelf.Hash whitelist_id = 1; + aelf.Address address = 2; +} + +message GetExtraInfoIdListInput{ + aelf.Hash whitelist_id = 1; + aelf.Hash project_id = 2; +} + +message GetExtraInfoByTagInput{ + aelf.Hash whitelist_id = 1; + aelf.Hash tag_info_id = 2; +} + +message GetAddressFromWhitelistInput{ + aelf.Hash whitelist_id = 1; + aelf.Address address = 2; +} + +message GetExtraInfoFromWhitelistInput{ + aelf.Hash whitelist_id = 1; + ExtraInfoId extra_info_id = 2; +} + +message GetTagInfoFromWhitelistInput{ + aelf.Hash whitelist_id = 1; + aelf.Hash project_id = 2; + TagInfo tag_info = 3; +} + +message GetManagerExistFromWhitelistInput{ + aelf.Hash whitelist_id = 1; + aelf.Address manager = 2; +} + +message ResetWhitelistInput{ + aelf.Hash whitelist_id = 1; + aelf.Hash project_id = 2; +} + +//Events. + +message WhitelistCreated { + option (aelf.is_event) = true; + //The whitelist id. + aelf.Hash whitelist_id = 1; + //The list of address and extra info in this whitelist. + ExtraInfoIdList extra_info_id_list = 2; + //Whether the whitelist is available. + bool is_available = 3; + bool is_cloneable = 4; + string remark = 5; + aelf.Hash clone_from = 6; + aelf.Address creator = 7; + AddressList manager = 8; + aelf.Hash project_id = 9; + StrategyType strategy_type = 10; + +} + +message WhitelistSubscribed { + option (aelf.is_event) = true; + //The subscribe id. + aelf.Hash subscribe_id = 1; + //The project id. + aelf.Hash project_id = 2; + //The whitelist id. + aelf.Hash whitelist_id = 3; + //Subscriber. + aelf.Address subscriber = 4; + //Manager list. + AddressList manager_list = 5; +} + +message WhitelistUnsubscribed{ + option (aelf.is_event) = true; + aelf.Hash subscribe_id = 1; + aelf.Hash project_id = 2; + aelf.Hash whitelist_id = 3; +} + +message WhitelistAddressInfoAdded { + option (aelf.is_event) = true; + aelf.Hash whitelist_id = 1; + ExtraInfoIdList extra_info_id_list = 2; +} + +message WhitelistAddressInfoRemoved { + option (aelf.is_event) = true; + aelf.Hash whitelist_id = 1; + ExtraInfoIdList extra_info_id_list = 2; +} + +message WhitelistDisabled { + option (aelf.is_event) = true; + aelf.Hash whitelist_id = 1; + bool is_available = 2; +} + +message WhitelistReenable{ + option (aelf.is_event) = true; + aelf.Hash whitelist_id = 1; + bool is_available = 2; +} + +message ConsumedListAdded { + option (aelf.is_event) = true; + aelf.Hash subscribe_id = 1; + aelf.Hash whitelist_id = 2; + ExtraInfoIdList extra_info_id_list = 3; +} + +message IsCloneableChanged{ + option (aelf.is_event) = true; + aelf.Hash whitelist_id = 1; + bool is_cloneable = 2; +} + +message TagInfoAdded{ + option (aelf.is_event) = true; + aelf.Hash tag_info_id = 1; + TagInfo tag_info = 2; + aelf.Hash project_id = 3; + aelf.Hash whitelist_id = 4; +} + +message TagInfoRemoved{ + option (aelf.is_event) = true; + aelf.Hash tag_info_id = 1; + TagInfo tag_info = 2; + aelf.Hash project_id = 3; + aelf.Hash whitelist_id = 4; +} + +message ExtraInfoUpdated { + option (aelf.is_event) = true; + aelf.Hash whitelist_id = 1; + ExtraInfoId extra_info_id_before = 2; + ExtraInfoId extra_info_id_after = 3; +} + +message ManagerTransferred{ + option (aelf.is_event) = true; + aelf.Hash whitelist_id = 1; + aelf.Address transfer_from = 2; + aelf.Address transfer_to = 3; +} + +message ManagerAdded{ + option (aelf.is_event) = true; + aelf.Hash whitelist_id = 1; + AddressList manager_list = 2; +} + +message ManagerRemoved{ + option (aelf.is_event) = true; + aelf.Hash whitelist_id = 1; + AddressList manager_list = 2; +} + +message WhitelistReset{ + option (aelf.is_event) = true; + aelf.Hash whitelist_id = 1; + aelf.Hash project_id = 2; +} + +message SubscribeManagerAdded{ + option (aelf.is_event) = true; + aelf.Hash subscribe_id = 1; + AddressList manager_list = 2; +} + +message SubscribeManagerRemoved{ + option (aelf.is_event) = true; + aelf.Hash subscribe_id = 1; + AddressList manager_list = 2; +} \ No newline at end of file diff --git a/modules/AElf.Client.Report/AElf.Client.Report.csproj b/modules/AElf.Client.Report/AElf.Client.Report.csproj new file mode 100644 index 00000000..33db7d5f --- /dev/null +++ b/modules/AElf.Client.Report/AElf.Client.Report.csproj @@ -0,0 +1,33 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + + + TextTemplatingFileGenerator + ReportService.g.cs + + + + + + True + True + ReportService.tt + + + + diff --git a/modules/AElf.Client.Report/AElfClientReportModule.cs b/modules/AElf.Client.Report/AElfClientReportModule.cs new file mode 100644 index 00000000..8f0a0429 --- /dev/null +++ b/modules/AElf.Client.Report/AElfClientReportModule.cs @@ -0,0 +1,12 @@ +using AElf.Client.Core; +using Volo.Abp.Modularity; + +namespace AElf.Client.Report; + +[DependsOn( + typeof(AElfClientModule), + typeof(CoreAElfModule) +)] +public class AElfClientReportModule : AbpModule +{ +} \ No newline at end of file diff --git a/modules/AElf.Client.Report/ContractService.ttinclude b/modules/AElf.Client.Report/ContractService.ttinclude new file mode 100644 index 00000000..ee5f7dba --- /dev/null +++ b/modules/AElf.Client.Report/ContractService.ttinclude @@ -0,0 +1,58 @@ +<#@ template language="C#"#> +<#@ output extension=".g.cs"#> +<#@ import namespace="System.Collections.Generic" #> +<#+ + public string ContractName = "Report"; + + public List ContractMethodInfoList = new() + { + new ContractMethodInfo("ProposeReport", "CallbackInput"), + new ContractMethodInfo("ConfirmReport"), + new ContractMethodInfo("RejectReport"), + }; + + public class ContractMethodInfo + { + public ContractMethodInfo(string methodName) + { + MethodName = methodName; + } + + public ContractMethodInfo(string methodName, string parameterTypeName) + { + MethodName = methodName; + _parameterTypeName = parameterTypeName; + } + + public string MethodName { get; set; } + private string _parameterTypeName; + + public string ParameterTypeName + { + get => _parameterTypeName ?? $"{MethodName}Input"; + set => _parameterTypeName = value; + } + + public string InputName => ConvertMethodNameToInputName(MethodName); + } + + /// + /// Generates text for a given sequence of items, automatically adding the necessary spacing + /// + public void GenerateTextForItems(IReadOnlyList items, Action factory) + { + for (int i = 0; i < items.Count; i++) + { + // Insert a blank line after the first item + if (i > 0) WriteLine(""); + + // Invoke the factory with the current item + factory(items [i]); + } + } + + public static string ConvertMethodNameToInputName(string methodName) + { + return $"{char.ToLowerInvariant(methodName[0])}{methodName.Substring(1)}Input"; + } +#> diff --git a/modules/AElf.Client.Report/ReportService.tt b/modules/AElf.Client.Report/ReportService.tt new file mode 100644 index 00000000..074d3a95 --- /dev/null +++ b/modules/AElf.Client.Report/ReportService.tt @@ -0,0 +1,54 @@ +<#@include file="ContractService.ttinclude" #><#@ import namespace="System.Diagnostics.Contracts" #> +using AElf.Client.Core; +using AElf.Client.Core.Options; +using AElf.Contracts.<#=ContractName#>; +using AElf.Types; +using Microsoft.Extensions.Options; +using Volo.Abp.DependencyInjection; + +namespace AElf.Client.<#=ContractName#>; + +public interface I<#=ContractName#>Service +{ +<# + GenerateTextForItems(ContractMethodInfoList, item => + { +#> + Task <#=item.MethodName#>Async(<#=item.ParameterTypeName#> <#=item.InputName#>); +<# + }); +#> +} + +public class <#=ContractName#>Service : ContractServiceBase, I<#=ContractName#>Service, ITransientDependency +{ + private readonly IAElfClientService _clientService; + private readonly AElfClientConfigOptions _clientConfigOptions; + + protected <#=ContractName#>Service(IAElfClientService clientService, + IOptionsSnapshot clientConfigOptions, + IOptionsSnapshot contractOptions) : base(clientService, + Address.FromBase58(contractOptions.Value.ContractAddressList["<#=ContractName#>ContractAddress"])) + { + _clientService = clientService; + _clientConfigOptions = clientConfigOptions.Value; + } + +<# + GenerateTextForItems(ContractMethodInfoList, item => + { +#> + public async Task <#=item.MethodName#>Async(<#=item.ParameterTypeName#> <#=item.InputName#>) + { + var useClientAlias = _clientConfigOptions.ClientAlias; + var tx = await PerformSendTransactionAsync("<#=item.MethodName#>", <#=item.InputName#>, useClientAlias); + return new SendTransactionResult + { + Transaction = tx, + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), useClientAlias) + }; + } +<# + }); +#> +} \ No newline at end of file diff --git a/modules/AElf.Client/AElf.Client.csproj b/modules/AElf.Client/AElf.Client.csproj new file mode 100644 index 00000000..2f7dc852 --- /dev/null +++ b/modules/AElf.Client/AElf.Client.csproj @@ -0,0 +1,22 @@ + + + + net6.0 + enable + enable + AElf.Client + This is a C# client library, used to communicate with the AElf API. + AElf + true + + + + + + + + + + + + diff --git a/modules/AElf.Client/AElfClient.Block.cs b/modules/AElf.Client/AElfClient.Block.cs new file mode 100644 index 00000000..b6c73014 --- /dev/null +++ b/modules/AElf.Client/AElfClient.Block.cs @@ -0,0 +1,44 @@ +using AElf.Client.Dto; +using AElf.Client.Services; + +namespace AElf.Client; + +public partial class AElfClient : IBlockAppService +{ + /// + /// Get height of the current chain. + /// + /// Height + public async Task GetBlockHeightAsync() + { + var url = GetRequestUrl(_baseUrl, "api/blockChain/blockHeight"); + return await _httpService.GetResponseAsync(url); + } + + /// + /// Get information of a block by given block hash. Optional whether to include transaction information. + /// + /// + /// + /// Block information + public async Task GetBlockByHashAsync(string blockHash, bool includeTransactions = false) + { + AssertValidHash(blockHash); + var url = GetRequestUrl(_baseUrl, + $"api/blockChain/block?blockHash={blockHash}&includeTransactions={includeTransactions}"); + return await _httpService.GetResponseAsync(url); + } + + /// + /// Get information of a block by specified height. Optional whether to include transaction information. + /// + /// + /// + /// Block information + public async Task GetBlockByHeightAsync(long blockHeight, bool includeTransactions = false) + { + var url = GetRequestUrl(_baseUrl, + $"api/blockChain/blockByHeight?blockHeight={blockHeight}&includeTransactions={includeTransactions}"); + return await _httpService.GetResponseAsync(url); + } +} \ No newline at end of file diff --git a/modules/AElf.Client/AElfClient.Chain.cs b/modules/AElf.Client/AElfClient.Chain.cs new file mode 100644 index 00000000..e42eb0fd --- /dev/null +++ b/modules/AElf.Client/AElfClient.Chain.cs @@ -0,0 +1,69 @@ +using AElf.Client.Dto; + +namespace AElf.Client; + +public partial class AElfClient : IChainAppService +{ + /// + /// Get the current status of the block chain. + /// + /// Description of current status + public async Task GetChainStatusAsync() + { + var url = GetRequestUrl(_baseUrl, "api/blockChain/chainStatus"); + var chainStatus = await _httpService.GetResponseAsync(url); + if (chainStatus == null) + { + throw new AElfClientException("Failed to get chain status"); + } + + return chainStatus; + } + + /// + /// Get the definitions of proto-buff related to a contract. + /// + /// + /// Definitions of proto-buff + public async Task GetContractFileDescriptorSetAsync(string? address) + { + AssertValidAddress(address); + var url = GetRequestUrl(_baseUrl, $"api/blockChain/contractFileDescriptorSet?address={address}"); + var set = await _httpService.GetResponseAsync(url); + if (set == null) + { + throw new AElfClientException("Failed to get chain status"); + } + + return set; + } + + /// + /// Gets the status information of the task queue. + /// + /// Information of the task queue + public async Task> GetTaskQueueStatusAsync() + { + var url = GetRequestUrl(_baseUrl, "api/blockChain/taskQueueStatus"); + + var taskQueueInfoList = await _httpService.GetResponseAsync>(url); + if (taskQueueInfoList == null) + { + throw new AElfClientException("Failed to get chain status"); + } + + return taskQueueInfoList; + } + + /// + /// Get id of the chain. + /// + /// ChainId + public async Task GetChainIdAsync() + { + var chainStatus = await GetChainStatusAsync(); + var base58ChainId = chainStatus.ChainId; + var chainId = ChainHelper.ConvertBase58ToChainId(base58ChainId); + return chainId; + } +} \ No newline at end of file diff --git a/modules/AElf.Client/AElfClient.Client.cs b/modules/AElf.Client/AElfClient.Client.cs new file mode 100644 index 00000000..fd455c2e --- /dev/null +++ b/modules/AElf.Client/AElfClient.Client.cs @@ -0,0 +1,265 @@ +using AElf.Client.Dto; +using AElf.Client.Extensions; +using AElf.Client.Model; +using AElf.Client.Services; +using AElf.Cryptography; +using AElf.Cryptography.ECDSA; +using Google.Protobuf; +using Google.Protobuf.WellKnownTypes; + +namespace AElf.Client; + +public partial class AElfClient : IClientService +{ + /// + /// Verify whether this sdk successfully connects the chain. + /// + /// IsConnected or not + public async Task IsConnectedAsync() + { + try + { + await GetChainStatusAsync(); + return true; + } + catch (Exception) + { + return false; + } + } + + /// + /// Get the address of genesis contract. + /// + /// Address + public async Task GetGenesisContractAddressAsync() + { + var statusDto = await GetChainStatusAsync(); + var genesisAddress = statusDto.GenesisContractAddress; + return genesisAddress; + } + + /// + /// Get address of a contract by given contractNameHash. + /// + /// + /// Address + public async Task
GetContractAddressByNameAsync(Hash contractNameHash) + { + var from = GetAddressFromPrivateKey(AElfClientConstants.DefaultPrivateKey); + var to = await GetGenesisContractAddressAsync(); + var transaction = await GenerateTransactionAsync(from, to, "GetContractAddressByName", contractNameHash); + var txWithSig = SignTransaction(AElfClientConstants.DefaultPrivateKey, transaction); + + var response = await ExecuteTransactionAsync(new ExecuteTransactionDto + { + RawTransaction = txWithSig.ToByteArray().ToHex() + }); + var byteArray = ByteArrayHelper.HexStringToByteArray(response); + var address = Address.Parser.ParseFrom(byteArray); + + return address; + } + + /// + /// Build a transaction from the input parameters. + /// + /// + /// + /// + /// + /// Transaction unsigned + public async Task GenerateTransactionAsync(string? from, string? to, + string methodName, IMessage input) + { + try + { + AssertValidAddress(to); + var chainStatus = await GetChainStatusAsync(); + var transaction = new Transaction + { + From = from.ToAddress(), + To = Address.FromBase58(to), + MethodName = methodName, + Params = input.ToByteString(), + RefBlockNumber = chainStatus.BestChainHeight, + RefBlockPrefix = ByteString.CopyFrom(Hash.LoadFromHex(chainStatus.BestChainHash).Value + .Take(4).ToArray()) + }; + + return transaction; + } + catch (Exception ex) + { + throw new AElfClientException($"Failed to generate transaction: {ex.Message}"); + } + } + + /// + /// Convert the Address to the displayed string:symbol_base58-string_base58-string-chain-id + /// + /// + /// + public async Task GetFormattedAddressAsync(Address address) + { + var tokenContractAddress = + await GetContractAddressByNameAsync(HashHelper.ComputeFrom("AElf.ContractNames.Token")); + var fromAddress = GetAddressFromPrivateKey(AElfClientConstants.DefaultPrivateKey); + var toAddress = tokenContractAddress.ToBase58(); + var methodName = "GetPrimaryTokenSymbol"; + var param = new Empty(); + + var transaction = await GenerateTransactionAsync(fromAddress, toAddress, methodName, param); + var txWithSign = SignTransaction(AElfClientConstants.DefaultPrivateKey, transaction); + + var result = await ExecuteTransactionAsync(new ExecuteTransactionDto + { + RawTransaction = txWithSign.ToByteArray().ToHex() + }); + + var symbol = StringValue.Parser.ParseFrom(ByteArrayHelper.HexStringToByteArray(result)); + var chainIdString = (await GetChainStatusAsync()).ChainId; + + return $"{symbol.Value}_{address.ToBase58()}_{chainIdString}"; + } + + /// + /// Sign a transaction using private key. + /// + /// + /// + /// Transaction signed + public Transaction SignTransaction(string? privateKeyHex, Transaction transaction) + { + var transactionData = transaction.GetHash().ToByteArray(); + + privateKeyHex ??= AElfClientConstants.DefaultPrivateKey; + + // Sign the hash + var privateKey = ByteArrayHelper.HexStringToByteArray(privateKeyHex); + var signature = CryptoHelper.SignWithPrivateKey(privateKey, transactionData); + transaction.Signature = ByteString.CopyFrom(signature); + + return transaction; + } + + /// + /// Sign a transaction using private key. + /// + /// + /// + /// Transaction signed + public Transaction SignTransaction(byte[]? privateKey, Transaction transaction) + { + var transactionData = transaction.GetHash().ToByteArray(); + + privateKey ??= ByteArrayHelper.HexStringToByteArray(AElfClientConstants.DefaultPrivateKey); + + // Sign the hash + var signature = CryptoHelper.SignWithPrivateKey(privateKey, transactionData); + transaction.Signature = ByteString.CopyFrom(signature); + + return transaction; + } + + /// + /// Get the account address through the public key. + /// + /// + /// Account + public string GetAddressFromPubKey(string pubKey) + { + var publicKey = ByteArrayHelper.HexStringToByteArray(pubKey); + var address = Address.FromPublicKey(publicKey); + return address.ToBase58(); + } + + /// + /// Get the account address through the private key. + /// + /// + /// + public string? GetAddressFromPrivateKey(string? privateKeyHex) + { + var address = Address.FromPublicKey(GetAElfKeyPair(privateKeyHex).PublicKey); + return address.ToBase58(); + } + + public KeyPairInfo GenerateKeyPairInfo() + { + var keyPair = CryptoHelper.GenerateKeyPair(); + var privateKey = keyPair.PrivateKey.ToHex(); + var publicKey = keyPair.PublicKey.ToHex(); + var address = GetAddressFromPrivateKey(privateKey); + + return new KeyPairInfo + { + PrivateKey = privateKey, + PublicKey = publicKey, + Address = address + }; + } + + #region private methods + + private ECKeyPair GetAElfKeyPair(string? privateKeyHex) + { + var privateKey = ByteArrayHelper.HexStringToByteArray(privateKeyHex); + var keyPair = CryptoHelper.FromPrivateKey(privateKey); + + return keyPair; + } + + private string GetRequestUrl(string baseUrl, string relativeUrl) + { + var uri = new Uri(baseUrl + (baseUrl.EndsWith("/") ? "" : "/")); + return new Uri(uri, relativeUrl).ToString(); + } + + private void AssertValidAddress(params string?[] addresses) + { + try + { + foreach (var address in addresses) + { + Address.FromBase58(address); + } + } + catch (Exception) + { + throw new AElfClientException(Error.Message[Error.InvalidAddress]); + } + } + + private void AssertValidHash(params string[] hashes) + { + try + { + foreach (var hash in hashes) + { + Hash.LoadFromHex(hash); + } + } + catch (Exception) + { + throw new AElfClientException(Error.Message[Error.InvalidBlockHash]); + } + } + + private void AssertValidTransactionId(params string[] transactionIds) + { + try + { + foreach (var transactionId in transactionIds) + { + Hash.LoadFromHex(transactionId); + } + } + catch (Exception) + { + throw new AElfClientException(Error.Message[Error.InvalidTransactionId]); + } + } + + #endregion +} \ No newline at end of file diff --git a/modules/AElf.Client/AElfClient.Net.cs b/modules/AElf.Client/AElfClient.Net.cs new file mode 100644 index 00000000..5b4d4fb7 --- /dev/null +++ b/modules/AElf.Client/AElfClient.Net.cs @@ -0,0 +1,80 @@ +using System.Net.Http.Headers; +using System.Text; +using AElf.Client.Dto; +using AElf.Client.Helper; +using AElf.Client.Services; + +namespace AElf.Client; + +public partial class AElfClient : INetAppService +{ + /// + /// Attempt to add a node to the connected network nodes.Input parameter contains the ipAddress of the node. + /// + /// + /// + /// + /// Add successfully or not + public async Task AddPeerAsync(string ipAddress, string? userName, string? password) + { + if (!EndpointHelper.TryParse(ipAddress, out var endpoint)) + { + return false; + } + + var url = GetRequestUrl(_baseUrl, "api/net/peer"); + var parameters = new Dictionary + { + { "address", endpoint?.ToString() ?? AElfClientConstants.LocalEndpoint }, + }; + + return await _httpService.PostResponseAsync(url, parameters, + authenticationHeaderValue: GetAuthenticationHeaderValue(userName, password)); + } + + /// + /// Attempt to remove a node from the connected network nodes by given the ipAddress. + /// + /// + /// + /// + /// Delete successfully or not + public async Task RemovePeerAsync(string ipAddress, string? userName, string? password) + { + if (!EndpointHelper.TryParse(ipAddress, out var endpoint)) + { + return false; + } + + var url = GetRequestUrl(_baseUrl, $"api/net/peer?address={endpoint}"); + return await _httpService.DeleteResponseAsObjectAsync(url, + authenticationHeaderValue: GetAuthenticationHeaderValue(userName, password)); + } + + /// + /// Gets information about the peer nodes of the current node.Optional whether to include metrics. + /// + /// + /// Information about the peer nodes + public async Task?> GetPeersAsync(bool withMetrics) + { + var url = GetRequestUrl(_baseUrl, $"api/net/peers?withMetrics={withMetrics}"); + return await _httpService.GetResponseAsync>(url); + } + + /// + /// Get the node's network information. + /// + /// Network information + public async Task GetNetworkInfoAsync() + { + var url = GetRequestUrl(_baseUrl, "api/net/networkInfo"); + return await _httpService.GetResponseAsync(url); + } + + private AuthenticationHeaderValue GetAuthenticationHeaderValue(string? userName, string? password) + { + var byteArray = Encoding.ASCII.GetBytes($"{userName ?? _userName}:{password ?? _password}"); + return new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray)); + } +} \ No newline at end of file diff --git a/modules/AElf.Client/AElfClient.Transaction.cs b/modules/AElf.Client/AElfClient.Transaction.cs new file mode 100644 index 00000000..5afbc164 --- /dev/null +++ b/modules/AElf.Client/AElfClient.Transaction.cs @@ -0,0 +1,165 @@ +using AElf.Client.Dto; +using AElf.Client.Services; + +namespace AElf.Client; + +public partial class AElfClient : ITransactionAppService +{ + /// + /// Get information about the current transaction pool. + /// + /// TransactionPoolStatusOutput + public async Task GetTransactionPoolStatusAsync() + { + var url = GetRequestUrl(_baseUrl, "api/blockChain/transactionPoolStatus"); + return await _httpService.GetResponseAsync(url); + } + + /// + /// Call a read-only method of a contract. + /// + /// + /// + public async Task ExecuteTransactionAsync(ExecuteTransactionDto input) + { + var url = GetRequestUrl(_baseUrl, "api/blockChain/executeTransaction"); + var parameters = new Dictionary + { + { "RawTransaction", input.RawTransaction } + }; + + var result = await _httpService.PostResponseAsync(url, parameters); + + if (result == null) + { + throw new AElfClientException("Failed to execute tx."); + } + + return result; + } + + /// + /// Call a method of a contract by given serialized strings. + /// + /// + /// Serialized result + public async Task ExecuteRawTransactionAsync(ExecuteRawTransactionDto input) + { + var url = GetRequestUrl(_baseUrl, "api/blockChain/executeRawTransaction"); + var parameters = new Dictionary + { + { "RawTransaction", input.RawTransaction }, + { "Signature", input.Signature } + }; + + return await _httpService.PostResponseAsync(url, parameters); + } + + /// + /// Creates an unsigned serialized transaction. + /// + /// + /// CreateRawTransactionOutput + public async Task CreateRawTransactionAsync(CreateRawTransactionInput input) + { + var url = GetRequestUrl(_baseUrl, "api/blockChain/rawTransaction"); + var parameters = new Dictionary + { + { "From", input.From }, + { "To", input.To }, + { "RefBlockNumber", input.RefBlockNumber.ToString() }, + { "RefBlockHash", input.RefBlockHash }, + { "MethodName", input.MethodName }, + { "Params", input.Params } + }; + + return await _httpService.PostResponseAsync(url, parameters); + } + + /// + /// Broadcast a serialized transaction. + /// + /// + /// SendRawTransactionOutput + public async Task SendRawTransactionAsync(SendRawTransactionInput input) + { + var url = GetRequestUrl(_baseUrl, "api/blockChain/sendRawTransaction"); + var parameters = new Dictionary + { + { "Transaction", input.Transaction }, + { "Signature", input.Signature }, + { "ReturnTransaction", input.ReturnTransaction ? "true" : "false" } + }; + return await _httpService.PostResponseAsync(url, parameters); + } + + /// + /// Broadcast a transaction. + /// + /// + /// TransactionId + public async Task SendTransactionAsync(SendTransactionInput input) + { + var url = GetRequestUrl(_baseUrl, "api/blockChain/sendTransaction"); + var parameters = new Dictionary + { + { "RawTransaction", input.RawTransaction } + }; + return await _httpService.PostResponseAsync(url, parameters); + } + + /// + /// Broadcast volume transactions. + /// + /// + /// TransactionIds + public async Task SendTransactionsAsync(SendTransactionsInput input) + { + var url = GetRequestUrl(_baseUrl, "api/blockChain/sendTransactions"); + var parameters = new Dictionary + { + { "RawTransactions", input.RawTransactions } + }; + return await _httpService.PostResponseAsync(url, parameters); + } + + /// + /// Gets the result of transaction execution by the given transactionId. + /// + /// + /// TransactionResultDto + public async Task GetTransactionResultAsync(string transactionId) + { + AssertValidTransactionId(transactionId); + var url = GetRequestUrl(_baseUrl, $"api/blockChain/transactionResult?transactionId={transactionId}"); + return await _httpService.GetResponseAsync(url); + } + + /// + /// Get results of multiple transactions by specified blockHash and the offset. + /// + /// + /// + /// + /// TransactionResultDtos + public async Task?> GetTransactionResultsAsync(string blockHash, int offset = 0, + int limit = 10) + { + AssertValidHash(blockHash); + var url = GetRequestUrl(_baseUrl, + $"api/blockChain/transactionResults?blockHash={blockHash}&offset={offset}&limit={limit}"); + return await _httpService.GetResponseAsync>(url); + } + + /// + /// Get merkle path of a transaction. + /// + /// + /// MerklePathDto + public async Task GetMerklePathByTransactionIdAsync(string transactionId) + { + AssertValidTransactionId(transactionId); + var url = GetRequestUrl(_baseUrl, $"api/blockChain/merklePathByTransactionId?transactionId={transactionId}"); + return await _httpService.GetResponseAsync(url); + } +} \ No newline at end of file diff --git a/modules/AElf.Client/AElfClient.cs b/modules/AElf.Client/AElfClient.cs new file mode 100644 index 00000000..f5cd32d1 --- /dev/null +++ b/modules/AElf.Client/AElfClient.cs @@ -0,0 +1,39 @@ +using AElf.Client.Services; + +namespace AElf.Client; + +public partial class AElfClient : IDisposable +{ + private readonly IHttpService _httpService; + // aelf node endpoint. + private readonly string _baseUrl; + private string? _userName; + private string? _password; + + public AElfClient(string baseUrl, int timeOut = 60, string? userName = null, string? password = null, + bool useCamelCase = false) + { + _httpService = new HttpService(timeOut, useCamelCase); + _baseUrl = baseUrl; + _userName = userName; + _password = password; + } + + private bool _disposed; + + /// + public void Dispose() + { + if (_disposed) return; + Dispose(true); + _disposed = true; + } + + /// + /// Disposes the resources associated with the object. + /// + /// true if called by a call to the Dispose method; otherwise false. + protected virtual void Dispose(bool disposing) + { + } +} \ No newline at end of file diff --git a/modules/AElf.Client/AElfClientBuilder.cs b/modules/AElf.Client/AElfClientBuilder.cs new file mode 100644 index 00000000..91444fd2 --- /dev/null +++ b/modules/AElf.Client/AElfClientBuilder.cs @@ -0,0 +1,73 @@ +namespace AElf.Client; + +public sealed class AElfClientBuilder +{ + private string NodeEndpoint { get; set; } + private int Timeout { get; set; } + + private string? UserName { get; set; } + private string? Password { get; set; } + + private bool IsUseCamelCase { get; set; } + + public AElfClientBuilder() + { + NodeEndpoint = AElfClientConstants.LocalEndpoint; + Timeout = 60; + } + + public AElfClientBuilder UseEndpoint(string endpoint) + { + NodeEndpoint = endpoint; + return this; + } + + public AElfClientBuilder UsePublicEndpoint(EndpointType endpointType) + { + switch (endpointType) + { + case EndpointType.MainNetMainChain: + NodeEndpoint = AElfClientConstants.MainNetMainChain; + break; + case EndpointType.MainNetSideChain1: + NodeEndpoint = AElfClientConstants.MainNetSideChain1; + break; + case EndpointType.TestNetMainChain: + NodeEndpoint = AElfClientConstants.TestNetMainChain; + break; + case EndpointType.TestNetSideChain2: + NodeEndpoint = AElfClientConstants.TestNetSideChain2; + break; + case EndpointType.Local: + default: + NodeEndpoint = AElfClientConstants.LocalEndpoint; + break; + } + + return this; + } + + public AElfClientBuilder SetHttpTimeout(int timeout) + { + Timeout = timeout; + return this; + } + + public AElfClientBuilder ManagePeerInfo(string? userName, string? password) + { + UserName = userName; + Password = password; + return this; + } + + public AElfClientBuilder UseCamelCase(bool isUseCamelCase) + { + IsUseCamelCase = isUseCamelCase; + return this; + } + + public AElfClient Build() + { + return new AElfClient(NodeEndpoint, Timeout, UserName, Password, IsUseCamelCase); + } +} \ No newline at end of file diff --git a/modules/AElf.Client/AElfClientConstants.cs b/modules/AElf.Client/AElfClientConstants.cs new file mode 100644 index 00000000..b55f7e8e --- /dev/null +++ b/modules/AElf.Client/AElfClientConstants.cs @@ -0,0 +1,15 @@ +namespace AElf.Client; + +public class AElfClientConstants +{ + public const string DefaultPrivateKey = "09da44778f8db2e602fb484334f37df19e221c84c4582ce5b7770ccfbc3ddbef"; + public const string LocalEndpoint = "http://127.0.0.1:1726"; + public const string MainNetMainChain = "https://aelf-public-node.aelf.io"; + public const string MainNetSideChain1 = "https://tdvv-public-node.aelf.io"; + public const string TestNetMainChain = "https://aelf-test-node.aelf.io"; + public const string TestNetSideChain1 = "https://tdvv-test-node.aelf.io"; + public const string TestNetSideChain2 = "https://tdvw-test-node.aelf.io"; + public const int MainChainId = 9992731; + public const int SideChainId1 = 1866392; + public const int SideChainId2 = 1931928; +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/BlockBodyDto.cs b/modules/AElf.Client/Dto/BlockBodyDto.cs new file mode 100644 index 00000000..e2832e38 --- /dev/null +++ b/modules/AElf.Client/Dto/BlockBodyDto.cs @@ -0,0 +1,8 @@ +namespace AElf.Client.Dto; + +public class BlockBodyDto +{ + public int TransactionsCount { get; set; } + + public List Transactions { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/BlockDto.cs b/modules/AElf.Client/Dto/BlockDto.cs new file mode 100644 index 00000000..a1556534 --- /dev/null +++ b/modules/AElf.Client/Dto/BlockDto.cs @@ -0,0 +1,12 @@ +namespace AElf.Client.Dto; + +public class BlockDto +{ + public string BlockHash { get; set; } + + public BlockHeaderDto Header { get; set; } + + public BlockBodyDto Body { get; set; } + + public int BlockSize { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/BlockHeaderDto.cs b/modules/AElf.Client/Dto/BlockHeaderDto.cs new file mode 100644 index 00000000..699ff946 --- /dev/null +++ b/modules/AElf.Client/Dto/BlockHeaderDto.cs @@ -0,0 +1,24 @@ +namespace AElf.Client.Dto; + +public class BlockHeaderDto +{ + public string PreviousBlockHash { get; set; } + + public string MerkleTreeRootOfTransactions { get; set; } + + public string MerkleTreeRootOfWorldState { get; set; } + + public string MerkleTreeRootOfTransactionState { get; set; } + + public string Extra { get; set; } + + public long Height { get; set; } + + public DateTime Time { get; set; } + + public string ChainId { get; set; } + + public string Bloom { get; set; } + + public string SignerPubkey { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/ChainStatusDto.cs b/modules/AElf.Client/Dto/ChainStatusDto.cs new file mode 100644 index 00000000..45feb0d3 --- /dev/null +++ b/modules/AElf.Client/Dto/ChainStatusDto.cs @@ -0,0 +1,28 @@ +using System.Text.Json.Serialization; + +namespace AElf.Client.Dto; + +public class ChainStatusDto +{ + public string ChainId { get; set; } + + public Dictionary Branches { get; set; } + + public Dictionary NotLinkedBlocks { get; set; } + + public long LongestChainHeight { get; set; } + + public string LongestChainHash { get; set; } + + public string GenesisBlockHash { get; set; } + + public string GenesisContractAddress { get; set; } + + public string LastIrreversibleBlockHash { get; set; } + + public long LastIrreversibleBlockHeight { get; set; } + + public string BestChainHash { get; set; } + + public long BestChainHeight { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/CreateRawTransactionInput.cs b/modules/AElf.Client/Dto/CreateRawTransactionInput.cs new file mode 100644 index 00000000..ee21c92e --- /dev/null +++ b/modules/AElf.Client/Dto/CreateRawTransactionInput.cs @@ -0,0 +1,78 @@ +using System.ComponentModel.DataAnnotations; + +namespace AElf.Client.Dto; + +public class CreateRawTransactionInput : IValidatableObject +{ + /// + /// from address + /// + [Required] + public string From { get; set; } + + /// + /// to address + /// + [Required] + public string To { get; set; } + + /// + /// refer block height + /// + [Required] + public long RefBlockNumber { get; set; } + + /// + /// refer block hash + /// + [Required] + public string RefBlockHash { get; set; } + + /// + /// contract method name + /// + [Required] + public string MethodName { get; set; } + + /// + /// contract method parameters + /// + [Required] + public string Params { get; set; } + + public IEnumerable Validate(ValidationContext validationContext) + { + var validationResults = new List(); + try + { + Address.FromBase58(From); + } + catch + { + validationResults.Add(new ValidationResult(Error.Message[Error.InvalidAddress], + new[] {nameof(From)})); + } + + try + { + Address.FromBase58(To); + } + catch + { + validationResults.Add( + new ValidationResult(Error.Message[Error.InvalidAddress], new[] {nameof(To)})); + } + + try + { + Hash.LoadFromHex(RefBlockHash); + } + catch + { + validationResults.Add( + new ValidationResult(Error.Message[Error.InvalidBlockHash], new[] {nameof(RefBlockHash)})); + } + + return validationResults; + } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/CreateRawTransactionOutput.cs b/modules/AElf.Client/Dto/CreateRawTransactionOutput.cs new file mode 100644 index 00000000..7896ec85 --- /dev/null +++ b/modules/AElf.Client/Dto/CreateRawTransactionOutput.cs @@ -0,0 +1,6 @@ +namespace AElf.Client.Dto; + +public class CreateRawTransactionOutput +{ + public string RawTransaction { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/ExecuteRawTransactionDto.cs b/modules/AElf.Client/Dto/ExecuteRawTransactionDto.cs new file mode 100644 index 00000000..b07cd89a --- /dev/null +++ b/modules/AElf.Client/Dto/ExecuteRawTransactionDto.cs @@ -0,0 +1,14 @@ +namespace AElf.Client.Dto; + +public class ExecuteRawTransactionDto +{ + /// + /// raw transaction + /// + public string RawTransaction { get; set; } + + /// + /// signature + /// + public string Signature { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/ExecuteTransactionDto.cs b/modules/AElf.Client/Dto/ExecuteTransactionDto.cs new file mode 100644 index 00000000..5ee62791 --- /dev/null +++ b/modules/AElf.Client/Dto/ExecuteTransactionDto.cs @@ -0,0 +1,9 @@ +namespace AElf.Client.Dto; + +public class ExecuteTransactionDto +{ + /// + /// raw transaction + /// + public string RawTransaction { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/LogEventDto.cs b/modules/AElf.Client/Dto/LogEventDto.cs new file mode 100644 index 00000000..74dfd090 --- /dev/null +++ b/modules/AElf.Client/Dto/LogEventDto.cs @@ -0,0 +1,12 @@ +namespace AElf.Client.Dto; + +public class LogEventDto +{ + public string Address { get; set; } + + public string Name { get; set; } + + public string[] Indexed { get; set; } + + public string NonIndexed { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/MerklePathDto.cs b/modules/AElf.Client/Dto/MerklePathDto.cs new file mode 100644 index 00000000..dbd8994f --- /dev/null +++ b/modules/AElf.Client/Dto/MerklePathDto.cs @@ -0,0 +1,12 @@ +namespace AElf.Client.Dto; + +public class MerklePathDto +{ + public List MerklePathNodes { get; set; } +} + +public class MerklePathNodeDto +{ + public string Hash { get; set; } + public bool IsLeftChildNode { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/NetworkInfoOutput.cs b/modules/AElf.Client/Dto/NetworkInfoOutput.cs new file mode 100644 index 00000000..50f76a5a --- /dev/null +++ b/modules/AElf.Client/Dto/NetworkInfoOutput.cs @@ -0,0 +1,19 @@ +namespace AElf.Client.Dto; + +public class NetworkInfoOutput +{ + /// + /// node version + /// + public string Version { get; set; } + + /// + /// network protocol version + /// + public int ProtocolVersion { get; set; } + + /// + /// total number of open connections between this node and other nodes + /// + public int Connections { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/PeerDto.cs b/modules/AElf.Client/Dto/PeerDto.cs new file mode 100644 index 00000000..d7ba8429 --- /dev/null +++ b/modules/AElf.Client/Dto/PeerDto.cs @@ -0,0 +1,24 @@ +using Google.Protobuf.WellKnownTypes; + +namespace AElf.Client.Dto; + +public class PeerDto +{ + public string IpAddress { get; set; } + public int ProtocolVersion { get; set; } + public long ConnectionTime { get; set; } + public string ConnectionStatus { get; set; } + public bool Inbound { get; set; } + public int BufferedTransactionsCount { get; set; } + public int BufferedBlocksCount { get; set; } + public int BufferedAnnouncementsCount { get; set; } + public List RequestMetrics { get; set; } +} + +public class RequestMetric +{ + public long RoundTripTime { get; set; } + public string MethodName { get; set; } + public string Info { get; set; } + public Timestamp RequestTime { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/SendRawTransactionInput.cs b/modules/AElf.Client/Dto/SendRawTransactionInput.cs new file mode 100644 index 00000000..e5941ec6 --- /dev/null +++ b/modules/AElf.Client/Dto/SendRawTransactionInput.cs @@ -0,0 +1,19 @@ +namespace AElf.Client.Dto; + +public class SendRawTransactionInput +{ + /// + /// raw transaction + /// + public string Transaction { get; set; } + + /// + /// signature + /// + public string Signature { get; set; } + + /// + /// return transaction detail or not + /// + public bool ReturnTransaction { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/SendRawTransactionOutput.cs b/modules/AElf.Client/Dto/SendRawTransactionOutput.cs new file mode 100644 index 00000000..25046c88 --- /dev/null +++ b/modules/AElf.Client/Dto/SendRawTransactionOutput.cs @@ -0,0 +1,8 @@ +namespace AElf.Client.Dto; + +public class SendRawTransactionOutput +{ + public string TransactionId { get; set; } + + public TransactionDto Transaction { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/SendTransactionInput.cs b/modules/AElf.Client/Dto/SendTransactionInput.cs new file mode 100644 index 00000000..1e1c8cce --- /dev/null +++ b/modules/AElf.Client/Dto/SendTransactionInput.cs @@ -0,0 +1,9 @@ +namespace AElf.Client.Dto; + +public class SendTransactionInput +{ + /// + /// raw transaction + /// + public string RawTransaction { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/SendTransactionOutput.cs b/modules/AElf.Client/Dto/SendTransactionOutput.cs new file mode 100644 index 00000000..f22ca67c --- /dev/null +++ b/modules/AElf.Client/Dto/SendTransactionOutput.cs @@ -0,0 +1,6 @@ +namespace AElf.Client.Dto; + +public class SendTransactionOutput +{ + public string TransactionId { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/SendTransactionsInput.cs b/modules/AElf.Client/Dto/SendTransactionsInput.cs new file mode 100644 index 00000000..c623c748 --- /dev/null +++ b/modules/AElf.Client/Dto/SendTransactionsInput.cs @@ -0,0 +1,9 @@ +namespace AElf.Client.Dto; + +public class SendTransactionsInput +{ + /// + /// raw transactions + /// + public string RawTransactions { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/TaskQueueInfoDto.cs b/modules/AElf.Client/Dto/TaskQueueInfoDto.cs new file mode 100644 index 00000000..d02fc569 --- /dev/null +++ b/modules/AElf.Client/Dto/TaskQueueInfoDto.cs @@ -0,0 +1,8 @@ +namespace AElf.Client.Dto; + +public class TaskQueueInfoDto +{ + public string Name { get; set; } + + public int Size { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/TransactionDto.cs b/modules/AElf.Client/Dto/TransactionDto.cs new file mode 100644 index 00000000..fbfc40de --- /dev/null +++ b/modules/AElf.Client/Dto/TransactionDto.cs @@ -0,0 +1,18 @@ +namespace AElf.Client.Dto; + +public class TransactionDto +{ + public string From { get; set; } + + public string To { get; set; } + + public long RefBlockNumber { get; set; } + + public string RefBlockPrefix { get; set; } + + public string MethodName { get; set; } + + public string Params { get; set; } + + public string Signature { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/TransactionPoolStatusOutput.cs b/modules/AElf.Client/Dto/TransactionPoolStatusOutput.cs new file mode 100644 index 00000000..ba60b967 --- /dev/null +++ b/modules/AElf.Client/Dto/TransactionPoolStatusOutput.cs @@ -0,0 +1,7 @@ +namespace AElf.Client.Dto; + +public class TransactionPoolStatusOutput +{ + public int Queued { get; set; } + public int Validated { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/Dto/TransactionResultDto.cs b/modules/AElf.Client/Dto/TransactionResultDto.cs new file mode 100644 index 00000000..815aa47a --- /dev/null +++ b/modules/AElf.Client/Dto/TransactionResultDto.cs @@ -0,0 +1,24 @@ +namespace AElf.Client.Dto; + +public class TransactionResultDto +{ + public string TransactionId { get; set; } + + public string Status { get; set; } + + public LogEventDto[] Logs { get; set; } + + public string Bloom { get; set; } + + public long BlockNumber { get; set; } + + public string BlockHash { get; set; } + + public TransactionDto Transaction { get; set; } + + public string ReturnValue { get; set; } + + public string Error { get; set; } + + public int TransactionSize { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client/EndpointType.cs b/modules/AElf.Client/EndpointType.cs new file mode 100644 index 00000000..43011e04 --- /dev/null +++ b/modules/AElf.Client/EndpointType.cs @@ -0,0 +1,10 @@ +namespace AElf.Client; + +public enum EndpointType +{ + MainNetMainChain, + MainNetSideChain1, + TestNetMainChain, + TestNetSideChain2, + Local +} \ No newline at end of file diff --git a/modules/AElf.Client/Exception/AElfClientException.cs b/modules/AElf.Client/Exception/AElfClientException.cs new file mode 100644 index 00000000..1f9c4095 --- /dev/null +++ b/modules/AElf.Client/Exception/AElfClientException.cs @@ -0,0 +1,9 @@ +namespace AElf.Client; + +public class AElfClientException : Exception +{ + public AElfClientException(string message) : base(message) + { + + } +} \ No newline at end of file diff --git a/modules/AElf.Client/Exception/Error.cs b/modules/AElf.Client/Exception/Error.cs new file mode 100644 index 00000000..fc78fc69 --- /dev/null +++ b/modules/AElf.Client/Exception/Error.cs @@ -0,0 +1,35 @@ +namespace AElf.Client; + +public class Error +{ + public const int NotFound = 20001; + public const int InvalidAddress = 20002; + public const int InvalidBlockHash = 20003; + public const int InvalidTransactionId = 20004; + public const int InvalidProposalId = 20005; + public const int InvalidOffset = 20006; + public const int InvalidLimit = 20007; + public const int InvalidTransaction = 20008; + public const int CannotBroadcastTransaction = 20009; + public const int InvalidContractAddress = 20010; + public const int NoMatchMethodInContractAddress = 20011; + public const int InvalidParams = 20012; + public const int InvalidSignature = 20013; + + public static readonly Dictionary Message = new Dictionary + { + {NotFound, "Not found"}, + {InvalidAddress, "Invalid address format"}, + {InvalidBlockHash, "Invalid block hash format"}, + {InvalidTransactionId, "Invalid Transaction id format"}, + {InvalidProposalId, "Invalid proposal id format"}, + {InvalidOffset, "Offset must greater than or equal to 0"}, + {InvalidLimit, "Limit must between 0 and 100"}, + {InvalidTransaction, "Invalid transaction information"}, + {CannotBroadcastTransaction, "Sync still in progress, cannot send transactions"}, + {InvalidContractAddress, "Invalid contract address"}, + {NoMatchMethodInContractAddress, "No match method in contract address"}, + {InvalidParams, "Invalid params"}, + {InvalidSignature, "Invalid signature"} + }; +} \ No newline at end of file diff --git a/modules/AElf.Client/Extensions/StringExtensions.cs b/modules/AElf.Client/Extensions/StringExtensions.cs new file mode 100644 index 00000000..7b2108f6 --- /dev/null +++ b/modules/AElf.Client/Extensions/StringExtensions.cs @@ -0,0 +1,14 @@ +namespace AElf.Client.Extensions; + +public static class StringExtensions +{ + public static Address ToAddress(this string? address) + { + if (address == null) + { + return Address.FromPublicKey(ByteArrayHelper.HexStringToByteArray(AElfClientConstants.DefaultPrivateKey)); + } + + return Address.FromBase58(address); + } +} \ No newline at end of file diff --git a/modules/AElf.Client/Extensions/TransactionResultDtoExtension.cs b/modules/AElf.Client/Extensions/TransactionResultDtoExtension.cs new file mode 100644 index 00000000..886aaaac --- /dev/null +++ b/modules/AElf.Client/Extensions/TransactionResultDtoExtension.cs @@ -0,0 +1,37 @@ +using AElf.Client.Dto; +using AElf.Contracts.MultiToken; +using Google.Protobuf; + +namespace AElf.Client.Extensions; + +public static class TransactionResultDtoExtension +{ + public static Dictionary GetTransactionFees(this TransactionResultDto transactionResultDto) + { + var result = new Dictionary(); + + var transactionFeeLogs = + transactionResultDto.Logs?.Where(l => l.Name == nameof(TransactionFeeCharged)).ToList(); + if (transactionFeeLogs != null) + { + foreach (var transactionFee in transactionFeeLogs.Select(transactionFeeLog => + TransactionFeeCharged.Parser.ParseFrom(ByteString.FromBase64(transactionFeeLog.NonIndexed)))) + { + result.Add(transactionFee.Symbol, transactionFee.Amount); + } + } + + var resourceTokenLogs = + transactionResultDto.Logs?.Where(l => l.Name == nameof(ResourceTokenCharged)).ToList(); + if (resourceTokenLogs != null) + { + foreach (var resourceToken in resourceTokenLogs.Select(transactionFeeLog => + ResourceTokenCharged.Parser.ParseFrom(ByteString.FromBase64(transactionFeeLog.NonIndexed)))) + { + result.Add(resourceToken.Symbol, resourceToken.Amount); + } + } + + return result; + } +} \ No newline at end of file diff --git a/modules/AElf.Client/GlobalUsings.cs b/modules/AElf.Client/GlobalUsings.cs new file mode 100644 index 00000000..e2e7f5ce --- /dev/null +++ b/modules/AElf.Client/GlobalUsings.cs @@ -0,0 +1 @@ +global using AElf.Types; \ No newline at end of file diff --git a/modules/AElf.Client/Helper/EndpointHelper.cs b/modules/AElf.Client/Helper/EndpointHelper.cs new file mode 100644 index 00000000..3d04103d --- /dev/null +++ b/modules/AElf.Client/Helper/EndpointHelper.cs @@ -0,0 +1,95 @@ +using System.Linq; +using System.Net; +using System.Net.Sockets; + +namespace AElf.Client.Helper +{ + public static class EndpointHelper + { + public static bool TryParse(string endpointString, out DnsEndPoint? endpoint, + int defaultPort = 6800) + { + endpoint = null; + + if (string.IsNullOrEmpty(endpointString) || endpointString.Trim().Length == 0) + return false; + + if (defaultPort != -1 && (defaultPort < IPEndPoint.MinPort || defaultPort > IPEndPoint.MaxPort)) + return false; + + var values = endpointString.Split(new[] {':'}); + string host; + var port = -1; + + switch (values.Length) + { + case <= 2: + { + // ipv4 or hostname + host = values[0]; + + if (values.Length == 1) + { + port = defaultPort; + } + else + { + var parsedPort = GetPort(values[1]); + + if (parsedPort == 0) + return false; + + port = parsedPort; + } + + break; + } + //ipv6 + //could be [a:b:c]:d + case > 2 when values[0].StartsWith("[") && values[values.Length - 2].EndsWith("]"): + { + host = string.Join(":", values.Take(values.Length - 1).ToArray()); + var parsedPort = GetPort(values[values.Length - 1]); + + if (parsedPort == 0) + return false; + break; + } + // [a:b:c] or a:b:c + case > 2: + host = endpointString; + port = defaultPort; + break; + } + + if (port == -1) + return false; + + // we leave semantic analysis of the ip/hostname to lower levels. + endpoint = new PeerEndpoint(host, port); + + return true; + } + + private static int GetPort(string p) + { + if (!int.TryParse(p, out int port) || port < IPEndPoint.MinPort || port > IPEndPoint.MaxPort) + return 0; + + return port; + } + } + + public class PeerEndpoint : DnsEndPoint + { + public PeerEndpoint(string host, int port) + : base(host, port, AddressFamily.Unspecified) + { + } + + public override string ToString() + { + return Host + ":" + Port; + } + } +} \ No newline at end of file diff --git a/modules/AElf.Client/Model/KeyPairInfo.cs b/modules/AElf.Client/Model/KeyPairInfo.cs new file mode 100644 index 00000000..cf9f1898 --- /dev/null +++ b/modules/AElf.Client/Model/KeyPairInfo.cs @@ -0,0 +1,9 @@ +namespace AElf.Client.Model +{ + public class KeyPairInfo + { + public string PrivateKey { get; set; } + public string PublicKey { get; set; } + public string? Address { get; set; } + } +} \ No newline at end of file diff --git a/modules/AElf.Client/Services/HttpService.cs b/modules/AElf.Client/Services/HttpService.cs new file mode 100644 index 00000000..388d59c5 --- /dev/null +++ b/modules/AElf.Client/Services/HttpService.cs @@ -0,0 +1,232 @@ +using System.Net; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; + +namespace AElf.Client.Services; + +public interface IHttpService +{ + Task GetResponseAsync(string url, string? version = null, + HttpStatusCode expectedStatusCode = HttpStatusCode.OK); + + Task PostResponseAsync(string url, Dictionary parameters, + string? version = null, HttpStatusCode expectedStatusCode = HttpStatusCode.OK, + AuthenticationHeaderValue? authenticationHeaderValue = null); + + Task DeleteResponseAsObjectAsync(string url, string? version = null, + HttpStatusCode expectedStatusCode = HttpStatusCode.OK, + AuthenticationHeaderValue? authenticationHeaderValue = null); +} + +public class HttpService : IHttpService +{ + private readonly bool _useCamelCase; + private HttpClient? Client { get; set; } + private int TimeoutSeconds { get; } + + public HttpService(int timeoutSeconds, bool useCamelCase = false) + { + _useCamelCase = useCamelCase; + TimeoutSeconds = timeoutSeconds; + } + + /// + /// Get request. + /// + /// + /// + /// + /// + /// + public async Task GetResponseAsync(string url, string? version = null, + HttpStatusCode expectedStatusCode = HttpStatusCode.OK) + { + var response = await GetResponseAsync(url, version, expectedStatusCode); + var stream = await response.Content.ReadAsStreamAsync(); + var jsonSerializerOptions = _useCamelCase + ? new JsonSerializerOptions + { + PropertyNamingPolicy = JsonNamingPolicy.CamelCase + } + : new JsonSerializerOptions(); + return await JsonSerializer.DeserializeAsync(stream, jsonSerializerOptions); + } + + /// + /// Post request. + /// + /// + /// + /// + /// + /// + /// + /// + public async Task PostResponseAsync(string url, Dictionary parameters, + string? version = null, + HttpStatusCode expectedStatusCode = HttpStatusCode.OK, + AuthenticationHeaderValue? authenticationHeaderValue = null) + { + var response = await PostResponseAsync(url, parameters, version, true, expectedStatusCode, + authenticationHeaderValue); + var stream = await response.Content.ReadAsStreamAsync(); + var jsonSerializerOptions = _useCamelCase + ? new JsonSerializerOptions + { + PropertyNamingPolicy = JsonNamingPolicy.CamelCase + } + : new JsonSerializerOptions(); + return await JsonSerializer.DeserializeAsync(stream, jsonSerializerOptions); + } + + /// + /// Delete request. + /// + /// + /// + /// + /// + /// + /// + /// + public async Task DeleteResponseAsObjectAsync(string url, string? version = null, + HttpStatusCode expectedStatusCode = HttpStatusCode.OK, + AuthenticationHeaderValue? authenticationHeaderValue = null) + { + var response = await DeleteResponseAsync(url, version, expectedStatusCode, authenticationHeaderValue); + var stream = await response.Content.ReadAsStreamAsync(); + var jsonSerializerOptions = _useCamelCase + ? new JsonSerializerOptions + { + PropertyNamingPolicy = JsonNamingPolicy.CamelCase + } + : new JsonSerializerOptions(); + return await JsonSerializer.DeserializeAsync(stream, jsonSerializerOptions); + } + + #region GetResponse + + private async Task GetResponseAsync(string url, string? version = null, + HttpStatusCode expectedStatusCode = HttpStatusCode.OK) + { + version = !string.IsNullOrWhiteSpace(version) ? $";v={version}" : string.Empty; + + var client = GetHttpClient(version); + try + { + var response = await client.GetAsync(url); + if (response.StatusCode == expectedStatusCode) + return response; + throw new AElfClientException(response.ToString()); + } + catch (Exception ex) + { + throw new AElfClientException(ex.Message); + } + } + + #endregion + + #region PostResponse + + private async Task PostResponseAsync(string url, + Dictionary parameters, + string? version = null, bool useApplicationJson = false, + HttpStatusCode expectedStatusCode = HttpStatusCode.OK, + AuthenticationHeaderValue? authenticationHeaderValue = null) + { + version = !string.IsNullOrWhiteSpace(version) ? $";v={version}" : string.Empty; + var client = GetHttpClient(version); + + if (authenticationHeaderValue != null) + { + client.DefaultRequestHeaders.Authorization = authenticationHeaderValue; + } + + HttpContent content; + if (useApplicationJson) + { + var paramsStr = JsonSerializer.Serialize(parameters); + content = new StringContent(paramsStr, Encoding.UTF8, "application/json"); + content.Headers.ContentType = MediaTypeHeaderValue.Parse($"application/json{version}"); + } + + else + { + content = new FormUrlEncodedContent(parameters); + content.Headers.ContentType = + MediaTypeHeaderValue.Parse($"application/x-www-form-urlencoded{version}"); + } + + try + { + var response = await client.PostAsync(url, content); + if (response.StatusCode == expectedStatusCode) + return response; + var message = await response.Content.ReadAsStringAsync(); + throw new HttpRequestException(message); + } + catch (Exception ex) + { + throw new AElfClientException(ex.Message); + } + } + + #endregion + + #region DeleteResponse + + private async Task DeleteResponseAsStringAsync(string url, string? version = null, + HttpStatusCode expectedStatusCode = HttpStatusCode.OK, + AuthenticationHeaderValue? authenticationHeaderValue = null) + { + var response = await DeleteResponseAsync(url, version, expectedStatusCode, authenticationHeaderValue); + return await response.Content.ReadAsStringAsync(); + } + + private async Task DeleteResponseAsync(string url, string? version = null, + HttpStatusCode expectedStatusCode = HttpStatusCode.OK, + AuthenticationHeaderValue? authenticationHeaderValue = null) + { + version = !string.IsNullOrWhiteSpace(version) ? $";v={version}" : string.Empty; + var client = GetHttpClient(version); + + if (authenticationHeaderValue != null) + { + client.DefaultRequestHeaders.Authorization = authenticationHeaderValue; + } + + try + { + var response = await client.DeleteAsync(url); + if (response.StatusCode == expectedStatusCode) + return response; + throw new AElfClientException(response.ToString()); + } + catch (Exception ex) + { + throw new AElfClientException(ex.Message); + } + } + + #endregion + + #region private methods + + private HttpClient GetHttpClient(string? version = null) + { + if (Client != null) return Client; + Client = new HttpClient + { + Timeout = TimeSpan.FromSeconds(TimeoutSeconds) + }; + Client.DefaultRequestHeaders.Accept.Clear(); + Client.DefaultRequestHeaders.Accept.Add( + MediaTypeWithQualityHeaderValue.Parse($"application/json{version}")); + Client.DefaultRequestHeaders.Add("Connection", "close"); + return Client; + } + + #endregion +} \ No newline at end of file diff --git a/modules/AElf.Client/Services/IBlockAppService.cs b/modules/AElf.Client/Services/IBlockAppService.cs new file mode 100644 index 00000000..ec449cfd --- /dev/null +++ b/modules/AElf.Client/Services/IBlockAppService.cs @@ -0,0 +1,12 @@ +using AElf.Client.Dto; + +namespace AElf.Client.Services; + +public interface IBlockAppService +{ + Task GetBlockHeightAsync(); + + Task GetBlockByHashAsync(string blockHash, bool includeTransactions = false); + + Task GetBlockByHeightAsync(long blockHeight, bool includeTransactions = false); +} \ No newline at end of file diff --git a/modules/AElf.Client/Services/IChainAppService.cs b/modules/AElf.Client/Services/IChainAppService.cs new file mode 100644 index 00000000..48d9b61f --- /dev/null +++ b/modules/AElf.Client/Services/IChainAppService.cs @@ -0,0 +1,15 @@ +using AElf.Client.Dto; +using AElf.Kernel; + +namespace AElf.Client; + +public interface IChainAppService +{ + Task GetChainStatusAsync(); + + Task GetContractFileDescriptorSetAsync(string? address); + + Task> GetTaskQueueStatusAsync(); + + Task GetChainIdAsync(); +} \ No newline at end of file diff --git a/modules/AElf.Client/Services/IClientService.cs b/modules/AElf.Client/Services/IClientService.cs new file mode 100644 index 00000000..8331a7a7 --- /dev/null +++ b/modules/AElf.Client/Services/IClientService.cs @@ -0,0 +1,13 @@ +using AElf.Client.Model; + +namespace AElf.Client.Services; + +public interface IClientService +{ + Task IsConnectedAsync(); + Task GetFormattedAddressAsync(Address address); + Task GetGenesisContractAddressAsync(); + Task
GetContractAddressByNameAsync(Hash contractNameHash); + string GetAddressFromPubKey(string pubKey); + KeyPairInfo GenerateKeyPairInfo(); +} \ No newline at end of file diff --git a/modules/AElf.Client/Services/INetAppService.cs b/modules/AElf.Client/Services/INetAppService.cs new file mode 100644 index 00000000..ada9aeae --- /dev/null +++ b/modules/AElf.Client/Services/INetAppService.cs @@ -0,0 +1,14 @@ +using AElf.Client.Dto; + +namespace AElf.Client.Services; + +public interface INetAppService +{ + Task AddPeerAsync(string ipAddress, string userName, string password); + + Task RemovePeerAsync(string ipAddress, string userName, string password); + + Task?> GetPeersAsync(bool withMetrics); + + Task GetNetworkInfoAsync(); +} \ No newline at end of file diff --git a/modules/AElf.Client/Services/ITransactionAppService.cs b/modules/AElf.Client/Services/ITransactionAppService.cs new file mode 100644 index 00000000..2bf140a5 --- /dev/null +++ b/modules/AElf.Client/Services/ITransactionAppService.cs @@ -0,0 +1,27 @@ +using AElf.Client.Dto; + +namespace AElf.Client.Services; + +public interface ITransactionAppService +{ + Task GetTransactionPoolStatusAsync(); + + Task ExecuteTransactionAsync(ExecuteTransactionDto input); + + Task ExecuteRawTransactionAsync(ExecuteRawTransactionDto input); + + Task CreateRawTransactionAsync(CreateRawTransactionInput input); + + Task SendRawTransactionAsync(SendRawTransactionInput input); + + Task SendTransactionAsync(SendTransactionInput input); + + Task SendTransactionsAsync(SendTransactionsInput input); + + Task GetTransactionResultAsync(string transactionId); + + Task?> GetTransactionResultsAsync(string blockHash, int offset = 0, + int limit = 10); + + Task GetMerklePathByTransactionIdAsync(string transactionId); +} \ No newline at end of file diff --git a/modules/AElf.Client/TransactionBuilder.cs b/modules/AElf.Client/TransactionBuilder.cs new file mode 100644 index 00000000..beb357f5 --- /dev/null +++ b/modules/AElf.Client/TransactionBuilder.cs @@ -0,0 +1,60 @@ +using AElf.Cryptography; +using Google.Protobuf; + +namespace AElf.Client; + +public class TransactionBuilder +{ + private readonly AElfClient _aelfClient; + + private byte[] PrivateKey { get; set; } + private string ContractAddress { get; set; } + private string MethodName { get; set; } + private IMessage Parameter { get; set; } + + public TransactionBuilder(AElfClient aelfClient) + { + _aelfClient = aelfClient; + PrivateKey = ByteArrayHelper.HexStringToByteArray(AElfClientConstants.DefaultPrivateKey); + } + + public TransactionBuilder UsePrivateKey(byte[] privateKey) + { + PrivateKey = privateKey; + return this; + } + + public TransactionBuilder UseSystemContract(string systemContractName) + { + ContractAddress = _aelfClient.GetContractAddressByNameAsync(HashHelper.ComputeFrom(systemContractName)).Result + .ToBase58(); + return this; + } + + public TransactionBuilder UseContract(string contractAddress) + { + ContractAddress = contractAddress; + return this; + } + + public TransactionBuilder UseMethod(string methodName) + { + MethodName = methodName; + return this; + } + + public TransactionBuilder UseParameter(IMessage parameter) + { + Parameter = parameter; + return this; + } + + public Transaction Build() + { + var keyPair = CryptoHelper.FromPrivateKey(PrivateKey); + var from = Address.FromPublicKey(keyPair.PublicKey).ToBase58(); + var unsignedTx = _aelfClient.GenerateTransactionAsync(from, ContractAddress, MethodName, Parameter).Result; + var signedTx = _aelfClient.SignTransaction(PrivateKey, unsignedTx); + return signedTx; + } +} \ No newline at end of file diff --git a/modules/AElf.Nethereum.Core/AElf.Nethereum.Core.csproj b/modules/AElf.Nethereum.Core/AElf.Nethereum.Core.csproj new file mode 100644 index 00000000..658bb27c --- /dev/null +++ b/modules/AElf.Nethereum.Core/AElf.Nethereum.Core.csproj @@ -0,0 +1,20 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + + + diff --git a/modules/AElf.Nethereum.Core/AElfNethereumClientModule.cs b/modules/AElf.Nethereum.Core/AElfNethereumClientModule.cs new file mode 100644 index 00000000..801e05ef --- /dev/null +++ b/modules/AElf.Nethereum.Core/AElfNethereumClientModule.cs @@ -0,0 +1,23 @@ +using AElf.Nethereum.Core.Options; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Autofac; +using Volo.Abp.AutoMapper; +using Volo.Abp.Modularity; + +namespace AElf.Nethereum.Core; + +[DependsOn( + typeof(AbpAutofacModule), + typeof(AbpAutoMapperModule) +)] +public class AElfNethereumClientModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + var configuration = context.Services.GetConfiguration(); + + Configure(configuration.GetSection("EthereumAccount")); + Configure(configuration.GetSection("EthereumClientConfig")); + Configure(configuration.GetSection("EthereumContract")); + } +} \ No newline at end of file diff --git a/modules/AElf.Nethereum.Core/Options/EthereumAccountOptions.cs b/modules/AElf.Nethereum.Core/Options/EthereumAccountOptions.cs new file mode 100644 index 00000000..3d37a778 --- /dev/null +++ b/modules/AElf.Nethereum.Core/Options/EthereumAccountOptions.cs @@ -0,0 +1,15 @@ +namespace AElf.Nethereum.Core.Options; + +public class EthereumAccountOptions +{ + public string KeyDirectory { get; set; } + public List AccountConfigList { get; set; } = new(); +} + +public class EthereumAccountConfig +{ + public string Alias { get; set; } + public string Address { get; set; } + public string Password { get; set; } + public string PrivateKey { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Nethereum.Core/Options/EthereumClientConfigOptions.cs b/modules/AElf.Nethereum.Core/Options/EthereumClientConfigOptions.cs new file mode 100644 index 00000000..ca4d70eb --- /dev/null +++ b/modules/AElf.Nethereum.Core/Options/EthereumClientConfigOptions.cs @@ -0,0 +1,7 @@ +namespace AElf.Nethereum.Core.Options; + +public class EthereumClientConfigOptions +{ + public string Url { get; set; } = "https://kovan.infura.io/v3/4c41b8476e874c178c633ff442a27a1b"; + public string AccountAlias { get; set; } = "Default"; +} \ No newline at end of file diff --git a/modules/AElf.Nethereum.Core/Options/EthereumContractOptions.cs b/modules/AElf.Nethereum.Core/Options/EthereumContractOptions.cs new file mode 100644 index 00000000..21f733a1 --- /dev/null +++ b/modules/AElf.Nethereum.Core/Options/EthereumContractOptions.cs @@ -0,0 +1,13 @@ +namespace AElf.Nethereum.Core.Options; + +public class EthereumContractOptions +{ + public string AbiFileDirectory { get; set; } + public Dictionary ContractInfoList { get; set; } +} + +public class EthereumContractInfo +{ + public string ContractAddress { get; set; } + public string AbiFileName { get; set; } +} \ No newline at end of file diff --git a/src/AElf.EventHandler/AElf.EventHandler.csproj b/src/AElf.EventHandler/AElf.EventHandler.csproj index ab74d2cd..634e385d 100644 --- a/src/AElf.EventHandler/AElf.EventHandler.csproj +++ b/src/AElf.EventHandler/AElf.EventHandler.csproj @@ -12,7 +12,7 @@ - + @@ -25,7 +25,7 @@ - + @@ -63,6 +63,11 @@ + + + + + diff --git a/src/AElf.EventHandler/Dto/Acs0c.cs b/src/AElf.EventHandler/Dto/Acs0c.cs deleted file mode 100644 index 35aef2b0..00000000 --- a/src/AElf.EventHandler/Dto/Acs0c.cs +++ /dev/null @@ -1,273 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: acs0.proto -// -// Original file comments: -// * -// AElf Standards ACS0(Contract Deployment Standard) -// -// Used to manage the deployment and update of contracts. -#pragma warning disable 0414, 1591 -#region Designer generated code - -using System.Collections.Generic; -using aelf = global::AElf.CSharp.Core; - -namespace AElf.Standards.ACS0 { - - #region Events - internal partial class ContractProposed : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public ContractProposed GetNonIndexed() - { - return new ContractProposed - { - ProposedContractInputHash = ProposedContractInputHash, - }; - } - } - - internal partial class ContractDeployed : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - new ContractDeployed - { - Author = Author - }, - new ContractDeployed - { - CodeHash = CodeHash - }, - }; - } - - public ContractDeployed GetNonIndexed() - { - return new ContractDeployed - { - Address = Address, - Version = Version, - Name = Name, - }; - } - } - - internal partial class CodeCheckRequired : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public CodeCheckRequired GetNonIndexed() - { - return new CodeCheckRequired - { - Code = Code, - ProposedContractInputHash = ProposedContractInputHash, - Category = Category, - IsSystemContract = IsSystemContract, - }; - } - } - - internal partial class CodeUpdated : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - new CodeUpdated - { - Address = Address - }, - }; - } - - public CodeUpdated GetNonIndexed() - { - return new CodeUpdated - { - OldCodeHash = OldCodeHash, - NewCodeHash = NewCodeHash, - Version = Version, - }; - } - } - - #endregion - internal static partial class ACS0Container - { - static readonly string __ServiceName = "acs0.ACS0"; - - #region Marshallers - static readonly aelf::Marshaller __Marshaller_acs0_SystemContractDeploymentInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Standards.ACS0.SystemContractDeploymentInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_aelf_Address = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Types.Address.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_acs0_ContractDeploymentInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Standards.ACS0.ContractDeploymentInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_acs0_ContractUpdateInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Standards.ACS0.ContractUpdateInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_aelf_Hash = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Types.Hash.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_acs0_ContractCodeCheckInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Standards.ACS0.ContractCodeCheckInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_acs0_ReleaseContractInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Standards.ACS0.ReleaseContractInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_Empty = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_acs0_ValidateSystemContractAddressInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Standards.ACS0.ValidateSystemContractAddressInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_BoolValue = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.BoolValue.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_Int64Value = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Int64Value.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_acs0_ContractInfo = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Standards.ACS0.ContractInfo.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_aelf_SmartContractRegistration = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Types.SmartContractRegistration.Parser.ParseFrom); - #endregion - - #region Methods - static readonly aelf::Method __Method_DeploySystemSmartContract = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "DeploySystemSmartContract", - __Marshaller_acs0_SystemContractDeploymentInput, - __Marshaller_aelf_Address); - - static readonly aelf::Method __Method_DeploySmartContract = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "DeploySmartContract", - __Marshaller_acs0_ContractDeploymentInput, - __Marshaller_aelf_Address); - - static readonly aelf::Method __Method_UpdateSmartContract = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "UpdateSmartContract", - __Marshaller_acs0_ContractUpdateInput, - __Marshaller_aelf_Address); - - static readonly aelf::Method __Method_ProposeNewContract = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "ProposeNewContract", - __Marshaller_acs0_ContractDeploymentInput, - __Marshaller_aelf_Hash); - - static readonly aelf::Method __Method_ProposeContractCodeCheck = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "ProposeContractCodeCheck", - __Marshaller_acs0_ContractCodeCheckInput, - __Marshaller_aelf_Hash); - - static readonly aelf::Method __Method_ProposeUpdateContract = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "ProposeUpdateContract", - __Marshaller_acs0_ContractUpdateInput, - __Marshaller_aelf_Hash); - - static readonly aelf::Method __Method_ReleaseApprovedContract = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "ReleaseApprovedContract", - __Marshaller_acs0_ReleaseContractInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_ReleaseCodeCheckedContract = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "ReleaseCodeCheckedContract", - __Marshaller_acs0_ReleaseContractInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_ValidateSystemContractAddress = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "ValidateSystemContractAddress", - __Marshaller_acs0_ValidateSystemContractAddressInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_SetContractProposerRequiredState = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "SetContractProposerRequiredState", - __Marshaller_google_protobuf_BoolValue, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_CurrentContractSerialNumber = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "CurrentContractSerialNumber", - __Marshaller_google_protobuf_Empty, - __Marshaller_google_protobuf_Int64Value); - - static readonly aelf::Method __Method_GetContractInfo = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetContractInfo", - __Marshaller_aelf_Address, - __Marshaller_acs0_ContractInfo); - - static readonly aelf::Method __Method_GetContractAuthor = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetContractAuthor", - __Marshaller_aelf_Address, - __Marshaller_aelf_Address); - - static readonly aelf::Method __Method_GetContractHash = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetContractHash", - __Marshaller_aelf_Address, - __Marshaller_aelf_Hash); - - static readonly aelf::Method __Method_GetContractAddressByName = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetContractAddressByName", - __Marshaller_aelf_Hash, - __Marshaller_aelf_Address); - - static readonly aelf::Method __Method_GetSmartContractRegistrationByAddress = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetSmartContractRegistrationByAddress", - __Marshaller_aelf_Address, - __Marshaller_aelf_SmartContractRegistration); - - static readonly aelf::Method __Method_GetSmartContractRegistrationByCodeHash = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetSmartContractRegistrationByCodeHash", - __Marshaller_aelf_Hash, - __Marshaller_aelf_SmartContractRegistration); - - #endregion - - #region Descriptors - public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor - { - get { return global::AElf.Standards.ACS0.Acs0Reflection.Descriptor.Services[0]; } - } - - public static global::System.Collections.Generic.IReadOnlyList Descriptors - { - get - { - return new global::System.Collections.Generic.List() - { - global::AElf.Standards.ACS0.Acs0Reflection.Descriptor.Services[0], - }; - } - } - #endregion - } -} -#endregion - diff --git a/src/AElf.EventHandler/Dto/Acs0g.cs b/src/AElf.EventHandler/Dto/Acs0g.cs deleted file mode 100644 index 3fe969bd..00000000 --- a/src/AElf.EventHandler/Dto/Acs0g.cs +++ /dev/null @@ -1,3657 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: acs0.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace AElf.Standards.ACS0 { - - /// Holder for reflection information generated from acs0.proto - internal static partial class Acs0Reflection { - - #region Descriptor - /// File descriptor for acs0.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static Acs0Reflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "CgphY3MwLnByb3RvEgRhY3MwGg9hZWxmL2NvcmUucHJvdG8aEmFlbGYvb3B0", - "aW9ucy5wcm90bxobZ29vZ2xlL3Byb3RvYnVmL2VtcHR5LnByb3RvGh5nb29n", - "bGUvcHJvdG9idWYvd3JhcHBlcnMucHJvdG8iogEKDENvbnRyYWN0SW5mbxIV", - "Cg1zZXJpYWxfbnVtYmVyGAEgASgDEh0KBmF1dGhvchgCIAEoCzINLmFlbGYu", - "QWRkcmVzcxIQCghjYXRlZ29yeRgDIAEoERIdCgljb2RlX2hhc2gYBCABKAsy", - "Ci5hZWxmLkhhc2gSGgoSaXNfc3lzdGVtX2NvbnRyYWN0GAUgASgIEg8KB3Zl", - "cnNpb24YBiABKAUiOQoXQ29udHJhY3REZXBsb3ltZW50SW5wdXQSEAoIY2F0", - "ZWdvcnkYASABKBESDAoEY29kZRgCIAEoDCL7AgodU3lzdGVtQ29udHJhY3RE", - "ZXBsb3ltZW50SW5wdXQSEAoIY2F0ZWdvcnkYASABKBESDAoEY29kZRgCIAEo", - "DBIYCgRuYW1lGAMgASgLMgouYWVsZi5IYXNoEmkKHHRyYW5zYWN0aW9uX21l", - "dGhvZF9jYWxsX2xpc3QYBCABKAsyQy5hY3MwLlN5c3RlbUNvbnRyYWN0RGVw", - "bG95bWVudElucHV0LlN5c3RlbVRyYW5zYWN0aW9uTWV0aG9kQ2FsbExpc3Qa", - "QgobU3lzdGVtVHJhbnNhY3Rpb25NZXRob2RDYWxsEhMKC21ldGhvZF9uYW1l", - "GAEgASgJEg4KBnBhcmFtcxgCIAEoDBpxCh9TeXN0ZW1UcmFuc2FjdGlvbk1l", - "dGhvZENhbGxMaXN0Ek4KBXZhbHVlGAEgAygLMj8uYWNzMC5TeXN0ZW1Db250", - "cmFjdERlcGxveW1lbnRJbnB1dC5TeXN0ZW1UcmFuc2FjdGlvbk1ldGhvZENh", - "bGwiQwoTQ29udHJhY3RVcGRhdGVJbnB1dBIeCgdhZGRyZXNzGAEgASgLMg0u", - "YWVsZi5BZGRyZXNzEgwKBGNvZGUYAiABKAwi0wEKFkNvbnRyYWN0Q29kZUNo", - "ZWNrSW5wdXQSFgoOY29udHJhY3RfaW5wdXQYASABKAwSHgoWaXNfY29udHJh", - "Y3RfZGVwbG95bWVudBgCIAEoCBIhChljb2RlX2NoZWNrX3JlbGVhc2VfbWV0", - "aG9kGAMgASgJEjAKHHByb3Bvc2VkX2NvbnRyYWN0X2lucHV0X2hhc2gYBCAB", - "KAsyCi5hZWxmLkhhc2gSEAoIY2F0ZWdvcnkYBSABKBESGgoSaXNfc3lzdGVt", - "X2NvbnRyYWN0GAYgASgIIkoKEENvbnRyYWN0UHJvcG9zZWQSMAoccHJvcG9z", - "ZWRfY29udHJhY3RfaW5wdXRfaGFzaBgBIAEoCzIKLmFlbGYuSGFzaDoEoLsY", - "ASKvAQoQQ29udHJhY3REZXBsb3llZBIkCgZhdXRob3IYASABKAsyDS5hZWxm", - "LkFkZHJlc3NCBYiP9QEBEiQKCWNvZGVfaGFzaBgCIAEoCzIKLmFlbGYuSGFz", - "aEIFiI/1AQESHgoHYWRkcmVzcxgDIAEoCzINLmFlbGYuQWRkcmVzcxIPCgd2", - "ZXJzaW9uGAQgASgFEhgKBE5hbWUYBSABKAsyCi5hZWxmLkhhc2g6BKC7GAEi", - "hwEKEUNvZGVDaGVja1JlcXVpcmVkEgwKBGNvZGUYASABKAwSMAoccHJvcG9z", - "ZWRfY29udHJhY3RfaW5wdXRfaGFzaBgCIAEoCzIKLmFlbGYuSGFzaBIQCghj", - "YXRlZ29yeRgDIAEoERIaChJpc19zeXN0ZW1fY29udHJhY3QYBCABKAg6BKC7", - "GAEikQEKC0NvZGVVcGRhdGVkEiUKB2FkZHJlc3MYASABKAsyDS5hZWxmLkFk", - "ZHJlc3NCBYiP9QEBEiEKDW9sZF9jb2RlX2hhc2gYAiABKAsyCi5hZWxmLkhh", - "c2gSIQoNbmV3X2NvZGVfaGFzaBgDIAEoCzIKLmFlbGYuSGFzaBIPCgd2ZXJz", - "aW9uGAQgASgFOgSguxgBInMKIlZhbGlkYXRlU3lzdGVtQ29udHJhY3RBZGRy", - "ZXNzSW5wdXQSLQoZc3lzdGVtX2NvbnRyYWN0X2hhc2hfbmFtZRgBIAEoCzIK", - "LmFlbGYuSGFzaBIeCgdhZGRyZXNzGAIgASgLMg0uYWVsZi5BZGRyZXNzImkK", - "FFJlbGVhc2VDb250cmFjdElucHV0Eh8KC3Byb3Bvc2FsX2lkGAEgASgLMgou", - "YWVsZi5IYXNoEjAKHHByb3Bvc2VkX2NvbnRyYWN0X2lucHV0X2hhc2gYAiAB", - "KAsyCi5hZWxmLkhhc2gylwoKBEFDUzASUQoZRGVwbG95U3lzdGVtU21hcnRD", - "b250cmFjdBIjLmFjczAuU3lzdGVtQ29udHJhY3REZXBsb3ltZW50SW5wdXQa", - "DS5hZWxmLkFkZHJlc3MiABJFChNEZXBsb3lTbWFydENvbnRyYWN0Eh0uYWNz", - "MC5Db250cmFjdERlcGxveW1lbnRJbnB1dBoNLmFlbGYuQWRkcmVzcyIAEkEK", - "E1VwZGF0ZVNtYXJ0Q29udHJhY3QSGS5hY3MwLkNvbnRyYWN0VXBkYXRlSW5w", - "dXQaDS5hZWxmLkFkZHJlc3MiABJBChJQcm9wb3NlTmV3Q29udHJhY3QSHS5h", - "Y3MwLkNvbnRyYWN0RGVwbG95bWVudElucHV0GgouYWVsZi5IYXNoIgASRgoY", - "UHJvcG9zZUNvbnRyYWN0Q29kZUNoZWNrEhwuYWNzMC5Db250cmFjdENvZGVD", - "aGVja0lucHV0GgouYWVsZi5IYXNoIgASQAoVUHJvcG9zZVVwZGF0ZUNvbnRy", - "YWN0EhkuYWNzMC5Db250cmFjdFVwZGF0ZUlucHV0GgouYWVsZi5IYXNoIgAS", - "TwoXUmVsZWFzZUFwcHJvdmVkQ29udHJhY3QSGi5hY3MwLlJlbGVhc2VDb250", - "cmFjdElucHV0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IgASUgoaUmVsZWFz", - "ZUNvZGVDaGVja2VkQ29udHJhY3QSGi5hY3MwLlJlbGVhc2VDb250cmFjdElu", - "cHV0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IgASYwodVmFsaWRhdGVTeXN0", - "ZW1Db250cmFjdEFkZHJlc3MSKC5hY3MwLlZhbGlkYXRlU3lzdGVtQ29udHJh", - "Y3RBZGRyZXNzSW5wdXQaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiABJYCiBT", - "ZXRDb250cmFjdFByb3Bvc2VyUmVxdWlyZWRTdGF0ZRIaLmdvb2dsZS5wcm90", - "b2J1Zi5Cb29sVmFsdWUaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiABJZChtD", - "dXJyZW50Q29udHJhY3RTZXJpYWxOdW1iZXISFi5nb29nbGUucHJvdG9idWYu", - "RW1wdHkaGy5nb29nbGUucHJvdG9idWYuSW50NjRWYWx1ZSIFiIn3AQESOwoP", - "R2V0Q29udHJhY3RJbmZvEg0uYWVsZi5BZGRyZXNzGhIuYWNzMC5Db250cmFj", - "dEluZm8iBYiJ9wEBEjgKEUdldENvbnRyYWN0QXV0aG9yEg0uYWVsZi5BZGRy", - "ZXNzGg0uYWVsZi5BZGRyZXNzIgWIifcBARIzCg9HZXRDb250cmFjdEhhc2gS", - "DS5hZWxmLkFkZHJlc3MaCi5hZWxmLkhhc2giBYiJ9wEBEjwKGEdldENvbnRy", - "YWN0QWRkcmVzc0J5TmFtZRIKLmFlbGYuSGFzaBoNLmFlbGYuQWRkcmVzcyIF", - "iIn3AQESXgolR2V0U21hcnRDb250cmFjdFJlZ2lzdHJhdGlvbkJ5QWRkcmVz", - "cxINLmFlbGYuQWRkcmVzcxofLmFlbGYuU21hcnRDb250cmFjdFJlZ2lzdHJh", - "dGlvbiIFiIn3AQESXAomR2V0U21hcnRDb250cmFjdFJlZ2lzdHJhdGlvbkJ5", - "Q29kZUhhc2gSCi5hZWxmLkhhc2gaHy5hZWxmLlNtYXJ0Q29udHJhY3RSZWdp", - "c3RyYXRpb24iBYiJ9wEBQhaqAhNBRWxmLlN0YW5kYXJkcy5BQ1MwUABiBnBy", - "b3RvMw==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::AElf.Types.CoreReflection.Descriptor, global::AElf.OptionsReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Standards.ACS0.ContractInfo), global::AElf.Standards.ACS0.ContractInfo.Parser, new[]{ "SerialNumber", "Author", "Category", "CodeHash", "IsSystemContract", "Version" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Standards.ACS0.ContractDeploymentInput), global::AElf.Standards.ACS0.ContractDeploymentInput.Parser, new[]{ "Category", "Code" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Standards.ACS0.SystemContractDeploymentInput), global::AElf.Standards.ACS0.SystemContractDeploymentInput.Parser, new[]{ "Category", "Code", "Name", "TransactionMethodCallList" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Standards.ACS0.SystemContractDeploymentInput.Types.SystemTransactionMethodCall), global::AElf.Standards.ACS0.SystemContractDeploymentInput.Types.SystemTransactionMethodCall.Parser, new[]{ "MethodName", "Params" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Standards.ACS0.SystemContractDeploymentInput.Types.SystemTransactionMethodCallList), global::AElf.Standards.ACS0.SystemContractDeploymentInput.Types.SystemTransactionMethodCallList.Parser, new[]{ "Value" }, null, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Standards.ACS0.ContractUpdateInput), global::AElf.Standards.ACS0.ContractUpdateInput.Parser, new[]{ "Address", "Code" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Standards.ACS0.ContractCodeCheckInput), global::AElf.Standards.ACS0.ContractCodeCheckInput.Parser, new[]{ "ContractInput", "IsContractDeployment", "CodeCheckReleaseMethod", "ProposedContractInputHash", "Category", "IsSystemContract" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Standards.ACS0.ContractProposed), global::AElf.Standards.ACS0.ContractProposed.Parser, new[]{ "ProposedContractInputHash" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Standards.ACS0.ContractDeployed), global::AElf.Standards.ACS0.ContractDeployed.Parser, new[]{ "Author", "CodeHash", "Address", "Version", "Name" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Standards.ACS0.CodeCheckRequired), global::AElf.Standards.ACS0.CodeCheckRequired.Parser, new[]{ "Code", "ProposedContractInputHash", "Category", "IsSystemContract" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Standards.ACS0.CodeUpdated), global::AElf.Standards.ACS0.CodeUpdated.Parser, new[]{ "Address", "OldCodeHash", "NewCodeHash", "Version" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Standards.ACS0.ValidateSystemContractAddressInput), global::AElf.Standards.ACS0.ValidateSystemContractAddressInput.Parser, new[]{ "SystemContractHashName", "Address" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Standards.ACS0.ReleaseContractInput), global::AElf.Standards.ACS0.ReleaseContractInput.Parser, new[]{ "ProposalId", "ProposedContractInputHash" }, null, null, null, null) - })); - } - #endregion - - } - #region Messages - internal sealed partial class ContractInfo : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ContractInfo()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Standards.ACS0.Acs0Reflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContractInfo() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContractInfo(ContractInfo other) : this() { - serialNumber_ = other.serialNumber_; - author_ = other.author_ != null ? other.author_.Clone() : null; - category_ = other.category_; - codeHash_ = other.codeHash_ != null ? other.codeHash_.Clone() : null; - isSystemContract_ = other.isSystemContract_; - version_ = other.version_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContractInfo Clone() { - return new ContractInfo(this); - } - - /// Field number for the "serial_number" field. - public const int SerialNumberFieldNumber = 1; - private long serialNumber_; - /// - /// The serial number of the contract. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long SerialNumber { - get { return serialNumber_; } - set { - serialNumber_ = value; - } - } - - /// Field number for the "author" field. - public const int AuthorFieldNumber = 2; - private global::AElf.Types.Address author_; - /// - /// The author of the contract, this is the person who deployed the contract. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Author { - get { return author_; } - set { - author_ = value; - } - } - - /// Field number for the "category" field. - public const int CategoryFieldNumber = 3; - private int category_; - /// - /// The category of contract code(0: C#). - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Category { - get { return category_; } - set { - category_ = value; - } - } - - /// Field number for the "code_hash" field. - public const int CodeHashFieldNumber = 4; - private global::AElf.Types.Hash codeHash_; - /// - /// The hash of the contract code. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash CodeHash { - get { return codeHash_; } - set { - codeHash_ = value; - } - } - - /// Field number for the "is_system_contract" field. - public const int IsSystemContractFieldNumber = 5; - private bool isSystemContract_; - /// - /// Whether it is a system contract. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsSystemContract { - get { return isSystemContract_; } - set { - isSystemContract_ = value; - } - } - - /// Field number for the "version" field. - public const int VersionFieldNumber = 6; - private int version_; - /// - /// The version of the current contract. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Version { - get { return version_; } - set { - version_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ContractInfo); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ContractInfo other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (SerialNumber != other.SerialNumber) return false; - if (!object.Equals(Author, other.Author)) return false; - if (Category != other.Category) return false; - if (!object.Equals(CodeHash, other.CodeHash)) return false; - if (IsSystemContract != other.IsSystemContract) return false; - if (Version != other.Version) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (SerialNumber != 0L) hash ^= SerialNumber.GetHashCode(); - if (author_ != null) hash ^= Author.GetHashCode(); - if (Category != 0) hash ^= Category.GetHashCode(); - if (codeHash_ != null) hash ^= CodeHash.GetHashCode(); - if (IsSystemContract != false) hash ^= IsSystemContract.GetHashCode(); - if (Version != 0) hash ^= Version.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (SerialNumber != 0L) { - output.WriteRawTag(8); - output.WriteInt64(SerialNumber); - } - if (author_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Author); - } - if (Category != 0) { - output.WriteRawTag(24); - output.WriteSInt32(Category); - } - if (codeHash_ != null) { - output.WriteRawTag(34); - output.WriteMessage(CodeHash); - } - if (IsSystemContract != false) { - output.WriteRawTag(40); - output.WriteBool(IsSystemContract); - } - if (Version != 0) { - output.WriteRawTag(48); - output.WriteInt32(Version); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (SerialNumber != 0L) { - output.WriteRawTag(8); - output.WriteInt64(SerialNumber); - } - if (author_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Author); - } - if (Category != 0) { - output.WriteRawTag(24); - output.WriteSInt32(Category); - } - if (codeHash_ != null) { - output.WriteRawTag(34); - output.WriteMessage(CodeHash); - } - if (IsSystemContract != false) { - output.WriteRawTag(40); - output.WriteBool(IsSystemContract); - } - if (Version != 0) { - output.WriteRawTag(48); - output.WriteInt32(Version); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (SerialNumber != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(SerialNumber); - } - if (author_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Author); - } - if (Category != 0) { - size += 1 + pb::CodedOutputStream.ComputeSInt32Size(Category); - } - if (codeHash_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(CodeHash); - } - if (IsSystemContract != false) { - size += 1 + 1; - } - if (Version != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Version); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ContractInfo other) { - if (other == null) { - return; - } - if (other.SerialNumber != 0L) { - SerialNumber = other.SerialNumber; - } - if (other.author_ != null) { - if (author_ == null) { - Author = new global::AElf.Types.Address(); - } - Author.MergeFrom(other.Author); - } - if (other.Category != 0) { - Category = other.Category; - } - if (other.codeHash_ != null) { - if (codeHash_ == null) { - CodeHash = new global::AElf.Types.Hash(); - } - CodeHash.MergeFrom(other.CodeHash); - } - if (other.IsSystemContract != false) { - IsSystemContract = other.IsSystemContract; - } - if (other.Version != 0) { - Version = other.Version; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - SerialNumber = input.ReadInt64(); - break; - } - case 18: { - if (author_ == null) { - Author = new global::AElf.Types.Address(); - } - input.ReadMessage(Author); - break; - } - case 24: { - Category = input.ReadSInt32(); - break; - } - case 34: { - if (codeHash_ == null) { - CodeHash = new global::AElf.Types.Hash(); - } - input.ReadMessage(CodeHash); - break; - } - case 40: { - IsSystemContract = input.ReadBool(); - break; - } - case 48: { - Version = input.ReadInt32(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - SerialNumber = input.ReadInt64(); - break; - } - case 18: { - if (author_ == null) { - Author = new global::AElf.Types.Address(); - } - input.ReadMessage(Author); - break; - } - case 24: { - Category = input.ReadSInt32(); - break; - } - case 34: { - if (codeHash_ == null) { - CodeHash = new global::AElf.Types.Hash(); - } - input.ReadMessage(CodeHash); - break; - } - case 40: { - IsSystemContract = input.ReadBool(); - break; - } - case 48: { - Version = input.ReadInt32(); - break; - } - } - } - } - #endif - - } - - internal sealed partial class ContractDeploymentInput : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ContractDeploymentInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Standards.ACS0.Acs0Reflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContractDeploymentInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContractDeploymentInput(ContractDeploymentInput other) : this() { - category_ = other.category_; - code_ = other.code_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContractDeploymentInput Clone() { - return new ContractDeploymentInput(this); - } - - /// Field number for the "category" field. - public const int CategoryFieldNumber = 1; - private int category_; - /// - /// The category of contract code(0: C#). - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Category { - get { return category_; } - set { - category_ = value; - } - } - - /// Field number for the "code" field. - public const int CodeFieldNumber = 2; - private pb::ByteString code_ = pb::ByteString.Empty; - /// - /// The byte array of the contract code. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Code { - get { return code_; } - set { - code_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ContractDeploymentInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ContractDeploymentInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Category != other.Category) return false; - if (Code != other.Code) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Category != 0) hash ^= Category.GetHashCode(); - if (Code.Length != 0) hash ^= Code.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Category != 0) { - output.WriteRawTag(8); - output.WriteSInt32(Category); - } - if (Code.Length != 0) { - output.WriteRawTag(18); - output.WriteBytes(Code); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Category != 0) { - output.WriteRawTag(8); - output.WriteSInt32(Category); - } - if (Code.Length != 0) { - output.WriteRawTag(18); - output.WriteBytes(Code); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Category != 0) { - size += 1 + pb::CodedOutputStream.ComputeSInt32Size(Category); - } - if (Code.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Code); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ContractDeploymentInput other) { - if (other == null) { - return; - } - if (other.Category != 0) { - Category = other.Category; - } - if (other.Code.Length != 0) { - Code = other.Code; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Category = input.ReadSInt32(); - break; - } - case 18: { - Code = input.ReadBytes(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Category = input.ReadSInt32(); - break; - } - case 18: { - Code = input.ReadBytes(); - break; - } - } - } - } - #endif - - } - - internal sealed partial class SystemContractDeploymentInput : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SystemContractDeploymentInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Standards.ACS0.Acs0Reflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SystemContractDeploymentInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SystemContractDeploymentInput(SystemContractDeploymentInput other) : this() { - category_ = other.category_; - code_ = other.code_; - name_ = other.name_ != null ? other.name_.Clone() : null; - transactionMethodCallList_ = other.transactionMethodCallList_ != null ? other.transactionMethodCallList_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SystemContractDeploymentInput Clone() { - return new SystemContractDeploymentInput(this); - } - - /// Field number for the "category" field. - public const int CategoryFieldNumber = 1; - private int category_; - /// - /// The category of contract code(0: C#). - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Category { - get { return category_; } - set { - category_ = value; - } - } - - /// Field number for the "code" field. - public const int CodeFieldNumber = 2; - private pb::ByteString code_ = pb::ByteString.Empty; - /// - /// The byte array of the contract code. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Code { - get { return code_; } - set { - code_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 3; - private global::AElf.Types.Hash name_; - /// - /// The name of the contract. It has to be unique. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash Name { - get { return name_; } - set { - name_ = value; - } - } - - /// Field number for the "transaction_method_call_list" field. - public const int TransactionMethodCallListFieldNumber = 4; - private global::AElf.Standards.ACS0.SystemContractDeploymentInput.Types.SystemTransactionMethodCallList transactionMethodCallList_; - /// - /// An initial list of transactions for the system contract, - /// which is executed in sequence when the contract is deployed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Standards.ACS0.SystemContractDeploymentInput.Types.SystemTransactionMethodCallList TransactionMethodCallList { - get { return transactionMethodCallList_; } - set { - transactionMethodCallList_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SystemContractDeploymentInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SystemContractDeploymentInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Category != other.Category) return false; - if (Code != other.Code) return false; - if (!object.Equals(Name, other.Name)) return false; - if (!object.Equals(TransactionMethodCallList, other.TransactionMethodCallList)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Category != 0) hash ^= Category.GetHashCode(); - if (Code.Length != 0) hash ^= Code.GetHashCode(); - if (name_ != null) hash ^= Name.GetHashCode(); - if (transactionMethodCallList_ != null) hash ^= TransactionMethodCallList.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Category != 0) { - output.WriteRawTag(8); - output.WriteSInt32(Category); - } - if (Code.Length != 0) { - output.WriteRawTag(18); - output.WriteBytes(Code); - } - if (name_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Name); - } - if (transactionMethodCallList_ != null) { - output.WriteRawTag(34); - output.WriteMessage(TransactionMethodCallList); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Category != 0) { - output.WriteRawTag(8); - output.WriteSInt32(Category); - } - if (Code.Length != 0) { - output.WriteRawTag(18); - output.WriteBytes(Code); - } - if (name_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Name); - } - if (transactionMethodCallList_ != null) { - output.WriteRawTag(34); - output.WriteMessage(TransactionMethodCallList); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Category != 0) { - size += 1 + pb::CodedOutputStream.ComputeSInt32Size(Category); - } - if (Code.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Code); - } - if (name_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Name); - } - if (transactionMethodCallList_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(TransactionMethodCallList); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SystemContractDeploymentInput other) { - if (other == null) { - return; - } - if (other.Category != 0) { - Category = other.Category; - } - if (other.Code.Length != 0) { - Code = other.Code; - } - if (other.name_ != null) { - if (name_ == null) { - Name = new global::AElf.Types.Hash(); - } - Name.MergeFrom(other.Name); - } - if (other.transactionMethodCallList_ != null) { - if (transactionMethodCallList_ == null) { - TransactionMethodCallList = new global::AElf.Standards.ACS0.SystemContractDeploymentInput.Types.SystemTransactionMethodCallList(); - } - TransactionMethodCallList.MergeFrom(other.TransactionMethodCallList); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Category = input.ReadSInt32(); - break; - } - case 18: { - Code = input.ReadBytes(); - break; - } - case 26: { - if (name_ == null) { - Name = new global::AElf.Types.Hash(); - } - input.ReadMessage(Name); - break; - } - case 34: { - if (transactionMethodCallList_ == null) { - TransactionMethodCallList = new global::AElf.Standards.ACS0.SystemContractDeploymentInput.Types.SystemTransactionMethodCallList(); - } - input.ReadMessage(TransactionMethodCallList); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Category = input.ReadSInt32(); - break; - } - case 18: { - Code = input.ReadBytes(); - break; - } - case 26: { - if (name_ == null) { - Name = new global::AElf.Types.Hash(); - } - input.ReadMessage(Name); - break; - } - case 34: { - if (transactionMethodCallList_ == null) { - TransactionMethodCallList = new global::AElf.Standards.ACS0.SystemContractDeploymentInput.Types.SystemTransactionMethodCallList(); - } - input.ReadMessage(TransactionMethodCallList); - break; - } - } - } - } - #endif - - #region Nested types - /// Container for nested types declared in the SystemContractDeploymentInput message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - internal sealed partial class SystemTransactionMethodCall : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SystemTransactionMethodCall()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Standards.ACS0.SystemContractDeploymentInput.Descriptor.NestedTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SystemTransactionMethodCall() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SystemTransactionMethodCall(SystemTransactionMethodCall other) : this() { - methodName_ = other.methodName_; - params_ = other.params_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SystemTransactionMethodCall Clone() { - return new SystemTransactionMethodCall(this); - } - - /// Field number for the "method_name" field. - public const int MethodNameFieldNumber = 1; - private string methodName_ = ""; - /// - /// The method name of system transaction. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string MethodName { - get { return methodName_; } - set { - methodName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "params" field. - public const int ParamsFieldNumber = 2; - private pb::ByteString params_ = pb::ByteString.Empty; - /// - /// The params of system transaction method. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Params { - get { return params_; } - set { - params_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SystemTransactionMethodCall); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SystemTransactionMethodCall other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (MethodName != other.MethodName) return false; - if (Params != other.Params) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (MethodName.Length != 0) hash ^= MethodName.GetHashCode(); - if (Params.Length != 0) hash ^= Params.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (MethodName.Length != 0) { - output.WriteRawTag(10); - output.WriteString(MethodName); - } - if (Params.Length != 0) { - output.WriteRawTag(18); - output.WriteBytes(Params); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (MethodName.Length != 0) { - output.WriteRawTag(10); - output.WriteString(MethodName); - } - if (Params.Length != 0) { - output.WriteRawTag(18); - output.WriteBytes(Params); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (MethodName.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(MethodName); - } - if (Params.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Params); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SystemTransactionMethodCall other) { - if (other == null) { - return; - } - if (other.MethodName.Length != 0) { - MethodName = other.MethodName; - } - if (other.Params.Length != 0) { - Params = other.Params; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - MethodName = input.ReadString(); - break; - } - case 18: { - Params = input.ReadBytes(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - MethodName = input.ReadString(); - break; - } - case 18: { - Params = input.ReadBytes(); - break; - } - } - } - } - #endif - - } - - internal sealed partial class SystemTransactionMethodCallList : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SystemTransactionMethodCallList()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Standards.ACS0.SystemContractDeploymentInput.Descriptor.NestedTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SystemTransactionMethodCallList() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SystemTransactionMethodCallList(SystemTransactionMethodCallList other) : this() { - value_ = other.value_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SystemTransactionMethodCallList Clone() { - return new SystemTransactionMethodCallList(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_value_codec - = pb::FieldCodec.ForMessage(10, global::AElf.Standards.ACS0.SystemContractDeploymentInput.Types.SystemTransactionMethodCall.Parser); - private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); - /// - /// The list of system transactions. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Value { - get { return value_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SystemTransactionMethodCallList); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SystemTransactionMethodCallList other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!value_.Equals(other.value_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= value_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - value_.WriteTo(output, _repeated_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - value_.WriteTo(ref output, _repeated_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += value_.CalculateSize(_repeated_value_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SystemTransactionMethodCallList other) { - if (other == null) { - return; - } - value_.Add(other.value_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - value_.AddEntriesFrom(input, _repeated_value_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - value_.AddEntriesFrom(ref input, _repeated_value_codec); - break; - } - } - } - } - #endif - - } - - } - #endregion - - } - - internal sealed partial class ContractUpdateInput : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ContractUpdateInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Standards.ACS0.Acs0Reflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContractUpdateInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContractUpdateInput(ContractUpdateInput other) : this() { - address_ = other.address_ != null ? other.address_.Clone() : null; - code_ = other.code_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContractUpdateInput Clone() { - return new ContractUpdateInput(this); - } - - /// Field number for the "address" field. - public const int AddressFieldNumber = 1; - private global::AElf.Types.Address address_; - /// - /// The contract address that needs to be updated. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Address { - get { return address_; } - set { - address_ = value; - } - } - - /// Field number for the "code" field. - public const int CodeFieldNumber = 2; - private pb::ByteString code_ = pb::ByteString.Empty; - /// - /// The byte array of the new contract code. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Code { - get { return code_; } - set { - code_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ContractUpdateInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ContractUpdateInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Address, other.Address)) return false; - if (Code != other.Code) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (address_ != null) hash ^= Address.GetHashCode(); - if (Code.Length != 0) hash ^= Code.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (address_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Address); - } - if (Code.Length != 0) { - output.WriteRawTag(18); - output.WriteBytes(Code); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (address_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Address); - } - if (Code.Length != 0) { - output.WriteRawTag(18); - output.WriteBytes(Code); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (address_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Address); - } - if (Code.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Code); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ContractUpdateInput other) { - if (other == null) { - return; - } - if (other.address_ != null) { - if (address_ == null) { - Address = new global::AElf.Types.Address(); - } - Address.MergeFrom(other.Address); - } - if (other.Code.Length != 0) { - Code = other.Code; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (address_ == null) { - Address = new global::AElf.Types.Address(); - } - input.ReadMessage(Address); - break; - } - case 18: { - Code = input.ReadBytes(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - if (address_ == null) { - Address = new global::AElf.Types.Address(); - } - input.ReadMessage(Address); - break; - } - case 18: { - Code = input.ReadBytes(); - break; - } - } - } - } - #endif - - } - - internal sealed partial class ContractCodeCheckInput : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ContractCodeCheckInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Standards.ACS0.Acs0Reflection.Descriptor.MessageTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContractCodeCheckInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContractCodeCheckInput(ContractCodeCheckInput other) : this() { - contractInput_ = other.contractInput_; - isContractDeployment_ = other.isContractDeployment_; - codeCheckReleaseMethod_ = other.codeCheckReleaseMethod_; - proposedContractInputHash_ = other.proposedContractInputHash_ != null ? other.proposedContractInputHash_.Clone() : null; - category_ = other.category_; - isSystemContract_ = other.isSystemContract_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContractCodeCheckInput Clone() { - return new ContractCodeCheckInput(this); - } - - /// Field number for the "contract_input" field. - public const int ContractInputFieldNumber = 1; - private pb::ByteString contractInput_ = pb::ByteString.Empty; - /// - /// The byte array of the contract code to be checked. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString ContractInput { - get { return contractInput_; } - set { - contractInput_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "is_contract_deployment" field. - public const int IsContractDeploymentFieldNumber = 2; - private bool isContractDeployment_; - /// - /// Whether the input contract is to be deployed or updated. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsContractDeployment { - get { return isContractDeployment_; } - set { - isContractDeployment_ = value; - } - } - - /// Field number for the "code_check_release_method" field. - public const int CodeCheckReleaseMethodFieldNumber = 3; - private string codeCheckReleaseMethod_ = ""; - /// - /// Method to call after code check complete(DeploySmartContract or UpdateSmartContract). - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string CodeCheckReleaseMethod { - get { return codeCheckReleaseMethod_; } - set { - codeCheckReleaseMethod_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "proposed_contract_input_hash" field. - public const int ProposedContractInputHashFieldNumber = 4; - private global::AElf.Types.Hash proposedContractInputHash_; - /// - /// The id of the proposed contract. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash ProposedContractInputHash { - get { return proposedContractInputHash_; } - set { - proposedContractInputHash_ = value; - } - } - - /// Field number for the "category" field. - public const int CategoryFieldNumber = 5; - private int category_; - /// - /// The category of contract code(0: C#). - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Category { - get { return category_; } - set { - category_ = value; - } - } - - /// Field number for the "is_system_contract" field. - public const int IsSystemContractFieldNumber = 6; - private bool isSystemContract_; - /// - /// Indicates if the contract is the system contract. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsSystemContract { - get { return isSystemContract_; } - set { - isSystemContract_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ContractCodeCheckInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ContractCodeCheckInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (ContractInput != other.ContractInput) return false; - if (IsContractDeployment != other.IsContractDeployment) return false; - if (CodeCheckReleaseMethod != other.CodeCheckReleaseMethod) return false; - if (!object.Equals(ProposedContractInputHash, other.ProposedContractInputHash)) return false; - if (Category != other.Category) return false; - if (IsSystemContract != other.IsSystemContract) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (ContractInput.Length != 0) hash ^= ContractInput.GetHashCode(); - if (IsContractDeployment != false) hash ^= IsContractDeployment.GetHashCode(); - if (CodeCheckReleaseMethod.Length != 0) hash ^= CodeCheckReleaseMethod.GetHashCode(); - if (proposedContractInputHash_ != null) hash ^= ProposedContractInputHash.GetHashCode(); - if (Category != 0) hash ^= Category.GetHashCode(); - if (IsSystemContract != false) hash ^= IsSystemContract.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (ContractInput.Length != 0) { - output.WriteRawTag(10); - output.WriteBytes(ContractInput); - } - if (IsContractDeployment != false) { - output.WriteRawTag(16); - output.WriteBool(IsContractDeployment); - } - if (CodeCheckReleaseMethod.Length != 0) { - output.WriteRawTag(26); - output.WriteString(CodeCheckReleaseMethod); - } - if (proposedContractInputHash_ != null) { - output.WriteRawTag(34); - output.WriteMessage(ProposedContractInputHash); - } - if (Category != 0) { - output.WriteRawTag(40); - output.WriteSInt32(Category); - } - if (IsSystemContract != false) { - output.WriteRawTag(48); - output.WriteBool(IsSystemContract); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (ContractInput.Length != 0) { - output.WriteRawTag(10); - output.WriteBytes(ContractInput); - } - if (IsContractDeployment != false) { - output.WriteRawTag(16); - output.WriteBool(IsContractDeployment); - } - if (CodeCheckReleaseMethod.Length != 0) { - output.WriteRawTag(26); - output.WriteString(CodeCheckReleaseMethod); - } - if (proposedContractInputHash_ != null) { - output.WriteRawTag(34); - output.WriteMessage(ProposedContractInputHash); - } - if (Category != 0) { - output.WriteRawTag(40); - output.WriteSInt32(Category); - } - if (IsSystemContract != false) { - output.WriteRawTag(48); - output.WriteBool(IsSystemContract); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (ContractInput.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(ContractInput); - } - if (IsContractDeployment != false) { - size += 1 + 1; - } - if (CodeCheckReleaseMethod.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(CodeCheckReleaseMethod); - } - if (proposedContractInputHash_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ProposedContractInputHash); - } - if (Category != 0) { - size += 1 + pb::CodedOutputStream.ComputeSInt32Size(Category); - } - if (IsSystemContract != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ContractCodeCheckInput other) { - if (other == null) { - return; - } - if (other.ContractInput.Length != 0) { - ContractInput = other.ContractInput; - } - if (other.IsContractDeployment != false) { - IsContractDeployment = other.IsContractDeployment; - } - if (other.CodeCheckReleaseMethod.Length != 0) { - CodeCheckReleaseMethod = other.CodeCheckReleaseMethod; - } - if (other.proposedContractInputHash_ != null) { - if (proposedContractInputHash_ == null) { - ProposedContractInputHash = new global::AElf.Types.Hash(); - } - ProposedContractInputHash.MergeFrom(other.ProposedContractInputHash); - } - if (other.Category != 0) { - Category = other.Category; - } - if (other.IsSystemContract != false) { - IsSystemContract = other.IsSystemContract; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - ContractInput = input.ReadBytes(); - break; - } - case 16: { - IsContractDeployment = input.ReadBool(); - break; - } - case 26: { - CodeCheckReleaseMethod = input.ReadString(); - break; - } - case 34: { - if (proposedContractInputHash_ == null) { - ProposedContractInputHash = new global::AElf.Types.Hash(); - } - input.ReadMessage(ProposedContractInputHash); - break; - } - case 40: { - Category = input.ReadSInt32(); - break; - } - case 48: { - IsSystemContract = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - ContractInput = input.ReadBytes(); - break; - } - case 16: { - IsContractDeployment = input.ReadBool(); - break; - } - case 26: { - CodeCheckReleaseMethod = input.ReadString(); - break; - } - case 34: { - if (proposedContractInputHash_ == null) { - ProposedContractInputHash = new global::AElf.Types.Hash(); - } - input.ReadMessage(ProposedContractInputHash); - break; - } - case 40: { - Category = input.ReadSInt32(); - break; - } - case 48: { - IsSystemContract = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - internal sealed partial class ContractProposed : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ContractProposed()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Standards.ACS0.Acs0Reflection.Descriptor.MessageTypes[5]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContractProposed() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContractProposed(ContractProposed other) : this() { - proposedContractInputHash_ = other.proposedContractInputHash_ != null ? other.proposedContractInputHash_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContractProposed Clone() { - return new ContractProposed(this); - } - - /// Field number for the "proposed_contract_input_hash" field. - public const int ProposedContractInputHashFieldNumber = 1; - private global::AElf.Types.Hash proposedContractInputHash_; - /// - /// The id of the proposed contract. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash ProposedContractInputHash { - get { return proposedContractInputHash_; } - set { - proposedContractInputHash_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ContractProposed); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ContractProposed other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(ProposedContractInputHash, other.ProposedContractInputHash)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (proposedContractInputHash_ != null) hash ^= ProposedContractInputHash.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (proposedContractInputHash_ != null) { - output.WriteRawTag(10); - output.WriteMessage(ProposedContractInputHash); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (proposedContractInputHash_ != null) { - output.WriteRawTag(10); - output.WriteMessage(ProposedContractInputHash); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (proposedContractInputHash_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ProposedContractInputHash); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ContractProposed other) { - if (other == null) { - return; - } - if (other.proposedContractInputHash_ != null) { - if (proposedContractInputHash_ == null) { - ProposedContractInputHash = new global::AElf.Types.Hash(); - } - ProposedContractInputHash.MergeFrom(other.ProposedContractInputHash); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (proposedContractInputHash_ == null) { - ProposedContractInputHash = new global::AElf.Types.Hash(); - } - input.ReadMessage(ProposedContractInputHash); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - if (proposedContractInputHash_ == null) { - ProposedContractInputHash = new global::AElf.Types.Hash(); - } - input.ReadMessage(ProposedContractInputHash); - break; - } - } - } - } - #endif - - } - - internal sealed partial class ContractDeployed : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ContractDeployed()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Standards.ACS0.Acs0Reflection.Descriptor.MessageTypes[6]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContractDeployed() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContractDeployed(ContractDeployed other) : this() { - author_ = other.author_ != null ? other.author_.Clone() : null; - codeHash_ = other.codeHash_ != null ? other.codeHash_.Clone() : null; - address_ = other.address_ != null ? other.address_.Clone() : null; - version_ = other.version_; - name_ = other.name_ != null ? other.name_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ContractDeployed Clone() { - return new ContractDeployed(this); - } - - /// Field number for the "author" field. - public const int AuthorFieldNumber = 1; - private global::AElf.Types.Address author_; - /// - /// The author of the contract, this is the person who deployed the contract. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Author { - get { return author_; } - set { - author_ = value; - } - } - - /// Field number for the "code_hash" field. - public const int CodeHashFieldNumber = 2; - private global::AElf.Types.Hash codeHash_; - /// - /// The hash of the contract code. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash CodeHash { - get { return codeHash_; } - set { - codeHash_ = value; - } - } - - /// Field number for the "address" field. - public const int AddressFieldNumber = 3; - private global::AElf.Types.Address address_; - /// - /// The address of the contract. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Address { - get { return address_; } - set { - address_ = value; - } - } - - /// Field number for the "version" field. - public const int VersionFieldNumber = 4; - private int version_; - /// - /// The version of the current contract. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Version { - get { return version_; } - set { - version_ = value; - } - } - - /// Field number for the "Name" field. - public const int NameFieldNumber = 5; - private global::AElf.Types.Hash name_; - /// - /// The name of the contract. It has to be unique. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash Name { - get { return name_; } - set { - name_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ContractDeployed); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ContractDeployed other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Author, other.Author)) return false; - if (!object.Equals(CodeHash, other.CodeHash)) return false; - if (!object.Equals(Address, other.Address)) return false; - if (Version != other.Version) return false; - if (!object.Equals(Name, other.Name)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (author_ != null) hash ^= Author.GetHashCode(); - if (codeHash_ != null) hash ^= CodeHash.GetHashCode(); - if (address_ != null) hash ^= Address.GetHashCode(); - if (Version != 0) hash ^= Version.GetHashCode(); - if (name_ != null) hash ^= Name.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (author_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Author); - } - if (codeHash_ != null) { - output.WriteRawTag(18); - output.WriteMessage(CodeHash); - } - if (address_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Address); - } - if (Version != 0) { - output.WriteRawTag(32); - output.WriteInt32(Version); - } - if (name_ != null) { - output.WriteRawTag(42); - output.WriteMessage(Name); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (author_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Author); - } - if (codeHash_ != null) { - output.WriteRawTag(18); - output.WriteMessage(CodeHash); - } - if (address_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Address); - } - if (Version != 0) { - output.WriteRawTag(32); - output.WriteInt32(Version); - } - if (name_ != null) { - output.WriteRawTag(42); - output.WriteMessage(Name); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (author_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Author); - } - if (codeHash_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(CodeHash); - } - if (address_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Address); - } - if (Version != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Version); - } - if (name_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Name); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ContractDeployed other) { - if (other == null) { - return; - } - if (other.author_ != null) { - if (author_ == null) { - Author = new global::AElf.Types.Address(); - } - Author.MergeFrom(other.Author); - } - if (other.codeHash_ != null) { - if (codeHash_ == null) { - CodeHash = new global::AElf.Types.Hash(); - } - CodeHash.MergeFrom(other.CodeHash); - } - if (other.address_ != null) { - if (address_ == null) { - Address = new global::AElf.Types.Address(); - } - Address.MergeFrom(other.Address); - } - if (other.Version != 0) { - Version = other.Version; - } - if (other.name_ != null) { - if (name_ == null) { - Name = new global::AElf.Types.Hash(); - } - Name.MergeFrom(other.Name); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (author_ == null) { - Author = new global::AElf.Types.Address(); - } - input.ReadMessage(Author); - break; - } - case 18: { - if (codeHash_ == null) { - CodeHash = new global::AElf.Types.Hash(); - } - input.ReadMessage(CodeHash); - break; - } - case 26: { - if (address_ == null) { - Address = new global::AElf.Types.Address(); - } - input.ReadMessage(Address); - break; - } - case 32: { - Version = input.ReadInt32(); - break; - } - case 42: { - if (name_ == null) { - Name = new global::AElf.Types.Hash(); - } - input.ReadMessage(Name); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - if (author_ == null) { - Author = new global::AElf.Types.Address(); - } - input.ReadMessage(Author); - break; - } - case 18: { - if (codeHash_ == null) { - CodeHash = new global::AElf.Types.Hash(); - } - input.ReadMessage(CodeHash); - break; - } - case 26: { - if (address_ == null) { - Address = new global::AElf.Types.Address(); - } - input.ReadMessage(Address); - break; - } - case 32: { - Version = input.ReadInt32(); - break; - } - case 42: { - if (name_ == null) { - Name = new global::AElf.Types.Hash(); - } - input.ReadMessage(Name); - break; - } - } - } - } - #endif - - } - - internal sealed partial class CodeCheckRequired : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CodeCheckRequired()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Standards.ACS0.Acs0Reflection.Descriptor.MessageTypes[7]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CodeCheckRequired() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CodeCheckRequired(CodeCheckRequired other) : this() { - code_ = other.code_; - proposedContractInputHash_ = other.proposedContractInputHash_ != null ? other.proposedContractInputHash_.Clone() : null; - category_ = other.category_; - isSystemContract_ = other.isSystemContract_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CodeCheckRequired Clone() { - return new CodeCheckRequired(this); - } - - /// Field number for the "code" field. - public const int CodeFieldNumber = 1; - private pb::ByteString code_ = pb::ByteString.Empty; - /// - /// The byte array of the contract code. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Code { - get { return code_; } - set { - code_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "proposed_contract_input_hash" field. - public const int ProposedContractInputHashFieldNumber = 2; - private global::AElf.Types.Hash proposedContractInputHash_; - /// - /// The id of the proposed contract. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash ProposedContractInputHash { - get { return proposedContractInputHash_; } - set { - proposedContractInputHash_ = value; - } - } - - /// Field number for the "category" field. - public const int CategoryFieldNumber = 3; - private int category_; - /// - /// The category of contract code(0: C#). - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Category { - get { return category_; } - set { - category_ = value; - } - } - - /// Field number for the "is_system_contract" field. - public const int IsSystemContractFieldNumber = 4; - private bool isSystemContract_; - /// - /// Indicates if the contract is the system contract. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsSystemContract { - get { return isSystemContract_; } - set { - isSystemContract_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as CodeCheckRequired); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(CodeCheckRequired other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Code != other.Code) return false; - if (!object.Equals(ProposedContractInputHash, other.ProposedContractInputHash)) return false; - if (Category != other.Category) return false; - if (IsSystemContract != other.IsSystemContract) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Code.Length != 0) hash ^= Code.GetHashCode(); - if (proposedContractInputHash_ != null) hash ^= ProposedContractInputHash.GetHashCode(); - if (Category != 0) hash ^= Category.GetHashCode(); - if (IsSystemContract != false) hash ^= IsSystemContract.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Code.Length != 0) { - output.WriteRawTag(10); - output.WriteBytes(Code); - } - if (proposedContractInputHash_ != null) { - output.WriteRawTag(18); - output.WriteMessage(ProposedContractInputHash); - } - if (Category != 0) { - output.WriteRawTag(24); - output.WriteSInt32(Category); - } - if (IsSystemContract != false) { - output.WriteRawTag(32); - output.WriteBool(IsSystemContract); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Code.Length != 0) { - output.WriteRawTag(10); - output.WriteBytes(Code); - } - if (proposedContractInputHash_ != null) { - output.WriteRawTag(18); - output.WriteMessage(ProposedContractInputHash); - } - if (Category != 0) { - output.WriteRawTag(24); - output.WriteSInt32(Category); - } - if (IsSystemContract != false) { - output.WriteRawTag(32); - output.WriteBool(IsSystemContract); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Code.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Code); - } - if (proposedContractInputHash_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ProposedContractInputHash); - } - if (Category != 0) { - size += 1 + pb::CodedOutputStream.ComputeSInt32Size(Category); - } - if (IsSystemContract != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(CodeCheckRequired other) { - if (other == null) { - return; - } - if (other.Code.Length != 0) { - Code = other.Code; - } - if (other.proposedContractInputHash_ != null) { - if (proposedContractInputHash_ == null) { - ProposedContractInputHash = new global::AElf.Types.Hash(); - } - ProposedContractInputHash.MergeFrom(other.ProposedContractInputHash); - } - if (other.Category != 0) { - Category = other.Category; - } - if (other.IsSystemContract != false) { - IsSystemContract = other.IsSystemContract; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Code = input.ReadBytes(); - break; - } - case 18: { - if (proposedContractInputHash_ == null) { - ProposedContractInputHash = new global::AElf.Types.Hash(); - } - input.ReadMessage(ProposedContractInputHash); - break; - } - case 24: { - Category = input.ReadSInt32(); - break; - } - case 32: { - IsSystemContract = input.ReadBool(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Code = input.ReadBytes(); - break; - } - case 18: { - if (proposedContractInputHash_ == null) { - ProposedContractInputHash = new global::AElf.Types.Hash(); - } - input.ReadMessage(ProposedContractInputHash); - break; - } - case 24: { - Category = input.ReadSInt32(); - break; - } - case 32: { - IsSystemContract = input.ReadBool(); - break; - } - } - } - } - #endif - - } - - internal sealed partial class CodeUpdated : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CodeUpdated()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Standards.ACS0.Acs0Reflection.Descriptor.MessageTypes[8]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CodeUpdated() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CodeUpdated(CodeUpdated other) : this() { - address_ = other.address_ != null ? other.address_.Clone() : null; - oldCodeHash_ = other.oldCodeHash_ != null ? other.oldCodeHash_.Clone() : null; - newCodeHash_ = other.newCodeHash_ != null ? other.newCodeHash_.Clone() : null; - version_ = other.version_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CodeUpdated Clone() { - return new CodeUpdated(this); - } - - /// Field number for the "address" field. - public const int AddressFieldNumber = 1; - private global::AElf.Types.Address address_; - /// - /// The address of the updated contract. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Address { - get { return address_; } - set { - address_ = value; - } - } - - /// Field number for the "old_code_hash" field. - public const int OldCodeHashFieldNumber = 2; - private global::AElf.Types.Hash oldCodeHash_; - /// - /// The byte array of the old contract code. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash OldCodeHash { - get { return oldCodeHash_; } - set { - oldCodeHash_ = value; - } - } - - /// Field number for the "new_code_hash" field. - public const int NewCodeHashFieldNumber = 3; - private global::AElf.Types.Hash newCodeHash_; - /// - /// The byte array of the new contract code. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash NewCodeHash { - get { return newCodeHash_; } - set { - newCodeHash_ = value; - } - } - - /// Field number for the "version" field. - public const int VersionFieldNumber = 4; - private int version_; - /// - /// The version of the current contract. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Version { - get { return version_; } - set { - version_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as CodeUpdated); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(CodeUpdated other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Address, other.Address)) return false; - if (!object.Equals(OldCodeHash, other.OldCodeHash)) return false; - if (!object.Equals(NewCodeHash, other.NewCodeHash)) return false; - if (Version != other.Version) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (address_ != null) hash ^= Address.GetHashCode(); - if (oldCodeHash_ != null) hash ^= OldCodeHash.GetHashCode(); - if (newCodeHash_ != null) hash ^= NewCodeHash.GetHashCode(); - if (Version != 0) hash ^= Version.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (address_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Address); - } - if (oldCodeHash_ != null) { - output.WriteRawTag(18); - output.WriteMessage(OldCodeHash); - } - if (newCodeHash_ != null) { - output.WriteRawTag(26); - output.WriteMessage(NewCodeHash); - } - if (Version != 0) { - output.WriteRawTag(32); - output.WriteInt32(Version); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (address_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Address); - } - if (oldCodeHash_ != null) { - output.WriteRawTag(18); - output.WriteMessage(OldCodeHash); - } - if (newCodeHash_ != null) { - output.WriteRawTag(26); - output.WriteMessage(NewCodeHash); - } - if (Version != 0) { - output.WriteRawTag(32); - output.WriteInt32(Version); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (address_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Address); - } - if (oldCodeHash_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OldCodeHash); - } - if (newCodeHash_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(NewCodeHash); - } - if (Version != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Version); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(CodeUpdated other) { - if (other == null) { - return; - } - if (other.address_ != null) { - if (address_ == null) { - Address = new global::AElf.Types.Address(); - } - Address.MergeFrom(other.Address); - } - if (other.oldCodeHash_ != null) { - if (oldCodeHash_ == null) { - OldCodeHash = new global::AElf.Types.Hash(); - } - OldCodeHash.MergeFrom(other.OldCodeHash); - } - if (other.newCodeHash_ != null) { - if (newCodeHash_ == null) { - NewCodeHash = new global::AElf.Types.Hash(); - } - NewCodeHash.MergeFrom(other.NewCodeHash); - } - if (other.Version != 0) { - Version = other.Version; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (address_ == null) { - Address = new global::AElf.Types.Address(); - } - input.ReadMessage(Address); - break; - } - case 18: { - if (oldCodeHash_ == null) { - OldCodeHash = new global::AElf.Types.Hash(); - } - input.ReadMessage(OldCodeHash); - break; - } - case 26: { - if (newCodeHash_ == null) { - NewCodeHash = new global::AElf.Types.Hash(); - } - input.ReadMessage(NewCodeHash); - break; - } - case 32: { - Version = input.ReadInt32(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - if (address_ == null) { - Address = new global::AElf.Types.Address(); - } - input.ReadMessage(Address); - break; - } - case 18: { - if (oldCodeHash_ == null) { - OldCodeHash = new global::AElf.Types.Hash(); - } - input.ReadMessage(OldCodeHash); - break; - } - case 26: { - if (newCodeHash_ == null) { - NewCodeHash = new global::AElf.Types.Hash(); - } - input.ReadMessage(NewCodeHash); - break; - } - case 32: { - Version = input.ReadInt32(); - break; - } - } - } - } - #endif - - } - - internal sealed partial class ValidateSystemContractAddressInput : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ValidateSystemContractAddressInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Standards.ACS0.Acs0Reflection.Descriptor.MessageTypes[9]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ValidateSystemContractAddressInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ValidateSystemContractAddressInput(ValidateSystemContractAddressInput other) : this() { - systemContractHashName_ = other.systemContractHashName_ != null ? other.systemContractHashName_.Clone() : null; - address_ = other.address_ != null ? other.address_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ValidateSystemContractAddressInput Clone() { - return new ValidateSystemContractAddressInput(this); - } - - /// Field number for the "system_contract_hash_name" field. - public const int SystemContractHashNameFieldNumber = 1; - private global::AElf.Types.Hash systemContractHashName_; - /// - /// The name hash of the contract. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash SystemContractHashName { - get { return systemContractHashName_; } - set { - systemContractHashName_ = value; - } - } - - /// Field number for the "address" field. - public const int AddressFieldNumber = 2; - private global::AElf.Types.Address address_; - /// - /// The address of the contract. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Address { - get { return address_; } - set { - address_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ValidateSystemContractAddressInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ValidateSystemContractAddressInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(SystemContractHashName, other.SystemContractHashName)) return false; - if (!object.Equals(Address, other.Address)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (systemContractHashName_ != null) hash ^= SystemContractHashName.GetHashCode(); - if (address_ != null) hash ^= Address.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (systemContractHashName_ != null) { - output.WriteRawTag(10); - output.WriteMessage(SystemContractHashName); - } - if (address_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Address); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (systemContractHashName_ != null) { - output.WriteRawTag(10); - output.WriteMessage(SystemContractHashName); - } - if (address_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Address); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (systemContractHashName_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SystemContractHashName); - } - if (address_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Address); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ValidateSystemContractAddressInput other) { - if (other == null) { - return; - } - if (other.systemContractHashName_ != null) { - if (systemContractHashName_ == null) { - SystemContractHashName = new global::AElf.Types.Hash(); - } - SystemContractHashName.MergeFrom(other.SystemContractHashName); - } - if (other.address_ != null) { - if (address_ == null) { - Address = new global::AElf.Types.Address(); - } - Address.MergeFrom(other.Address); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (systemContractHashName_ == null) { - SystemContractHashName = new global::AElf.Types.Hash(); - } - input.ReadMessage(SystemContractHashName); - break; - } - case 18: { - if (address_ == null) { - Address = new global::AElf.Types.Address(); - } - input.ReadMessage(Address); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - if (systemContractHashName_ == null) { - SystemContractHashName = new global::AElf.Types.Hash(); - } - input.ReadMessage(SystemContractHashName); - break; - } - case 18: { - if (address_ == null) { - Address = new global::AElf.Types.Address(); - } - input.ReadMessage(Address); - break; - } - } - } - } - #endif - - } - - internal sealed partial class ReleaseContractInput : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReleaseContractInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Standards.ACS0.Acs0Reflection.Descriptor.MessageTypes[10]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReleaseContractInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReleaseContractInput(ReleaseContractInput other) : this() { - proposalId_ = other.proposalId_ != null ? other.proposalId_.Clone() : null; - proposedContractInputHash_ = other.proposedContractInputHash_ != null ? other.proposedContractInputHash_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReleaseContractInput Clone() { - return new ReleaseContractInput(this); - } - - /// Field number for the "proposal_id" field. - public const int ProposalIdFieldNumber = 1; - private global::AElf.Types.Hash proposalId_; - /// - /// The hash of the proposal. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash ProposalId { - get { return proposalId_; } - set { - proposalId_ = value; - } - } - - /// Field number for the "proposed_contract_input_hash" field. - public const int ProposedContractInputHashFieldNumber = 2; - private global::AElf.Types.Hash proposedContractInputHash_; - /// - /// The id of the proposed contract. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash ProposedContractInputHash { - get { return proposedContractInputHash_; } - set { - proposedContractInputHash_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ReleaseContractInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ReleaseContractInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(ProposalId, other.ProposalId)) return false; - if (!object.Equals(ProposedContractInputHash, other.ProposedContractInputHash)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (proposalId_ != null) hash ^= ProposalId.GetHashCode(); - if (proposedContractInputHash_ != null) hash ^= ProposedContractInputHash.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (proposalId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(ProposalId); - } - if (proposedContractInputHash_ != null) { - output.WriteRawTag(18); - output.WriteMessage(ProposedContractInputHash); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (proposalId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(ProposalId); - } - if (proposedContractInputHash_ != null) { - output.WriteRawTag(18); - output.WriteMessage(ProposedContractInputHash); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (proposalId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ProposalId); - } - if (proposedContractInputHash_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ProposedContractInputHash); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ReleaseContractInput other) { - if (other == null) { - return; - } - if (other.proposalId_ != null) { - if (proposalId_ == null) { - ProposalId = new global::AElf.Types.Hash(); - } - ProposalId.MergeFrom(other.ProposalId); - } - if (other.proposedContractInputHash_ != null) { - if (proposedContractInputHash_ == null) { - ProposedContractInputHash = new global::AElf.Types.Hash(); - } - ProposedContractInputHash.MergeFrom(other.ProposedContractInputHash); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (proposalId_ == null) { - ProposalId = new global::AElf.Types.Hash(); - } - input.ReadMessage(ProposalId); - break; - } - case 18: { - if (proposedContractInputHash_ == null) { - ProposedContractInputHash = new global::AElf.Types.Hash(); - } - input.ReadMessage(ProposedContractInputHash); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - if (proposalId_ == null) { - ProposalId = new global::AElf.Types.Hash(); - } - input.ReadMessage(ProposalId); - break; - } - case 18: { - if (proposedContractInputHash_ == null) { - ProposedContractInputHash = new global::AElf.Types.Hash(); - } - input.ReadMessage(ProposedContractInputHash); - break; - } - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/src/AElf.EventHandler/Dto/Acs1c.cs b/src/AElf.EventHandler/Dto/Acs1c.cs deleted file mode 100644 index a2988e64..00000000 --- a/src/AElf.EventHandler/Dto/Acs1c.cs +++ /dev/null @@ -1,37 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: acs1.proto -// -#pragma warning disable 0414, 1591 -#region Designer generated code - -using System.Collections.Generic; -using aelf = global::AElf.CSharp.Core; - -namespace AElf.Standards.ACS1 { - - #region Events - public partial class MethodFeeSet : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public MethodFeeSet GetNonIndexed() - { - return new MethodFeeSet - { - Method = Method, - Symbol = Symbol, - OldFee = OldFee, - NewFee = NewFee, - }; - } - } - - #endregion -} -#endregion \ No newline at end of file diff --git a/src/AElf.EventHandler/Dto/Acs1g.cs b/src/AElf.EventHandler/Dto/Acs1g.cs deleted file mode 100644 index 641c933e..00000000 --- a/src/AElf.EventHandler/Dto/Acs1g.cs +++ /dev/null @@ -1,612 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: acs1.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace AElf.Standards.ACS1 { - - /// Holder for reflection information generated from acs1.proto - public static partial class Acs1Reflection { - - #region Descriptor - /// File descriptor for acs1.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static Acs1Reflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "CgphY3MxLnByb3RvEgRhY3MxGhJhZWxmL29wdGlvbnMucHJvdG8aG2dvb2ds", - "ZS9wcm90b2J1Zi9lbXB0eS5wcm90bxoeZ29vZ2xlL3Byb3RvYnVmL3dyYXBw", - "ZXJzLnByb3RvGg9hZWxmL2NvcmUucHJvdG8aFGF1dGhvcml0eV9pbmZvLnBy", - "b3RvIloKCk1ldGhvZEZlZXMSEwoLbWV0aG9kX25hbWUYASABKAkSHQoEZmVl", - "cxgCIAMoCzIPLmFjczEuTWV0aG9kRmVlEhgKEGlzX3NpemVfZmVlX2ZyZWUY", - "AyABKAgiLgoJTWV0aG9kRmVlEg4KBnN5bWJvbBgBIAEoCRIRCgliYXNpY19m", - "ZWUYAiABKAMiVgoMTWV0aG9kRmVlU2V0Eg4KBm1ldGhvZBgBIAEoCRIOCgZz", - "eW1ib2wYAiABKAkSDwoHb2xkX2ZlZRgDIAEoAxIPCgduZXdfZmVlGAQgASgD", - "OgSguxgBMq4CChlNZXRob2RGZWVQcm92aWRlckNvbnRyYWN0EjoKDFNldE1l", - "dGhvZEZlZRIQLmFjczEuTWV0aG9kRmVlcxoWLmdvb2dsZS5wcm90b2J1Zi5F", - "bXB0eSIAEkUKGUNoYW5nZU1ldGhvZEZlZUNvbnRyb2xsZXISDi5BdXRob3Jp", - "dHlJbmZvGhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IgASRQoMR2V0TWV0aG9k", - "RmVlEhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlGhAuYWNzMS5NZXRo", - "b2RGZWVzIgWIifcBARJHChZHZXRNZXRob2RGZWVDb250cm9sbGVyEhYuZ29v", - "Z2xlLnByb3RvYnVmLkVtcHR5Gg4uQXV0aG9yaXR5SW5mbyIFiIn3AQFCH6oC", - "E0FFbGYuU3RhbmRhcmRzLkFDUzGKkvQBBGFjczFQAFABUAJiBnByb3RvMw==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::AElf.OptionsReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, global::AElf.Types.CoreReflection.Descriptor, global::AuthorityInfoReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Standards.ACS1.MethodFees), global::AElf.Standards.ACS1.MethodFees.Parser, new[]{ "MethodName", "Fees", "IsSizeFeeFree" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Standards.ACS1.MethodFee), global::AElf.Standards.ACS1.MethodFee.Parser, new[]{ "Symbol", "BasicFee" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Standards.ACS1.MethodFeeSet), global::AElf.Standards.ACS1.MethodFeeSet.Parser, new[]{ "Method", "Symbol", "OldFee", "NewFee" }, null, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class MethodFees : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MethodFees()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Standards.ACS1.Acs1Reflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MethodFees() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MethodFees(MethodFees other) : this() { - methodName_ = other.methodName_; - fees_ = other.fees_.Clone(); - isSizeFeeFree_ = other.isSizeFeeFree_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MethodFees Clone() { - return new MethodFees(this); - } - - /// Field number for the "method_name" field. - public const int MethodNameFieldNumber = 1; - private string methodName_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string MethodName { - get { return methodName_; } - set { - methodName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "fees" field. - public const int FeesFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_fees_codec - = pb::FieldCodec.ForMessage(18, global::AElf.Standards.ACS1.MethodFee.Parser); - private readonly pbc::RepeatedField fees_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Fees { - get { return fees_; } - } - - /// Field number for the "is_size_fee_free" field. - public const int IsSizeFeeFreeFieldNumber = 3; - private bool isSizeFeeFree_; - /// - /// Optional based on the implementation of SetMethodFee method. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsSizeFeeFree { - get { return isSizeFeeFree_; } - set { - isSizeFeeFree_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MethodFees); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MethodFees other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (MethodName != other.MethodName) return false; - if(!fees_.Equals(other.fees_)) return false; - if (IsSizeFeeFree != other.IsSizeFeeFree) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (MethodName.Length != 0) hash ^= MethodName.GetHashCode(); - hash ^= fees_.GetHashCode(); - if (IsSizeFeeFree != false) hash ^= IsSizeFeeFree.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (MethodName.Length != 0) { - output.WriteRawTag(10); - output.WriteString(MethodName); - } - fees_.WriteTo(output, _repeated_fees_codec); - if (IsSizeFeeFree != false) { - output.WriteRawTag(24); - output.WriteBool(IsSizeFeeFree); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (MethodName.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(MethodName); - } - size += fees_.CalculateSize(_repeated_fees_codec); - if (IsSizeFeeFree != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MethodFees other) { - if (other == null) { - return; - } - if (other.MethodName.Length != 0) { - MethodName = other.MethodName; - } - fees_.Add(other.fees_); - if (other.IsSizeFeeFree != false) { - IsSizeFeeFree = other.IsSizeFeeFree; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - MethodName = input.ReadString(); - break; - } - case 18: { - fees_.AddEntriesFrom(input, _repeated_fees_codec); - break; - } - case 24: { - IsSizeFeeFree = input.ReadBool(); - break; - } - } - } - } - - } - - public sealed partial class MethodFee : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MethodFee()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Standards.ACS1.Acs1Reflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MethodFee() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MethodFee(MethodFee other) : this() { - symbol_ = other.symbol_; - basicFee_ = other.basicFee_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MethodFee Clone() { - return new MethodFee(this); - } - - /// Field number for the "symbol" field. - public const int SymbolFieldNumber = 1; - private string symbol_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Symbol { - get { return symbol_; } - set { - symbol_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "basic_fee" field. - public const int BasicFeeFieldNumber = 2; - private long basicFee_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long BasicFee { - get { return basicFee_; } - set { - basicFee_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MethodFee); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MethodFee other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Symbol != other.Symbol) return false; - if (BasicFee != other.BasicFee) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Symbol.Length != 0) hash ^= Symbol.GetHashCode(); - if (BasicFee != 0L) hash ^= BasicFee.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Symbol.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Symbol); - } - if (BasicFee != 0L) { - output.WriteRawTag(16); - output.WriteInt64(BasicFee); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Symbol.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Symbol); - } - if (BasicFee != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(BasicFee); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MethodFee other) { - if (other == null) { - return; - } - if (other.Symbol.Length != 0) { - Symbol = other.Symbol; - } - if (other.BasicFee != 0L) { - BasicFee = other.BasicFee; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Symbol = input.ReadString(); - break; - } - case 16: { - BasicFee = input.ReadInt64(); - break; - } - } - } - } - - } - - /// - /// Events - /// - public sealed partial class MethodFeeSet : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MethodFeeSet()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Standards.ACS1.Acs1Reflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MethodFeeSet() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MethodFeeSet(MethodFeeSet other) : this() { - method_ = other.method_; - symbol_ = other.symbol_; - oldFee_ = other.oldFee_; - newFee_ = other.newFee_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MethodFeeSet Clone() { - return new MethodFeeSet(this); - } - - /// Field number for the "method" field. - public const int MethodFieldNumber = 1; - private string method_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Method { - get { return method_; } - set { - method_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "symbol" field. - public const int SymbolFieldNumber = 2; - private string symbol_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Symbol { - get { return symbol_; } - set { - symbol_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "old_fee" field. - public const int OldFeeFieldNumber = 3; - private long oldFee_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long OldFee { - get { return oldFee_; } - set { - oldFee_ = value; - } - } - - /// Field number for the "new_fee" field. - public const int NewFeeFieldNumber = 4; - private long newFee_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long NewFee { - get { return newFee_; } - set { - newFee_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MethodFeeSet); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MethodFeeSet other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Method != other.Method) return false; - if (Symbol != other.Symbol) return false; - if (OldFee != other.OldFee) return false; - if (NewFee != other.NewFee) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Method.Length != 0) hash ^= Method.GetHashCode(); - if (Symbol.Length != 0) hash ^= Symbol.GetHashCode(); - if (OldFee != 0L) hash ^= OldFee.GetHashCode(); - if (NewFee != 0L) hash ^= NewFee.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Method.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Method); - } - if (Symbol.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Symbol); - } - if (OldFee != 0L) { - output.WriteRawTag(24); - output.WriteInt64(OldFee); - } - if (NewFee != 0L) { - output.WriteRawTag(32); - output.WriteInt64(NewFee); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Method.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Method); - } - if (Symbol.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Symbol); - } - if (OldFee != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(OldFee); - } - if (NewFee != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(NewFee); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MethodFeeSet other) { - if (other == null) { - return; - } - if (other.Method.Length != 0) { - Method = other.Method; - } - if (other.Symbol.Length != 0) { - Symbol = other.Symbol; - } - if (other.OldFee != 0L) { - OldFee = other.OldFee; - } - if (other.NewFee != 0L) { - NewFee = other.NewFee; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Method = input.ReadString(); - break; - } - case 18: { - Symbol = input.ReadString(); - break; - } - case 24: { - OldFee = input.ReadInt64(); - break; - } - case 32: { - NewFee = input.ReadInt64(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/src/AElf.EventHandler/Dto/AedposContractc.cs b/src/AElf.EventHandler/Dto/AedposContractc.cs deleted file mode 100644 index 2b25ae44..00000000 --- a/src/AElf.EventHandler/Dto/AedposContractc.cs +++ /dev/null @@ -1,159 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: aedpos_contract.proto -// -// Original file comments: -// * -// AEDPoS contract. -#pragma warning disable 0414, 1591 -#region Designer generated code - -using System.Collections.Generic; -using aelf = global::AElf.CSharp.Core; - -namespace AElf.Contracts.Consensus.AEDPoS { - - #region Events - public partial class IrreversibleBlockFound : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - new IrreversibleBlockFound - { - IrreversibleBlockHeight = IrreversibleBlockHeight - }, - }; - } - - public IrreversibleBlockFound GetNonIndexed() - { - return new IrreversibleBlockFound - { - }; - } - } - - public partial class IrreversibleBlockHeightUnacceptable : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public IrreversibleBlockHeightUnacceptable GetNonIndexed() - { - return new IrreversibleBlockHeightUnacceptable - { - DistanceToIrreversibleBlockHeight = DistanceToIrreversibleBlockHeight, - }; - } - } - - public partial class MiningInformationUpdated : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - new MiningInformationUpdated - { - Pubkey = Pubkey - }, - new MiningInformationUpdated - { - MiningTime = MiningTime - }, - new MiningInformationUpdated - { - Behaviour = Behaviour - }, - new MiningInformationUpdated - { - BlockHeight = BlockHeight - }, - new MiningInformationUpdated - { - PreviousBlockHash = PreviousBlockHash - }, - }; - } - - public MiningInformationUpdated GetNonIndexed() - { - return new MiningInformationUpdated - { - }; - } - } - - public partial class SecretSharingInformation : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - new SecretSharingInformation - { - PreviousRound = PreviousRound - }, - }; - } - - public SecretSharingInformation GetNonIndexed() - { - return new SecretSharingInformation - { - CurrentRoundId = CurrentRoundId, - PreviousRoundId = PreviousRoundId, - }; - } - } - - public partial class MiningRewardGenerated : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - new MiningRewardGenerated - { - TermNumber = TermNumber - }, - }; - } - - public MiningRewardGenerated GetNonIndexed() - { - return new MiningRewardGenerated - { - Amount = Amount, - }; - } - } - - public partial class MinerReplaced : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public MinerReplaced GetNonIndexed() - { - return new MinerReplaced - { - NewMinerPubkey = NewMinerPubkey, - }; - } - } - - #endregion -} -#endregion - diff --git a/src/AElf.EventHandler/Dto/AedposContractg.cs b/src/AElf.EventHandler/Dto/AedposContractg.cs deleted file mode 100644 index f0d2090e..00000000 --- a/src/AElf.EventHandler/Dto/AedposContractg.cs +++ /dev/null @@ -1,5772 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: aedpos_contract.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace AElf.Contracts.Consensus.AEDPoS { - - /// Holder for reflection information generated from aedpos_contract.proto - public static partial class AedposContractReflection { - - #region Descriptor - /// File descriptor for aedpos_contract.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static AedposContractReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChVhZWRwb3NfY29udHJhY3QucHJvdG8SBkFFRFBvUxoSYWVsZi9vcHRpb25z", - "LnByb3RvGg9hZWxmL2NvcmUucHJvdG8aFGF1dGhvcml0eV9pbmZvLnByb3Rv", - "Ghtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8aH2dvb2dsZS9wcm90b2J1", - "Zi90aW1lc3RhbXAucHJvdG8aHmdvb2dsZS9wcm90b2J1Zi93cmFwcGVycy5w", - "cm90byKNAQohSW5pdGlhbEFFbGZDb25zZW5zdXNDb250cmFjdElucHV0EhgK", - "EGlzX3Rlcm1fc3RheV9vbmUYASABKAgSFQoNaXNfc2lkZV9jaGFpbhgCIAEo", - "CBIWCg5wZXJpb2Rfc2Vjb25kcxgDIAEoAxIfChdtaW5lcl9pbmNyZWFzZV9p", - "bnRlcnZhbBgEIAEoAyLiBgoQVXBkYXRlVmFsdWVJbnB1dBIdCglvdXRfdmFs", - "dWUYASABKAsyCi5hZWxmLkhhc2gSHQoJc2lnbmF0dXJlGAIgASgLMgouYWVs", - "Zi5IYXNoEhAKCHJvdW5kX2lkGAMgASgDEiUKEXByZXZpb3VzX2luX3ZhbHVl", - "GAQgASgLMgouYWVsZi5IYXNoEjYKEmFjdHVhbF9taW5pbmdfdGltZRgFIAEo", - "CzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASJAocc3VwcG9zZWRfb3Jk", - "ZXJfb2ZfbmV4dF9yb3VuZBgGIAEoBRJSChZ0dW5lX29yZGVyX2luZm9ybWF0", - "aW9uGAcgAygLMjIuQUVEUG9TLlVwZGF0ZVZhbHVlSW5wdXQuVHVuZU9yZGVy", - "SW5mb3JtYXRpb25FbnRyeRJHChBlbmNyeXB0ZWRfcGllY2VzGAggAygLMi0u", - "QUVEUG9TLlVwZGF0ZVZhbHVlSW5wdXQuRW5jcnlwdGVkUGllY2VzRW50cnkS", - "RwoQZGVjcnlwdGVkX3BpZWNlcxgJIAMoCzItLkFFRFBvUy5VcGRhdGVWYWx1", - "ZUlucHV0LkRlY3J5cHRlZFBpZWNlc0VudHJ5EhcKD3Byb2R1Y2VkX2Jsb2Nr", - "cxgKIAEoAxJXChltaW5lcnNfcHJldmlvdXNfaW5fdmFsdWVzGAsgAygLMjQu", - "QUVEUG9TLlVwZGF0ZVZhbHVlSW5wdXQuTWluZXJzUHJldmlvdXNJblZhbHVl", - "c0VudHJ5EikKIWltcGxpZWRfaXJyZXZlcnNpYmxlX2Jsb2NrX2hlaWdodBgM", - "IAEoAxo7ChlUdW5lT3JkZXJJbmZvcm1hdGlvbkVudHJ5EgsKA2tleRgBIAEo", - "CRINCgV2YWx1ZRgCIAEoBToCOAEaNgoURW5jcnlwdGVkUGllY2VzRW50cnkS", - "CwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgMOgI4ARo2ChREZWNyeXB0ZWRQ", - "aWVjZXNFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAw6AjgBGkkK", - "G01pbmVyc1ByZXZpb3VzSW5WYWx1ZXNFbnRyeRILCgNrZXkYASABKAkSGQoF", - "dmFsdWUYAiABKAsyCi5hZWxmLkhhc2g6AjgBIhwKCU1pbmVyTGlzdBIPCgdw", - "dWJrZXlzGAEgAygMIh0KClB1YmtleUxpc3QSDwoHcHVia2V5cxgBIAMoCSJu", - "ChBUZXJtTnVtYmVyTG9va1VwEi4KA21hcBgBIAMoCzIhLkFFRFBvUy5UZXJt", - "TnVtYmVyTG9va1VwLk1hcEVudHJ5GioKCE1hcEVudHJ5EgsKA2tleRgBIAEo", - "AxINCgV2YWx1ZRgCIAEoAzoCOAEiHQoKQ2FuZGlkYXRlcxIPCgdwdWJrZXlz", - "GAEgAygMIvMDCgVSb3VuZBIUCgxyb3VuZF9udW1iZXIYASABKAMSUgoccmVh", - "bF90aW1lX21pbmVyc19pbmZvcm1hdGlvbhgCIAMoCzIsLkFFRFBvUy5Sb3Vu", - "ZC5SZWFsVGltZU1pbmVyc0luZm9ybWF0aW9uRW50cnkSJgoebWFpbl9jaGFp", - "bl9taW5lcnNfcm91bmRfbnVtYmVyGAMgASgDEhYKDmJsb2NrY2hhaW5fYWdl", - "GAQgASgDEi4KJmV4dHJhX2Jsb2NrX3Byb2R1Y2VyX29mX3ByZXZpb3VzX3Jv", - "dW5kGAUgASgJEhMKC3Rlcm1fbnVtYmVyGAYgASgDEisKI2NvbmZpcm1lZF9p", - "cnJldmVyc2libGVfYmxvY2tfaGVpZ2h0GAcgASgDEjEKKWNvbmZpcm1lZF9p", - "cnJldmVyc2libGVfYmxvY2tfcm91bmRfbnVtYmVyGAggASgDEiIKGmlzX21p", - "bmVyX2xpc3RfanVzdF9jaGFuZ2VkGAkgASgIEh8KF3JvdW5kX2lkX2Zvcl92", - "YWxpZGF0aW9uGAogASgDGlYKHlJlYWxUaW1lTWluZXJzSW5mb3JtYXRpb25F", - "bnRyeRILCgNrZXkYASABKAkSIwoFdmFsdWUYAiABKAsyFC5BRURQb1MuTWlu", - "ZXJJblJvdW5kOgI4ASKEBgoMTWluZXJJblJvdW5kEg0KBW9yZGVyGAEgASgF", - "Eh8KF2lzX2V4dHJhX2Jsb2NrX3Byb2R1Y2VyGAIgASgIEhwKCGluX3ZhbHVl", - "GAMgASgLMgouYWVsZi5IYXNoEh0KCW91dF92YWx1ZRgEIAEoCzIKLmFlbGYu", - "SGFzaBIdCglzaWduYXR1cmUYBSABKAsyCi5hZWxmLkhhc2gSOAoUZXhwZWN0", - "ZWRfbWluaW5nX3RpbWUYBiABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0", - "YW1wEhcKD3Byb2R1Y2VkX2Jsb2NrcxgHIAEoAxIZChFtaXNzZWRfdGltZV9z", - "bG90cxgIIAEoAxIOCgZwdWJrZXkYCSABKAkSJQoRcHJldmlvdXNfaW5fdmFs", - "dWUYCiABKAsyCi5hZWxmLkhhc2gSJAocc3VwcG9zZWRfb3JkZXJfb2ZfbmV4", - "dF9yb3VuZBgLIAEoBRIhChlmaW5hbF9vcmRlcl9vZl9uZXh0X3JvdW5kGAwg", - "ASgFEjcKE2FjdHVhbF9taW5pbmdfdGltZXMYDSADKAsyGi5nb29nbGUucHJv", - "dG9idWYuVGltZXN0YW1wEkMKEGVuY3J5cHRlZF9waWVjZXMYDiADKAsyKS5B", - "RURQb1MuTWluZXJJblJvdW5kLkVuY3J5cHRlZFBpZWNlc0VudHJ5EkMKEGRl", - "Y3J5cHRlZF9waWVjZXMYDyADKAsyKS5BRURQb1MuTWluZXJJblJvdW5kLkRl", - "Y3J5cHRlZFBpZWNlc0VudHJ5EhwKFHByb2R1Y2VkX3RpbnlfYmxvY2tzGBAg", - "ASgDEikKIWltcGxpZWRfaXJyZXZlcnNpYmxlX2Jsb2NrX2hlaWdodBgRIAEo", - "Axo2ChRFbmNyeXB0ZWRQaWVjZXNFbnRyeRILCgNrZXkYASABKAkSDQoFdmFs", - "dWUYAiABKAw6AjgBGjYKFERlY3J5cHRlZFBpZWNlc0VudHJ5EgsKA2tleRgB", - "IAEoCRINCgV2YWx1ZRgCIAEoDDoCOAEiiAEKHkFFbGZDb25zZW5zdXNIZWFk", - "ZXJJbmZvcm1hdGlvbhIVCg1zZW5kZXJfcHVia2V5GAEgASgMEhwKBXJvdW5k", - "GAIgASgLMg0uQUVEUG9TLlJvdW5kEjEKCWJlaGF2aW91chgDIAEoDjIeLkFF", - "RFBvUy5BRWxmQ29uc2Vuc3VzQmVoYXZpb3VyInMKEUFFbGZDb25zZW5zdXNI", - "aW50EjEKCWJlaGF2aW91chgBIAEoDjIeLkFFRFBvUy5BRWxmQ29uc2Vuc3Vz", - "QmVoYXZpb3VyEhAKCHJvdW5kX2lkGAIgASgDEhkKEXByZXZpb3VzX3JvdW5k", - "X2lkGAMgASgDIukECh9BRWxmQ29uc2Vuc3VzVHJpZ2dlckluZm9ybWF0aW9u", - "Eg4KBnB1YmtleRgBIAEoDBIcCghpbl92YWx1ZRgCIAEoCzIKLmFlbGYuSGFz", - "aBIlChFwcmV2aW91c19pbl92YWx1ZRgDIAEoCzIKLmFlbGYuSGFzaBIxCgli", - "ZWhhdmlvdXIYBCABKA4yHi5BRURQb1MuQUVsZkNvbnNlbnN1c0JlaGF2aW91", - "chJWChBlbmNyeXB0ZWRfcGllY2VzGAUgAygLMjwuQUVEUG9TLkFFbGZDb25z", - "ZW5zdXNUcmlnZ2VySW5mb3JtYXRpb24uRW5jcnlwdGVkUGllY2VzRW50cnkS", - "VgoQZGVjcnlwdGVkX3BpZWNlcxgGIAMoCzI8LkFFRFBvUy5BRWxmQ29uc2Vu", - "c3VzVHJpZ2dlckluZm9ybWF0aW9uLkRlY3J5cHRlZFBpZWNlc0VudHJ5ElkK", - "EnJldmVhbGVkX2luX3ZhbHVlcxgHIAMoCzI9LkFFRFBvUy5BRWxmQ29uc2Vu", - "c3VzVHJpZ2dlckluZm9ybWF0aW9uLlJldmVhbGVkSW5WYWx1ZXNFbnRyeRo2", - "ChRFbmNyeXB0ZWRQaWVjZXNFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUY", - "AiABKAw6AjgBGjYKFERlY3J5cHRlZFBpZWNlc0VudHJ5EgsKA2tleRgBIAEo", - "CRINCgV2YWx1ZRgCIAEoDDoCOAEaQwoVUmV2ZWFsZWRJblZhbHVlc0VudHJ5", - "EgsKA2tleRgBIAEoCRIZCgV2YWx1ZRgCIAEoCzIKLmFlbGYuSGFzaDoCOAEi", - "NQoIVGVybUluZm8SEwoLdGVybV9udW1iZXIYASABKAMSFAoMcm91bmRfbnVt", - "YmVyGAIgASgDIlcKGE1pbmVyTGlzdFdpdGhSb3VuZE51bWJlchIlCgptaW5l", - "cl9saXN0GAEgASgLMhEuQUVEUG9TLk1pbmVyTGlzdBIUCgxyb3VuZF9udW1i", - "ZXIYAiABKAMicwoOVGlueUJsb2NrSW5wdXQSEAoIcm91bmRfaWQYASABKAMS", - "NgoSYWN0dWFsX21pbmluZ190aW1lGAIgASgLMhouZ29vZ2xlLnByb3RvYnVm", - "LlRpbWVzdGFtcBIXCg9wcm9kdWNlZF9ibG9ja3MYAyABKAMiPAoUVm90ZU1p", - "bmVyc0NvdW50SW5wdXQSFAoMbWluZXJzX2NvdW50GAEgASgFEg4KBmFtb3Vu", - "dBgCIAEoAyIlChRDb25zZW5zdXNJbmZvcm1hdGlvbhINCgV2YWx1ZRgBIAEo", - "DCIoChFHZXRNaW5lckxpc3RJbnB1dBITCgt0ZXJtX251bWJlchgBIAEoAyJr", - "Ch5SYW5kb21OdW1iZXJSZXF1ZXN0SW5mb3JtYXRpb24SGwoTdGFyZ2V0X3Jv", - "dW5kX251bWJlchgBIAEoAxINCgVvcmRlchgCIAEoAxIdChVleHBlY3RlZF9i", - "bG9ja19oZWlnaHQYAyABKAMiJgoISGFzaExpc3QSGgoGdmFsdWVzGAEgAygL", - "MgouYWVsZi5IYXNoIkUKHUxhdGVzdFB1YmtleVRvVGlueUJsb2Nrc0NvdW50", - "Eg4KBnB1YmtleRgBIAEoCRIUCgxibG9ja3NfY291bnQYAiABKAMiSAoWSXJy", - "ZXZlcnNpYmxlQmxvY2tGb3VuZBIoChlpcnJldmVyc2libGVfYmxvY2tfaGVp", - "Z2h0GAEgASgDQgWIj/UBAToEoLsYASJaCiNJcnJldmVyc2libGVCbG9ja0hl", - "aWdodFVuYWNjZXB0YWJsZRItCiVkaXN0YW5jZV90b19pcnJldmVyc2libGVf", - "YmxvY2tfaGVpZ2h0GAEgASgDOgSguxgBItYBChhNaW5pbmdJbmZvcm1hdGlv", - "blVwZGF0ZWQSFQoGcHVia2V5GAEgASgJQgWIj/UBARI2CgttaW5pbmdfdGlt", - "ZRgCIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXBCBYiP9QEBEhgK", - "CWJlaGF2aW91chgDIAEoCUIFiI/1AQESGwoMYmxvY2tfaGVpZ2h0GAQgASgD", - "QgWIj/UBARIuChNwcmV2aW91c19ibG9ja19oYXNoGAUgASgLMgouYWVsZi5I", - "YXNoQgWIj/UBAToEoLsYASKDAQoYU2VjcmV0U2hhcmluZ0luZm9ybWF0aW9u", - "EiwKDnByZXZpb3VzX3JvdW5kGAEgASgLMg0uQUVEUG9TLlJvdW5kQgWIj/UB", - "ARIYChBjdXJyZW50X3JvdW5kX2lkGAIgASgDEhkKEXByZXZpb3VzX3JvdW5k", - "X2lkGAMgASgDOgSguxgBIkkKFU1pbmluZ1Jld2FyZEdlbmVyYXRlZBIaCgt0", - "ZXJtX251bWJlchgBIAEoA0IFiI/1AQESDgoGYW1vdW50GAIgASgDOgSguxgB", - "Ii8KDU1pbmVyUmVwbGFjZWQSGAoQbmV3X21pbmVyX3B1YmtleRgBIAEoCToE", - "oLsYASJJCh9SZWNvcmRDYW5kaWRhdGVSZXBsYWNlbWVudElucHV0EhIKCm9s", - "ZF9wdWJrZXkYASABKAkSEgoKbmV3X3B1YmtleRgCIAEoCSpmChZBRWxmQ29u", - "c2Vuc3VzQmVoYXZpb3VyEhAKDFVQREFURV9WQUxVRRAAEg4KCk5FWFRfUk9V", - "TkQQARINCglORVhUX1RFUk0QAhILCgdOT1RISU5HEAMSDgoKVElOWV9CTE9D", - "SxAEMrUUCg5BRURQb1NDb250cmFjdBJjChxJbml0aWFsQUVsZkNvbnNlbnN1", - "c0NvbnRyYWN0EikuQUVEUG9TLkluaXRpYWxBRWxmQ29uc2Vuc3VzQ29udHJh", - "Y3RJbnB1dBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIAEjUKCkZpcnN0Um91", - "bmQSDS5BRURQb1MuUm91bmQaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiABJB", - "CgtVcGRhdGVWYWx1ZRIYLkFFRFBvUy5VcGRhdGVWYWx1ZUlucHV0GhYuZ29v", - "Z2xlLnByb3RvYnVmLkVtcHR5IgASNAoJTmV4dFJvdW5kEg0uQUVEUG9TLlJv", - "dW5kGhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IgASMwoITmV4dFRlcm0SDS5B", - "RURQb1MuUm91bmQaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiABJOChpVcGRh", - "dGVUaW55QmxvY2tJbmZvcm1hdGlvbhIWLkFFRFBvUy5UaW55QmxvY2tJbnB1", - "dBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIAEk4KFVNldE1heGltdW1NaW5l", - "cnNDb3VudBIbLmdvb2dsZS5wcm90b2J1Zi5JbnQzMlZhbHVlGhYuZ29vZ2xl", - "LnByb3RvYnVmLkVtcHR5IgASTgoiQ2hhbmdlTWF4aW11bU1pbmVyc0NvdW50", - "Q29udHJvbGxlchIOLkF1dGhvcml0eUluZm8aFi5nb29nbGUucHJvdG9idWYu", - "RW1wdHkiABJfChpSZWNvcmRDYW5kaWRhdGVSZXBsYWNlbWVudBInLkFFRFBv", - "Uy5SZWNvcmRDYW5kaWRhdGVSZXBsYWNlbWVudElucHV0GhYuZ29vZ2xlLnBy", - "b3RvYnVmLkVtcHR5IgASRwoTR2V0Q3VycmVudE1pbmVyTGlzdBIWLmdvb2ds", - "ZS5wcm90b2J1Zi5FbXB0eRoRLkFFRFBvUy5NaW5lckxpc3QiBYiJ9wEBEk4K", - "GUdldEN1cnJlbnRNaW5lclB1YmtleUxpc3QSFi5nb29nbGUucHJvdG9idWYu", - "RW1wdHkaEi5BRURQb1MuUHVia2V5TGlzdCIFiIn3AQESZQoiR2V0Q3VycmVu", - "dE1pbmVyTGlzdFdpdGhSb3VuZE51bWJlchIWLmdvb2dsZS5wcm90b2J1Zi5F", - "bXB0eRogLkFFRFBvUy5NaW5lckxpc3RXaXRoUm91bmROdW1iZXIiBYiJ9wEB", - "EkgKE0dldFJvdW5kSW5mb3JtYXRpb24SGy5nb29nbGUucHJvdG9idWYuSW50", - "NjRWYWx1ZRoNLkFFRFBvUy5Sb3VuZCIFiIn3AQESUwoVR2V0Q3VycmVudFJv", - "dW5kTnVtYmVyEhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5GhsuZ29vZ2xlLnBy", - "b3RvYnVmLkludDY0VmFsdWUiBYiJ9wEBEkoKGkdldEN1cnJlbnRSb3VuZElu", - "Zm9ybWF0aW9uEhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5Gg0uQUVEUG9TLlJv", - "dW5kIgWIifcBARJLChtHZXRQcmV2aW91c1JvdW5kSW5mb3JtYXRpb24SFi5n", - "b29nbGUucHJvdG9idWYuRW1wdHkaDS5BRURQb1MuUm91bmQiBYiJ9wEBElIK", - "FEdldEN1cnJlbnRUZXJtTnVtYmVyEhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5", - "GhsuZ29vZ2xlLnByb3RvYnVmLkludDY0VmFsdWUiBYiJ9wEBElgKGkdldEN1", - "cnJlbnRUZXJtTWluaW5nUmV3YXJkEhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5", - "GhsuZ29vZ2xlLnByb3RvYnVmLkludDY0VmFsdWUiBYiJ9wEBEkMKDEdldE1p", - "bmVyTGlzdBIZLkFFRFBvUy5HZXRNaW5lckxpc3RJbnB1dBoRLkFFRFBvUy5N", - "aW5lckxpc3QiBYiJ9wEBEkgKFEdldFByZXZpb3VzTWluZXJMaXN0EhYuZ29v", - "Z2xlLnByb3RvYnVmLkVtcHR5GhEuQUVEUG9TLk1pbmVyTGlzdCIFiIn3AQES", - "WgocR2V0TWluZWRCbG9ja3NPZlByZXZpb3VzVGVybRIWLmdvb2dsZS5wcm90", - "b2J1Zi5FbXB0eRobLmdvb2dsZS5wcm90b2J1Zi5JbnQ2NFZhbHVlIgWIifcB", - "ARJRChJHZXROZXh0TWluZXJQdWJrZXkSFi5nb29nbGUucHJvdG9idWYuRW1w", - "dHkaHC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFsdWUiBYiJ9wEBEkIKDklz", - "Q3VycmVudE1pbmVyEg0uYWVsZi5BZGRyZXNzGhouZ29vZ2xlLnByb3RvYnVm", - "LkJvb2xWYWx1ZSIFiIn3AQESUwoVR2V0TmV4dEVsZWN0Q291bnREb3duEhYu", - "Z29vZ2xlLnByb3RvYnVmLkVtcHR5GhsuZ29vZ2xlLnByb3RvYnVmLkludDY0", - "VmFsdWUiBYiJ9wEBEk8KGkdldFByZXZpb3VzVGVybUluZm9ybWF0aW9uEhsu", - "Z29vZ2xlLnByb3RvYnVmLkludDY0VmFsdWUaDS5BRURQb1MuUm91bmQiBYiJ", - "9wEBEj8KDUdldFJhbmRvbUhhc2gSGy5nb29nbGUucHJvdG9idWYuSW50NjRW", - "YWx1ZRoKLmFlbGYuSGFzaCIFiIn3AQESUwoVR2V0TWF4aW11bUJsb2Nrc0Nv", - "dW50EhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5GhsuZ29vZ2xlLnByb3RvYnVm", - "LkludDMyVmFsdWUiBYiJ9wEBElMKFUdldE1heGltdW1NaW5lcnNDb3VudBIW", - "Lmdvb2dsZS5wcm90b2J1Zi5FbXB0eRobLmdvb2dsZS5wcm90b2J1Zi5JbnQz", - "MlZhbHVlIgWIifcBARJQCh9HZXRNYXhpbXVtTWluZXJzQ291bnRDb250cm9s", - "bGVyEhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5Gg4uQXV0aG9yaXR5SW5mbyIF", - "iIn3AQESUAocR2V0TWFpbkNoYWluQ3VycmVudE1pbmVyTGlzdBIWLmdvb2ds", - "ZS5wcm90b2J1Zi5FbXB0eRoRLkFFRFBvUy5NaW5lckxpc3QiBYiJ9wEBElMK", - "HkdldFByZXZpb3VzVGVybU1pbmVyUHVia2V5TGlzdBIWLmdvb2dsZS5wcm90", - "b2J1Zi5FbXB0eRoSLkFFRFBvUy5QdWJrZXlMaXN0IgWIifcBARJcCh5HZXRD", - "dXJyZW50TWluaW5nUmV3YXJkUGVyQmxvY2sSFi5nb29nbGUucHJvdG9idWYu", - "RW1wdHkaGy5nb29nbGUucHJvdG9idWYuSW50NjRWYWx1ZSIFiIn3AQEaOLLM", - "9gEzQUVsZi5Db250cmFjdHMuQ29uc2Vuc3VzLkFFRFBvUy5BRURQb1NDb250", - "cmFjdFN0YXRlQiKqAh9BRWxmLkNvbnRyYWN0cy5Db25zZW5zdXMuQUVEUG9T", - "YgZwcm90bzM=")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::AElf.OptionsReflection.Descriptor, global::AElf.Types.CoreReflection.Descriptor, global::AuthorityInfoReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.InitialAElfConsensusContractInput), global::AElf.Contracts.Consensus.AEDPoS.InitialAElfConsensusContractInput.Parser, new[]{ "IsTermStayOne", "IsSideChain", "PeriodSeconds", "MinerIncreaseInterval" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.UpdateValueInput), global::AElf.Contracts.Consensus.AEDPoS.UpdateValueInput.Parser, new[]{ "OutValue", "Signature", "RoundId", "PreviousInValue", "ActualMiningTime", "SupposedOrderOfNextRound", "TuneOrderInformation", "EncryptedPieces", "DecryptedPieces", "ProducedBlocks", "MinersPreviousInValues", "ImpliedIrreversibleBlockHeight" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, null, null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.MinerList), global::AElf.Contracts.Consensus.AEDPoS.MinerList.Parser, new[]{ "Pubkeys" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.PubkeyList), global::AElf.Contracts.Consensus.AEDPoS.PubkeyList.Parser, new[]{ "Pubkeys" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.TermNumberLookUp), global::AElf.Contracts.Consensus.AEDPoS.TermNumberLookUp.Parser, new[]{ "Map" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.Candidates), global::AElf.Contracts.Consensus.AEDPoS.Candidates.Parser, new[]{ "Pubkeys" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.Round), global::AElf.Contracts.Consensus.AEDPoS.Round.Parser, new[]{ "RoundNumber", "RealTimeMinersInformation", "MainChainMinersRoundNumber", "BlockchainAge", "ExtraBlockProducerOfPreviousRound", "TermNumber", "ConfirmedIrreversibleBlockHeight", "ConfirmedIrreversibleBlockRoundNumber", "IsMinerListJustChanged", "RoundIdForValidation" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.MinerInRound), global::AElf.Contracts.Consensus.AEDPoS.MinerInRound.Parser, new[]{ "Order", "IsExtraBlockProducer", "InValue", "OutValue", "Signature", "ExpectedMiningTime", "ProducedBlocks", "MissedTimeSlots", "Pubkey", "PreviousInValue", "SupposedOrderOfNextRound", "FinalOrderOfNextRound", "ActualMiningTimes", "EncryptedPieces", "DecryptedPieces", "ProducedTinyBlocks", "ImpliedIrreversibleBlockHeight" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusHeaderInformation), global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusHeaderInformation.Parser, new[]{ "SenderPubkey", "Round", "Behaviour" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusHint), global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusHint.Parser, new[]{ "Behaviour", "RoundId", "PreviousRoundId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusTriggerInformation), global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusTriggerInformation.Parser, new[]{ "Pubkey", "InValue", "PreviousInValue", "Behaviour", "EncryptedPieces", "DecryptedPieces", "RevealedInValues" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.TermInfo), global::AElf.Contracts.Consensus.AEDPoS.TermInfo.Parser, new[]{ "TermNumber", "RoundNumber" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.MinerListWithRoundNumber), global::AElf.Contracts.Consensus.AEDPoS.MinerListWithRoundNumber.Parser, new[]{ "MinerList", "RoundNumber" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.TinyBlockInput), global::AElf.Contracts.Consensus.AEDPoS.TinyBlockInput.Parser, new[]{ "RoundId", "ActualMiningTime", "ProducedBlocks" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.VoteMinersCountInput), global::AElf.Contracts.Consensus.AEDPoS.VoteMinersCountInput.Parser, new[]{ "MinersCount", "Amount" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.ConsensusInformation), global::AElf.Contracts.Consensus.AEDPoS.ConsensusInformation.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.GetMinerListInput), global::AElf.Contracts.Consensus.AEDPoS.GetMinerListInput.Parser, new[]{ "TermNumber" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.RandomNumberRequestInformation), global::AElf.Contracts.Consensus.AEDPoS.RandomNumberRequestInformation.Parser, new[]{ "TargetRoundNumber", "Order", "ExpectedBlockHeight" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.HashList), global::AElf.Contracts.Consensus.AEDPoS.HashList.Parser, new[]{ "Values" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.LatestPubkeyToTinyBlocksCount), global::AElf.Contracts.Consensus.AEDPoS.LatestPubkeyToTinyBlocksCount.Parser, new[]{ "Pubkey", "BlocksCount" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.IrreversibleBlockFound), global::AElf.Contracts.Consensus.AEDPoS.IrreversibleBlockFound.Parser, new[]{ "IrreversibleBlockHeight" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.IrreversibleBlockHeightUnacceptable), global::AElf.Contracts.Consensus.AEDPoS.IrreversibleBlockHeightUnacceptable.Parser, new[]{ "DistanceToIrreversibleBlockHeight" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.MiningInformationUpdated), global::AElf.Contracts.Consensus.AEDPoS.MiningInformationUpdated.Parser, new[]{ "Pubkey", "MiningTime", "Behaviour", "BlockHeight", "PreviousBlockHash" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.SecretSharingInformation), global::AElf.Contracts.Consensus.AEDPoS.SecretSharingInformation.Parser, new[]{ "PreviousRound", "CurrentRoundId", "PreviousRoundId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.MiningRewardGenerated), global::AElf.Contracts.Consensus.AEDPoS.MiningRewardGenerated.Parser, new[]{ "TermNumber", "Amount" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.MinerReplaced), global::AElf.Contracts.Consensus.AEDPoS.MinerReplaced.Parser, new[]{ "NewMinerPubkey" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Consensus.AEDPoS.RecordCandidateReplacementInput), global::AElf.Contracts.Consensus.AEDPoS.RecordCandidateReplacementInput.Parser, new[]{ "OldPubkey", "NewPubkey" }, null, null, null, null) - })); - } - #endregion - - } - #region Enums - public enum AElfConsensusBehaviour { - [pbr::OriginalName("UPDATE_VALUE")] UpdateValue = 0, - [pbr::OriginalName("NEXT_ROUND")] NextRound = 1, - [pbr::OriginalName("NEXT_TERM")] NextTerm = 2, - [pbr::OriginalName("NOTHING")] Nothing = 3, - [pbr::OriginalName("TINY_BLOCK")] TinyBlock = 4, - } - - #endregion - - #region Messages - public sealed partial class InitialAElfConsensusContractInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new InitialAElfConsensusContractInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitialAElfConsensusContractInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitialAElfConsensusContractInput(InitialAElfConsensusContractInput other) : this() { - isTermStayOne_ = other.isTermStayOne_; - isSideChain_ = other.isSideChain_; - periodSeconds_ = other.periodSeconds_; - minerIncreaseInterval_ = other.minerIncreaseInterval_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitialAElfConsensusContractInput Clone() { - return new InitialAElfConsensusContractInput(this); - } - - /// Field number for the "is_term_stay_one" field. - public const int IsTermStayOneFieldNumber = 1; - private bool isTermStayOne_; - /// - /// Whether not to change the term. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsTermStayOne { - get { return isTermStayOne_; } - set { - isTermStayOne_ = value; - } - } - - /// Field number for the "is_side_chain" field. - public const int IsSideChainFieldNumber = 2; - private bool isSideChain_; - /// - /// Is a side chain. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsSideChain { - get { return isSideChain_; } - set { - isSideChain_ = value; - } - } - - /// Field number for the "period_seconds" field. - public const int PeriodSecondsFieldNumber = 3; - private long periodSeconds_; - /// - /// The number of seconds per term. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long PeriodSeconds { - get { return periodSeconds_; } - set { - periodSeconds_ = value; - } - } - - /// Field number for the "miner_increase_interval" field. - public const int MinerIncreaseIntervalFieldNumber = 4; - private long minerIncreaseInterval_; - /// - /// The interval second that increases the number of miners. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long MinerIncreaseInterval { - get { return minerIncreaseInterval_; } - set { - minerIncreaseInterval_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as InitialAElfConsensusContractInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(InitialAElfConsensusContractInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (IsTermStayOne != other.IsTermStayOne) return false; - if (IsSideChain != other.IsSideChain) return false; - if (PeriodSeconds != other.PeriodSeconds) return false; - if (MinerIncreaseInterval != other.MinerIncreaseInterval) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (IsTermStayOne != false) hash ^= IsTermStayOne.GetHashCode(); - if (IsSideChain != false) hash ^= IsSideChain.GetHashCode(); - if (PeriodSeconds != 0L) hash ^= PeriodSeconds.GetHashCode(); - if (MinerIncreaseInterval != 0L) hash ^= MinerIncreaseInterval.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (IsTermStayOne != false) { - output.WriteRawTag(8); - output.WriteBool(IsTermStayOne); - } - if (IsSideChain != false) { - output.WriteRawTag(16); - output.WriteBool(IsSideChain); - } - if (PeriodSeconds != 0L) { - output.WriteRawTag(24); - output.WriteInt64(PeriodSeconds); - } - if (MinerIncreaseInterval != 0L) { - output.WriteRawTag(32); - output.WriteInt64(MinerIncreaseInterval); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (IsTermStayOne != false) { - size += 1 + 1; - } - if (IsSideChain != false) { - size += 1 + 1; - } - if (PeriodSeconds != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(PeriodSeconds); - } - if (MinerIncreaseInterval != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(MinerIncreaseInterval); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(InitialAElfConsensusContractInput other) { - if (other == null) { - return; - } - if (other.IsTermStayOne != false) { - IsTermStayOne = other.IsTermStayOne; - } - if (other.IsSideChain != false) { - IsSideChain = other.IsSideChain; - } - if (other.PeriodSeconds != 0L) { - PeriodSeconds = other.PeriodSeconds; - } - if (other.MinerIncreaseInterval != 0L) { - MinerIncreaseInterval = other.MinerIncreaseInterval; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - IsTermStayOne = input.ReadBool(); - break; - } - case 16: { - IsSideChain = input.ReadBool(); - break; - } - case 24: { - PeriodSeconds = input.ReadInt64(); - break; - } - case 32: { - MinerIncreaseInterval = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class UpdateValueInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UpdateValueInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UpdateValueInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UpdateValueInput(UpdateValueInput other) : this() { - outValue_ = other.outValue_ != null ? other.outValue_.Clone() : null; - signature_ = other.signature_ != null ? other.signature_.Clone() : null; - roundId_ = other.roundId_; - previousInValue_ = other.previousInValue_ != null ? other.previousInValue_.Clone() : null; - actualMiningTime_ = other.actualMiningTime_ != null ? other.actualMiningTime_.Clone() : null; - supposedOrderOfNextRound_ = other.supposedOrderOfNextRound_; - tuneOrderInformation_ = other.tuneOrderInformation_.Clone(); - encryptedPieces_ = other.encryptedPieces_.Clone(); - decryptedPieces_ = other.decryptedPieces_.Clone(); - producedBlocks_ = other.producedBlocks_; - minersPreviousInValues_ = other.minersPreviousInValues_.Clone(); - impliedIrreversibleBlockHeight_ = other.impliedIrreversibleBlockHeight_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UpdateValueInput Clone() { - return new UpdateValueInput(this); - } - - /// Field number for the "out_value" field. - public const int OutValueFieldNumber = 1; - private global::AElf.Types.Hash outValue_; - /// - /// Calculated from current in value. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash OutValue { - get { return outValue_; } - set { - outValue_ = value; - } - } - - /// Field number for the "signature" field. - public const int SignatureFieldNumber = 2; - private global::AElf.Types.Hash signature_; - /// - /// Calculated from current in value and signatures of previous round. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash Signature { - get { return signature_; } - set { - signature_ = value; - } - } - - /// Field number for the "round_id" field. - public const int RoundIdFieldNumber = 3; - private long roundId_; - /// - /// To ensure the values to update will be apply to correct round by comparing round id. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RoundId { - get { return roundId_; } - set { - roundId_ = value; - } - } - - /// Field number for the "previous_in_value" field. - public const int PreviousInValueFieldNumber = 4; - private global::AElf.Types.Hash previousInValue_; - /// - /// Publish previous in value for validation previous signature and previous out value. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash PreviousInValue { - get { return previousInValue_; } - set { - previousInValue_ = value; - } - } - - /// Field number for the "actual_mining_time" field. - public const int ActualMiningTimeFieldNumber = 5; - private global::Google.Protobuf.WellKnownTypes.Timestamp actualMiningTime_; - /// - /// The actual mining time, miners must fill actual mining time when they do the mining. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp ActualMiningTime { - get { return actualMiningTime_; } - set { - actualMiningTime_ = value; - } - } - - /// Field number for the "supposed_order_of_next_round" field. - public const int SupposedOrderOfNextRoundFieldNumber = 6; - private int supposedOrderOfNextRound_; - /// - /// The supposed order of mining for the next round. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int SupposedOrderOfNextRound { - get { return supposedOrderOfNextRound_; } - set { - supposedOrderOfNextRound_ = value; - } - } - - /// Field number for the "tune_order_information" field. - public const int TuneOrderInformationFieldNumber = 7; - private static readonly pbc::MapField.Codec _map_tuneOrderInformation_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForInt32(16, 0), 58); - private readonly pbc::MapField tuneOrderInformation_ = new pbc::MapField(); - /// - /// The tuning order of mining for the next round, miner public key -> order. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField TuneOrderInformation { - get { return tuneOrderInformation_; } - } - - /// Field number for the "encrypted_pieces" field. - public const int EncryptedPiecesFieldNumber = 8; - private static readonly pbc::MapField.Codec _map_encryptedPieces_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForBytes(18, pb::ByteString.Empty), 66); - private readonly pbc::MapField encryptedPieces_ = new pbc::MapField(); - /// - /// The encrypted pieces of InValue. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField EncryptedPieces { - get { return encryptedPieces_; } - } - - /// Field number for the "decrypted_pieces" field. - public const int DecryptedPiecesFieldNumber = 9; - private static readonly pbc::MapField.Codec _map_decryptedPieces_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForBytes(18, pb::ByteString.Empty), 74); - private readonly pbc::MapField decryptedPieces_ = new pbc::MapField(); - /// - /// The decrypted pieces of InValue. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField DecryptedPieces { - get { return decryptedPieces_; } - } - - /// Field number for the "produced_blocks" field. - public const int ProducedBlocksFieldNumber = 10; - private long producedBlocks_; - /// - /// The amount of produced blocks. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ProducedBlocks { - get { return producedBlocks_; } - set { - producedBlocks_ = value; - } - } - - /// Field number for the "miners_previous_in_values" field. - public const int MinersPreviousInValuesFieldNumber = 11; - private static readonly pbc::MapField.Codec _map_minersPreviousInValues_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::AElf.Types.Hash.Parser), 90); - private readonly pbc::MapField minersPreviousInValues_ = new pbc::MapField(); - /// - /// The InValue in the previous round, miner public key -> InValue. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField MinersPreviousInValues { - get { return minersPreviousInValues_; } - } - - /// Field number for the "implied_irreversible_block_height" field. - public const int ImpliedIrreversibleBlockHeightFieldNumber = 12; - private long impliedIrreversibleBlockHeight_; - /// - /// The irreversible block height that miner recorded. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ImpliedIrreversibleBlockHeight { - get { return impliedIrreversibleBlockHeight_; } - set { - impliedIrreversibleBlockHeight_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as UpdateValueInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(UpdateValueInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(OutValue, other.OutValue)) return false; - if (!object.Equals(Signature, other.Signature)) return false; - if (RoundId != other.RoundId) return false; - if (!object.Equals(PreviousInValue, other.PreviousInValue)) return false; - if (!object.Equals(ActualMiningTime, other.ActualMiningTime)) return false; - if (SupposedOrderOfNextRound != other.SupposedOrderOfNextRound) return false; - if (!TuneOrderInformation.Equals(other.TuneOrderInformation)) return false; - if (!EncryptedPieces.Equals(other.EncryptedPieces)) return false; - if (!DecryptedPieces.Equals(other.DecryptedPieces)) return false; - if (ProducedBlocks != other.ProducedBlocks) return false; - if (!MinersPreviousInValues.Equals(other.MinersPreviousInValues)) return false; - if (ImpliedIrreversibleBlockHeight != other.ImpliedIrreversibleBlockHeight) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (outValue_ != null) hash ^= OutValue.GetHashCode(); - if (signature_ != null) hash ^= Signature.GetHashCode(); - if (RoundId != 0L) hash ^= RoundId.GetHashCode(); - if (previousInValue_ != null) hash ^= PreviousInValue.GetHashCode(); - if (actualMiningTime_ != null) hash ^= ActualMiningTime.GetHashCode(); - if (SupposedOrderOfNextRound != 0) hash ^= SupposedOrderOfNextRound.GetHashCode(); - hash ^= TuneOrderInformation.GetHashCode(); - hash ^= EncryptedPieces.GetHashCode(); - hash ^= DecryptedPieces.GetHashCode(); - if (ProducedBlocks != 0L) hash ^= ProducedBlocks.GetHashCode(); - hash ^= MinersPreviousInValues.GetHashCode(); - if (ImpliedIrreversibleBlockHeight != 0L) hash ^= ImpliedIrreversibleBlockHeight.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (outValue_ != null) { - output.WriteRawTag(10); - output.WriteMessage(OutValue); - } - if (signature_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Signature); - } - if (RoundId != 0L) { - output.WriteRawTag(24); - output.WriteInt64(RoundId); - } - if (previousInValue_ != null) { - output.WriteRawTag(34); - output.WriteMessage(PreviousInValue); - } - if (actualMiningTime_ != null) { - output.WriteRawTag(42); - output.WriteMessage(ActualMiningTime); - } - if (SupposedOrderOfNextRound != 0) { - output.WriteRawTag(48); - output.WriteInt32(SupposedOrderOfNextRound); - } - tuneOrderInformation_.WriteTo(output, _map_tuneOrderInformation_codec); - encryptedPieces_.WriteTo(output, _map_encryptedPieces_codec); - decryptedPieces_.WriteTo(output, _map_decryptedPieces_codec); - if (ProducedBlocks != 0L) { - output.WriteRawTag(80); - output.WriteInt64(ProducedBlocks); - } - minersPreviousInValues_.WriteTo(output, _map_minersPreviousInValues_codec); - if (ImpliedIrreversibleBlockHeight != 0L) { - output.WriteRawTag(96); - output.WriteInt64(ImpliedIrreversibleBlockHeight); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (outValue_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OutValue); - } - if (signature_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Signature); - } - if (RoundId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RoundId); - } - if (previousInValue_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(PreviousInValue); - } - if (actualMiningTime_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ActualMiningTime); - } - if (SupposedOrderOfNextRound != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(SupposedOrderOfNextRound); - } - size += tuneOrderInformation_.CalculateSize(_map_tuneOrderInformation_codec); - size += encryptedPieces_.CalculateSize(_map_encryptedPieces_codec); - size += decryptedPieces_.CalculateSize(_map_decryptedPieces_codec); - if (ProducedBlocks != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(ProducedBlocks); - } - size += minersPreviousInValues_.CalculateSize(_map_minersPreviousInValues_codec); - if (ImpliedIrreversibleBlockHeight != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(ImpliedIrreversibleBlockHeight); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(UpdateValueInput other) { - if (other == null) { - return; - } - if (other.outValue_ != null) { - if (outValue_ == null) { - OutValue = new global::AElf.Types.Hash(); - } - OutValue.MergeFrom(other.OutValue); - } - if (other.signature_ != null) { - if (signature_ == null) { - Signature = new global::AElf.Types.Hash(); - } - Signature.MergeFrom(other.Signature); - } - if (other.RoundId != 0L) { - RoundId = other.RoundId; - } - if (other.previousInValue_ != null) { - if (previousInValue_ == null) { - PreviousInValue = new global::AElf.Types.Hash(); - } - PreviousInValue.MergeFrom(other.PreviousInValue); - } - if (other.actualMiningTime_ != null) { - if (actualMiningTime_ == null) { - ActualMiningTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - ActualMiningTime.MergeFrom(other.ActualMiningTime); - } - if (other.SupposedOrderOfNextRound != 0) { - SupposedOrderOfNextRound = other.SupposedOrderOfNextRound; - } - tuneOrderInformation_.Add(other.tuneOrderInformation_); - encryptedPieces_.Add(other.encryptedPieces_); - decryptedPieces_.Add(other.decryptedPieces_); - if (other.ProducedBlocks != 0L) { - ProducedBlocks = other.ProducedBlocks; - } - minersPreviousInValues_.Add(other.minersPreviousInValues_); - if (other.ImpliedIrreversibleBlockHeight != 0L) { - ImpliedIrreversibleBlockHeight = other.ImpliedIrreversibleBlockHeight; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (outValue_ == null) { - OutValue = new global::AElf.Types.Hash(); - } - input.ReadMessage(OutValue); - break; - } - case 18: { - if (signature_ == null) { - Signature = new global::AElf.Types.Hash(); - } - input.ReadMessage(Signature); - break; - } - case 24: { - RoundId = input.ReadInt64(); - break; - } - case 34: { - if (previousInValue_ == null) { - PreviousInValue = new global::AElf.Types.Hash(); - } - input.ReadMessage(PreviousInValue); - break; - } - case 42: { - if (actualMiningTime_ == null) { - ActualMiningTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(ActualMiningTime); - break; - } - case 48: { - SupposedOrderOfNextRound = input.ReadInt32(); - break; - } - case 58: { - tuneOrderInformation_.AddEntriesFrom(input, _map_tuneOrderInformation_codec); - break; - } - case 66: { - encryptedPieces_.AddEntriesFrom(input, _map_encryptedPieces_codec); - break; - } - case 74: { - decryptedPieces_.AddEntriesFrom(input, _map_decryptedPieces_codec); - break; - } - case 80: { - ProducedBlocks = input.ReadInt64(); - break; - } - case 90: { - minersPreviousInValues_.AddEntriesFrom(input, _map_minersPreviousInValues_codec); - break; - } - case 96: { - ImpliedIrreversibleBlockHeight = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class MinerList : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MinerList()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MinerList() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MinerList(MinerList other) : this() { - pubkeys_ = other.pubkeys_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MinerList Clone() { - return new MinerList(this); - } - - /// Field number for the "pubkeys" field. - public const int PubkeysFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_pubkeys_codec - = pb::FieldCodec.ForBytes(10); - private readonly pbc::RepeatedField pubkeys_ = new pbc::RepeatedField(); - /// - /// The miners public key list. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Pubkeys { - get { return pubkeys_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MinerList); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MinerList other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!pubkeys_.Equals(other.pubkeys_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= pubkeys_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - pubkeys_.WriteTo(output, _repeated_pubkeys_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += pubkeys_.CalculateSize(_repeated_pubkeys_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MinerList other) { - if (other == null) { - return; - } - pubkeys_.Add(other.pubkeys_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - pubkeys_.AddEntriesFrom(input, _repeated_pubkeys_codec); - break; - } - } - } - } - - } - - public sealed partial class PubkeyList : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PubkeyList()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public PubkeyList() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public PubkeyList(PubkeyList other) : this() { - pubkeys_ = other.pubkeys_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public PubkeyList Clone() { - return new PubkeyList(this); - } - - /// Field number for the "pubkeys" field. - public const int PubkeysFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_pubkeys_codec - = pb::FieldCodec.ForString(10); - private readonly pbc::RepeatedField pubkeys_ = new pbc::RepeatedField(); - /// - /// The miners public key list. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Pubkeys { - get { return pubkeys_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as PubkeyList); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(PubkeyList other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!pubkeys_.Equals(other.pubkeys_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= pubkeys_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - pubkeys_.WriteTo(output, _repeated_pubkeys_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += pubkeys_.CalculateSize(_repeated_pubkeys_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(PubkeyList other) { - if (other == null) { - return; - } - pubkeys_.Add(other.pubkeys_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - pubkeys_.AddEntriesFrom(input, _repeated_pubkeys_codec); - break; - } - } - } - } - - } - - public sealed partial class TermNumberLookUp : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TermNumberLookUp()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TermNumberLookUp() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TermNumberLookUp(TermNumberLookUp other) : this() { - map_ = other.map_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TermNumberLookUp Clone() { - return new TermNumberLookUp(this); - } - - /// Field number for the "map" field. - public const int MapFieldNumber = 1; - private static readonly pbc::MapField.Codec _map_map_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt64(8, 0L), pb::FieldCodec.ForInt64(16, 0L), 10); - private readonly pbc::MapField map_ = new pbc::MapField(); - /// - /// Term number -> Round number. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField Map { - get { return map_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TermNumberLookUp); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TermNumberLookUp other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!Map.Equals(other.Map)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= Map.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - map_.WriteTo(output, _map_map_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += map_.CalculateSize(_map_map_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TermNumberLookUp other) { - if (other == null) { - return; - } - map_.Add(other.map_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - map_.AddEntriesFrom(input, _map_map_codec); - break; - } - } - } - } - - } - - public sealed partial class Candidates : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Candidates()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[5]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Candidates() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Candidates(Candidates other) : this() { - pubkeys_ = other.pubkeys_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Candidates Clone() { - return new Candidates(this); - } - - /// Field number for the "pubkeys" field. - public const int PubkeysFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_pubkeys_codec - = pb::FieldCodec.ForBytes(10); - private readonly pbc::RepeatedField pubkeys_ = new pbc::RepeatedField(); - /// - /// The candidate public keys. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Pubkeys { - get { return pubkeys_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Candidates); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Candidates other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!pubkeys_.Equals(other.pubkeys_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= pubkeys_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - pubkeys_.WriteTo(output, _repeated_pubkeys_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += pubkeys_.CalculateSize(_repeated_pubkeys_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Candidates other) { - if (other == null) { - return; - } - pubkeys_.Add(other.pubkeys_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - pubkeys_.AddEntriesFrom(input, _repeated_pubkeys_codec); - break; - } - } - } - } - - } - - public sealed partial class Round : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Round()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[6]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Round() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Round(Round other) : this() { - roundNumber_ = other.roundNumber_; - realTimeMinersInformation_ = other.realTimeMinersInformation_.Clone(); - mainChainMinersRoundNumber_ = other.mainChainMinersRoundNumber_; - blockchainAge_ = other.blockchainAge_; - extraBlockProducerOfPreviousRound_ = other.extraBlockProducerOfPreviousRound_; - termNumber_ = other.termNumber_; - confirmedIrreversibleBlockHeight_ = other.confirmedIrreversibleBlockHeight_; - confirmedIrreversibleBlockRoundNumber_ = other.confirmedIrreversibleBlockRoundNumber_; - isMinerListJustChanged_ = other.isMinerListJustChanged_; - roundIdForValidation_ = other.roundIdForValidation_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Round Clone() { - return new Round(this); - } - - /// Field number for the "round_number" field. - public const int RoundNumberFieldNumber = 1; - private long roundNumber_; - /// - /// The round number. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RoundNumber { - get { return roundNumber_; } - set { - roundNumber_ = value; - } - } - - /// Field number for the "real_time_miners_information" field. - public const int RealTimeMinersInformationFieldNumber = 2; - private static readonly pbc::MapField.Codec _map_realTimeMinersInformation_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::AElf.Contracts.Consensus.AEDPoS.MinerInRound.Parser), 18); - private readonly pbc::MapField realTimeMinersInformation_ = new pbc::MapField(); - /// - /// Current miner information, miner public key -> miner information. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField RealTimeMinersInformation { - get { return realTimeMinersInformation_; } - } - - /// Field number for the "main_chain_miners_round_number" field. - public const int MainChainMinersRoundNumberFieldNumber = 3; - private long mainChainMinersRoundNumber_; - /// - /// The round number on the main chain - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long MainChainMinersRoundNumber { - get { return mainChainMinersRoundNumber_; } - set { - mainChainMinersRoundNumber_ = value; - } - } - - /// Field number for the "blockchain_age" field. - public const int BlockchainAgeFieldNumber = 4; - private long blockchainAge_; - /// - /// The time from chain start to current round (seconds). - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long BlockchainAge { - get { return blockchainAge_; } - set { - blockchainAge_ = value; - } - } - - /// Field number for the "extra_block_producer_of_previous_round" field. - public const int ExtraBlockProducerOfPreviousRoundFieldNumber = 5; - private string extraBlockProducerOfPreviousRound_ = ""; - /// - /// The miner public key that produced the extra block in the previous round. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ExtraBlockProducerOfPreviousRound { - get { return extraBlockProducerOfPreviousRound_; } - set { - extraBlockProducerOfPreviousRound_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "term_number" field. - public const int TermNumberFieldNumber = 6; - private long termNumber_; - /// - /// The current term number. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long TermNumber { - get { return termNumber_; } - set { - termNumber_ = value; - } - } - - /// Field number for the "confirmed_irreversible_block_height" field. - public const int ConfirmedIrreversibleBlockHeightFieldNumber = 7; - private long confirmedIrreversibleBlockHeight_; - /// - /// The height of the confirmed irreversible block. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ConfirmedIrreversibleBlockHeight { - get { return confirmedIrreversibleBlockHeight_; } - set { - confirmedIrreversibleBlockHeight_ = value; - } - } - - /// Field number for the "confirmed_irreversible_block_round_number" field. - public const int ConfirmedIrreversibleBlockRoundNumberFieldNumber = 8; - private long confirmedIrreversibleBlockRoundNumber_; - /// - /// The round number of the confirmed irreversible block. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ConfirmedIrreversibleBlockRoundNumber { - get { return confirmedIrreversibleBlockRoundNumber_; } - set { - confirmedIrreversibleBlockRoundNumber_ = value; - } - } - - /// Field number for the "is_miner_list_just_changed" field. - public const int IsMinerListJustChangedFieldNumber = 9; - private bool isMinerListJustChanged_; - /// - /// Is miner list different from the the miner list in the previous round. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsMinerListJustChanged { - get { return isMinerListJustChanged_; } - set { - isMinerListJustChanged_ = value; - } - } - - /// Field number for the "round_id_for_validation" field. - public const int RoundIdForValidationFieldNumber = 10; - private long roundIdForValidation_; - /// - /// The round id, calculated by summing block producers’ expecting time (second). - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RoundIdForValidation { - get { return roundIdForValidation_; } - set { - roundIdForValidation_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Round); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Round other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (RoundNumber != other.RoundNumber) return false; - if (!RealTimeMinersInformation.Equals(other.RealTimeMinersInformation)) return false; - if (MainChainMinersRoundNumber != other.MainChainMinersRoundNumber) return false; - if (BlockchainAge != other.BlockchainAge) return false; - if (ExtraBlockProducerOfPreviousRound != other.ExtraBlockProducerOfPreviousRound) return false; - if (TermNumber != other.TermNumber) return false; - if (ConfirmedIrreversibleBlockHeight != other.ConfirmedIrreversibleBlockHeight) return false; - if (ConfirmedIrreversibleBlockRoundNumber != other.ConfirmedIrreversibleBlockRoundNumber) return false; - if (IsMinerListJustChanged != other.IsMinerListJustChanged) return false; - if (RoundIdForValidation != other.RoundIdForValidation) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (RoundNumber != 0L) hash ^= RoundNumber.GetHashCode(); - hash ^= RealTimeMinersInformation.GetHashCode(); - if (MainChainMinersRoundNumber != 0L) hash ^= MainChainMinersRoundNumber.GetHashCode(); - if (BlockchainAge != 0L) hash ^= BlockchainAge.GetHashCode(); - if (ExtraBlockProducerOfPreviousRound.Length != 0) hash ^= ExtraBlockProducerOfPreviousRound.GetHashCode(); - if (TermNumber != 0L) hash ^= TermNumber.GetHashCode(); - if (ConfirmedIrreversibleBlockHeight != 0L) hash ^= ConfirmedIrreversibleBlockHeight.GetHashCode(); - if (ConfirmedIrreversibleBlockRoundNumber != 0L) hash ^= ConfirmedIrreversibleBlockRoundNumber.GetHashCode(); - if (IsMinerListJustChanged != false) hash ^= IsMinerListJustChanged.GetHashCode(); - if (RoundIdForValidation != 0L) hash ^= RoundIdForValidation.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (RoundNumber != 0L) { - output.WriteRawTag(8); - output.WriteInt64(RoundNumber); - } - realTimeMinersInformation_.WriteTo(output, _map_realTimeMinersInformation_codec); - if (MainChainMinersRoundNumber != 0L) { - output.WriteRawTag(24); - output.WriteInt64(MainChainMinersRoundNumber); - } - if (BlockchainAge != 0L) { - output.WriteRawTag(32); - output.WriteInt64(BlockchainAge); - } - if (ExtraBlockProducerOfPreviousRound.Length != 0) { - output.WriteRawTag(42); - output.WriteString(ExtraBlockProducerOfPreviousRound); - } - if (TermNumber != 0L) { - output.WriteRawTag(48); - output.WriteInt64(TermNumber); - } - if (ConfirmedIrreversibleBlockHeight != 0L) { - output.WriteRawTag(56); - output.WriteInt64(ConfirmedIrreversibleBlockHeight); - } - if (ConfirmedIrreversibleBlockRoundNumber != 0L) { - output.WriteRawTag(64); - output.WriteInt64(ConfirmedIrreversibleBlockRoundNumber); - } - if (IsMinerListJustChanged != false) { - output.WriteRawTag(72); - output.WriteBool(IsMinerListJustChanged); - } - if (RoundIdForValidation != 0L) { - output.WriteRawTag(80); - output.WriteInt64(RoundIdForValidation); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (RoundNumber != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RoundNumber); - } - size += realTimeMinersInformation_.CalculateSize(_map_realTimeMinersInformation_codec); - if (MainChainMinersRoundNumber != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(MainChainMinersRoundNumber); - } - if (BlockchainAge != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(BlockchainAge); - } - if (ExtraBlockProducerOfPreviousRound.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ExtraBlockProducerOfPreviousRound); - } - if (TermNumber != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(TermNumber); - } - if (ConfirmedIrreversibleBlockHeight != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(ConfirmedIrreversibleBlockHeight); - } - if (ConfirmedIrreversibleBlockRoundNumber != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(ConfirmedIrreversibleBlockRoundNumber); - } - if (IsMinerListJustChanged != false) { - size += 1 + 1; - } - if (RoundIdForValidation != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RoundIdForValidation); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Round other) { - if (other == null) { - return; - } - if (other.RoundNumber != 0L) { - RoundNumber = other.RoundNumber; - } - realTimeMinersInformation_.Add(other.realTimeMinersInformation_); - if (other.MainChainMinersRoundNumber != 0L) { - MainChainMinersRoundNumber = other.MainChainMinersRoundNumber; - } - if (other.BlockchainAge != 0L) { - BlockchainAge = other.BlockchainAge; - } - if (other.ExtraBlockProducerOfPreviousRound.Length != 0) { - ExtraBlockProducerOfPreviousRound = other.ExtraBlockProducerOfPreviousRound; - } - if (other.TermNumber != 0L) { - TermNumber = other.TermNumber; - } - if (other.ConfirmedIrreversibleBlockHeight != 0L) { - ConfirmedIrreversibleBlockHeight = other.ConfirmedIrreversibleBlockHeight; - } - if (other.ConfirmedIrreversibleBlockRoundNumber != 0L) { - ConfirmedIrreversibleBlockRoundNumber = other.ConfirmedIrreversibleBlockRoundNumber; - } - if (other.IsMinerListJustChanged != false) { - IsMinerListJustChanged = other.IsMinerListJustChanged; - } - if (other.RoundIdForValidation != 0L) { - RoundIdForValidation = other.RoundIdForValidation; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - RoundNumber = input.ReadInt64(); - break; - } - case 18: { - realTimeMinersInformation_.AddEntriesFrom(input, _map_realTimeMinersInformation_codec); - break; - } - case 24: { - MainChainMinersRoundNumber = input.ReadInt64(); - break; - } - case 32: { - BlockchainAge = input.ReadInt64(); - break; - } - case 42: { - ExtraBlockProducerOfPreviousRound = input.ReadString(); - break; - } - case 48: { - TermNumber = input.ReadInt64(); - break; - } - case 56: { - ConfirmedIrreversibleBlockHeight = input.ReadInt64(); - break; - } - case 64: { - ConfirmedIrreversibleBlockRoundNumber = input.ReadInt64(); - break; - } - case 72: { - IsMinerListJustChanged = input.ReadBool(); - break; - } - case 80: { - RoundIdForValidation = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class MinerInRound : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MinerInRound()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[7]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MinerInRound() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MinerInRound(MinerInRound other) : this() { - order_ = other.order_; - isExtraBlockProducer_ = other.isExtraBlockProducer_; - inValue_ = other.inValue_ != null ? other.inValue_.Clone() : null; - outValue_ = other.outValue_ != null ? other.outValue_.Clone() : null; - signature_ = other.signature_ != null ? other.signature_.Clone() : null; - expectedMiningTime_ = other.expectedMiningTime_ != null ? other.expectedMiningTime_.Clone() : null; - producedBlocks_ = other.producedBlocks_; - missedTimeSlots_ = other.missedTimeSlots_; - pubkey_ = other.pubkey_; - previousInValue_ = other.previousInValue_ != null ? other.previousInValue_.Clone() : null; - supposedOrderOfNextRound_ = other.supposedOrderOfNextRound_; - finalOrderOfNextRound_ = other.finalOrderOfNextRound_; - actualMiningTimes_ = other.actualMiningTimes_.Clone(); - encryptedPieces_ = other.encryptedPieces_.Clone(); - decryptedPieces_ = other.decryptedPieces_.Clone(); - producedTinyBlocks_ = other.producedTinyBlocks_; - impliedIrreversibleBlockHeight_ = other.impliedIrreversibleBlockHeight_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MinerInRound Clone() { - return new MinerInRound(this); - } - - /// Field number for the "order" field. - public const int OrderFieldNumber = 1; - private int order_; - /// - /// The order of the miner producing block. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Order { - get { return order_; } - set { - order_ = value; - } - } - - /// Field number for the "is_extra_block_producer" field. - public const int IsExtraBlockProducerFieldNumber = 2; - private bool isExtraBlockProducer_; - /// - /// Is extra block producer in the current round. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsExtraBlockProducer { - get { return isExtraBlockProducer_; } - set { - isExtraBlockProducer_ = value; - } - } - - /// Field number for the "in_value" field. - public const int InValueFieldNumber = 3; - private global::AElf.Types.Hash inValue_; - /// - /// Generated by secret sharing and used for validation between miner. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash InValue { - get { return inValue_; } - set { - inValue_ = value; - } - } - - /// Field number for the "out_value" field. - public const int OutValueFieldNumber = 4; - private global::AElf.Types.Hash outValue_; - /// - /// Calculated from current in value. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash OutValue { - get { return outValue_; } - set { - outValue_ = value; - } - } - - /// Field number for the "signature" field. - public const int SignatureFieldNumber = 5; - private global::AElf.Types.Hash signature_; - /// - /// Calculated from current in value and signatures of previous round. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash Signature { - get { return signature_; } - set { - signature_ = value; - } - } - - /// Field number for the "expected_mining_time" field. - public const int ExpectedMiningTimeFieldNumber = 6; - private global::Google.Protobuf.WellKnownTypes.Timestamp expectedMiningTime_; - /// - /// The expected mining time. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp ExpectedMiningTime { - get { return expectedMiningTime_; } - set { - expectedMiningTime_ = value; - } - } - - /// Field number for the "produced_blocks" field. - public const int ProducedBlocksFieldNumber = 7; - private long producedBlocks_; - /// - /// The amount of produced blocks. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ProducedBlocks { - get { return producedBlocks_; } - set { - producedBlocks_ = value; - } - } - - /// Field number for the "missed_time_slots" field. - public const int MissedTimeSlotsFieldNumber = 8; - private long missedTimeSlots_; - /// - /// The amount of missed time slots. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long MissedTimeSlots { - get { return missedTimeSlots_; } - set { - missedTimeSlots_ = value; - } - } - - /// Field number for the "pubkey" field. - public const int PubkeyFieldNumber = 9; - private string pubkey_ = ""; - /// - /// The public key of this miner. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Pubkey { - get { return pubkey_; } - set { - pubkey_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "previous_in_value" field. - public const int PreviousInValueFieldNumber = 10; - private global::AElf.Types.Hash previousInValue_; - /// - /// The InValue of the previous round. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash PreviousInValue { - get { return previousInValue_; } - set { - previousInValue_ = value; - } - } - - /// Field number for the "supposed_order_of_next_round" field. - public const int SupposedOrderOfNextRoundFieldNumber = 11; - private int supposedOrderOfNextRound_; - /// - /// The supposed order of mining for the next round. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int SupposedOrderOfNextRound { - get { return supposedOrderOfNextRound_; } - set { - supposedOrderOfNextRound_ = value; - } - } - - /// Field number for the "final_order_of_next_round" field. - public const int FinalOrderOfNextRoundFieldNumber = 12; - private int finalOrderOfNextRound_; - /// - /// The final order of mining for the next round. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int FinalOrderOfNextRound { - get { return finalOrderOfNextRound_; } - set { - finalOrderOfNextRound_ = value; - } - } - - /// Field number for the "actual_mining_times" field. - public const int ActualMiningTimesFieldNumber = 13; - private static readonly pb::FieldCodec _repeated_actualMiningTimes_codec - = pb::FieldCodec.ForMessage(106, global::Google.Protobuf.WellKnownTypes.Timestamp.Parser); - private readonly pbc::RepeatedField actualMiningTimes_ = new pbc::RepeatedField(); - /// - /// The actual mining time, miners must fill actual mining time when they do the mining. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField ActualMiningTimes { - get { return actualMiningTimes_; } - } - - /// Field number for the "encrypted_pieces" field. - public const int EncryptedPiecesFieldNumber = 14; - private static readonly pbc::MapField.Codec _map_encryptedPieces_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForBytes(18, pb::ByteString.Empty), 114); - private readonly pbc::MapField encryptedPieces_ = new pbc::MapField(); - /// - /// The encrypted pieces of InValue. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField EncryptedPieces { - get { return encryptedPieces_; } - } - - /// Field number for the "decrypted_pieces" field. - public const int DecryptedPiecesFieldNumber = 15; - private static readonly pbc::MapField.Codec _map_decryptedPieces_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForBytes(18, pb::ByteString.Empty), 122); - private readonly pbc::MapField decryptedPieces_ = new pbc::MapField(); - /// - /// The decrypted pieces of InValue. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField DecryptedPieces { - get { return decryptedPieces_; } - } - - /// Field number for the "produced_tiny_blocks" field. - public const int ProducedTinyBlocksFieldNumber = 16; - private long producedTinyBlocks_; - /// - /// The amount of produced tiny blocks. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ProducedTinyBlocks { - get { return producedTinyBlocks_; } - set { - producedTinyBlocks_ = value; - } - } - - /// Field number for the "implied_irreversible_block_height" field. - public const int ImpliedIrreversibleBlockHeightFieldNumber = 17; - private long impliedIrreversibleBlockHeight_; - /// - /// The irreversible block height that current miner recorded. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ImpliedIrreversibleBlockHeight { - get { return impliedIrreversibleBlockHeight_; } - set { - impliedIrreversibleBlockHeight_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MinerInRound); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MinerInRound other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Order != other.Order) return false; - if (IsExtraBlockProducer != other.IsExtraBlockProducer) return false; - if (!object.Equals(InValue, other.InValue)) return false; - if (!object.Equals(OutValue, other.OutValue)) return false; - if (!object.Equals(Signature, other.Signature)) return false; - if (!object.Equals(ExpectedMiningTime, other.ExpectedMiningTime)) return false; - if (ProducedBlocks != other.ProducedBlocks) return false; - if (MissedTimeSlots != other.MissedTimeSlots) return false; - if (Pubkey != other.Pubkey) return false; - if (!object.Equals(PreviousInValue, other.PreviousInValue)) return false; - if (SupposedOrderOfNextRound != other.SupposedOrderOfNextRound) return false; - if (FinalOrderOfNextRound != other.FinalOrderOfNextRound) return false; - if(!actualMiningTimes_.Equals(other.actualMiningTimes_)) return false; - if (!EncryptedPieces.Equals(other.EncryptedPieces)) return false; - if (!DecryptedPieces.Equals(other.DecryptedPieces)) return false; - if (ProducedTinyBlocks != other.ProducedTinyBlocks) return false; - if (ImpliedIrreversibleBlockHeight != other.ImpliedIrreversibleBlockHeight) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Order != 0) hash ^= Order.GetHashCode(); - if (IsExtraBlockProducer != false) hash ^= IsExtraBlockProducer.GetHashCode(); - if (inValue_ != null) hash ^= InValue.GetHashCode(); - if (outValue_ != null) hash ^= OutValue.GetHashCode(); - if (signature_ != null) hash ^= Signature.GetHashCode(); - if (expectedMiningTime_ != null) hash ^= ExpectedMiningTime.GetHashCode(); - if (ProducedBlocks != 0L) hash ^= ProducedBlocks.GetHashCode(); - if (MissedTimeSlots != 0L) hash ^= MissedTimeSlots.GetHashCode(); - if (Pubkey.Length != 0) hash ^= Pubkey.GetHashCode(); - if (previousInValue_ != null) hash ^= PreviousInValue.GetHashCode(); - if (SupposedOrderOfNextRound != 0) hash ^= SupposedOrderOfNextRound.GetHashCode(); - if (FinalOrderOfNextRound != 0) hash ^= FinalOrderOfNextRound.GetHashCode(); - hash ^= actualMiningTimes_.GetHashCode(); - hash ^= EncryptedPieces.GetHashCode(); - hash ^= DecryptedPieces.GetHashCode(); - if (ProducedTinyBlocks != 0L) hash ^= ProducedTinyBlocks.GetHashCode(); - if (ImpliedIrreversibleBlockHeight != 0L) hash ^= ImpliedIrreversibleBlockHeight.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Order != 0) { - output.WriteRawTag(8); - output.WriteInt32(Order); - } - if (IsExtraBlockProducer != false) { - output.WriteRawTag(16); - output.WriteBool(IsExtraBlockProducer); - } - if (inValue_ != null) { - output.WriteRawTag(26); - output.WriteMessage(InValue); - } - if (outValue_ != null) { - output.WriteRawTag(34); - output.WriteMessage(OutValue); - } - if (signature_ != null) { - output.WriteRawTag(42); - output.WriteMessage(Signature); - } - if (expectedMiningTime_ != null) { - output.WriteRawTag(50); - output.WriteMessage(ExpectedMiningTime); - } - if (ProducedBlocks != 0L) { - output.WriteRawTag(56); - output.WriteInt64(ProducedBlocks); - } - if (MissedTimeSlots != 0L) { - output.WriteRawTag(64); - output.WriteInt64(MissedTimeSlots); - } - if (Pubkey.Length != 0) { - output.WriteRawTag(74); - output.WriteString(Pubkey); - } - if (previousInValue_ != null) { - output.WriteRawTag(82); - output.WriteMessage(PreviousInValue); - } - if (SupposedOrderOfNextRound != 0) { - output.WriteRawTag(88); - output.WriteInt32(SupposedOrderOfNextRound); - } - if (FinalOrderOfNextRound != 0) { - output.WriteRawTag(96); - output.WriteInt32(FinalOrderOfNextRound); - } - actualMiningTimes_.WriteTo(output, _repeated_actualMiningTimes_codec); - encryptedPieces_.WriteTo(output, _map_encryptedPieces_codec); - decryptedPieces_.WriteTo(output, _map_decryptedPieces_codec); - if (ProducedTinyBlocks != 0L) { - output.WriteRawTag(128, 1); - output.WriteInt64(ProducedTinyBlocks); - } - if (ImpliedIrreversibleBlockHeight != 0L) { - output.WriteRawTag(136, 1); - output.WriteInt64(ImpliedIrreversibleBlockHeight); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Order != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Order); - } - if (IsExtraBlockProducer != false) { - size += 1 + 1; - } - if (inValue_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(InValue); - } - if (outValue_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OutValue); - } - if (signature_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Signature); - } - if (expectedMiningTime_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ExpectedMiningTime); - } - if (ProducedBlocks != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(ProducedBlocks); - } - if (MissedTimeSlots != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(MissedTimeSlots); - } - if (Pubkey.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Pubkey); - } - if (previousInValue_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(PreviousInValue); - } - if (SupposedOrderOfNextRound != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(SupposedOrderOfNextRound); - } - if (FinalOrderOfNextRound != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(FinalOrderOfNextRound); - } - size += actualMiningTimes_.CalculateSize(_repeated_actualMiningTimes_codec); - size += encryptedPieces_.CalculateSize(_map_encryptedPieces_codec); - size += decryptedPieces_.CalculateSize(_map_decryptedPieces_codec); - if (ProducedTinyBlocks != 0L) { - size += 2 + pb::CodedOutputStream.ComputeInt64Size(ProducedTinyBlocks); - } - if (ImpliedIrreversibleBlockHeight != 0L) { - size += 2 + pb::CodedOutputStream.ComputeInt64Size(ImpliedIrreversibleBlockHeight); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MinerInRound other) { - if (other == null) { - return; - } - if (other.Order != 0) { - Order = other.Order; - } - if (other.IsExtraBlockProducer != false) { - IsExtraBlockProducer = other.IsExtraBlockProducer; - } - if (other.inValue_ != null) { - if (inValue_ == null) { - InValue = new global::AElf.Types.Hash(); - } - InValue.MergeFrom(other.InValue); - } - if (other.outValue_ != null) { - if (outValue_ == null) { - OutValue = new global::AElf.Types.Hash(); - } - OutValue.MergeFrom(other.OutValue); - } - if (other.signature_ != null) { - if (signature_ == null) { - Signature = new global::AElf.Types.Hash(); - } - Signature.MergeFrom(other.Signature); - } - if (other.expectedMiningTime_ != null) { - if (expectedMiningTime_ == null) { - ExpectedMiningTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - ExpectedMiningTime.MergeFrom(other.ExpectedMiningTime); - } - if (other.ProducedBlocks != 0L) { - ProducedBlocks = other.ProducedBlocks; - } - if (other.MissedTimeSlots != 0L) { - MissedTimeSlots = other.MissedTimeSlots; - } - if (other.Pubkey.Length != 0) { - Pubkey = other.Pubkey; - } - if (other.previousInValue_ != null) { - if (previousInValue_ == null) { - PreviousInValue = new global::AElf.Types.Hash(); - } - PreviousInValue.MergeFrom(other.PreviousInValue); - } - if (other.SupposedOrderOfNextRound != 0) { - SupposedOrderOfNextRound = other.SupposedOrderOfNextRound; - } - if (other.FinalOrderOfNextRound != 0) { - FinalOrderOfNextRound = other.FinalOrderOfNextRound; - } - actualMiningTimes_.Add(other.actualMiningTimes_); - encryptedPieces_.Add(other.encryptedPieces_); - decryptedPieces_.Add(other.decryptedPieces_); - if (other.ProducedTinyBlocks != 0L) { - ProducedTinyBlocks = other.ProducedTinyBlocks; - } - if (other.ImpliedIrreversibleBlockHeight != 0L) { - ImpliedIrreversibleBlockHeight = other.ImpliedIrreversibleBlockHeight; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Order = input.ReadInt32(); - break; - } - case 16: { - IsExtraBlockProducer = input.ReadBool(); - break; - } - case 26: { - if (inValue_ == null) { - InValue = new global::AElf.Types.Hash(); - } - input.ReadMessage(InValue); - break; - } - case 34: { - if (outValue_ == null) { - OutValue = new global::AElf.Types.Hash(); - } - input.ReadMessage(OutValue); - break; - } - case 42: { - if (signature_ == null) { - Signature = new global::AElf.Types.Hash(); - } - input.ReadMessage(Signature); - break; - } - case 50: { - if (expectedMiningTime_ == null) { - ExpectedMiningTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(ExpectedMiningTime); - break; - } - case 56: { - ProducedBlocks = input.ReadInt64(); - break; - } - case 64: { - MissedTimeSlots = input.ReadInt64(); - break; - } - case 74: { - Pubkey = input.ReadString(); - break; - } - case 82: { - if (previousInValue_ == null) { - PreviousInValue = new global::AElf.Types.Hash(); - } - input.ReadMessage(PreviousInValue); - break; - } - case 88: { - SupposedOrderOfNextRound = input.ReadInt32(); - break; - } - case 96: { - FinalOrderOfNextRound = input.ReadInt32(); - break; - } - case 106: { - actualMiningTimes_.AddEntriesFrom(input, _repeated_actualMiningTimes_codec); - break; - } - case 114: { - encryptedPieces_.AddEntriesFrom(input, _map_encryptedPieces_codec); - break; - } - case 122: { - decryptedPieces_.AddEntriesFrom(input, _map_decryptedPieces_codec); - break; - } - case 128: { - ProducedTinyBlocks = input.ReadInt64(); - break; - } - case 136: { - ImpliedIrreversibleBlockHeight = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class AElfConsensusHeaderInformation : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AElfConsensusHeaderInformation()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[8]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AElfConsensusHeaderInformation() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AElfConsensusHeaderInformation(AElfConsensusHeaderInformation other) : this() { - senderPubkey_ = other.senderPubkey_; - round_ = other.round_ != null ? other.round_.Clone() : null; - behaviour_ = other.behaviour_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AElfConsensusHeaderInformation Clone() { - return new AElfConsensusHeaderInformation(this); - } - - /// Field number for the "sender_pubkey" field. - public const int SenderPubkeyFieldNumber = 1; - private pb::ByteString senderPubkey_ = pb::ByteString.Empty; - /// - /// The sender public key. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString SenderPubkey { - get { return senderPubkey_; } - set { - senderPubkey_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "round" field. - public const int RoundFieldNumber = 2; - private global::AElf.Contracts.Consensus.AEDPoS.Round round_; - /// - /// The round information. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Consensus.AEDPoS.Round Round { - get { return round_; } - set { - round_ = value; - } - } - - /// Field number for the "behaviour" field. - public const int BehaviourFieldNumber = 3; - private global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour behaviour_ = global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour.UpdateValue; - /// - /// The behaviour of consensus. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour Behaviour { - get { return behaviour_; } - set { - behaviour_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as AElfConsensusHeaderInformation); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(AElfConsensusHeaderInformation other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (SenderPubkey != other.SenderPubkey) return false; - if (!object.Equals(Round, other.Round)) return false; - if (Behaviour != other.Behaviour) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (SenderPubkey.Length != 0) hash ^= SenderPubkey.GetHashCode(); - if (round_ != null) hash ^= Round.GetHashCode(); - if (Behaviour != global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour.UpdateValue) hash ^= Behaviour.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (SenderPubkey.Length != 0) { - output.WriteRawTag(10); - output.WriteBytes(SenderPubkey); - } - if (round_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Round); - } - if (Behaviour != global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour.UpdateValue) { - output.WriteRawTag(24); - output.WriteEnum((int) Behaviour); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (SenderPubkey.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(SenderPubkey); - } - if (round_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Round); - } - if (Behaviour != global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour.UpdateValue) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Behaviour); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(AElfConsensusHeaderInformation other) { - if (other == null) { - return; - } - if (other.SenderPubkey.Length != 0) { - SenderPubkey = other.SenderPubkey; - } - if (other.round_ != null) { - if (round_ == null) { - Round = new global::AElf.Contracts.Consensus.AEDPoS.Round(); - } - Round.MergeFrom(other.Round); - } - if (other.Behaviour != global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour.UpdateValue) { - Behaviour = other.Behaviour; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - SenderPubkey = input.ReadBytes(); - break; - } - case 18: { - if (round_ == null) { - Round = new global::AElf.Contracts.Consensus.AEDPoS.Round(); - } - input.ReadMessage(Round); - break; - } - case 24: { - Behaviour = (global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour) input.ReadEnum(); - break; - } - } - } - } - - } - - public sealed partial class AElfConsensusHint : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AElfConsensusHint()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[9]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AElfConsensusHint() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AElfConsensusHint(AElfConsensusHint other) : this() { - behaviour_ = other.behaviour_; - roundId_ = other.roundId_; - previousRoundId_ = other.previousRoundId_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AElfConsensusHint Clone() { - return new AElfConsensusHint(this); - } - - /// Field number for the "behaviour" field. - public const int BehaviourFieldNumber = 1; - private global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour behaviour_ = global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour.UpdateValue; - /// - /// The behaviour of consensus. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour Behaviour { - get { return behaviour_; } - set { - behaviour_ = value; - } - } - - /// Field number for the "round_id" field. - public const int RoundIdFieldNumber = 2; - private long roundId_; - /// - /// The round id. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RoundId { - get { return roundId_; } - set { - roundId_ = value; - } - } - - /// Field number for the "previous_round_id" field. - public const int PreviousRoundIdFieldNumber = 3; - private long previousRoundId_; - /// - /// The previous round id. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long PreviousRoundId { - get { return previousRoundId_; } - set { - previousRoundId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as AElfConsensusHint); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(AElfConsensusHint other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Behaviour != other.Behaviour) return false; - if (RoundId != other.RoundId) return false; - if (PreviousRoundId != other.PreviousRoundId) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Behaviour != global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour.UpdateValue) hash ^= Behaviour.GetHashCode(); - if (RoundId != 0L) hash ^= RoundId.GetHashCode(); - if (PreviousRoundId != 0L) hash ^= PreviousRoundId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Behaviour != global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour.UpdateValue) { - output.WriteRawTag(8); - output.WriteEnum((int) Behaviour); - } - if (RoundId != 0L) { - output.WriteRawTag(16); - output.WriteInt64(RoundId); - } - if (PreviousRoundId != 0L) { - output.WriteRawTag(24); - output.WriteInt64(PreviousRoundId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Behaviour != global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour.UpdateValue) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Behaviour); - } - if (RoundId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RoundId); - } - if (PreviousRoundId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(PreviousRoundId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(AElfConsensusHint other) { - if (other == null) { - return; - } - if (other.Behaviour != global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour.UpdateValue) { - Behaviour = other.Behaviour; - } - if (other.RoundId != 0L) { - RoundId = other.RoundId; - } - if (other.PreviousRoundId != 0L) { - PreviousRoundId = other.PreviousRoundId; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Behaviour = (global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour) input.ReadEnum(); - break; - } - case 16: { - RoundId = input.ReadInt64(); - break; - } - case 24: { - PreviousRoundId = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class AElfConsensusTriggerInformation : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AElfConsensusTriggerInformation()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[10]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AElfConsensusTriggerInformation() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AElfConsensusTriggerInformation(AElfConsensusTriggerInformation other) : this() { - pubkey_ = other.pubkey_; - inValue_ = other.inValue_ != null ? other.inValue_.Clone() : null; - previousInValue_ = other.previousInValue_ != null ? other.previousInValue_.Clone() : null; - behaviour_ = other.behaviour_; - encryptedPieces_ = other.encryptedPieces_.Clone(); - decryptedPieces_ = other.decryptedPieces_.Clone(); - revealedInValues_ = other.revealedInValues_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AElfConsensusTriggerInformation Clone() { - return new AElfConsensusTriggerInformation(this); - } - - /// Field number for the "pubkey" field. - public const int PubkeyFieldNumber = 1; - private pb::ByteString pubkey_ = pb::ByteString.Empty; - /// - /// The miner public key. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Pubkey { - get { return pubkey_; } - set { - pubkey_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "in_value" field. - public const int InValueFieldNumber = 2; - private global::AElf.Types.Hash inValue_; - /// - /// The InValue for current round. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash InValue { - get { return inValue_; } - set { - inValue_ = value; - } - } - - /// Field number for the "previous_in_value" field. - public const int PreviousInValueFieldNumber = 3; - private global::AElf.Types.Hash previousInValue_; - /// - /// The InValue for previous round. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash PreviousInValue { - get { return previousInValue_; } - set { - previousInValue_ = value; - } - } - - /// Field number for the "behaviour" field. - public const int BehaviourFieldNumber = 4; - private global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour behaviour_ = global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour.UpdateValue; - /// - /// The behaviour of consensus. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour Behaviour { - get { return behaviour_; } - set { - behaviour_ = value; - } - } - - /// Field number for the "encrypted_pieces" field. - public const int EncryptedPiecesFieldNumber = 5; - private static readonly pbc::MapField.Codec _map_encryptedPieces_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForBytes(18, pb::ByteString.Empty), 42); - private readonly pbc::MapField encryptedPieces_ = new pbc::MapField(); - /// - /// The encrypted pieces of InValue. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField EncryptedPieces { - get { return encryptedPieces_; } - } - - /// Field number for the "decrypted_pieces" field. - public const int DecryptedPiecesFieldNumber = 6; - private static readonly pbc::MapField.Codec _map_decryptedPieces_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForBytes(18, pb::ByteString.Empty), 50); - private readonly pbc::MapField decryptedPieces_ = new pbc::MapField(); - /// - /// The decrypted pieces of InValue. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField DecryptedPieces { - get { return decryptedPieces_; } - } - - /// Field number for the "revealed_in_values" field. - public const int RevealedInValuesFieldNumber = 7; - private static readonly pbc::MapField.Codec _map_revealedInValues_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::AElf.Types.Hash.Parser), 58); - private readonly pbc::MapField revealedInValues_ = new pbc::MapField(); - /// - /// The revealed InValues. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField RevealedInValues { - get { return revealedInValues_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as AElfConsensusTriggerInformation); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(AElfConsensusTriggerInformation other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Pubkey != other.Pubkey) return false; - if (!object.Equals(InValue, other.InValue)) return false; - if (!object.Equals(PreviousInValue, other.PreviousInValue)) return false; - if (Behaviour != other.Behaviour) return false; - if (!EncryptedPieces.Equals(other.EncryptedPieces)) return false; - if (!DecryptedPieces.Equals(other.DecryptedPieces)) return false; - if (!RevealedInValues.Equals(other.RevealedInValues)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Pubkey.Length != 0) hash ^= Pubkey.GetHashCode(); - if (inValue_ != null) hash ^= InValue.GetHashCode(); - if (previousInValue_ != null) hash ^= PreviousInValue.GetHashCode(); - if (Behaviour != global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour.UpdateValue) hash ^= Behaviour.GetHashCode(); - hash ^= EncryptedPieces.GetHashCode(); - hash ^= DecryptedPieces.GetHashCode(); - hash ^= RevealedInValues.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Pubkey.Length != 0) { - output.WriteRawTag(10); - output.WriteBytes(Pubkey); - } - if (inValue_ != null) { - output.WriteRawTag(18); - output.WriteMessage(InValue); - } - if (previousInValue_ != null) { - output.WriteRawTag(26); - output.WriteMessage(PreviousInValue); - } - if (Behaviour != global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour.UpdateValue) { - output.WriteRawTag(32); - output.WriteEnum((int) Behaviour); - } - encryptedPieces_.WriteTo(output, _map_encryptedPieces_codec); - decryptedPieces_.WriteTo(output, _map_decryptedPieces_codec); - revealedInValues_.WriteTo(output, _map_revealedInValues_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Pubkey.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Pubkey); - } - if (inValue_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(InValue); - } - if (previousInValue_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(PreviousInValue); - } - if (Behaviour != global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour.UpdateValue) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Behaviour); - } - size += encryptedPieces_.CalculateSize(_map_encryptedPieces_codec); - size += decryptedPieces_.CalculateSize(_map_decryptedPieces_codec); - size += revealedInValues_.CalculateSize(_map_revealedInValues_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(AElfConsensusTriggerInformation other) { - if (other == null) { - return; - } - if (other.Pubkey.Length != 0) { - Pubkey = other.Pubkey; - } - if (other.inValue_ != null) { - if (inValue_ == null) { - InValue = new global::AElf.Types.Hash(); - } - InValue.MergeFrom(other.InValue); - } - if (other.previousInValue_ != null) { - if (previousInValue_ == null) { - PreviousInValue = new global::AElf.Types.Hash(); - } - PreviousInValue.MergeFrom(other.PreviousInValue); - } - if (other.Behaviour != global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour.UpdateValue) { - Behaviour = other.Behaviour; - } - encryptedPieces_.Add(other.encryptedPieces_); - decryptedPieces_.Add(other.decryptedPieces_); - revealedInValues_.Add(other.revealedInValues_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Pubkey = input.ReadBytes(); - break; - } - case 18: { - if (inValue_ == null) { - InValue = new global::AElf.Types.Hash(); - } - input.ReadMessage(InValue); - break; - } - case 26: { - if (previousInValue_ == null) { - PreviousInValue = new global::AElf.Types.Hash(); - } - input.ReadMessage(PreviousInValue); - break; - } - case 32: { - Behaviour = (global::AElf.Contracts.Consensus.AEDPoS.AElfConsensusBehaviour) input.ReadEnum(); - break; - } - case 42: { - encryptedPieces_.AddEntriesFrom(input, _map_encryptedPieces_codec); - break; - } - case 50: { - decryptedPieces_.AddEntriesFrom(input, _map_decryptedPieces_codec); - break; - } - case 58: { - revealedInValues_.AddEntriesFrom(input, _map_revealedInValues_codec); - break; - } - } - } - } - - } - - public sealed partial class TermInfo : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TermInfo()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[11]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TermInfo() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TermInfo(TermInfo other) : this() { - termNumber_ = other.termNumber_; - roundNumber_ = other.roundNumber_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TermInfo Clone() { - return new TermInfo(this); - } - - /// Field number for the "term_number" field. - public const int TermNumberFieldNumber = 1; - private long termNumber_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long TermNumber { - get { return termNumber_; } - set { - termNumber_ = value; - } - } - - /// Field number for the "round_number" field. - public const int RoundNumberFieldNumber = 2; - private long roundNumber_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RoundNumber { - get { return roundNumber_; } - set { - roundNumber_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TermInfo); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TermInfo other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (TermNumber != other.TermNumber) return false; - if (RoundNumber != other.RoundNumber) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (TermNumber != 0L) hash ^= TermNumber.GetHashCode(); - if (RoundNumber != 0L) hash ^= RoundNumber.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (TermNumber != 0L) { - output.WriteRawTag(8); - output.WriteInt64(TermNumber); - } - if (RoundNumber != 0L) { - output.WriteRawTag(16); - output.WriteInt64(RoundNumber); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (TermNumber != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(TermNumber); - } - if (RoundNumber != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RoundNumber); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TermInfo other) { - if (other == null) { - return; - } - if (other.TermNumber != 0L) { - TermNumber = other.TermNumber; - } - if (other.RoundNumber != 0L) { - RoundNumber = other.RoundNumber; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - TermNumber = input.ReadInt64(); - break; - } - case 16: { - RoundNumber = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class MinerListWithRoundNumber : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MinerListWithRoundNumber()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[12]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MinerListWithRoundNumber() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MinerListWithRoundNumber(MinerListWithRoundNumber other) : this() { - minerList_ = other.minerList_ != null ? other.minerList_.Clone() : null; - roundNumber_ = other.roundNumber_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MinerListWithRoundNumber Clone() { - return new MinerListWithRoundNumber(this); - } - - /// Field number for the "miner_list" field. - public const int MinerListFieldNumber = 1; - private global::AElf.Contracts.Consensus.AEDPoS.MinerList minerList_; - /// - /// The list of miners. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Consensus.AEDPoS.MinerList MinerList { - get { return minerList_; } - set { - minerList_ = value; - } - } - - /// Field number for the "round_number" field. - public const int RoundNumberFieldNumber = 2; - private long roundNumber_; - /// - /// The round number. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RoundNumber { - get { return roundNumber_; } - set { - roundNumber_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MinerListWithRoundNumber); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MinerListWithRoundNumber other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(MinerList, other.MinerList)) return false; - if (RoundNumber != other.RoundNumber) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (minerList_ != null) hash ^= MinerList.GetHashCode(); - if (RoundNumber != 0L) hash ^= RoundNumber.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (minerList_ != null) { - output.WriteRawTag(10); - output.WriteMessage(MinerList); - } - if (RoundNumber != 0L) { - output.WriteRawTag(16); - output.WriteInt64(RoundNumber); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (minerList_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(MinerList); - } - if (RoundNumber != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RoundNumber); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MinerListWithRoundNumber other) { - if (other == null) { - return; - } - if (other.minerList_ != null) { - if (minerList_ == null) { - MinerList = new global::AElf.Contracts.Consensus.AEDPoS.MinerList(); - } - MinerList.MergeFrom(other.MinerList); - } - if (other.RoundNumber != 0L) { - RoundNumber = other.RoundNumber; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (minerList_ == null) { - MinerList = new global::AElf.Contracts.Consensus.AEDPoS.MinerList(); - } - input.ReadMessage(MinerList); - break; - } - case 16: { - RoundNumber = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class TinyBlockInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TinyBlockInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[13]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TinyBlockInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TinyBlockInput(TinyBlockInput other) : this() { - roundId_ = other.roundId_; - actualMiningTime_ = other.actualMiningTime_ != null ? other.actualMiningTime_.Clone() : null; - producedBlocks_ = other.producedBlocks_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TinyBlockInput Clone() { - return new TinyBlockInput(this); - } - - /// Field number for the "round_id" field. - public const int RoundIdFieldNumber = 1; - private long roundId_; - /// - /// The round id. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RoundId { - get { return roundId_; } - set { - roundId_ = value; - } - } - - /// Field number for the "actual_mining_time" field. - public const int ActualMiningTimeFieldNumber = 2; - private global::Google.Protobuf.WellKnownTypes.Timestamp actualMiningTime_; - /// - /// The actual mining time. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp ActualMiningTime { - get { return actualMiningTime_; } - set { - actualMiningTime_ = value; - } - } - - /// Field number for the "produced_blocks" field. - public const int ProducedBlocksFieldNumber = 3; - private long producedBlocks_; - /// - /// Count of blocks currently produced - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ProducedBlocks { - get { return producedBlocks_; } - set { - producedBlocks_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TinyBlockInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TinyBlockInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (RoundId != other.RoundId) return false; - if (!object.Equals(ActualMiningTime, other.ActualMiningTime)) return false; - if (ProducedBlocks != other.ProducedBlocks) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (RoundId != 0L) hash ^= RoundId.GetHashCode(); - if (actualMiningTime_ != null) hash ^= ActualMiningTime.GetHashCode(); - if (ProducedBlocks != 0L) hash ^= ProducedBlocks.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (RoundId != 0L) { - output.WriteRawTag(8); - output.WriteInt64(RoundId); - } - if (actualMiningTime_ != null) { - output.WriteRawTag(18); - output.WriteMessage(ActualMiningTime); - } - if (ProducedBlocks != 0L) { - output.WriteRawTag(24); - output.WriteInt64(ProducedBlocks); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (RoundId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RoundId); - } - if (actualMiningTime_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ActualMiningTime); - } - if (ProducedBlocks != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(ProducedBlocks); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TinyBlockInput other) { - if (other == null) { - return; - } - if (other.RoundId != 0L) { - RoundId = other.RoundId; - } - if (other.actualMiningTime_ != null) { - if (actualMiningTime_ == null) { - ActualMiningTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - ActualMiningTime.MergeFrom(other.ActualMiningTime); - } - if (other.ProducedBlocks != 0L) { - ProducedBlocks = other.ProducedBlocks; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - RoundId = input.ReadInt64(); - break; - } - case 18: { - if (actualMiningTime_ == null) { - ActualMiningTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(ActualMiningTime); - break; - } - case 24: { - ProducedBlocks = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class VoteMinersCountInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new VoteMinersCountInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[14]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public VoteMinersCountInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public VoteMinersCountInput(VoteMinersCountInput other) : this() { - minersCount_ = other.minersCount_; - amount_ = other.amount_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public VoteMinersCountInput Clone() { - return new VoteMinersCountInput(this); - } - - /// Field number for the "miners_count" field. - public const int MinersCountFieldNumber = 1; - private int minersCount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int MinersCount { - get { return minersCount_; } - set { - minersCount_ = value; - } - } - - /// Field number for the "amount" field. - public const int AmountFieldNumber = 2; - private long amount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Amount { - get { return amount_; } - set { - amount_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as VoteMinersCountInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(VoteMinersCountInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (MinersCount != other.MinersCount) return false; - if (Amount != other.Amount) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (MinersCount != 0) hash ^= MinersCount.GetHashCode(); - if (Amount != 0L) hash ^= Amount.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (MinersCount != 0) { - output.WriteRawTag(8); - output.WriteInt32(MinersCount); - } - if (Amount != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Amount); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (MinersCount != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(MinersCount); - } - if (Amount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Amount); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(VoteMinersCountInput other) { - if (other == null) { - return; - } - if (other.MinersCount != 0) { - MinersCount = other.MinersCount; - } - if (other.Amount != 0L) { - Amount = other.Amount; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - MinersCount = input.ReadInt32(); - break; - } - case 16: { - Amount = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class ConsensusInformation : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConsensusInformation()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[15]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ConsensusInformation() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ConsensusInformation(ConsensusInformation other) : this() { - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ConsensusInformation Clone() { - return new ConsensusInformation(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private pb::ByteString value_ = pb::ByteString.Empty; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Value { - get { return value_; } - set { - value_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ConsensusInformation); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ConsensusInformation other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Value != other.Value) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Value.Length != 0) hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Value.Length != 0) { - output.WriteRawTag(10); - output.WriteBytes(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Value.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Value); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ConsensusInformation other) { - if (other == null) { - return; - } - if (other.Value.Length != 0) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Value = input.ReadBytes(); - break; - } - } - } - } - - } - - public sealed partial class GetMinerListInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetMinerListInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[16]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetMinerListInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetMinerListInput(GetMinerListInput other) : this() { - termNumber_ = other.termNumber_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetMinerListInput Clone() { - return new GetMinerListInput(this); - } - - /// Field number for the "term_number" field. - public const int TermNumberFieldNumber = 1; - private long termNumber_; - /// - /// The term number. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long TermNumber { - get { return termNumber_; } - set { - termNumber_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GetMinerListInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GetMinerListInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (TermNumber != other.TermNumber) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (TermNumber != 0L) hash ^= TermNumber.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (TermNumber != 0L) { - output.WriteRawTag(8); - output.WriteInt64(TermNumber); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (TermNumber != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(TermNumber); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GetMinerListInput other) { - if (other == null) { - return; - } - if (other.TermNumber != 0L) { - TermNumber = other.TermNumber; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - TermNumber = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class RandomNumberRequestInformation : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RandomNumberRequestInformation()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[17]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RandomNumberRequestInformation() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RandomNumberRequestInformation(RandomNumberRequestInformation other) : this() { - targetRoundNumber_ = other.targetRoundNumber_; - order_ = other.order_; - expectedBlockHeight_ = other.expectedBlockHeight_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RandomNumberRequestInformation Clone() { - return new RandomNumberRequestInformation(this); - } - - /// Field number for the "target_round_number" field. - public const int TargetRoundNumberFieldNumber = 1; - private long targetRoundNumber_; - /// - /// The random hash is likely generated during this round. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long TargetRoundNumber { - get { return targetRoundNumber_; } - set { - targetRoundNumber_ = value; - } - } - - /// Field number for the "order" field. - public const int OrderFieldNumber = 2; - private long order_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Order { - get { return order_; } - set { - order_ = value; - } - } - - /// Field number for the "expected_block_height" field. - public const int ExpectedBlockHeightFieldNumber = 3; - private long expectedBlockHeight_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ExpectedBlockHeight { - get { return expectedBlockHeight_; } - set { - expectedBlockHeight_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as RandomNumberRequestInformation); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(RandomNumberRequestInformation other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (TargetRoundNumber != other.TargetRoundNumber) return false; - if (Order != other.Order) return false; - if (ExpectedBlockHeight != other.ExpectedBlockHeight) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (TargetRoundNumber != 0L) hash ^= TargetRoundNumber.GetHashCode(); - if (Order != 0L) hash ^= Order.GetHashCode(); - if (ExpectedBlockHeight != 0L) hash ^= ExpectedBlockHeight.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (TargetRoundNumber != 0L) { - output.WriteRawTag(8); - output.WriteInt64(TargetRoundNumber); - } - if (Order != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Order); - } - if (ExpectedBlockHeight != 0L) { - output.WriteRawTag(24); - output.WriteInt64(ExpectedBlockHeight); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (TargetRoundNumber != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(TargetRoundNumber); - } - if (Order != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Order); - } - if (ExpectedBlockHeight != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(ExpectedBlockHeight); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(RandomNumberRequestInformation other) { - if (other == null) { - return; - } - if (other.TargetRoundNumber != 0L) { - TargetRoundNumber = other.TargetRoundNumber; - } - if (other.Order != 0L) { - Order = other.Order; - } - if (other.ExpectedBlockHeight != 0L) { - ExpectedBlockHeight = other.ExpectedBlockHeight; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - TargetRoundNumber = input.ReadInt64(); - break; - } - case 16: { - Order = input.ReadInt64(); - break; - } - case 24: { - ExpectedBlockHeight = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class HashList : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new HashList()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[18]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HashList() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HashList(HashList other) : this() { - values_ = other.values_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public HashList Clone() { - return new HashList(this); - } - - /// Field number for the "values" field. - public const int ValuesFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_values_codec - = pb::FieldCodec.ForMessage(10, global::AElf.Types.Hash.Parser); - private readonly pbc::RepeatedField values_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Values { - get { return values_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as HashList); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(HashList other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!values_.Equals(other.values_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= values_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - values_.WriteTo(output, _repeated_values_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += values_.CalculateSize(_repeated_values_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(HashList other) { - if (other == null) { - return; - } - values_.Add(other.values_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - values_.AddEntriesFrom(input, _repeated_values_codec); - break; - } - } - } - } - - } - - public sealed partial class LatestPubkeyToTinyBlocksCount : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new LatestPubkeyToTinyBlocksCount()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[19]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public LatestPubkeyToTinyBlocksCount() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public LatestPubkeyToTinyBlocksCount(LatestPubkeyToTinyBlocksCount other) : this() { - pubkey_ = other.pubkey_; - blocksCount_ = other.blocksCount_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public LatestPubkeyToTinyBlocksCount Clone() { - return new LatestPubkeyToTinyBlocksCount(this); - } - - /// Field number for the "pubkey" field. - public const int PubkeyFieldNumber = 1; - private string pubkey_ = ""; - /// - /// The miner public key. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Pubkey { - get { return pubkey_; } - set { - pubkey_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "blocks_count" field. - public const int BlocksCountFieldNumber = 2; - private long blocksCount_; - /// - /// The count of blocks the miner produced. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long BlocksCount { - get { return blocksCount_; } - set { - blocksCount_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as LatestPubkeyToTinyBlocksCount); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(LatestPubkeyToTinyBlocksCount other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Pubkey != other.Pubkey) return false; - if (BlocksCount != other.BlocksCount) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Pubkey.Length != 0) hash ^= Pubkey.GetHashCode(); - if (BlocksCount != 0L) hash ^= BlocksCount.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Pubkey.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Pubkey); - } - if (BlocksCount != 0L) { - output.WriteRawTag(16); - output.WriteInt64(BlocksCount); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Pubkey.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Pubkey); - } - if (BlocksCount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(BlocksCount); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(LatestPubkeyToTinyBlocksCount other) { - if (other == null) { - return; - } - if (other.Pubkey.Length != 0) { - Pubkey = other.Pubkey; - } - if (other.BlocksCount != 0L) { - BlocksCount = other.BlocksCount; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Pubkey = input.ReadString(); - break; - } - case 16: { - BlocksCount = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class IrreversibleBlockFound : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new IrreversibleBlockFound()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[20]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public IrreversibleBlockFound() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public IrreversibleBlockFound(IrreversibleBlockFound other) : this() { - irreversibleBlockHeight_ = other.irreversibleBlockHeight_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public IrreversibleBlockFound Clone() { - return new IrreversibleBlockFound(this); - } - - /// Field number for the "irreversible_block_height" field. - public const int IrreversibleBlockHeightFieldNumber = 1; - private long irreversibleBlockHeight_; - /// - /// The irreversible block height found. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long IrreversibleBlockHeight { - get { return irreversibleBlockHeight_; } - set { - irreversibleBlockHeight_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as IrreversibleBlockFound); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(IrreversibleBlockFound other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (IrreversibleBlockHeight != other.IrreversibleBlockHeight) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (IrreversibleBlockHeight != 0L) hash ^= IrreversibleBlockHeight.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (IrreversibleBlockHeight != 0L) { - output.WriteRawTag(8); - output.WriteInt64(IrreversibleBlockHeight); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (IrreversibleBlockHeight != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(IrreversibleBlockHeight); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(IrreversibleBlockFound other) { - if (other == null) { - return; - } - if (other.IrreversibleBlockHeight != 0L) { - IrreversibleBlockHeight = other.IrreversibleBlockHeight; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - IrreversibleBlockHeight = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class IrreversibleBlockHeightUnacceptable : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new IrreversibleBlockHeightUnacceptable()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[21]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public IrreversibleBlockHeightUnacceptable() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public IrreversibleBlockHeightUnacceptable(IrreversibleBlockHeightUnacceptable other) : this() { - distanceToIrreversibleBlockHeight_ = other.distanceToIrreversibleBlockHeight_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public IrreversibleBlockHeightUnacceptable Clone() { - return new IrreversibleBlockHeightUnacceptable(this); - } - - /// Field number for the "distance_to_irreversible_block_height" field. - public const int DistanceToIrreversibleBlockHeightFieldNumber = 1; - private long distanceToIrreversibleBlockHeight_; - /// - /// Distance to the height of the last irreversible block. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long DistanceToIrreversibleBlockHeight { - get { return distanceToIrreversibleBlockHeight_; } - set { - distanceToIrreversibleBlockHeight_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as IrreversibleBlockHeightUnacceptable); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(IrreversibleBlockHeightUnacceptable other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (DistanceToIrreversibleBlockHeight != other.DistanceToIrreversibleBlockHeight) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (DistanceToIrreversibleBlockHeight != 0L) hash ^= DistanceToIrreversibleBlockHeight.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (DistanceToIrreversibleBlockHeight != 0L) { - output.WriteRawTag(8); - output.WriteInt64(DistanceToIrreversibleBlockHeight); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (DistanceToIrreversibleBlockHeight != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(DistanceToIrreversibleBlockHeight); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(IrreversibleBlockHeightUnacceptable other) { - if (other == null) { - return; - } - if (other.DistanceToIrreversibleBlockHeight != 0L) { - DistanceToIrreversibleBlockHeight = other.DistanceToIrreversibleBlockHeight; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - DistanceToIrreversibleBlockHeight = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class MiningInformationUpdated : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MiningInformationUpdated()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[22]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MiningInformationUpdated() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MiningInformationUpdated(MiningInformationUpdated other) : this() { - pubkey_ = other.pubkey_; - miningTime_ = other.miningTime_ != null ? other.miningTime_.Clone() : null; - behaviour_ = other.behaviour_; - blockHeight_ = other.blockHeight_; - previousBlockHash_ = other.previousBlockHash_ != null ? other.previousBlockHash_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MiningInformationUpdated Clone() { - return new MiningInformationUpdated(this); - } - - /// Field number for the "pubkey" field. - public const int PubkeyFieldNumber = 1; - private string pubkey_ = ""; - /// - /// The miner public key. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Pubkey { - get { return pubkey_; } - set { - pubkey_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "mining_time" field. - public const int MiningTimeFieldNumber = 2; - private global::Google.Protobuf.WellKnownTypes.Timestamp miningTime_; - /// - /// The current block time. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp MiningTime { - get { return miningTime_; } - set { - miningTime_ = value; - } - } - - /// Field number for the "behaviour" field. - public const int BehaviourFieldNumber = 3; - private string behaviour_ = ""; - /// - /// The behaviour of consensus. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Behaviour { - get { return behaviour_; } - set { - behaviour_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "block_height" field. - public const int BlockHeightFieldNumber = 4; - private long blockHeight_; - /// - /// The current block height. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long BlockHeight { - get { return blockHeight_; } - set { - blockHeight_ = value; - } - } - - /// Field number for the "previous_block_hash" field. - public const int PreviousBlockHashFieldNumber = 5; - private global::AElf.Types.Hash previousBlockHash_; - /// - /// The previous block hash. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash PreviousBlockHash { - get { return previousBlockHash_; } - set { - previousBlockHash_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MiningInformationUpdated); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MiningInformationUpdated other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Pubkey != other.Pubkey) return false; - if (!object.Equals(MiningTime, other.MiningTime)) return false; - if (Behaviour != other.Behaviour) return false; - if (BlockHeight != other.BlockHeight) return false; - if (!object.Equals(PreviousBlockHash, other.PreviousBlockHash)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Pubkey.Length != 0) hash ^= Pubkey.GetHashCode(); - if (miningTime_ != null) hash ^= MiningTime.GetHashCode(); - if (Behaviour.Length != 0) hash ^= Behaviour.GetHashCode(); - if (BlockHeight != 0L) hash ^= BlockHeight.GetHashCode(); - if (previousBlockHash_ != null) hash ^= PreviousBlockHash.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Pubkey.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Pubkey); - } - if (miningTime_ != null) { - output.WriteRawTag(18); - output.WriteMessage(MiningTime); - } - if (Behaviour.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Behaviour); - } - if (BlockHeight != 0L) { - output.WriteRawTag(32); - output.WriteInt64(BlockHeight); - } - if (previousBlockHash_ != null) { - output.WriteRawTag(42); - output.WriteMessage(PreviousBlockHash); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Pubkey.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Pubkey); - } - if (miningTime_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(MiningTime); - } - if (Behaviour.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Behaviour); - } - if (BlockHeight != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(BlockHeight); - } - if (previousBlockHash_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(PreviousBlockHash); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MiningInformationUpdated other) { - if (other == null) { - return; - } - if (other.Pubkey.Length != 0) { - Pubkey = other.Pubkey; - } - if (other.miningTime_ != null) { - if (miningTime_ == null) { - MiningTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - MiningTime.MergeFrom(other.MiningTime); - } - if (other.Behaviour.Length != 0) { - Behaviour = other.Behaviour; - } - if (other.BlockHeight != 0L) { - BlockHeight = other.BlockHeight; - } - if (other.previousBlockHash_ != null) { - if (previousBlockHash_ == null) { - PreviousBlockHash = new global::AElf.Types.Hash(); - } - PreviousBlockHash.MergeFrom(other.PreviousBlockHash); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Pubkey = input.ReadString(); - break; - } - case 18: { - if (miningTime_ == null) { - MiningTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(MiningTime); - break; - } - case 26: { - Behaviour = input.ReadString(); - break; - } - case 32: { - BlockHeight = input.ReadInt64(); - break; - } - case 42: { - if (previousBlockHash_ == null) { - PreviousBlockHash = new global::AElf.Types.Hash(); - } - input.ReadMessage(PreviousBlockHash); - break; - } - } - } - } - - } - - public sealed partial class SecretSharingInformation : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SecretSharingInformation()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[23]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SecretSharingInformation() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SecretSharingInformation(SecretSharingInformation other) : this() { - previousRound_ = other.previousRound_ != null ? other.previousRound_.Clone() : null; - currentRoundId_ = other.currentRoundId_; - previousRoundId_ = other.previousRoundId_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SecretSharingInformation Clone() { - return new SecretSharingInformation(this); - } - - /// Field number for the "previous_round" field. - public const int PreviousRoundFieldNumber = 1; - private global::AElf.Contracts.Consensus.AEDPoS.Round previousRound_; - /// - /// The previous round information. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Consensus.AEDPoS.Round PreviousRound { - get { return previousRound_; } - set { - previousRound_ = value; - } - } - - /// Field number for the "current_round_id" field. - public const int CurrentRoundIdFieldNumber = 2; - private long currentRoundId_; - /// - /// The current round id. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long CurrentRoundId { - get { return currentRoundId_; } - set { - currentRoundId_ = value; - } - } - - /// Field number for the "previous_round_id" field. - public const int PreviousRoundIdFieldNumber = 3; - private long previousRoundId_; - /// - /// The previous round id. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long PreviousRoundId { - get { return previousRoundId_; } - set { - previousRoundId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SecretSharingInformation); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SecretSharingInformation other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(PreviousRound, other.PreviousRound)) return false; - if (CurrentRoundId != other.CurrentRoundId) return false; - if (PreviousRoundId != other.PreviousRoundId) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (previousRound_ != null) hash ^= PreviousRound.GetHashCode(); - if (CurrentRoundId != 0L) hash ^= CurrentRoundId.GetHashCode(); - if (PreviousRoundId != 0L) hash ^= PreviousRoundId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (previousRound_ != null) { - output.WriteRawTag(10); - output.WriteMessage(PreviousRound); - } - if (CurrentRoundId != 0L) { - output.WriteRawTag(16); - output.WriteInt64(CurrentRoundId); - } - if (PreviousRoundId != 0L) { - output.WriteRawTag(24); - output.WriteInt64(PreviousRoundId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (previousRound_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(PreviousRound); - } - if (CurrentRoundId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(CurrentRoundId); - } - if (PreviousRoundId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(PreviousRoundId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SecretSharingInformation other) { - if (other == null) { - return; - } - if (other.previousRound_ != null) { - if (previousRound_ == null) { - PreviousRound = new global::AElf.Contracts.Consensus.AEDPoS.Round(); - } - PreviousRound.MergeFrom(other.PreviousRound); - } - if (other.CurrentRoundId != 0L) { - CurrentRoundId = other.CurrentRoundId; - } - if (other.PreviousRoundId != 0L) { - PreviousRoundId = other.PreviousRoundId; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (previousRound_ == null) { - PreviousRound = new global::AElf.Contracts.Consensus.AEDPoS.Round(); - } - input.ReadMessage(PreviousRound); - break; - } - case 16: { - CurrentRoundId = input.ReadInt64(); - break; - } - case 24: { - PreviousRoundId = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class MiningRewardGenerated : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MiningRewardGenerated()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[24]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MiningRewardGenerated() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MiningRewardGenerated(MiningRewardGenerated other) : this() { - termNumber_ = other.termNumber_; - amount_ = other.amount_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MiningRewardGenerated Clone() { - return new MiningRewardGenerated(this); - } - - /// Field number for the "term_number" field. - public const int TermNumberFieldNumber = 1; - private long termNumber_; - /// - /// The number of term the mining reward is generated. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long TermNumber { - get { return termNumber_; } - set { - termNumber_ = value; - } - } - - /// Field number for the "amount" field. - public const int AmountFieldNumber = 2; - private long amount_; - /// - /// The amount of mining reward. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Amount { - get { return amount_; } - set { - amount_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MiningRewardGenerated); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MiningRewardGenerated other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (TermNumber != other.TermNumber) return false; - if (Amount != other.Amount) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (TermNumber != 0L) hash ^= TermNumber.GetHashCode(); - if (Amount != 0L) hash ^= Amount.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (TermNumber != 0L) { - output.WriteRawTag(8); - output.WriteInt64(TermNumber); - } - if (Amount != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Amount); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (TermNumber != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(TermNumber); - } - if (Amount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Amount); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MiningRewardGenerated other) { - if (other == null) { - return; - } - if (other.TermNumber != 0L) { - TermNumber = other.TermNumber; - } - if (other.Amount != 0L) { - Amount = other.Amount; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - TermNumber = input.ReadInt64(); - break; - } - case 16: { - Amount = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class MinerReplaced : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MinerReplaced()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[25]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MinerReplaced() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MinerReplaced(MinerReplaced other) : this() { - newMinerPubkey_ = other.newMinerPubkey_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MinerReplaced Clone() { - return new MinerReplaced(this); - } - - /// Field number for the "new_miner_pubkey" field. - public const int NewMinerPubkeyFieldNumber = 1; - private string newMinerPubkey_ = ""; - /// - /// The new miner public key. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string NewMinerPubkey { - get { return newMinerPubkey_; } - set { - newMinerPubkey_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MinerReplaced); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MinerReplaced other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (NewMinerPubkey != other.NewMinerPubkey) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (NewMinerPubkey.Length != 0) hash ^= NewMinerPubkey.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (NewMinerPubkey.Length != 0) { - output.WriteRawTag(10); - output.WriteString(NewMinerPubkey); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (NewMinerPubkey.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(NewMinerPubkey); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MinerReplaced other) { - if (other == null) { - return; - } - if (other.NewMinerPubkey.Length != 0) { - NewMinerPubkey = other.NewMinerPubkey; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - NewMinerPubkey = input.ReadString(); - break; - } - } - } - } - - } - - public sealed partial class RecordCandidateReplacementInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RecordCandidateReplacementInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Consensus.AEDPoS.AedposContractReflection.Descriptor.MessageTypes[26]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RecordCandidateReplacementInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RecordCandidateReplacementInput(RecordCandidateReplacementInput other) : this() { - oldPubkey_ = other.oldPubkey_; - newPubkey_ = other.newPubkey_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RecordCandidateReplacementInput Clone() { - return new RecordCandidateReplacementInput(this); - } - - /// Field number for the "old_pubkey" field. - public const int OldPubkeyFieldNumber = 1; - private string oldPubkey_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string OldPubkey { - get { return oldPubkey_; } - set { - oldPubkey_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "new_pubkey" field. - public const int NewPubkeyFieldNumber = 2; - private string newPubkey_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string NewPubkey { - get { return newPubkey_; } - set { - newPubkey_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as RecordCandidateReplacementInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(RecordCandidateReplacementInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (OldPubkey != other.OldPubkey) return false; - if (NewPubkey != other.NewPubkey) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (OldPubkey.Length != 0) hash ^= OldPubkey.GetHashCode(); - if (NewPubkey.Length != 0) hash ^= NewPubkey.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (OldPubkey.Length != 0) { - output.WriteRawTag(10); - output.WriteString(OldPubkey); - } - if (NewPubkey.Length != 0) { - output.WriteRawTag(18); - output.WriteString(NewPubkey); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (OldPubkey.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(OldPubkey); - } - if (NewPubkey.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(NewPubkey); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(RecordCandidateReplacementInput other) { - if (other == null) { - return; - } - if (other.OldPubkey.Length != 0) { - OldPubkey = other.OldPubkey; - } - if (other.NewPubkey.Length != 0) { - NewPubkey = other.NewPubkey; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - OldPubkey = input.ReadString(); - break; - } - case 18: { - NewPubkey = input.ReadString(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/src/AElf.EventHandler/Dto/AuthorityInfog.cs b/src/AElf.EventHandler/Dto/AuthorityInfog.cs deleted file mode 100644 index cddfa743..00000000 --- a/src/AElf.EventHandler/Dto/AuthorityInfog.cs +++ /dev/null @@ -1,217 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: authority_info.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -/// Holder for reflection information generated from authority_info.proto -public static partial class AuthorityInfoReflection { - - #region Descriptor - /// File descriptor for authority_info.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static AuthorityInfoReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChRhdXRob3JpdHlfaW5mby5wcm90bxoPYWVsZi9jb3JlLnByb3RvIl4KDUF1", - "dGhvcml0eUluZm8SJwoQY29udHJhY3RfYWRkcmVzcxgBIAEoCzINLmFlbGYu", - "QWRkcmVzcxIkCg1vd25lcl9hZGRyZXNzGAIgASgLMg0uYWVsZi5BZGRyZXNz", - "YgZwcm90bzM=")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::AElf.Types.CoreReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::AuthorityInfo), global::AuthorityInfo.Parser, new[]{ "ContractAddress", "OwnerAddress" }, null, null, null, null) - })); - } - #endregion - -} -#region Messages -public sealed partial class AuthorityInfo : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AuthorityInfo()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AuthorityInfoReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AuthorityInfo() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AuthorityInfo(AuthorityInfo other) : this() { - contractAddress_ = other.contractAddress_ != null ? other.contractAddress_.Clone() : null; - ownerAddress_ = other.ownerAddress_ != null ? other.ownerAddress_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AuthorityInfo Clone() { - return new AuthorityInfo(this); - } - - /// Field number for the "contract_address" field. - public const int ContractAddressFieldNumber = 1; - private global::AElf.Types.Address contractAddress_; - /// - /// The contract address of the controller. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address ContractAddress { - get { return contractAddress_; } - set { - contractAddress_ = value; - } - } - - /// Field number for the "owner_address" field. - public const int OwnerAddressFieldNumber = 2; - private global::AElf.Types.Address ownerAddress_; - /// - /// The address of the owner of the contract. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address OwnerAddress { - get { return ownerAddress_; } - set { - ownerAddress_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as AuthorityInfo); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(AuthorityInfo other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(ContractAddress, other.ContractAddress)) return false; - if (!object.Equals(OwnerAddress, other.OwnerAddress)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (contractAddress_ != null) hash ^= ContractAddress.GetHashCode(); - if (ownerAddress_ != null) hash ^= OwnerAddress.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (contractAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(ContractAddress); - } - if (ownerAddress_ != null) { - output.WriteRawTag(18); - output.WriteMessage(OwnerAddress); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (contractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ContractAddress); - } - if (ownerAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OwnerAddress); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(AuthorityInfo other) { - if (other == null) { - return; - } - if (other.contractAddress_ != null) { - if (contractAddress_ == null) { - ContractAddress = new global::AElf.Types.Address(); - } - ContractAddress.MergeFrom(other.ContractAddress); - } - if (other.ownerAddress_ != null) { - if (ownerAddress_ == null) { - OwnerAddress = new global::AElf.Types.Address(); - } - OwnerAddress.MergeFrom(other.OwnerAddress); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (contractAddress_ == null) { - ContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(ContractAddress); - break; - } - case 18: { - if (ownerAddress_ == null) { - OwnerAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(OwnerAddress); - break; - } - } - } - } - -} - -#endregion - - -#endregion Designer generated code diff --git a/src/AElf.EventHandler/Dto/BridgeContractc.cs b/src/AElf.EventHandler/Dto/BridgeContractc.cs deleted file mode 100644 index db755018..00000000 --- a/src/AElf.EventHandler/Dto/BridgeContractc.cs +++ /dev/null @@ -1,230 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: bridge_contract.proto -// -#pragma warning disable 0414, 1591 -#region Designer generated code - -using System.Collections.Generic; -using aelf = global::AElf.CSharp.Core; - -namespace AElf.Contracts.Bridge { - - #region Events - public partial class SwapRatioChanged : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public SwapRatioChanged GetNonIndexed() - { - return new SwapRatioChanged - { - SwapId = SwapId, - NewSwapRatio = NewSwapRatio, - TargetTokenSymbol = TargetTokenSymbol, - }; - } - } - - public partial class TokenSwapped : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public TokenSwapped GetNonIndexed() - { - return new TokenSwapped - { - Address = Address, - Amount = Amount, - Symbol = Symbol, - }; - } - } - - public partial class SwapPairAdded : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public SwapPairAdded GetNonIndexed() - { - return new SwapPairAdded - { - SwapId = SwapId, - }; - } - } - - #endregion - public static partial class BridgeContractContainer - { - static readonly string __ServiceName = "BridgeContract"; - - #region Marshallers - static readonly aelf::Marshaller __Marshaller_acs13_AggregateInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Standards.ACS13.AggregateInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_StringValue = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.StringValue.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_Empty = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_Int64Value = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Int64Value.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_aelf_Hash = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Types.Hash.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_GetReceiptHashListInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.ReceiptMakerContract.GetReceiptHashListInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_GetReceiptHashListOutput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.ReceiptMakerContract.GetReceiptHashListOutput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_InitializeInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Bridge.InitializeInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_CreateSwapInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Bridge.CreateSwapInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_SwapTokenInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Bridge.SwapTokenInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_ChangeSwapRatioInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Bridge.ChangeSwapRatioInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_DepositInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Bridge.DepositInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_WithdrawInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Bridge.WithdrawInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_UpdateMerkleTreeInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Bridge.UpdateMerkleTreeInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_CallbackInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::CallbackInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_SwapInfo = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Bridge.SwapInfo.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_GetSwapPairInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Bridge.GetSwapPairInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_SwapPair = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Bridge.SwapPair.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_GetSwapAmountsInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Bridge.GetSwapAmountsInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_SwapAmounts = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Bridge.SwapAmounts.Parser.ParseFrom); - #endregion - - #region Methods - static readonly aelf::Method __Method_Aggregate = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "Aggregate", - __Marshaller_acs13_AggregateInput, - __Marshaller_google_protobuf_StringValue); - - static readonly aelf::Method __Method_GetReceiptCount = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetReceiptCount", - __Marshaller_google_protobuf_Empty, - __Marshaller_google_protobuf_Int64Value); - - static readonly aelf::Method __Method_GetReceiptHash = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetReceiptHash", - __Marshaller_google_protobuf_Int64Value, - __Marshaller_aelf_Hash); - - static readonly aelf::Method __Method_GetReceiptHashList = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetReceiptHashList", - __Marshaller_GetReceiptHashListInput, - __Marshaller_GetReceiptHashListOutput); - - static readonly aelf::Method __Method_Initialize = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "Initialize", - __Marshaller_InitializeInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_CreateSwap = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "CreateSwap", - __Marshaller_CreateSwapInput, - __Marshaller_aelf_Hash); - - static readonly aelf::Method __Method_SwapToken = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "SwapToken", - __Marshaller_SwapTokenInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_ChangeSwapRatio = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "ChangeSwapRatio", - __Marshaller_ChangeSwapRatioInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_Deposit = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "Deposit", - __Marshaller_DepositInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_Withdraw = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "Withdraw", - __Marshaller_WithdrawInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_UpdateMerkleTree = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "UpdateMerkleTree", - __Marshaller_UpdateMerkleTreeInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_RecordReceiptHash = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "RecordReceiptHash", - __Marshaller_CallbackInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_GetSwapInfo = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetSwapInfo", - __Marshaller_aelf_Hash, - __Marshaller_SwapInfo); - - static readonly aelf::Method __Method_GetSwapPair = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetSwapPair", - __Marshaller_GetSwapPairInput, - __Marshaller_SwapPair); - - static readonly aelf::Method __Method_GetSwapAmounts = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetSwapAmounts", - __Marshaller_GetSwapAmountsInput, - __Marshaller_SwapAmounts); - - #endregion - - #region Descriptors - public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor - { - get { return global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.Services[0]; } - } - - public static global::System.Collections.Generic.IReadOnlyList Descriptors - { - get - { - return new global::System.Collections.Generic.List() - { - global::AElf.Standards.ACS13.Acs13Reflection.Descriptor.Services[0], - global::AElf.Contracts.ReceiptMakerContract.ReceiptMakerReflection.Descriptor.Services[0], - global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.Services[0], - }; - } - } - #endregion - } -} -#endregion - diff --git a/src/AElf.EventHandler/Dto/BridgeContractg.cs b/src/AElf.EventHandler/Dto/BridgeContractg.cs deleted file mode 100644 index 1ae5cc5f..00000000 --- a/src/AElf.EventHandler/Dto/BridgeContractg.cs +++ /dev/null @@ -1,3653 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: bridge_contract.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace AElf.Contracts.Bridge { - - /// Holder for reflection information generated from bridge_contract.proto - public static partial class BridgeContractReflection { - - #region Descriptor - /// File descriptor for bridge_contract.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static BridgeContractReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChVicmlkZ2VfY29udHJhY3QucHJvdG8aD2FlbGYvY29yZS5wcm90bxoSYWVs", - "Zi9vcHRpb25zLnByb3RvGhtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8a", - "H2dvb2dsZS9wcm90b2J1Zi90aW1lc3RhbXAucHJvdG8aHmdvb2dsZS9wcm90", - "b2J1Zi93cmFwcGVycy5wcm90bxoUY2FsbGJhY2tfaW5wdXQucHJvdG8aC2Fj", - "czEzLnByb3RvGhNyZWNlaXB0X21ha2VyLnByb3RvIpACCg9Jbml0aWFsaXpl", - "SW5wdXQSLgoXb3JhY2xlX2NvbnRyYWN0X2FkZHJlc3MYASABKAsyDS5hZWxm", - "LkFkZHJlc3MSPAolbWVya2xlX3RyZWVfcmVjb3JkZXJfY29udHJhY3RfYWRk", - "cmVzcxgCIAEoCzINLmFlbGYuQWRkcmVzcxIwChlyZWdpbWVudF9jb250cmFj", - "dF9hZGRyZXNzGAMgASgLMg0uYWVsZi5BZGRyZXNzEj0KJm1lcmtsZV90cmVl", - "X2dlbmVyYXRvcl9jb250cmFjdF9hZGRyZXNzGAQgASgLMg0uYWVsZi5BZGRy", - "ZXNzEh4KFm1lcmtsZV90cmVlX2xlYWZfbGltaXQYBSABKAUiuAEKD0NyZWF0", - "ZVN3YXBJbnB1dBIhChlvcmlnaW5fdG9rZW5fc2l6ZV9pbl9ieXRlGAEgASgF", - "EicKH29yaWdpbl90b2tlbl9udW1lcmljX2JpZ19lbmRpYW4YAiABKAgSMAoW", - "c3dhcF90YXJnZXRfdG9rZW5fbGlzdBgDIAMoCzIQLlN3YXBUYXJnZXRUb2tl", - "bhInChByZWdpbWVudF9hZGRyZXNzGAQgASgLMg0uYWVsZi5BZGRyZXNzImYK", - "D1N3YXBUYXJnZXRUb2tlbhIbChN0YXJnZXRfdG9rZW5fc3ltYm9sGAEgASgJ", - "Eh4KCnN3YXBfcmF0aW8YAiABKAsyCi5Td2FwUmF0aW8SFgoOZGVwb3NpdF9h", - "bW91bnQYAyABKAMiugIKCFN3YXBJbmZvEhsKB3N3YXBfaWQYASABKAsyCi5h", - "ZWxmLkhhc2gSIQoZb3JpZ2luX3Rva2VuX3NpemVfaW5fYnl0ZRgCIAEoBRIn", - "Ch9vcmlnaW5fdG9rZW5fbnVtZXJpY19iaWdfZW5kaWFuGAMgASgIEkAKFXN3", - "YXBfdGFyZ2V0X3Rva2VuX21hcBgEIAMoCzIhLlN3YXBJbmZvLlN3YXBUYXJn", - "ZXRUb2tlbk1hcEVudHJ5EicKEHJlZ2ltZW50X2FkZHJlc3MYBSABKAsyDS5h", - "ZWxmLkFkZHJlc3MSEwoLcmVjb3JkZXJfaWQYBiABKAMaRQoXU3dhcFRhcmdl", - "dFRva2VuTWFwRW50cnkSCwoDa2V5GAEgASgJEhkKBXZhbHVlGAIgASgLMgou", - "YWVsZi5IYXNoOgI4ASL3AQoIU3dhcFBhaXISGwoHc3dhcF9pZBgBIAEoCzIK", - "LmFlbGYuSGFzaBIhChlvcmlnaW5fdG9rZW5fc2l6ZV9pbl9ieXRlGAIgASgF", - "EicKH29yaWdpbl90b2tlbl9udW1lcmljX2JpZ19lbmRpYW4YAyABKAgSGwoT", - "dGFyZ2V0X3Rva2VuX3N5bWJvbBgEIAEoCRIeCgpzd2FwX3JhdGlvGAUgASgL", - "MgouU3dhcFJhdGlvEhYKDnN3YXBwZWRfYW1vdW50GAYgASgDEhUKDXN3YXBw", - "ZWRfdGltZXMYByABKAMSFgoOZGVwb3NpdF9hbW91bnQYCCABKAMiNwoJU3dh", - "cFJhdGlvEhQKDG9yaWdpbl9zaGFyZRgBIAEoAxIUCgx0YXJnZXRfc2hhcmUY", - "AiABKAMicAoUQ2hhbmdlU3dhcFJhdGlvSW5wdXQSGwoHc3dhcF9pZBgBIAEo", - "CzIKLmFlbGYuSGFzaBIeCgpzd2FwX3JhdGlvGAIgASgLMgouU3dhcFJhdGlv", - "EhsKE3RhcmdldF90b2tlbl9zeW1ib2wYAyABKAkiWAoOU3dhcFRva2VuSW5w", - "dXQSGwoHc3dhcF9pZBgBIAEoCzIKLmFlbGYuSGFzaBISCgpyZWNlaXB0X2lk", - "GAIgASgDEhUKDW9yaWdpbl9hbW91bnQYAyABKAkiWAoMRGVwb3NpdElucHV0", - "EhsKB3N3YXBfaWQYASABKAsyCi5hZWxmLkhhc2gSGwoTdGFyZ2V0X3Rva2Vu", - "X3N5bWJvbBgCIAEoCRIOCgZhbW91bnQYAyABKAMiTAoQR2V0U3dhcFBhaXJJ", - "bnB1dBIbCgdzd2FwX2lkGAEgASgLMgouYWVsZi5IYXNoEhsKE3RhcmdldF90", - "b2tlbl9zeW1ib2wYAiABKAkiRgoTR2V0U3dhcEFtb3VudHNJbnB1dBIbCgdz", - "d2FwX2lkGAEgASgLMgouYWVsZi5IYXNoEhIKCnJlY2VpcHRfaWQYAiABKAMi", - "owEKC1N3YXBBbW91bnRzEh8KCHJlY2VpdmVyGAEgASgLMg0uYWVsZi5BZGRy", - "ZXNzEjsKEHJlY2VpdmVkX2Ftb3VudHMYAiADKAsyIS5Td2FwQW1vdW50cy5S", - "ZWNlaXZlZEFtb3VudHNFbnRyeRo2ChRSZWNlaXZlZEFtb3VudHNFbnRyeRIL", - "CgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAM6AjgBIlkKDVdpdGhkcmF3SW5w", - "dXQSGwoHc3dhcF9pZBgBIAEoCzIKLmFlbGYuSGFzaBIbChN0YXJnZXRfdG9r", - "ZW5fc3ltYm9sGAIgASgJEg4KBmFtb3VudBgDIAEoAyJ+Cg5SZWNlaXB0SGFz", - "aE1hcBIpCgV2YWx1ZRgBIAMoCzIaLlJlY2VpcHRIYXNoTWFwLlZhbHVlRW50", - "cnkSEwoLcmVjb3JkZXJfaWQYAiABKAMaLAoKVmFsdWVFbnRyeRILCgNrZXkY", - "ASABKAMSDQoFdmFsdWUYAiABKAk6AjgBIlUKFVVwZGF0ZU1lcmtsZVRyZWVJ", - "bnB1dBITCgtyZWNvcmRlcl9pZBgBIAEoAxInChByZWdpbWVudF9hZGRyZXNz", - "GAIgASgLMg0uYWVsZi5BZGRyZXNzInYKEFN3YXBSYXRpb0NoYW5nZWQSGwoH", - "c3dhcF9pZBgBIAEoCzIKLmFlbGYuSGFzaBIiCg5uZXdfc3dhcF9yYXRpbxgC", - "IAEoCzIKLlN3YXBSYXRpbxIbChN0YXJnZXRfdG9rZW5fc3ltYm9sGAMgASgJ", - "OgSguxgBIlQKDFRva2VuU3dhcHBlZBIeCgdhZGRyZXNzGAEgASgLMg0uYWVs", - "Zi5BZGRyZXNzEg4KBmFtb3VudBgCIAEoAxIOCgZzeW1ib2wYAyABKAk6BKC7", - "GAEiMgoNU3dhcFBhaXJBZGRlZBIbCgdzd2FwX2lkGAEgASgLMgouYWVsZi5I", - "YXNoOgSguxgBMtkFCg5CcmlkZ2VDb250cmFjdBI4CgpJbml0aWFsaXplEhAu", - "SW5pdGlhbGl6ZUlucHV0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IgASLAoK", - "Q3JlYXRlU3dhcBIQLkNyZWF0ZVN3YXBJbnB1dBoKLmFlbGYuSGFzaCIAEjYK", - "CVN3YXBUb2tlbhIPLlN3YXBUb2tlbklucHV0GhYuZ29vZ2xlLnByb3RvYnVm", - "LkVtcHR5IgASQgoPQ2hhbmdlU3dhcFJhdGlvEhUuQ2hhbmdlU3dhcFJhdGlv", - "SW5wdXQaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiABIyCgdEZXBvc2l0Eg0u", - "RGVwb3NpdElucHV0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IgASNAoIV2l0", - "aGRyYXcSDi5XaXRoZHJhd0lucHV0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5", - "IgASRAoQVXBkYXRlTWVya2xlVHJlZRIWLlVwZGF0ZU1lcmtsZVRyZWVJbnB1", - "dBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIAEj0KEVJlY29yZFJlY2VpcHRI", - "YXNoEg4uQ2FsbGJhY2tJbnB1dBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIA", - "EisKC0dldFN3YXBJbmZvEgouYWVsZi5IYXNoGgkuU3dhcEluZm8iBYiJ9wEB", - "EjIKC0dldFN3YXBQYWlyEhEuR2V0U3dhcFBhaXJJbnB1dBoJLlN3YXBQYWly", - "IgWIifcBARI7Cg5HZXRTd2FwQW1vdW50cxIULkdldFN3YXBBbW91bnRzSW5w", - "dXQaDC5Td2FwQW1vdW50cyIFiIn3AQEaVrLM9gEpQUVsZi5Db250cmFjdHMu", - "QnJpZGdlLkJyaWRnZUNvbnRyYWN0U3RhdGXKyvYBC2FjczEzLnByb3Rvysr2", - "ARNyZWNlaXB0X21ha2VyLnByb3RvQhiqAhVBRWxmLkNvbnRyYWN0cy5Ccmlk", - "Z2ViBnByb3RvMw==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::AElf.Types.CoreReflection.Descriptor, global::AElf.OptionsReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, global::CallbackInputReflection.Descriptor, global::AElf.Standards.ACS13.Acs13Reflection.Descriptor, global::AElf.Contracts.ReceiptMakerContract.ReceiptMakerReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Bridge.InitializeInput), global::AElf.Contracts.Bridge.InitializeInput.Parser, new[]{ "OracleContractAddress", "MerkleTreeRecorderContractAddress", "RegimentContractAddress", "MerkleTreeGeneratorContractAddress", "MerkleTreeLeafLimit" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Bridge.CreateSwapInput), global::AElf.Contracts.Bridge.CreateSwapInput.Parser, new[]{ "OriginTokenSizeInByte", "OriginTokenNumericBigEndian", "SwapTargetTokenList", "RegimentAddress" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Bridge.SwapTargetToken), global::AElf.Contracts.Bridge.SwapTargetToken.Parser, new[]{ "TargetTokenSymbol", "SwapRatio", "DepositAmount" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Bridge.SwapInfo), global::AElf.Contracts.Bridge.SwapInfo.Parser, new[]{ "SwapId", "OriginTokenSizeInByte", "OriginTokenNumericBigEndian", "SwapTargetTokenMap", "RegimentAddress", "RecorderId" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Bridge.SwapPair), global::AElf.Contracts.Bridge.SwapPair.Parser, new[]{ "SwapId", "OriginTokenSizeInByte", "OriginTokenNumericBigEndian", "TargetTokenSymbol", "SwapRatio", "SwappedAmount", "SwappedTimes", "DepositAmount" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Bridge.SwapRatio), global::AElf.Contracts.Bridge.SwapRatio.Parser, new[]{ "OriginShare", "TargetShare" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Bridge.ChangeSwapRatioInput), global::AElf.Contracts.Bridge.ChangeSwapRatioInput.Parser, new[]{ "SwapId", "SwapRatio", "TargetTokenSymbol" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Bridge.SwapTokenInput), global::AElf.Contracts.Bridge.SwapTokenInput.Parser, new[]{ "SwapId", "ReceiptId", "OriginAmount" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Bridge.DepositInput), global::AElf.Contracts.Bridge.DepositInput.Parser, new[]{ "SwapId", "TargetTokenSymbol", "Amount" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Bridge.GetSwapPairInput), global::AElf.Contracts.Bridge.GetSwapPairInput.Parser, new[]{ "SwapId", "TargetTokenSymbol" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Bridge.GetSwapAmountsInput), global::AElf.Contracts.Bridge.GetSwapAmountsInput.Parser, new[]{ "SwapId", "ReceiptId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Bridge.SwapAmounts), global::AElf.Contracts.Bridge.SwapAmounts.Parser, new[]{ "Receiver", "ReceivedAmounts" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Bridge.WithdrawInput), global::AElf.Contracts.Bridge.WithdrawInput.Parser, new[]{ "SwapId", "TargetTokenSymbol", "Amount" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Bridge.ReceiptHashMap), global::AElf.Contracts.Bridge.ReceiptHashMap.Parser, new[]{ "Value", "RecorderId" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Bridge.UpdateMerkleTreeInput), global::AElf.Contracts.Bridge.UpdateMerkleTreeInput.Parser, new[]{ "RecorderId", "RegimentAddress" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Bridge.SwapRatioChanged), global::AElf.Contracts.Bridge.SwapRatioChanged.Parser, new[]{ "SwapId", "NewSwapRatio", "TargetTokenSymbol" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Bridge.TokenSwapped), global::AElf.Contracts.Bridge.TokenSwapped.Parser, new[]{ "Address", "Amount", "Symbol" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Bridge.SwapPairAdded), global::AElf.Contracts.Bridge.SwapPairAdded.Parser, new[]{ "SwapId" }, null, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class InitializeInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new InitializeInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitializeInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitializeInput(InitializeInput other) : this() { - oracleContractAddress_ = other.oracleContractAddress_ != null ? other.oracleContractAddress_.Clone() : null; - merkleTreeRecorderContractAddress_ = other.merkleTreeRecorderContractAddress_ != null ? other.merkleTreeRecorderContractAddress_.Clone() : null; - regimentContractAddress_ = other.regimentContractAddress_ != null ? other.regimentContractAddress_.Clone() : null; - merkleTreeGeneratorContractAddress_ = other.merkleTreeGeneratorContractAddress_ != null ? other.merkleTreeGeneratorContractAddress_.Clone() : null; - merkleTreeLeafLimit_ = other.merkleTreeLeafLimit_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitializeInput Clone() { - return new InitializeInput(this); - } - - /// Field number for the "oracle_contract_address" field. - public const int OracleContractAddressFieldNumber = 1; - private global::AElf.Types.Address oracleContractAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address OracleContractAddress { - get { return oracleContractAddress_; } - set { - oracleContractAddress_ = value; - } - } - - /// Field number for the "merkle_tree_recorder_contract_address" field. - public const int MerkleTreeRecorderContractAddressFieldNumber = 2; - private global::AElf.Types.Address merkleTreeRecorderContractAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address MerkleTreeRecorderContractAddress { - get { return merkleTreeRecorderContractAddress_; } - set { - merkleTreeRecorderContractAddress_ = value; - } - } - - /// Field number for the "regiment_contract_address" field. - public const int RegimentContractAddressFieldNumber = 3; - private global::AElf.Types.Address regimentContractAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address RegimentContractAddress { - get { return regimentContractAddress_; } - set { - regimentContractAddress_ = value; - } - } - - /// Field number for the "merkle_tree_generator_contract_address" field. - public const int MerkleTreeGeneratorContractAddressFieldNumber = 4; - private global::AElf.Types.Address merkleTreeGeneratorContractAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address MerkleTreeGeneratorContractAddress { - get { return merkleTreeGeneratorContractAddress_; } - set { - merkleTreeGeneratorContractAddress_ = value; - } - } - - /// Field number for the "merkle_tree_leaf_limit" field. - public const int MerkleTreeLeafLimitFieldNumber = 5; - private int merkleTreeLeafLimit_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int MerkleTreeLeafLimit { - get { return merkleTreeLeafLimit_; } - set { - merkleTreeLeafLimit_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as InitializeInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(InitializeInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(OracleContractAddress, other.OracleContractAddress)) return false; - if (!object.Equals(MerkleTreeRecorderContractAddress, other.MerkleTreeRecorderContractAddress)) return false; - if (!object.Equals(RegimentContractAddress, other.RegimentContractAddress)) return false; - if (!object.Equals(MerkleTreeGeneratorContractAddress, other.MerkleTreeGeneratorContractAddress)) return false; - if (MerkleTreeLeafLimit != other.MerkleTreeLeafLimit) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (oracleContractAddress_ != null) hash ^= OracleContractAddress.GetHashCode(); - if (merkleTreeRecorderContractAddress_ != null) hash ^= MerkleTreeRecorderContractAddress.GetHashCode(); - if (regimentContractAddress_ != null) hash ^= RegimentContractAddress.GetHashCode(); - if (merkleTreeGeneratorContractAddress_ != null) hash ^= MerkleTreeGeneratorContractAddress.GetHashCode(); - if (MerkleTreeLeafLimit != 0) hash ^= MerkleTreeLeafLimit.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (oracleContractAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(OracleContractAddress); - } - if (merkleTreeRecorderContractAddress_ != null) { - output.WriteRawTag(18); - output.WriteMessage(MerkleTreeRecorderContractAddress); - } - if (regimentContractAddress_ != null) { - output.WriteRawTag(26); - output.WriteMessage(RegimentContractAddress); - } - if (merkleTreeGeneratorContractAddress_ != null) { - output.WriteRawTag(34); - output.WriteMessage(MerkleTreeGeneratorContractAddress); - } - if (MerkleTreeLeafLimit != 0) { - output.WriteRawTag(40); - output.WriteInt32(MerkleTreeLeafLimit); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (oracleContractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OracleContractAddress); - } - if (merkleTreeRecorderContractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(MerkleTreeRecorderContractAddress); - } - if (regimentContractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegimentContractAddress); - } - if (merkleTreeGeneratorContractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(MerkleTreeGeneratorContractAddress); - } - if (MerkleTreeLeafLimit != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(MerkleTreeLeafLimit); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(InitializeInput other) { - if (other == null) { - return; - } - if (other.oracleContractAddress_ != null) { - if (oracleContractAddress_ == null) { - OracleContractAddress = new global::AElf.Types.Address(); - } - OracleContractAddress.MergeFrom(other.OracleContractAddress); - } - if (other.merkleTreeRecorderContractAddress_ != null) { - if (merkleTreeRecorderContractAddress_ == null) { - MerkleTreeRecorderContractAddress = new global::AElf.Types.Address(); - } - MerkleTreeRecorderContractAddress.MergeFrom(other.MerkleTreeRecorderContractAddress); - } - if (other.regimentContractAddress_ != null) { - if (regimentContractAddress_ == null) { - RegimentContractAddress = new global::AElf.Types.Address(); - } - RegimentContractAddress.MergeFrom(other.RegimentContractAddress); - } - if (other.merkleTreeGeneratorContractAddress_ != null) { - if (merkleTreeGeneratorContractAddress_ == null) { - MerkleTreeGeneratorContractAddress = new global::AElf.Types.Address(); - } - MerkleTreeGeneratorContractAddress.MergeFrom(other.MerkleTreeGeneratorContractAddress); - } - if (other.MerkleTreeLeafLimit != 0) { - MerkleTreeLeafLimit = other.MerkleTreeLeafLimit; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (oracleContractAddress_ == null) { - OracleContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(OracleContractAddress); - break; - } - case 18: { - if (merkleTreeRecorderContractAddress_ == null) { - MerkleTreeRecorderContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(MerkleTreeRecorderContractAddress); - break; - } - case 26: { - if (regimentContractAddress_ == null) { - RegimentContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(RegimentContractAddress); - break; - } - case 34: { - if (merkleTreeGeneratorContractAddress_ == null) { - MerkleTreeGeneratorContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(MerkleTreeGeneratorContractAddress); - break; - } - case 40: { - MerkleTreeLeafLimit = input.ReadInt32(); - break; - } - } - } - } - - } - - public sealed partial class CreateSwapInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateSwapInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CreateSwapInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CreateSwapInput(CreateSwapInput other) : this() { - originTokenSizeInByte_ = other.originTokenSizeInByte_; - originTokenNumericBigEndian_ = other.originTokenNumericBigEndian_; - swapTargetTokenList_ = other.swapTargetTokenList_.Clone(); - regimentAddress_ = other.regimentAddress_ != null ? other.regimentAddress_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CreateSwapInput Clone() { - return new CreateSwapInput(this); - } - - /// Field number for the "origin_token_size_in_byte" field. - public const int OriginTokenSizeInByteFieldNumber = 1; - private int originTokenSizeInByte_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int OriginTokenSizeInByte { - get { return originTokenSizeInByte_; } - set { - originTokenSizeInByte_ = value; - } - } - - /// Field number for the "origin_token_numeric_big_endian" field. - public const int OriginTokenNumericBigEndianFieldNumber = 2; - private bool originTokenNumericBigEndian_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool OriginTokenNumericBigEndian { - get { return originTokenNumericBigEndian_; } - set { - originTokenNumericBigEndian_ = value; - } - } - - /// Field number for the "swap_target_token_list" field. - public const int SwapTargetTokenListFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_swapTargetTokenList_codec - = pb::FieldCodec.ForMessage(26, global::AElf.Contracts.Bridge.SwapTargetToken.Parser); - private readonly pbc::RepeatedField swapTargetTokenList_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField SwapTargetTokenList { - get { return swapTargetTokenList_; } - } - - /// Field number for the "regiment_address" field. - public const int RegimentAddressFieldNumber = 4; - private global::AElf.Types.Address regimentAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address RegimentAddress { - get { return regimentAddress_; } - set { - regimentAddress_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as CreateSwapInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(CreateSwapInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (OriginTokenSizeInByte != other.OriginTokenSizeInByte) return false; - if (OriginTokenNumericBigEndian != other.OriginTokenNumericBigEndian) return false; - if(!swapTargetTokenList_.Equals(other.swapTargetTokenList_)) return false; - if (!object.Equals(RegimentAddress, other.RegimentAddress)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (OriginTokenSizeInByte != 0) hash ^= OriginTokenSizeInByte.GetHashCode(); - if (OriginTokenNumericBigEndian != false) hash ^= OriginTokenNumericBigEndian.GetHashCode(); - hash ^= swapTargetTokenList_.GetHashCode(); - if (regimentAddress_ != null) hash ^= RegimentAddress.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (OriginTokenSizeInByte != 0) { - output.WriteRawTag(8); - output.WriteInt32(OriginTokenSizeInByte); - } - if (OriginTokenNumericBigEndian != false) { - output.WriteRawTag(16); - output.WriteBool(OriginTokenNumericBigEndian); - } - swapTargetTokenList_.WriteTo(output, _repeated_swapTargetTokenList_codec); - if (regimentAddress_ != null) { - output.WriteRawTag(34); - output.WriteMessage(RegimentAddress); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (OriginTokenSizeInByte != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(OriginTokenSizeInByte); - } - if (OriginTokenNumericBigEndian != false) { - size += 1 + 1; - } - size += swapTargetTokenList_.CalculateSize(_repeated_swapTargetTokenList_codec); - if (regimentAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegimentAddress); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(CreateSwapInput other) { - if (other == null) { - return; - } - if (other.OriginTokenSizeInByte != 0) { - OriginTokenSizeInByte = other.OriginTokenSizeInByte; - } - if (other.OriginTokenNumericBigEndian != false) { - OriginTokenNumericBigEndian = other.OriginTokenNumericBigEndian; - } - swapTargetTokenList_.Add(other.swapTargetTokenList_); - if (other.regimentAddress_ != null) { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - RegimentAddress.MergeFrom(other.RegimentAddress); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - OriginTokenSizeInByte = input.ReadInt32(); - break; - } - case 16: { - OriginTokenNumericBigEndian = input.ReadBool(); - break; - } - case 26: { - swapTargetTokenList_.AddEntriesFrom(input, _repeated_swapTargetTokenList_codec); - break; - } - case 34: { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(RegimentAddress); - break; - } - } - } - } - - } - - public sealed partial class SwapTargetToken : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SwapTargetToken()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapTargetToken() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapTargetToken(SwapTargetToken other) : this() { - targetTokenSymbol_ = other.targetTokenSymbol_; - swapRatio_ = other.swapRatio_ != null ? other.swapRatio_.Clone() : null; - depositAmount_ = other.depositAmount_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapTargetToken Clone() { - return new SwapTargetToken(this); - } - - /// Field number for the "target_token_symbol" field. - public const int TargetTokenSymbolFieldNumber = 1; - private string targetTokenSymbol_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string TargetTokenSymbol { - get { return targetTokenSymbol_; } - set { - targetTokenSymbol_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "swap_ratio" field. - public const int SwapRatioFieldNumber = 2; - private global::AElf.Contracts.Bridge.SwapRatio swapRatio_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Bridge.SwapRatio SwapRatio { - get { return swapRatio_; } - set { - swapRatio_ = value; - } - } - - /// Field number for the "deposit_amount" field. - public const int DepositAmountFieldNumber = 3; - private long depositAmount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long DepositAmount { - get { return depositAmount_; } - set { - depositAmount_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SwapTargetToken); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SwapTargetToken other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (TargetTokenSymbol != other.TargetTokenSymbol) return false; - if (!object.Equals(SwapRatio, other.SwapRatio)) return false; - if (DepositAmount != other.DepositAmount) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (TargetTokenSymbol.Length != 0) hash ^= TargetTokenSymbol.GetHashCode(); - if (swapRatio_ != null) hash ^= SwapRatio.GetHashCode(); - if (DepositAmount != 0L) hash ^= DepositAmount.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (TargetTokenSymbol.Length != 0) { - output.WriteRawTag(10); - output.WriteString(TargetTokenSymbol); - } - if (swapRatio_ != null) { - output.WriteRawTag(18); - output.WriteMessage(SwapRatio); - } - if (DepositAmount != 0L) { - output.WriteRawTag(24); - output.WriteInt64(DepositAmount); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (TargetTokenSymbol.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(TargetTokenSymbol); - } - if (swapRatio_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SwapRatio); - } - if (DepositAmount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(DepositAmount); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SwapTargetToken other) { - if (other == null) { - return; - } - if (other.TargetTokenSymbol.Length != 0) { - TargetTokenSymbol = other.TargetTokenSymbol; - } - if (other.swapRatio_ != null) { - if (swapRatio_ == null) { - SwapRatio = new global::AElf.Contracts.Bridge.SwapRatio(); - } - SwapRatio.MergeFrom(other.SwapRatio); - } - if (other.DepositAmount != 0L) { - DepositAmount = other.DepositAmount; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - TargetTokenSymbol = input.ReadString(); - break; - } - case 18: { - if (swapRatio_ == null) { - SwapRatio = new global::AElf.Contracts.Bridge.SwapRatio(); - } - input.ReadMessage(SwapRatio); - break; - } - case 24: { - DepositAmount = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class SwapInfo : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SwapInfo()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapInfo() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapInfo(SwapInfo other) : this() { - swapId_ = other.swapId_ != null ? other.swapId_.Clone() : null; - originTokenSizeInByte_ = other.originTokenSizeInByte_; - originTokenNumericBigEndian_ = other.originTokenNumericBigEndian_; - swapTargetTokenMap_ = other.swapTargetTokenMap_.Clone(); - regimentAddress_ = other.regimentAddress_ != null ? other.regimentAddress_.Clone() : null; - recorderId_ = other.recorderId_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapInfo Clone() { - return new SwapInfo(this); - } - - /// Field number for the "swap_id" field. - public const int SwapIdFieldNumber = 1; - private global::AElf.Types.Hash swapId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash SwapId { - get { return swapId_; } - set { - swapId_ = value; - } - } - - /// Field number for the "origin_token_size_in_byte" field. - public const int OriginTokenSizeInByteFieldNumber = 2; - private int originTokenSizeInByte_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int OriginTokenSizeInByte { - get { return originTokenSizeInByte_; } - set { - originTokenSizeInByte_ = value; - } - } - - /// Field number for the "origin_token_numeric_big_endian" field. - public const int OriginTokenNumericBigEndianFieldNumber = 3; - private bool originTokenNumericBigEndian_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool OriginTokenNumericBigEndian { - get { return originTokenNumericBigEndian_; } - set { - originTokenNumericBigEndian_ = value; - } - } - - /// Field number for the "swap_target_token_map" field. - public const int SwapTargetTokenMapFieldNumber = 4; - private static readonly pbc::MapField.Codec _map_swapTargetTokenMap_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::AElf.Types.Hash.Parser), 34); - private readonly pbc::MapField swapTargetTokenMap_ = new pbc::MapField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField SwapTargetTokenMap { - get { return swapTargetTokenMap_; } - } - - /// Field number for the "regiment_address" field. - public const int RegimentAddressFieldNumber = 5; - private global::AElf.Types.Address regimentAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address RegimentAddress { - get { return regimentAddress_; } - set { - regimentAddress_ = value; - } - } - - /// Field number for the "recorder_id" field. - public const int RecorderIdFieldNumber = 6; - private long recorderId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RecorderId { - get { return recorderId_; } - set { - recorderId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SwapInfo); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SwapInfo other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(SwapId, other.SwapId)) return false; - if (OriginTokenSizeInByte != other.OriginTokenSizeInByte) return false; - if (OriginTokenNumericBigEndian != other.OriginTokenNumericBigEndian) return false; - if (!SwapTargetTokenMap.Equals(other.SwapTargetTokenMap)) return false; - if (!object.Equals(RegimentAddress, other.RegimentAddress)) return false; - if (RecorderId != other.RecorderId) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (swapId_ != null) hash ^= SwapId.GetHashCode(); - if (OriginTokenSizeInByte != 0) hash ^= OriginTokenSizeInByte.GetHashCode(); - if (OriginTokenNumericBigEndian != false) hash ^= OriginTokenNumericBigEndian.GetHashCode(); - hash ^= SwapTargetTokenMap.GetHashCode(); - if (regimentAddress_ != null) hash ^= RegimentAddress.GetHashCode(); - if (RecorderId != 0L) hash ^= RecorderId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (swapId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(SwapId); - } - if (OriginTokenSizeInByte != 0) { - output.WriteRawTag(16); - output.WriteInt32(OriginTokenSizeInByte); - } - if (OriginTokenNumericBigEndian != false) { - output.WriteRawTag(24); - output.WriteBool(OriginTokenNumericBigEndian); - } - swapTargetTokenMap_.WriteTo(output, _map_swapTargetTokenMap_codec); - if (regimentAddress_ != null) { - output.WriteRawTag(42); - output.WriteMessage(RegimentAddress); - } - if (RecorderId != 0L) { - output.WriteRawTag(48); - output.WriteInt64(RecorderId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (swapId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SwapId); - } - if (OriginTokenSizeInByte != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(OriginTokenSizeInByte); - } - if (OriginTokenNumericBigEndian != false) { - size += 1 + 1; - } - size += swapTargetTokenMap_.CalculateSize(_map_swapTargetTokenMap_codec); - if (regimentAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegimentAddress); - } - if (RecorderId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RecorderId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SwapInfo other) { - if (other == null) { - return; - } - if (other.swapId_ != null) { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - SwapId.MergeFrom(other.SwapId); - } - if (other.OriginTokenSizeInByte != 0) { - OriginTokenSizeInByte = other.OriginTokenSizeInByte; - } - if (other.OriginTokenNumericBigEndian != false) { - OriginTokenNumericBigEndian = other.OriginTokenNumericBigEndian; - } - swapTargetTokenMap_.Add(other.swapTargetTokenMap_); - if (other.regimentAddress_ != null) { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - RegimentAddress.MergeFrom(other.RegimentAddress); - } - if (other.RecorderId != 0L) { - RecorderId = other.RecorderId; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - input.ReadMessage(SwapId); - break; - } - case 16: { - OriginTokenSizeInByte = input.ReadInt32(); - break; - } - case 24: { - OriginTokenNumericBigEndian = input.ReadBool(); - break; - } - case 34: { - swapTargetTokenMap_.AddEntriesFrom(input, _map_swapTargetTokenMap_codec); - break; - } - case 42: { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(RegimentAddress); - break; - } - case 48: { - RecorderId = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class SwapPair : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SwapPair()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.MessageTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapPair() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapPair(SwapPair other) : this() { - swapId_ = other.swapId_ != null ? other.swapId_.Clone() : null; - originTokenSizeInByte_ = other.originTokenSizeInByte_; - originTokenNumericBigEndian_ = other.originTokenNumericBigEndian_; - targetTokenSymbol_ = other.targetTokenSymbol_; - swapRatio_ = other.swapRatio_ != null ? other.swapRatio_.Clone() : null; - swappedAmount_ = other.swappedAmount_; - swappedTimes_ = other.swappedTimes_; - depositAmount_ = other.depositAmount_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapPair Clone() { - return new SwapPair(this); - } - - /// Field number for the "swap_id" field. - public const int SwapIdFieldNumber = 1; - private global::AElf.Types.Hash swapId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash SwapId { - get { return swapId_; } - set { - swapId_ = value; - } - } - - /// Field number for the "origin_token_size_in_byte" field. - public const int OriginTokenSizeInByteFieldNumber = 2; - private int originTokenSizeInByte_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int OriginTokenSizeInByte { - get { return originTokenSizeInByte_; } - set { - originTokenSizeInByte_ = value; - } - } - - /// Field number for the "origin_token_numeric_big_endian" field. - public const int OriginTokenNumericBigEndianFieldNumber = 3; - private bool originTokenNumericBigEndian_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool OriginTokenNumericBigEndian { - get { return originTokenNumericBigEndian_; } - set { - originTokenNumericBigEndian_ = value; - } - } - - /// Field number for the "target_token_symbol" field. - public const int TargetTokenSymbolFieldNumber = 4; - private string targetTokenSymbol_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string TargetTokenSymbol { - get { return targetTokenSymbol_; } - set { - targetTokenSymbol_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "swap_ratio" field. - public const int SwapRatioFieldNumber = 5; - private global::AElf.Contracts.Bridge.SwapRatio swapRatio_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Bridge.SwapRatio SwapRatio { - get { return swapRatio_; } - set { - swapRatio_ = value; - } - } - - /// Field number for the "swapped_amount" field. - public const int SwappedAmountFieldNumber = 6; - private long swappedAmount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long SwappedAmount { - get { return swappedAmount_; } - set { - swappedAmount_ = value; - } - } - - /// Field number for the "swapped_times" field. - public const int SwappedTimesFieldNumber = 7; - private long swappedTimes_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long SwappedTimes { - get { return swappedTimes_; } - set { - swappedTimes_ = value; - } - } - - /// Field number for the "deposit_amount" field. - public const int DepositAmountFieldNumber = 8; - private long depositAmount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long DepositAmount { - get { return depositAmount_; } - set { - depositAmount_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SwapPair); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SwapPair other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(SwapId, other.SwapId)) return false; - if (OriginTokenSizeInByte != other.OriginTokenSizeInByte) return false; - if (OriginTokenNumericBigEndian != other.OriginTokenNumericBigEndian) return false; - if (TargetTokenSymbol != other.TargetTokenSymbol) return false; - if (!object.Equals(SwapRatio, other.SwapRatio)) return false; - if (SwappedAmount != other.SwappedAmount) return false; - if (SwappedTimes != other.SwappedTimes) return false; - if (DepositAmount != other.DepositAmount) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (swapId_ != null) hash ^= SwapId.GetHashCode(); - if (OriginTokenSizeInByte != 0) hash ^= OriginTokenSizeInByte.GetHashCode(); - if (OriginTokenNumericBigEndian != false) hash ^= OriginTokenNumericBigEndian.GetHashCode(); - if (TargetTokenSymbol.Length != 0) hash ^= TargetTokenSymbol.GetHashCode(); - if (swapRatio_ != null) hash ^= SwapRatio.GetHashCode(); - if (SwappedAmount != 0L) hash ^= SwappedAmount.GetHashCode(); - if (SwappedTimes != 0L) hash ^= SwappedTimes.GetHashCode(); - if (DepositAmount != 0L) hash ^= DepositAmount.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (swapId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(SwapId); - } - if (OriginTokenSizeInByte != 0) { - output.WriteRawTag(16); - output.WriteInt32(OriginTokenSizeInByte); - } - if (OriginTokenNumericBigEndian != false) { - output.WriteRawTag(24); - output.WriteBool(OriginTokenNumericBigEndian); - } - if (TargetTokenSymbol.Length != 0) { - output.WriteRawTag(34); - output.WriteString(TargetTokenSymbol); - } - if (swapRatio_ != null) { - output.WriteRawTag(42); - output.WriteMessage(SwapRatio); - } - if (SwappedAmount != 0L) { - output.WriteRawTag(48); - output.WriteInt64(SwappedAmount); - } - if (SwappedTimes != 0L) { - output.WriteRawTag(56); - output.WriteInt64(SwappedTimes); - } - if (DepositAmount != 0L) { - output.WriteRawTag(64); - output.WriteInt64(DepositAmount); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (swapId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SwapId); - } - if (OriginTokenSizeInByte != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(OriginTokenSizeInByte); - } - if (OriginTokenNumericBigEndian != false) { - size += 1 + 1; - } - if (TargetTokenSymbol.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(TargetTokenSymbol); - } - if (swapRatio_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SwapRatio); - } - if (SwappedAmount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(SwappedAmount); - } - if (SwappedTimes != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(SwappedTimes); - } - if (DepositAmount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(DepositAmount); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SwapPair other) { - if (other == null) { - return; - } - if (other.swapId_ != null) { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - SwapId.MergeFrom(other.SwapId); - } - if (other.OriginTokenSizeInByte != 0) { - OriginTokenSizeInByte = other.OriginTokenSizeInByte; - } - if (other.OriginTokenNumericBigEndian != false) { - OriginTokenNumericBigEndian = other.OriginTokenNumericBigEndian; - } - if (other.TargetTokenSymbol.Length != 0) { - TargetTokenSymbol = other.TargetTokenSymbol; - } - if (other.swapRatio_ != null) { - if (swapRatio_ == null) { - SwapRatio = new global::AElf.Contracts.Bridge.SwapRatio(); - } - SwapRatio.MergeFrom(other.SwapRatio); - } - if (other.SwappedAmount != 0L) { - SwappedAmount = other.SwappedAmount; - } - if (other.SwappedTimes != 0L) { - SwappedTimes = other.SwappedTimes; - } - if (other.DepositAmount != 0L) { - DepositAmount = other.DepositAmount; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - input.ReadMessage(SwapId); - break; - } - case 16: { - OriginTokenSizeInByte = input.ReadInt32(); - break; - } - case 24: { - OriginTokenNumericBigEndian = input.ReadBool(); - break; - } - case 34: { - TargetTokenSymbol = input.ReadString(); - break; - } - case 42: { - if (swapRatio_ == null) { - SwapRatio = new global::AElf.Contracts.Bridge.SwapRatio(); - } - input.ReadMessage(SwapRatio); - break; - } - case 48: { - SwappedAmount = input.ReadInt64(); - break; - } - case 56: { - SwappedTimes = input.ReadInt64(); - break; - } - case 64: { - DepositAmount = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class SwapRatio : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SwapRatio()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.MessageTypes[5]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapRatio() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapRatio(SwapRatio other) : this() { - originShare_ = other.originShare_; - targetShare_ = other.targetShare_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapRatio Clone() { - return new SwapRatio(this); - } - - /// Field number for the "origin_share" field. - public const int OriginShareFieldNumber = 1; - private long originShare_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long OriginShare { - get { return originShare_; } - set { - originShare_ = value; - } - } - - /// Field number for the "target_share" field. - public const int TargetShareFieldNumber = 2; - private long targetShare_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long TargetShare { - get { return targetShare_; } - set { - targetShare_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SwapRatio); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SwapRatio other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (OriginShare != other.OriginShare) return false; - if (TargetShare != other.TargetShare) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (OriginShare != 0L) hash ^= OriginShare.GetHashCode(); - if (TargetShare != 0L) hash ^= TargetShare.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (OriginShare != 0L) { - output.WriteRawTag(8); - output.WriteInt64(OriginShare); - } - if (TargetShare != 0L) { - output.WriteRawTag(16); - output.WriteInt64(TargetShare); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (OriginShare != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(OriginShare); - } - if (TargetShare != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(TargetShare); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SwapRatio other) { - if (other == null) { - return; - } - if (other.OriginShare != 0L) { - OriginShare = other.OriginShare; - } - if (other.TargetShare != 0L) { - TargetShare = other.TargetShare; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - OriginShare = input.ReadInt64(); - break; - } - case 16: { - TargetShare = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class ChangeSwapRatioInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ChangeSwapRatioInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.MessageTypes[6]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ChangeSwapRatioInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ChangeSwapRatioInput(ChangeSwapRatioInput other) : this() { - swapId_ = other.swapId_ != null ? other.swapId_.Clone() : null; - swapRatio_ = other.swapRatio_ != null ? other.swapRatio_.Clone() : null; - targetTokenSymbol_ = other.targetTokenSymbol_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ChangeSwapRatioInput Clone() { - return new ChangeSwapRatioInput(this); - } - - /// Field number for the "swap_id" field. - public const int SwapIdFieldNumber = 1; - private global::AElf.Types.Hash swapId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash SwapId { - get { return swapId_; } - set { - swapId_ = value; - } - } - - /// Field number for the "swap_ratio" field. - public const int SwapRatioFieldNumber = 2; - private global::AElf.Contracts.Bridge.SwapRatio swapRatio_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Bridge.SwapRatio SwapRatio { - get { return swapRatio_; } - set { - swapRatio_ = value; - } - } - - /// Field number for the "target_token_symbol" field. - public const int TargetTokenSymbolFieldNumber = 3; - private string targetTokenSymbol_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string TargetTokenSymbol { - get { return targetTokenSymbol_; } - set { - targetTokenSymbol_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ChangeSwapRatioInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ChangeSwapRatioInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(SwapId, other.SwapId)) return false; - if (!object.Equals(SwapRatio, other.SwapRatio)) return false; - if (TargetTokenSymbol != other.TargetTokenSymbol) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (swapId_ != null) hash ^= SwapId.GetHashCode(); - if (swapRatio_ != null) hash ^= SwapRatio.GetHashCode(); - if (TargetTokenSymbol.Length != 0) hash ^= TargetTokenSymbol.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (swapId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(SwapId); - } - if (swapRatio_ != null) { - output.WriteRawTag(18); - output.WriteMessage(SwapRatio); - } - if (TargetTokenSymbol.Length != 0) { - output.WriteRawTag(26); - output.WriteString(TargetTokenSymbol); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (swapId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SwapId); - } - if (swapRatio_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SwapRatio); - } - if (TargetTokenSymbol.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(TargetTokenSymbol); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ChangeSwapRatioInput other) { - if (other == null) { - return; - } - if (other.swapId_ != null) { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - SwapId.MergeFrom(other.SwapId); - } - if (other.swapRatio_ != null) { - if (swapRatio_ == null) { - SwapRatio = new global::AElf.Contracts.Bridge.SwapRatio(); - } - SwapRatio.MergeFrom(other.SwapRatio); - } - if (other.TargetTokenSymbol.Length != 0) { - TargetTokenSymbol = other.TargetTokenSymbol; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - input.ReadMessage(SwapId); - break; - } - case 18: { - if (swapRatio_ == null) { - SwapRatio = new global::AElf.Contracts.Bridge.SwapRatio(); - } - input.ReadMessage(SwapRatio); - break; - } - case 26: { - TargetTokenSymbol = input.ReadString(); - break; - } - } - } - } - - } - - public sealed partial class SwapTokenInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SwapTokenInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.MessageTypes[7]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapTokenInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapTokenInput(SwapTokenInput other) : this() { - swapId_ = other.swapId_ != null ? other.swapId_.Clone() : null; - receiptId_ = other.receiptId_; - originAmount_ = other.originAmount_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapTokenInput Clone() { - return new SwapTokenInput(this); - } - - /// Field number for the "swap_id" field. - public const int SwapIdFieldNumber = 1; - private global::AElf.Types.Hash swapId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash SwapId { - get { return swapId_; } - set { - swapId_ = value; - } - } - - /// Field number for the "receipt_id" field. - public const int ReceiptIdFieldNumber = 2; - private long receiptId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ReceiptId { - get { return receiptId_; } - set { - receiptId_ = value; - } - } - - /// Field number for the "origin_amount" field. - public const int OriginAmountFieldNumber = 3; - private string originAmount_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string OriginAmount { - get { return originAmount_; } - set { - originAmount_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SwapTokenInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SwapTokenInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(SwapId, other.SwapId)) return false; - if (ReceiptId != other.ReceiptId) return false; - if (OriginAmount != other.OriginAmount) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (swapId_ != null) hash ^= SwapId.GetHashCode(); - if (ReceiptId != 0L) hash ^= ReceiptId.GetHashCode(); - if (OriginAmount.Length != 0) hash ^= OriginAmount.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (swapId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(SwapId); - } - if (ReceiptId != 0L) { - output.WriteRawTag(16); - output.WriteInt64(ReceiptId); - } - if (OriginAmount.Length != 0) { - output.WriteRawTag(26); - output.WriteString(OriginAmount); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (swapId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SwapId); - } - if (ReceiptId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(ReceiptId); - } - if (OriginAmount.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(OriginAmount); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SwapTokenInput other) { - if (other == null) { - return; - } - if (other.swapId_ != null) { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - SwapId.MergeFrom(other.SwapId); - } - if (other.ReceiptId != 0L) { - ReceiptId = other.ReceiptId; - } - if (other.OriginAmount.Length != 0) { - OriginAmount = other.OriginAmount; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - input.ReadMessage(SwapId); - break; - } - case 16: { - ReceiptId = input.ReadInt64(); - break; - } - case 26: { - OriginAmount = input.ReadString(); - break; - } - } - } - } - - } - - public sealed partial class DepositInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DepositInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.MessageTypes[8]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DepositInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DepositInput(DepositInput other) : this() { - swapId_ = other.swapId_ != null ? other.swapId_.Clone() : null; - targetTokenSymbol_ = other.targetTokenSymbol_; - amount_ = other.amount_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DepositInput Clone() { - return new DepositInput(this); - } - - /// Field number for the "swap_id" field. - public const int SwapIdFieldNumber = 1; - private global::AElf.Types.Hash swapId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash SwapId { - get { return swapId_; } - set { - swapId_ = value; - } - } - - /// Field number for the "target_token_symbol" field. - public const int TargetTokenSymbolFieldNumber = 2; - private string targetTokenSymbol_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string TargetTokenSymbol { - get { return targetTokenSymbol_; } - set { - targetTokenSymbol_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "amount" field. - public const int AmountFieldNumber = 3; - private long amount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Amount { - get { return amount_; } - set { - amount_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as DepositInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DepositInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(SwapId, other.SwapId)) return false; - if (TargetTokenSymbol != other.TargetTokenSymbol) return false; - if (Amount != other.Amount) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (swapId_ != null) hash ^= SwapId.GetHashCode(); - if (TargetTokenSymbol.Length != 0) hash ^= TargetTokenSymbol.GetHashCode(); - if (Amount != 0L) hash ^= Amount.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (swapId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(SwapId); - } - if (TargetTokenSymbol.Length != 0) { - output.WriteRawTag(18); - output.WriteString(TargetTokenSymbol); - } - if (Amount != 0L) { - output.WriteRawTag(24); - output.WriteInt64(Amount); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (swapId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SwapId); - } - if (TargetTokenSymbol.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(TargetTokenSymbol); - } - if (Amount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Amount); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DepositInput other) { - if (other == null) { - return; - } - if (other.swapId_ != null) { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - SwapId.MergeFrom(other.SwapId); - } - if (other.TargetTokenSymbol.Length != 0) { - TargetTokenSymbol = other.TargetTokenSymbol; - } - if (other.Amount != 0L) { - Amount = other.Amount; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - input.ReadMessage(SwapId); - break; - } - case 18: { - TargetTokenSymbol = input.ReadString(); - break; - } - case 24: { - Amount = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class GetSwapPairInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetSwapPairInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.MessageTypes[9]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetSwapPairInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetSwapPairInput(GetSwapPairInput other) : this() { - swapId_ = other.swapId_ != null ? other.swapId_.Clone() : null; - targetTokenSymbol_ = other.targetTokenSymbol_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetSwapPairInput Clone() { - return new GetSwapPairInput(this); - } - - /// Field number for the "swap_id" field. - public const int SwapIdFieldNumber = 1; - private global::AElf.Types.Hash swapId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash SwapId { - get { return swapId_; } - set { - swapId_ = value; - } - } - - /// Field number for the "target_token_symbol" field. - public const int TargetTokenSymbolFieldNumber = 2; - private string targetTokenSymbol_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string TargetTokenSymbol { - get { return targetTokenSymbol_; } - set { - targetTokenSymbol_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GetSwapPairInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GetSwapPairInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(SwapId, other.SwapId)) return false; - if (TargetTokenSymbol != other.TargetTokenSymbol) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (swapId_ != null) hash ^= SwapId.GetHashCode(); - if (TargetTokenSymbol.Length != 0) hash ^= TargetTokenSymbol.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (swapId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(SwapId); - } - if (TargetTokenSymbol.Length != 0) { - output.WriteRawTag(18); - output.WriteString(TargetTokenSymbol); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (swapId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SwapId); - } - if (TargetTokenSymbol.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(TargetTokenSymbol); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GetSwapPairInput other) { - if (other == null) { - return; - } - if (other.swapId_ != null) { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - SwapId.MergeFrom(other.SwapId); - } - if (other.TargetTokenSymbol.Length != 0) { - TargetTokenSymbol = other.TargetTokenSymbol; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - input.ReadMessage(SwapId); - break; - } - case 18: { - TargetTokenSymbol = input.ReadString(); - break; - } - } - } - } - - } - - public sealed partial class GetSwapAmountsInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetSwapAmountsInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.MessageTypes[10]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetSwapAmountsInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetSwapAmountsInput(GetSwapAmountsInput other) : this() { - swapId_ = other.swapId_ != null ? other.swapId_.Clone() : null; - receiptId_ = other.receiptId_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetSwapAmountsInput Clone() { - return new GetSwapAmountsInput(this); - } - - /// Field number for the "swap_id" field. - public const int SwapIdFieldNumber = 1; - private global::AElf.Types.Hash swapId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash SwapId { - get { return swapId_; } - set { - swapId_ = value; - } - } - - /// Field number for the "receipt_id" field. - public const int ReceiptIdFieldNumber = 2; - private long receiptId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ReceiptId { - get { return receiptId_; } - set { - receiptId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GetSwapAmountsInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GetSwapAmountsInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(SwapId, other.SwapId)) return false; - if (ReceiptId != other.ReceiptId) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (swapId_ != null) hash ^= SwapId.GetHashCode(); - if (ReceiptId != 0L) hash ^= ReceiptId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (swapId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(SwapId); - } - if (ReceiptId != 0L) { - output.WriteRawTag(16); - output.WriteInt64(ReceiptId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (swapId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SwapId); - } - if (ReceiptId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(ReceiptId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GetSwapAmountsInput other) { - if (other == null) { - return; - } - if (other.swapId_ != null) { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - SwapId.MergeFrom(other.SwapId); - } - if (other.ReceiptId != 0L) { - ReceiptId = other.ReceiptId; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - input.ReadMessage(SwapId); - break; - } - case 16: { - ReceiptId = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class SwapAmounts : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SwapAmounts()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.MessageTypes[11]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapAmounts() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapAmounts(SwapAmounts other) : this() { - receiver_ = other.receiver_ != null ? other.receiver_.Clone() : null; - receivedAmounts_ = other.receivedAmounts_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapAmounts Clone() { - return new SwapAmounts(this); - } - - /// Field number for the "receiver" field. - public const int ReceiverFieldNumber = 1; - private global::AElf.Types.Address receiver_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Receiver { - get { return receiver_; } - set { - receiver_ = value; - } - } - - /// Field number for the "received_amounts" field. - public const int ReceivedAmountsFieldNumber = 2; - private static readonly pbc::MapField.Codec _map_receivedAmounts_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForInt64(16, 0L), 18); - private readonly pbc::MapField receivedAmounts_ = new pbc::MapField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField ReceivedAmounts { - get { return receivedAmounts_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SwapAmounts); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SwapAmounts other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Receiver, other.Receiver)) return false; - if (!ReceivedAmounts.Equals(other.ReceivedAmounts)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (receiver_ != null) hash ^= Receiver.GetHashCode(); - hash ^= ReceivedAmounts.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (receiver_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Receiver); - } - receivedAmounts_.WriteTo(output, _map_receivedAmounts_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (receiver_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Receiver); - } - size += receivedAmounts_.CalculateSize(_map_receivedAmounts_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SwapAmounts other) { - if (other == null) { - return; - } - if (other.receiver_ != null) { - if (receiver_ == null) { - Receiver = new global::AElf.Types.Address(); - } - Receiver.MergeFrom(other.Receiver); - } - receivedAmounts_.Add(other.receivedAmounts_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (receiver_ == null) { - Receiver = new global::AElf.Types.Address(); - } - input.ReadMessage(Receiver); - break; - } - case 18: { - receivedAmounts_.AddEntriesFrom(input, _map_receivedAmounts_codec); - break; - } - } - } - } - - } - - public sealed partial class WithdrawInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new WithdrawInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.MessageTypes[12]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WithdrawInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WithdrawInput(WithdrawInput other) : this() { - swapId_ = other.swapId_ != null ? other.swapId_.Clone() : null; - targetTokenSymbol_ = other.targetTokenSymbol_; - amount_ = other.amount_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public WithdrawInput Clone() { - return new WithdrawInput(this); - } - - /// Field number for the "swap_id" field. - public const int SwapIdFieldNumber = 1; - private global::AElf.Types.Hash swapId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash SwapId { - get { return swapId_; } - set { - swapId_ = value; - } - } - - /// Field number for the "target_token_symbol" field. - public const int TargetTokenSymbolFieldNumber = 2; - private string targetTokenSymbol_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string TargetTokenSymbol { - get { return targetTokenSymbol_; } - set { - targetTokenSymbol_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "amount" field. - public const int AmountFieldNumber = 3; - private long amount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Amount { - get { return amount_; } - set { - amount_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as WithdrawInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(WithdrawInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(SwapId, other.SwapId)) return false; - if (TargetTokenSymbol != other.TargetTokenSymbol) return false; - if (Amount != other.Amount) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (swapId_ != null) hash ^= SwapId.GetHashCode(); - if (TargetTokenSymbol.Length != 0) hash ^= TargetTokenSymbol.GetHashCode(); - if (Amount != 0L) hash ^= Amount.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (swapId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(SwapId); - } - if (TargetTokenSymbol.Length != 0) { - output.WriteRawTag(18); - output.WriteString(TargetTokenSymbol); - } - if (Amount != 0L) { - output.WriteRawTag(24); - output.WriteInt64(Amount); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (swapId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SwapId); - } - if (TargetTokenSymbol.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(TargetTokenSymbol); - } - if (Amount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Amount); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(WithdrawInput other) { - if (other == null) { - return; - } - if (other.swapId_ != null) { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - SwapId.MergeFrom(other.SwapId); - } - if (other.TargetTokenSymbol.Length != 0) { - TargetTokenSymbol = other.TargetTokenSymbol; - } - if (other.Amount != 0L) { - Amount = other.Amount; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - input.ReadMessage(SwapId); - break; - } - case 18: { - TargetTokenSymbol = input.ReadString(); - break; - } - case 24: { - Amount = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class ReceiptHashMap : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReceiptHashMap()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.MessageTypes[13]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReceiptHashMap() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReceiptHashMap(ReceiptHashMap other) : this() { - value_ = other.value_.Clone(); - recorderId_ = other.recorderId_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReceiptHashMap Clone() { - return new ReceiptHashMap(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private static readonly pbc::MapField.Codec _map_value_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt64(8, 0L), pb::FieldCodec.ForString(18, ""), 10); - private readonly pbc::MapField value_ = new pbc::MapField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField Value { - get { return value_; } - } - - /// Field number for the "recorder_id" field. - public const int RecorderIdFieldNumber = 2; - private long recorderId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RecorderId { - get { return recorderId_; } - set { - recorderId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ReceiptHashMap); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ReceiptHashMap other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!Value.Equals(other.Value)) return false; - if (RecorderId != other.RecorderId) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= Value.GetHashCode(); - if (RecorderId != 0L) hash ^= RecorderId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - value_.WriteTo(output, _map_value_codec); - if (RecorderId != 0L) { - output.WriteRawTag(16); - output.WriteInt64(RecorderId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += value_.CalculateSize(_map_value_codec); - if (RecorderId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RecorderId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ReceiptHashMap other) { - if (other == null) { - return; - } - value_.Add(other.value_); - if (other.RecorderId != 0L) { - RecorderId = other.RecorderId; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - value_.AddEntriesFrom(input, _map_value_codec); - break; - } - case 16: { - RecorderId = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class UpdateMerkleTreeInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UpdateMerkleTreeInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.MessageTypes[14]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UpdateMerkleTreeInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UpdateMerkleTreeInput(UpdateMerkleTreeInput other) : this() { - recorderId_ = other.recorderId_; - regimentAddress_ = other.regimentAddress_ != null ? other.regimentAddress_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UpdateMerkleTreeInput Clone() { - return new UpdateMerkleTreeInput(this); - } - - /// Field number for the "recorder_id" field. - public const int RecorderIdFieldNumber = 1; - private long recorderId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RecorderId { - get { return recorderId_; } - set { - recorderId_ = value; - } - } - - /// Field number for the "regiment_address" field. - public const int RegimentAddressFieldNumber = 2; - private global::AElf.Types.Address regimentAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address RegimentAddress { - get { return regimentAddress_; } - set { - regimentAddress_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as UpdateMerkleTreeInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(UpdateMerkleTreeInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (RecorderId != other.RecorderId) return false; - if (!object.Equals(RegimentAddress, other.RegimentAddress)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (RecorderId != 0L) hash ^= RecorderId.GetHashCode(); - if (regimentAddress_ != null) hash ^= RegimentAddress.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (RecorderId != 0L) { - output.WriteRawTag(8); - output.WriteInt64(RecorderId); - } - if (regimentAddress_ != null) { - output.WriteRawTag(18); - output.WriteMessage(RegimentAddress); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (RecorderId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RecorderId); - } - if (regimentAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegimentAddress); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(UpdateMerkleTreeInput other) { - if (other == null) { - return; - } - if (other.RecorderId != 0L) { - RecorderId = other.RecorderId; - } - if (other.regimentAddress_ != null) { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - RegimentAddress.MergeFrom(other.RegimentAddress); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - RecorderId = input.ReadInt64(); - break; - } - case 18: { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(RegimentAddress); - break; - } - } - } - } - - } - - public sealed partial class SwapRatioChanged : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SwapRatioChanged()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.MessageTypes[15]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapRatioChanged() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapRatioChanged(SwapRatioChanged other) : this() { - swapId_ = other.swapId_ != null ? other.swapId_.Clone() : null; - newSwapRatio_ = other.newSwapRatio_ != null ? other.newSwapRatio_.Clone() : null; - targetTokenSymbol_ = other.targetTokenSymbol_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapRatioChanged Clone() { - return new SwapRatioChanged(this); - } - - /// Field number for the "swap_id" field. - public const int SwapIdFieldNumber = 1; - private global::AElf.Types.Hash swapId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash SwapId { - get { return swapId_; } - set { - swapId_ = value; - } - } - - /// Field number for the "new_swap_ratio" field. - public const int NewSwapRatioFieldNumber = 2; - private global::AElf.Contracts.Bridge.SwapRatio newSwapRatio_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Bridge.SwapRatio NewSwapRatio { - get { return newSwapRatio_; } - set { - newSwapRatio_ = value; - } - } - - /// Field number for the "target_token_symbol" field. - public const int TargetTokenSymbolFieldNumber = 3; - private string targetTokenSymbol_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string TargetTokenSymbol { - get { return targetTokenSymbol_; } - set { - targetTokenSymbol_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SwapRatioChanged); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SwapRatioChanged other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(SwapId, other.SwapId)) return false; - if (!object.Equals(NewSwapRatio, other.NewSwapRatio)) return false; - if (TargetTokenSymbol != other.TargetTokenSymbol) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (swapId_ != null) hash ^= SwapId.GetHashCode(); - if (newSwapRatio_ != null) hash ^= NewSwapRatio.GetHashCode(); - if (TargetTokenSymbol.Length != 0) hash ^= TargetTokenSymbol.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (swapId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(SwapId); - } - if (newSwapRatio_ != null) { - output.WriteRawTag(18); - output.WriteMessage(NewSwapRatio); - } - if (TargetTokenSymbol.Length != 0) { - output.WriteRawTag(26); - output.WriteString(TargetTokenSymbol); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (swapId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SwapId); - } - if (newSwapRatio_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(NewSwapRatio); - } - if (TargetTokenSymbol.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(TargetTokenSymbol); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SwapRatioChanged other) { - if (other == null) { - return; - } - if (other.swapId_ != null) { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - SwapId.MergeFrom(other.SwapId); - } - if (other.newSwapRatio_ != null) { - if (newSwapRatio_ == null) { - NewSwapRatio = new global::AElf.Contracts.Bridge.SwapRatio(); - } - NewSwapRatio.MergeFrom(other.NewSwapRatio); - } - if (other.TargetTokenSymbol.Length != 0) { - TargetTokenSymbol = other.TargetTokenSymbol; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - input.ReadMessage(SwapId); - break; - } - case 18: { - if (newSwapRatio_ == null) { - NewSwapRatio = new global::AElf.Contracts.Bridge.SwapRatio(); - } - input.ReadMessage(NewSwapRatio); - break; - } - case 26: { - TargetTokenSymbol = input.ReadString(); - break; - } - } - } - } - - } - - public sealed partial class TokenSwapped : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TokenSwapped()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.MessageTypes[16]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TokenSwapped() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TokenSwapped(TokenSwapped other) : this() { - address_ = other.address_ != null ? other.address_.Clone() : null; - amount_ = other.amount_; - symbol_ = other.symbol_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TokenSwapped Clone() { - return new TokenSwapped(this); - } - - /// Field number for the "address" field. - public const int AddressFieldNumber = 1; - private global::AElf.Types.Address address_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Address { - get { return address_; } - set { - address_ = value; - } - } - - /// Field number for the "amount" field. - public const int AmountFieldNumber = 2; - private long amount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Amount { - get { return amount_; } - set { - amount_ = value; - } - } - - /// Field number for the "symbol" field. - public const int SymbolFieldNumber = 3; - private string symbol_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Symbol { - get { return symbol_; } - set { - symbol_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TokenSwapped); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TokenSwapped other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Address, other.Address)) return false; - if (Amount != other.Amount) return false; - if (Symbol != other.Symbol) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (address_ != null) hash ^= Address.GetHashCode(); - if (Amount != 0L) hash ^= Amount.GetHashCode(); - if (Symbol.Length != 0) hash ^= Symbol.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (address_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Address); - } - if (Amount != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Amount); - } - if (Symbol.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Symbol); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (address_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Address); - } - if (Amount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Amount); - } - if (Symbol.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Symbol); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TokenSwapped other) { - if (other == null) { - return; - } - if (other.address_ != null) { - if (address_ == null) { - Address = new global::AElf.Types.Address(); - } - Address.MergeFrom(other.Address); - } - if (other.Amount != 0L) { - Amount = other.Amount; - } - if (other.Symbol.Length != 0) { - Symbol = other.Symbol; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (address_ == null) { - Address = new global::AElf.Types.Address(); - } - input.ReadMessage(Address); - break; - } - case 16: { - Amount = input.ReadInt64(); - break; - } - case 26: { - Symbol = input.ReadString(); - break; - } - } - } - } - - } - - public sealed partial class SwapPairAdded : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SwapPairAdded()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Bridge.BridgeContractReflection.Descriptor.MessageTypes[17]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapPairAdded() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapPairAdded(SwapPairAdded other) : this() { - swapId_ = other.swapId_ != null ? other.swapId_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SwapPairAdded Clone() { - return new SwapPairAdded(this); - } - - /// Field number for the "swap_id" field. - public const int SwapIdFieldNumber = 1; - private global::AElf.Types.Hash swapId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash SwapId { - get { return swapId_; } - set { - swapId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SwapPairAdded); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SwapPairAdded other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(SwapId, other.SwapId)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (swapId_ != null) hash ^= SwapId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (swapId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(SwapId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (swapId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SwapId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SwapPairAdded other) { - if (other == null) { - return; - } - if (other.swapId_ != null) { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - SwapId.MergeFrom(other.SwapId); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (swapId_ == null) { - SwapId = new global::AElf.Types.Hash(); - } - input.ReadMessage(SwapId); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/src/AElf.EventHandler/Dto/CallbackInputg.cs b/src/AElf.EventHandler/Dto/CallbackInputg.cs deleted file mode 100644 index 4381f088..00000000 --- a/src/AElf.EventHandler/Dto/CallbackInputg.cs +++ /dev/null @@ -1,258 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: callback_input.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -/// Holder for reflection information generated from callback_input.proto -public static partial class CallbackInputReflection { - - #region Descriptor - /// File descriptor for callback_input.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static CallbackInputReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChRjYWxsYmFja19pbnB1dC5wcm90bxoPYWVsZi9jb3JlLnByb3RvIj0KDUNh", - "bGxiYWNrSW5wdXQSHAoIcXVlcnlfaWQYASABKAsyCi5hZWxmLkhhc2gSDgoG", - "cmVzdWx0GAIgASgMYgZwcm90bzM=")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::AElf.Types.CoreReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::CallbackInput), global::CallbackInput.Parser, new[]{ "QueryId", "Result" }, null, null, null, null) - })); - } - #endregion - -} -#region Messages -public sealed partial class CallbackInput : pb::IMessage -#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage -#endif -{ - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CallbackInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::CallbackInputReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CallbackInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CallbackInput(CallbackInput other) : this() { - queryId_ = other.queryId_ != null ? other.queryId_.Clone() : null; - result_ = other.result_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CallbackInput Clone() { - return new CallbackInput(this); - } - - /// Field number for the "query_id" field. - public const int QueryIdFieldNumber = 1; - private global::AElf.Types.Hash queryId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash QueryId { - get { return queryId_; } - set { - queryId_ = value; - } - } - - /// Field number for the "result" field. - public const int ResultFieldNumber = 2; - private pb::ByteString result_ = pb::ByteString.Empty; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString Result { - get { return result_; } - set { - result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as CallbackInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(CallbackInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(QueryId, other.QueryId)) return false; - if (Result != other.Result) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (queryId_ != null) hash ^= QueryId.GetHashCode(); - if (Result.Length != 0) hash ^= Result.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (queryId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(QueryId); - } - if (Result.Length != 0) { - output.WriteRawTag(18); - output.WriteBytes(Result); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (queryId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(QueryId); - } - if (Result.Length != 0) { - output.WriteRawTag(18); - output.WriteBytes(Result); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (queryId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryId); - } - if (Result.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(Result); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(CallbackInput other) { - if (other == null) { - return; - } - if (other.queryId_ != null) { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - QueryId.MergeFrom(other.QueryId); - } - if (other.Result.Length != 0) { - Result = other.Result; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - input.ReadMessage(QueryId); - break; - } - case 18: { - Result = input.ReadBytes(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - input.ReadMessage(QueryId); - break; - } - case 18: { - Result = input.ReadBytes(); - break; - } - } - } - } - #endif - -} - -#endregion - - -#endregion Designer generated code diff --git a/src/AElf.EventHandler/Dto/IntegerAggregatorContractc.cs b/src/AElf.EventHandler/Dto/IntegerAggregatorContractc.cs deleted file mode 100644 index cf402a51..00000000 --- a/src/AElf.EventHandler/Dto/IntegerAggregatorContractc.cs +++ /dev/null @@ -1,77 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: integer_aggregator_contract.proto -// -#pragma warning disable 0414, 1591 -#region Designer generated code - -using System.Collections.Generic; -using aelf = global::AElf.CSharp.Core; - -namespace AElf.Contracts.IntegerAggregator { - - #region Events - public partial class AggregateDataReceived : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public AggregateDataReceived GetNonIndexed() - { - return new AggregateDataReceived - { - Results = Results, - FinalResult = FinalResult, - }; - } - } - - #endregion - /// - /// StringValue -> StringValue - /// - public static partial class IntegerAggregatorContractContainer - { - static readonly string __ServiceName = "IntegerAggregatorContract"; - - #region Marshallers - static readonly aelf::Marshaller __Marshaller_acs13_AggregateInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Standards.ACS13.AggregateInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_StringValue = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.StringValue.Parser.ParseFrom); - #endregion - - #region Methods - static readonly aelf::Method __Method_Aggregate = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "Aggregate", - __Marshaller_acs13_AggregateInput, - __Marshaller_google_protobuf_StringValue); - - #endregion - - #region Descriptors - public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor - { - get { return global::AElf.Contracts.IntegerAggregator.IntegerAggregatorContractReflection.Descriptor.Services[0]; } - } - - public static global::System.Collections.Generic.IReadOnlyList Descriptors - { - get - { - return new global::System.Collections.Generic.List() - { - global::AElf.Standards.ACS13.Acs13Reflection.Descriptor.Services[0], - global::AElf.Contracts.IntegerAggregator.IntegerAggregatorContractReflection.Descriptor.Services[0], - }; - } - } - #endregion - } -} -#endregion - diff --git a/src/AElf.EventHandler/Dto/IntegerAggregatorContractg.cs b/src/AElf.EventHandler/Dto/IntegerAggregatorContractg.cs deleted file mode 100644 index 8d343339..00000000 --- a/src/AElf.EventHandler/Dto/IntegerAggregatorContractg.cs +++ /dev/null @@ -1,428 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: integer_aggregator_contract.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace AElf.Contracts.IntegerAggregator { - - /// Holder for reflection information generated from integer_aggregator_contract.proto - public static partial class IntegerAggregatorContractReflection { - - #region Descriptor - /// File descriptor for integer_aggregator_contract.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static IntegerAggregatorContractReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "CiFpbnRlZ2VyX2FnZ3JlZ2F0b3JfY29udHJhY3QucHJvdG8aEmFlbGYvb3B0", - "aW9ucy5wcm90bxoPYWVsZi9jb3JlLnByb3RvGgthY3MxMy5wcm90byJOChVB", - "Z2dyZWdhdGVEYXRhUmVjZWl2ZWQSGQoHcmVzdWx0cxgBIAEoCzIILlJlc3Vs", - "dHMSFAoMZmluYWxfcmVzdWx0GAIgASgJOgSguxgBIhgKB1Jlc3VsdHMSDQoF", - "dmFsdWUYASADKAkycQoZSW50ZWdlckFnZ3JlZ2F0b3JDb250cmFjdBpUssz2", - "AT9BRWxmLkNvbnRyYWN0cy5JbnRlZ2VyQWdncmVnYXRvci5JbnRlZ2VyQWdn", - "cmVnYXRvckNvbnRyYWN0U3RhdGXKyvYBC2FjczEzLnByb3RvQiOqAiBBRWxm", - "LkNvbnRyYWN0cy5JbnRlZ2VyQWdncmVnYXRvcmIGcHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::AElf.OptionsReflection.Descriptor, global::AElf.Types.CoreReflection.Descriptor, global::AElf.Standards.ACS13.Acs13Reflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.IntegerAggregator.AggregateDataReceived), global::AElf.Contracts.IntegerAggregator.AggregateDataReceived.Parser, new[]{ "Results", "FinalResult" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.IntegerAggregator.Results), global::AElf.Contracts.IntegerAggregator.Results.Parser, new[]{ "Value" }, null, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class AggregateDataReceived : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AggregateDataReceived()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.IntegerAggregator.IntegerAggregatorContractReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AggregateDataReceived() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AggregateDataReceived(AggregateDataReceived other) : this() { - results_ = other.results_ != null ? other.results_.Clone() : null; - finalResult_ = other.finalResult_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AggregateDataReceived Clone() { - return new AggregateDataReceived(this); - } - - /// Field number for the "results" field. - public const int ResultsFieldNumber = 1; - private global::AElf.Contracts.IntegerAggregator.Results results_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.IntegerAggregator.Results Results { - get { return results_; } - set { - results_ = value; - } - } - - /// Field number for the "final_result" field. - public const int FinalResultFieldNumber = 2; - private string finalResult_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string FinalResult { - get { return finalResult_; } - set { - finalResult_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as AggregateDataReceived); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(AggregateDataReceived other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Results, other.Results)) return false; - if (FinalResult != other.FinalResult) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (results_ != null) hash ^= Results.GetHashCode(); - if (FinalResult.Length != 0) hash ^= FinalResult.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (results_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Results); - } - if (FinalResult.Length != 0) { - output.WriteRawTag(18); - output.WriteString(FinalResult); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (results_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Results); - } - if (FinalResult.Length != 0) { - output.WriteRawTag(18); - output.WriteString(FinalResult); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (results_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Results); - } - if (FinalResult.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(FinalResult); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(AggregateDataReceived other) { - if (other == null) { - return; - } - if (other.results_ != null) { - if (results_ == null) { - Results = new global::AElf.Contracts.IntegerAggregator.Results(); - } - Results.MergeFrom(other.Results); - } - if (other.FinalResult.Length != 0) { - FinalResult = other.FinalResult; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (results_ == null) { - Results = new global::AElf.Contracts.IntegerAggregator.Results(); - } - input.ReadMessage(Results); - break; - } - case 18: { - FinalResult = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - if (results_ == null) { - Results = new global::AElf.Contracts.IntegerAggregator.Results(); - } - input.ReadMessage(Results); - break; - } - case 18: { - FinalResult = input.ReadString(); - break; - } - } - } - } - #endif - - } - - public sealed partial class Results : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Results()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.IntegerAggregator.IntegerAggregatorContractReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Results() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Results(Results other) : this() { - value_ = other.value_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Results Clone() { - return new Results(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_value_codec - = pb::FieldCodec.ForString(10); - private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Value { - get { return value_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Results); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Results other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!value_.Equals(other.value_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= value_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - value_.WriteTo(output, _repeated_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - value_.WriteTo(ref output, _repeated_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += value_.CalculateSize(_repeated_value_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Results other) { - if (other == null) { - return; - } - value_.Add(other.value_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - value_.AddEntriesFrom(input, _repeated_value_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - value_.AddEntriesFrom(ref input, _repeated_value_codec); - break; - } - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/src/AElf.EventHandler/Dto/LotteryContractc.cs b/src/AElf.EventHandler/Dto/LotteryContractc.cs deleted file mode 100644 index ee96762c..00000000 --- a/src/AElf.EventHandler/Dto/LotteryContractc.cs +++ /dev/null @@ -1,308 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: lottery_contract.proto -// -#pragma warning disable 0414, 1591 -#region Designer generated code - -using System.Collections.Generic; -using aelf = global::AElf.CSharp.Core; - -namespace AElf.Contracts.Lottery { - - #region Events - public partial class DrewFinished : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public DrewFinished GetNonIndexed() - { - return new DrewFinished - { - PeriodId = PeriodId, - }; - } - } - - public partial class DrewUnfinished : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public DrewUnfinished GetNonIndexed() - { - return new DrewUnfinished - { - PeriodId = PeriodId, - ToAwardId = ToAwardId, - }; - } - } - - public partial class Staked : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public Staked GetNonIndexed() - { - return new Staked - { - User = User, - Amount = Amount, - LotteryCodeList = LotteryCodeList, - }; - } - } - - public partial class Redeemed : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public Redeemed GetNonIndexed() - { - return new Redeemed - { - User = User, - Amount = Amount, - PeriodId = PeriodId, - }; - } - } - - public partial class Claimed : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public Claimed GetNonIndexed() - { - return new Claimed - { - User = User, - Amount = Amount, - PeriodId = PeriodId, - ClaimedLotteryCodeList = ClaimedLotteryCodeList, - }; - } - } - - #endregion - /// - /// Only for the activity after eth2aelf ELF token swap. - /// - public static partial class LotteryContractContainer - { - static readonly string __ServiceName = "LotteryContract"; - - #region Marshallers - static readonly aelf::Marshaller __Marshaller_InitializeInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Lottery.InitializeInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_Empty = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_DrawInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Lottery.DrawInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_Int64Value = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Int64Value.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_OwnLottery = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Lottery.OwnLottery.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_Int32Value = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Int32Value.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_aelf_Address = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Types.Address.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_Int64List = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Lottery.Int64List.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_AwardList = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Lottery.AwardList.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_GetAwardListInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Lottery.GetAwardListInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_Lottery = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Lottery.Lottery.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_Award = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Lottery.Award.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_PeriodAward = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Lottery.PeriodAward.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_Timestamp = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Timestamp.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_AwardAmountMap = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Lottery.AwardAmountMap.Parser.ParseFrom); - #endregion - - #region Methods - static readonly aelf::Method __Method_Initialize = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "Initialize", - __Marshaller_InitializeInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_Draw = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "Draw", - __Marshaller_DrawInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_ResetTimestamp = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "ResetTimestamp", - __Marshaller_InitializeInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_Stake = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "Stake", - __Marshaller_google_protobuf_Int64Value, - __Marshaller_OwnLottery); - - static readonly aelf::Method __Method_Redeem = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "Redeem", - __Marshaller_google_protobuf_Empty, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_Claim = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "Claim", - __Marshaller_google_protobuf_Empty, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_GetCurrentPeriodId = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetCurrentPeriodId", - __Marshaller_google_protobuf_Empty, - __Marshaller_google_protobuf_Int32Value); - - static readonly aelf::Method __Method_GetTotalLotteryCount = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetTotalLotteryCount", - __Marshaller_google_protobuf_Empty, - __Marshaller_google_protobuf_Int64Value); - - static readonly aelf::Method __Method_GetTotalAwardCount = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetTotalAwardCount", - __Marshaller_google_protobuf_Empty, - __Marshaller_google_protobuf_Int64Value); - - static readonly aelf::Method __Method_GetLotteryCodeListByUserAddress = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetLotteryCodeListByUserAddress", - __Marshaller_aelf_Address, - __Marshaller_Int64List); - - static readonly aelf::Method __Method_GetAwardListByUserAddress = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetAwardListByUserAddress", - __Marshaller_aelf_Address, - __Marshaller_AwardList); - - static readonly aelf::Method __Method_GetAwardList = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetAwardList", - __Marshaller_GetAwardListInput, - __Marshaller_AwardList); - - static readonly aelf::Method __Method_GetLottery = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetLottery", - __Marshaller_google_protobuf_Int64Value, - __Marshaller_Lottery); - - static readonly aelf::Method __Method_GetStakingAmount = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetStakingAmount", - __Marshaller_aelf_Address, - __Marshaller_google_protobuf_Int64Value); - - static readonly aelf::Method __Method_GetOwnLottery = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetOwnLottery", - __Marshaller_aelf_Address, - __Marshaller_OwnLottery); - - static readonly aelf::Method __Method_GetAward = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetAward", - __Marshaller_google_protobuf_Int64Value, - __Marshaller_Award); - - static readonly aelf::Method __Method_GetPeriodAward = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetPeriodAward", - __Marshaller_google_protobuf_Int64Value, - __Marshaller_PeriodAward); - - static readonly aelf::Method __Method_GetStartTimestamp = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetStartTimestamp", - __Marshaller_google_protobuf_Empty, - __Marshaller_google_protobuf_Timestamp); - - static readonly aelf::Method __Method_GetShutdownTimestamp = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetShutdownTimestamp", - __Marshaller_google_protobuf_Empty, - __Marshaller_google_protobuf_Timestamp); - - static readonly aelf::Method __Method_GetRedeemTimestamp = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetRedeemTimestamp", - __Marshaller_google_protobuf_Empty, - __Marshaller_google_protobuf_Timestamp); - - static readonly aelf::Method __Method_GetAwardAmountMap = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetAwardAmountMap", - __Marshaller_aelf_Address, - __Marshaller_AwardAmountMap); - - #endregion - - #region Descriptors - public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor - { - get { return global::AElf.Contracts.Lottery.LotteryContractReflection.Descriptor.Services[0]; } - } - - public static global::System.Collections.Generic.IReadOnlyList Descriptors - { - get - { - return new global::System.Collections.Generic.List() - { - global::AElf.Contracts.Lottery.LotteryContractReflection.Descriptor.Services[0], - }; - } - } - #endregion - } -} -#endregion - diff --git a/src/AElf.EventHandler/Dto/LotteryContractg.cs b/src/AElf.EventHandler/Dto/LotteryContractg.cs deleted file mode 100644 index f2226f90..00000000 --- a/src/AElf.EventHandler/Dto/LotteryContractg.cs +++ /dev/null @@ -1,3171 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: lottery_contract.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace AElf.Contracts.Lottery { - - /// Holder for reflection information generated from lottery_contract.proto - public static partial class LotteryContractReflection { - - #region Descriptor - /// File descriptor for lottery_contract.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static LotteryContractReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChZsb3R0ZXJ5X2NvbnRyYWN0LnByb3RvGg9hZWxmL2NvcmUucHJvdG8aEmFl", - "bGYvb3B0aW9ucy5wcm90bxobZ29vZ2xlL3Byb3RvYnVmL2VtcHR5LnByb3Rv", - "Gh5nb29nbGUvcHJvdG9idWYvd3JhcHBlcnMucHJvdG8aH2dvb2dsZS9wcm90", - "b2J1Zi90aW1lc3RhbXAucHJvdG8iuwIKD0luaXRpYWxpemVJbnB1dBIzCg9z", - "dGFydF90aW1lc3RhbXAYASABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0", - "YW1wEjYKEnNodXRkb3duX3RpbWVzdGFtcBgCIAEoCzIaLmdvb2dsZS5wcm90", - "b2J1Zi5UaW1lc3RhbXASNAoQcmVkZWVtX3RpbWVzdGFtcBgDIAEoCzIaLmdv", - "b2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASOQoVc3RvcF9yZWRlZW1fdGltZXN0", - "YW1wGAQgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIaChJkZWZh", - "dWx0X2F3YXJkX2xpc3QYBSADKAMSHAoFYWRtaW4YBiABKAsyDS5hZWxmLkFk", - "ZHJlc3MSEAoIaXNfZGVidWcYByABKAgilAEKCk93bkxvdHRlcnkSGQoRbG90", - "dGVyeV9jb2RlX2xpc3QYASADKAMSHAoUdG90YWxfc3Rha2luZ19hbW91bnQY", - "AiABKAMSGgoSdG90YWxfYXdhcmRfYW1vdW50GAMgASgDEhwKFGNsYWltZWRf", - "YXdhcmRfYW1vdW50GAQgASgDEhMKC2lzX3JlZGVlbWVkGAUgASgIIs4BCgdM", - "b3R0ZXJ5EhQKDGxvdHRlcnlfY29kZRgBIAEoAxIzCg9pc3N1ZV90aW1lc3Rh", - "bXAYAiABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEhUKDWF3YXJk", - "X2lkX2xpc3QYAyADKAMSHAoFb3duZXIYBCABKAsyDS5hZWxmLkFkZHJlc3MS", - "HwoXbGF0ZXN0X2NsYWltZWRfYXdhcmRfaWQYBSABKAMSIgoabG90dGVyeV90", - "b3RhbF9hd2FyZF9hbW91bnQYBiABKAMiGgoJSW50NjRMaXN0Eg0KBXZhbHVl", - "GAEgAygDIocBCgVBd2FyZBIQCghhd2FyZF9pZBgBIAEoAxIUCgxhd2FyZF9h", - "bW91bnQYAiABKAMSFAoMbG90dGVyeV9jb2RlGAMgASgDEhIKCmlzX2NsYWlt", - "ZWQYBCABKAgSHAoFb3duZXIYBSABKAsyDS5hZWxmLkFkZHJlc3MSDgoGcGVy", - "aW9kGAYgASgFIiIKCUF3YXJkTGlzdBIVCgV2YWx1ZRgBIAMoCzIGLkF3YXJk", - "IvUBCgtQZXJpb2RBd2FyZBIRCglwZXJpb2RfaWQYASABKAUSMwoPc3RhcnRf", - "dGltZXN0YW1wGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIx", - "Cg1lbmRfdGltZXN0YW1wGAMgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVz", - "dGFtcBImChJ1c2VkX3JhbmRvbV9oYXNoZXMYBCADKAsyCi5hZWxmLkhhc2gS", - "FgoOc3RhcnRfYXdhcmRfaWQYBSABKAMSFAoMZW5kX2F3YXJkX2lkGAYgASgD", - "EhUKDWRyZXdfYXdhcmRfaWQYByABKAMiTAoJRHJhd0lucHV0EhEKCXBlcmlv", - "ZF9pZBgBIAEoBRIXCg9uZXh0X2F3YXJkX2xpc3QYAiADKAMSEwoLdG9fYXdh", - "cmRfaWQYAyABKAMiSgoRR2V0QXdhcmRMaXN0SW5wdXQSEQoJcGVyaW9kX2lk", - "GAEgASgFEhMKC3N0YXJ0X2luZGV4GAIgASgDEg0KBWNvdW50GAMgASgFImkK", - "DkF3YXJkQW1vdW50TWFwEikKBXZhbHVlGAEgAygLMhouQXdhcmRBbW91bnRN", - "YXAuVmFsdWVFbnRyeRosCgpWYWx1ZUVudHJ5EgsKA2tleRgBIAEoAxINCgV2", - "YWx1ZRgCIAEoAzoCOAEiJwoMRHJld0ZpbmlzaGVkEhEKCXBlcmlvZF9pZBgB", - "IAEoAzoEoLsYASI+Cg5EcmV3VW5maW5pc2hlZBIRCglwZXJpb2RfaWQYASAB", - "KAMSEwoLdG9fYXdhcmRfaWQYAiABKAM6BKC7GAEiYgoGU3Rha2VkEhsKBHVz", - "ZXIYASABKAsyDS5hZWxmLkFkZHJlc3MSDgoGYW1vdW50GAIgASgDEiUKEWxv", - "dHRlcnlfY29kZV9saXN0GAMgASgLMgouSW50NjRMaXN0OgSguxgBIlAKCFJl", - "ZGVlbWVkEhsKBHVzZXIYASABKAsyDS5hZWxmLkFkZHJlc3MSDgoGYW1vdW50", - "GAIgASgDEhEKCXBlcmlvZF9pZBgDIAEoAzoEoLsYASJ+CgdDbGFpbWVkEhsK", - "BHVzZXIYASABKAsyDS5hZWxmLkFkZHJlc3MSDgoGYW1vdW50GAIgASgDEhEK", - "CXBlcmlvZF9pZBgDIAEoAxItChljbGFpbWVkX2xvdHRlcnlfY29kZV9saXN0", - "GAQgASgLMgouSW50NjRMaXN0OgSguxgBMqsLCg9Mb3R0ZXJ5Q29udHJhY3QS", - "OAoKSW5pdGlhbGl6ZRIQLkluaXRpYWxpemVJbnB1dBoWLmdvb2dsZS5wcm90", - "b2J1Zi5FbXB0eSIAEiwKBERyYXcSCi5EcmF3SW5wdXQaFi5nb29nbGUucHJv", - "dG9idWYuRW1wdHkiABI8Cg5SZXNldFRpbWVzdGFtcBIQLkluaXRpYWxpemVJ", - "bnB1dBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIAEjMKBVN0YWtlEhsuZ29v", - "Z2xlLnByb3RvYnVmLkludDY0VmFsdWUaCy5Pd25Mb3R0ZXJ5IgASOgoGUmVk", - "ZWVtEhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5GhYuZ29vZ2xlLnByb3RvYnVm", - "LkVtcHR5IgASOQoFQ2xhaW0SFi5nb29nbGUucHJvdG9idWYuRW1wdHkaFi5n", - "b29nbGUucHJvdG9idWYuRW1wdHkiABJQChJHZXRDdXJyZW50UGVyaW9kSWQS", - "Fi5nb29nbGUucHJvdG9idWYuRW1wdHkaGy5nb29nbGUucHJvdG9idWYuSW50", - "MzJWYWx1ZSIFiIn3AQESUgoUR2V0VG90YWxMb3R0ZXJ5Q291bnQSFi5nb29n", - "bGUucHJvdG9idWYuRW1wdHkaGy5nb29nbGUucHJvdG9idWYuSW50NjRWYWx1", - "ZSIFiIn3AQESUAoSR2V0VG90YWxBd2FyZENvdW50EhYuZ29vZ2xlLnByb3Rv", - "YnVmLkVtcHR5GhsuZ29vZ2xlLnByb3RvYnVmLkludDY0VmFsdWUiBYiJ9wEB", - "EkMKH0dldExvdHRlcnlDb2RlTGlzdEJ5VXNlckFkZHJlc3MSDS5hZWxmLkFk", - "ZHJlc3MaCi5JbnQ2NExpc3QiBYiJ9wEBEj0KGUdldEF3YXJkTGlzdEJ5VXNl", - "ckFkZHJlc3MSDS5hZWxmLkFkZHJlc3MaCi5Bd2FyZExpc3QiBYiJ9wEBEjUK", - "DEdldEF3YXJkTGlzdBISLkdldEF3YXJkTGlzdElucHV0GgouQXdhcmRMaXN0", - "IgWIifcBARI6CgpHZXRMb3R0ZXJ5EhsuZ29vZ2xlLnByb3RvYnVmLkludDY0", - "VmFsdWUaCC5Mb3R0ZXJ5IgWIifcBARJFChBHZXRTdGFraW5nQW1vdW50Eg0u", - "YWVsZi5BZGRyZXNzGhsuZ29vZ2xlLnByb3RvYnVmLkludDY0VmFsdWUiBYiJ", - "9wEBEjIKDUdldE93bkxvdHRlcnkSDS5hZWxmLkFkZHJlc3MaCy5Pd25Mb3R0", - "ZXJ5IgWIifcBARI2CghHZXRBd2FyZBIbLmdvb2dsZS5wcm90b2J1Zi5JbnQ2", - "NFZhbHVlGgYuQXdhcmQiBYiJ9wEBEkIKDkdldFBlcmlvZEF3YXJkEhsuZ29v", - "Z2xlLnByb3RvYnVmLkludDY0VmFsdWUaDC5QZXJpb2RBd2FyZCIFiIn3AQES", - "TgoRR2V0U3RhcnRUaW1lc3RhbXASFi5nb29nbGUucHJvdG9idWYuRW1wdHka", - "Gi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wIgWIifcBARJRChRHZXRTaHV0", - "ZG93blRpbWVzdGFtcBIWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eRoaLmdvb2ds", - "ZS5wcm90b2J1Zi5UaW1lc3RhbXAiBYiJ9wEBEk8KEkdldFJlZGVlbVRpbWVz", - "dGFtcBIWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eRoaLmdvb2dsZS5wcm90b2J1", - "Zi5UaW1lc3RhbXAiBYiJ9wEBEjoKEUdldEF3YXJkQW1vdW50TWFwEg0uYWVs", - "Zi5BZGRyZXNzGg8uQXdhcmRBbW91bnRNYXAiBYiJ9wEBGjCyzPYBK0FFbGYu", - "Q29udHJhY3RzLkxvdHRlcnkuTG90dGVyeUNvbnRyYWN0U3RhdGVCGaoCFkFF", - "bGYuQ29udHJhY3RzLkxvdHRlcnliBnByb3RvMw==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::AElf.Types.CoreReflection.Descriptor, global::AElf.OptionsReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Lottery.InitializeInput), global::AElf.Contracts.Lottery.InitializeInput.Parser, new[]{ "StartTimestamp", "ShutdownTimestamp", "RedeemTimestamp", "StopRedeemTimestamp", "DefaultAwardList", "Admin", "IsDebug" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Lottery.OwnLottery), global::AElf.Contracts.Lottery.OwnLottery.Parser, new[]{ "LotteryCodeList", "TotalStakingAmount", "TotalAwardAmount", "ClaimedAwardAmount", "IsRedeemed" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Lottery.Lottery), global::AElf.Contracts.Lottery.Lottery.Parser, new[]{ "LotteryCode", "IssueTimestamp", "AwardIdList", "Owner", "LatestClaimedAwardId", "LotteryTotalAwardAmount" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Lottery.Int64List), global::AElf.Contracts.Lottery.Int64List.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Lottery.Award), global::AElf.Contracts.Lottery.Award.Parser, new[]{ "AwardId", "AwardAmount", "LotteryCode", "IsClaimed", "Owner", "Period" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Lottery.AwardList), global::AElf.Contracts.Lottery.AwardList.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Lottery.PeriodAward), global::AElf.Contracts.Lottery.PeriodAward.Parser, new[]{ "PeriodId", "StartTimestamp", "EndTimestamp", "UsedRandomHashes", "StartAwardId", "EndAwardId", "DrewAwardId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Lottery.DrawInput), global::AElf.Contracts.Lottery.DrawInput.Parser, new[]{ "PeriodId", "NextAwardList", "ToAwardId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Lottery.GetAwardListInput), global::AElf.Contracts.Lottery.GetAwardListInput.Parser, new[]{ "PeriodId", "StartIndex", "Count" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Lottery.AwardAmountMap), global::AElf.Contracts.Lottery.AwardAmountMap.Parser, new[]{ "Value" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Lottery.DrewFinished), global::AElf.Contracts.Lottery.DrewFinished.Parser, new[]{ "PeriodId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Lottery.DrewUnfinished), global::AElf.Contracts.Lottery.DrewUnfinished.Parser, new[]{ "PeriodId", "ToAwardId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Lottery.Staked), global::AElf.Contracts.Lottery.Staked.Parser, new[]{ "User", "Amount", "LotteryCodeList" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Lottery.Redeemed), global::AElf.Contracts.Lottery.Redeemed.Parser, new[]{ "User", "Amount", "PeriodId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Lottery.Claimed), global::AElf.Contracts.Lottery.Claimed.Parser, new[]{ "User", "Amount", "PeriodId", "ClaimedLotteryCodeList" }, null, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class InitializeInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new InitializeInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Lottery.LotteryContractReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitializeInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitializeInput(InitializeInput other) : this() { - startTimestamp_ = other.startTimestamp_ != null ? other.startTimestamp_.Clone() : null; - shutdownTimestamp_ = other.shutdownTimestamp_ != null ? other.shutdownTimestamp_.Clone() : null; - redeemTimestamp_ = other.redeemTimestamp_ != null ? other.redeemTimestamp_.Clone() : null; - stopRedeemTimestamp_ = other.stopRedeemTimestamp_ != null ? other.stopRedeemTimestamp_.Clone() : null; - defaultAwardList_ = other.defaultAwardList_.Clone(); - admin_ = other.admin_ != null ? other.admin_.Clone() : null; - isDebug_ = other.isDebug_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitializeInput Clone() { - return new InitializeInput(this); - } - - /// Field number for the "start_timestamp" field. - public const int StartTimestampFieldNumber = 1; - private global::Google.Protobuf.WellKnownTypes.Timestamp startTimestamp_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp StartTimestamp { - get { return startTimestamp_; } - set { - startTimestamp_ = value; - } - } - - /// Field number for the "shutdown_timestamp" field. - public const int ShutdownTimestampFieldNumber = 2; - private global::Google.Protobuf.WellKnownTypes.Timestamp shutdownTimestamp_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp ShutdownTimestamp { - get { return shutdownTimestamp_; } - set { - shutdownTimestamp_ = value; - } - } - - /// Field number for the "redeem_timestamp" field. - public const int RedeemTimestampFieldNumber = 3; - private global::Google.Protobuf.WellKnownTypes.Timestamp redeemTimestamp_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp RedeemTimestamp { - get { return redeemTimestamp_; } - set { - redeemTimestamp_ = value; - } - } - - /// Field number for the "stop_redeem_timestamp" field. - public const int StopRedeemTimestampFieldNumber = 4; - private global::Google.Protobuf.WellKnownTypes.Timestamp stopRedeemTimestamp_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp StopRedeemTimestamp { - get { return stopRedeemTimestamp_; } - set { - stopRedeemTimestamp_ = value; - } - } - - /// Field number for the "default_award_list" field. - public const int DefaultAwardListFieldNumber = 5; - private static readonly pb::FieldCodec _repeated_defaultAwardList_codec - = pb::FieldCodec.ForInt64(42); - private readonly pbc::RepeatedField defaultAwardList_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField DefaultAwardList { - get { return defaultAwardList_; } - } - - /// Field number for the "admin" field. - public const int AdminFieldNumber = 6; - private global::AElf.Types.Address admin_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Admin { - get { return admin_; } - set { - admin_ = value; - } - } - - /// Field number for the "is_debug" field. - public const int IsDebugFieldNumber = 7; - private bool isDebug_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsDebug { - get { return isDebug_; } - set { - isDebug_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as InitializeInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(InitializeInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(StartTimestamp, other.StartTimestamp)) return false; - if (!object.Equals(ShutdownTimestamp, other.ShutdownTimestamp)) return false; - if (!object.Equals(RedeemTimestamp, other.RedeemTimestamp)) return false; - if (!object.Equals(StopRedeemTimestamp, other.StopRedeemTimestamp)) return false; - if(!defaultAwardList_.Equals(other.defaultAwardList_)) return false; - if (!object.Equals(Admin, other.Admin)) return false; - if (IsDebug != other.IsDebug) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (startTimestamp_ != null) hash ^= StartTimestamp.GetHashCode(); - if (shutdownTimestamp_ != null) hash ^= ShutdownTimestamp.GetHashCode(); - if (redeemTimestamp_ != null) hash ^= RedeemTimestamp.GetHashCode(); - if (stopRedeemTimestamp_ != null) hash ^= StopRedeemTimestamp.GetHashCode(); - hash ^= defaultAwardList_.GetHashCode(); - if (admin_ != null) hash ^= Admin.GetHashCode(); - if (IsDebug != false) hash ^= IsDebug.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (startTimestamp_ != null) { - output.WriteRawTag(10); - output.WriteMessage(StartTimestamp); - } - if (shutdownTimestamp_ != null) { - output.WriteRawTag(18); - output.WriteMessage(ShutdownTimestamp); - } - if (redeemTimestamp_ != null) { - output.WriteRawTag(26); - output.WriteMessage(RedeemTimestamp); - } - if (stopRedeemTimestamp_ != null) { - output.WriteRawTag(34); - output.WriteMessage(StopRedeemTimestamp); - } - defaultAwardList_.WriteTo(output, _repeated_defaultAwardList_codec); - if (admin_ != null) { - output.WriteRawTag(50); - output.WriteMessage(Admin); - } - if (IsDebug != false) { - output.WriteRawTag(56); - output.WriteBool(IsDebug); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (startTimestamp_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(StartTimestamp); - } - if (shutdownTimestamp_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ShutdownTimestamp); - } - if (redeemTimestamp_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(RedeemTimestamp); - } - if (stopRedeemTimestamp_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(StopRedeemTimestamp); - } - size += defaultAwardList_.CalculateSize(_repeated_defaultAwardList_codec); - if (admin_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Admin); - } - if (IsDebug != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(InitializeInput other) { - if (other == null) { - return; - } - if (other.startTimestamp_ != null) { - if (startTimestamp_ == null) { - StartTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - StartTimestamp.MergeFrom(other.StartTimestamp); - } - if (other.shutdownTimestamp_ != null) { - if (shutdownTimestamp_ == null) { - ShutdownTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - ShutdownTimestamp.MergeFrom(other.ShutdownTimestamp); - } - if (other.redeemTimestamp_ != null) { - if (redeemTimestamp_ == null) { - RedeemTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - RedeemTimestamp.MergeFrom(other.RedeemTimestamp); - } - if (other.stopRedeemTimestamp_ != null) { - if (stopRedeemTimestamp_ == null) { - StopRedeemTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - StopRedeemTimestamp.MergeFrom(other.StopRedeemTimestamp); - } - defaultAwardList_.Add(other.defaultAwardList_); - if (other.admin_ != null) { - if (admin_ == null) { - Admin = new global::AElf.Types.Address(); - } - Admin.MergeFrom(other.Admin); - } - if (other.IsDebug != false) { - IsDebug = other.IsDebug; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (startTimestamp_ == null) { - StartTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(StartTimestamp); - break; - } - case 18: { - if (shutdownTimestamp_ == null) { - ShutdownTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(ShutdownTimestamp); - break; - } - case 26: { - if (redeemTimestamp_ == null) { - RedeemTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(RedeemTimestamp); - break; - } - case 34: { - if (stopRedeemTimestamp_ == null) { - StopRedeemTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(StopRedeemTimestamp); - break; - } - case 42: - case 40: { - defaultAwardList_.AddEntriesFrom(input, _repeated_defaultAwardList_codec); - break; - } - case 50: { - if (admin_ == null) { - Admin = new global::AElf.Types.Address(); - } - input.ReadMessage(Admin); - break; - } - case 56: { - IsDebug = input.ReadBool(); - break; - } - } - } - } - - } - - public sealed partial class OwnLottery : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OwnLottery()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Lottery.LotteryContractReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OwnLottery() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OwnLottery(OwnLottery other) : this() { - lotteryCodeList_ = other.lotteryCodeList_.Clone(); - totalStakingAmount_ = other.totalStakingAmount_; - totalAwardAmount_ = other.totalAwardAmount_; - claimedAwardAmount_ = other.claimedAwardAmount_; - isRedeemed_ = other.isRedeemed_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OwnLottery Clone() { - return new OwnLottery(this); - } - - /// Field number for the "lottery_code_list" field. - public const int LotteryCodeListFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_lotteryCodeList_codec - = pb::FieldCodec.ForInt64(10); - private readonly pbc::RepeatedField lotteryCodeList_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField LotteryCodeList { - get { return lotteryCodeList_; } - } - - /// Field number for the "total_staking_amount" field. - public const int TotalStakingAmountFieldNumber = 2; - private long totalStakingAmount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long TotalStakingAmount { - get { return totalStakingAmount_; } - set { - totalStakingAmount_ = value; - } - } - - /// Field number for the "total_award_amount" field. - public const int TotalAwardAmountFieldNumber = 3; - private long totalAwardAmount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long TotalAwardAmount { - get { return totalAwardAmount_; } - set { - totalAwardAmount_ = value; - } - } - - /// Field number for the "claimed_award_amount" field. - public const int ClaimedAwardAmountFieldNumber = 4; - private long claimedAwardAmount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ClaimedAwardAmount { - get { return claimedAwardAmount_; } - set { - claimedAwardAmount_ = value; - } - } - - /// Field number for the "is_redeemed" field. - public const int IsRedeemedFieldNumber = 5; - private bool isRedeemed_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsRedeemed { - get { return isRedeemed_; } - set { - isRedeemed_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as OwnLottery); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(OwnLottery other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!lotteryCodeList_.Equals(other.lotteryCodeList_)) return false; - if (TotalStakingAmount != other.TotalStakingAmount) return false; - if (TotalAwardAmount != other.TotalAwardAmount) return false; - if (ClaimedAwardAmount != other.ClaimedAwardAmount) return false; - if (IsRedeemed != other.IsRedeemed) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= lotteryCodeList_.GetHashCode(); - if (TotalStakingAmount != 0L) hash ^= TotalStakingAmount.GetHashCode(); - if (TotalAwardAmount != 0L) hash ^= TotalAwardAmount.GetHashCode(); - if (ClaimedAwardAmount != 0L) hash ^= ClaimedAwardAmount.GetHashCode(); - if (IsRedeemed != false) hash ^= IsRedeemed.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - lotteryCodeList_.WriteTo(output, _repeated_lotteryCodeList_codec); - if (TotalStakingAmount != 0L) { - output.WriteRawTag(16); - output.WriteInt64(TotalStakingAmount); - } - if (TotalAwardAmount != 0L) { - output.WriteRawTag(24); - output.WriteInt64(TotalAwardAmount); - } - if (ClaimedAwardAmount != 0L) { - output.WriteRawTag(32); - output.WriteInt64(ClaimedAwardAmount); - } - if (IsRedeemed != false) { - output.WriteRawTag(40); - output.WriteBool(IsRedeemed); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += lotteryCodeList_.CalculateSize(_repeated_lotteryCodeList_codec); - if (TotalStakingAmount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(TotalStakingAmount); - } - if (TotalAwardAmount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(TotalAwardAmount); - } - if (ClaimedAwardAmount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(ClaimedAwardAmount); - } - if (IsRedeemed != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(OwnLottery other) { - if (other == null) { - return; - } - lotteryCodeList_.Add(other.lotteryCodeList_); - if (other.TotalStakingAmount != 0L) { - TotalStakingAmount = other.TotalStakingAmount; - } - if (other.TotalAwardAmount != 0L) { - TotalAwardAmount = other.TotalAwardAmount; - } - if (other.ClaimedAwardAmount != 0L) { - ClaimedAwardAmount = other.ClaimedAwardAmount; - } - if (other.IsRedeemed != false) { - IsRedeemed = other.IsRedeemed; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: - case 8: { - lotteryCodeList_.AddEntriesFrom(input, _repeated_lotteryCodeList_codec); - break; - } - case 16: { - TotalStakingAmount = input.ReadInt64(); - break; - } - case 24: { - TotalAwardAmount = input.ReadInt64(); - break; - } - case 32: { - ClaimedAwardAmount = input.ReadInt64(); - break; - } - case 40: { - IsRedeemed = input.ReadBool(); - break; - } - } - } - } - - } - - public sealed partial class Lottery : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Lottery()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Lottery.LotteryContractReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Lottery() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Lottery(Lottery other) : this() { - lotteryCode_ = other.lotteryCode_; - issueTimestamp_ = other.issueTimestamp_ != null ? other.issueTimestamp_.Clone() : null; - awardIdList_ = other.awardIdList_.Clone(); - owner_ = other.owner_ != null ? other.owner_.Clone() : null; - latestClaimedAwardId_ = other.latestClaimedAwardId_; - lotteryTotalAwardAmount_ = other.lotteryTotalAwardAmount_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Lottery Clone() { - return new Lottery(this); - } - - /// Field number for the "lottery_code" field. - public const int LotteryCodeFieldNumber = 1; - private long lotteryCode_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long LotteryCode { - get { return lotteryCode_; } - set { - lotteryCode_ = value; - } - } - - /// Field number for the "issue_timestamp" field. - public const int IssueTimestampFieldNumber = 2; - private global::Google.Protobuf.WellKnownTypes.Timestamp issueTimestamp_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp IssueTimestamp { - get { return issueTimestamp_; } - set { - issueTimestamp_ = value; - } - } - - /// Field number for the "award_id_list" field. - public const int AwardIdListFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_awardIdList_codec - = pb::FieldCodec.ForInt64(26); - private readonly pbc::RepeatedField awardIdList_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField AwardIdList { - get { return awardIdList_; } - } - - /// Field number for the "owner" field. - public const int OwnerFieldNumber = 4; - private global::AElf.Types.Address owner_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Owner { - get { return owner_; } - set { - owner_ = value; - } - } - - /// Field number for the "latest_claimed_award_id" field. - public const int LatestClaimedAwardIdFieldNumber = 5; - private long latestClaimedAwardId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long LatestClaimedAwardId { - get { return latestClaimedAwardId_; } - set { - latestClaimedAwardId_ = value; - } - } - - /// Field number for the "lottery_total_award_amount" field. - public const int LotteryTotalAwardAmountFieldNumber = 6; - private long lotteryTotalAwardAmount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long LotteryTotalAwardAmount { - get { return lotteryTotalAwardAmount_; } - set { - lotteryTotalAwardAmount_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Lottery); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Lottery other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (LotteryCode != other.LotteryCode) return false; - if (!object.Equals(IssueTimestamp, other.IssueTimestamp)) return false; - if(!awardIdList_.Equals(other.awardIdList_)) return false; - if (!object.Equals(Owner, other.Owner)) return false; - if (LatestClaimedAwardId != other.LatestClaimedAwardId) return false; - if (LotteryTotalAwardAmount != other.LotteryTotalAwardAmount) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (LotteryCode != 0L) hash ^= LotteryCode.GetHashCode(); - if (issueTimestamp_ != null) hash ^= IssueTimestamp.GetHashCode(); - hash ^= awardIdList_.GetHashCode(); - if (owner_ != null) hash ^= Owner.GetHashCode(); - if (LatestClaimedAwardId != 0L) hash ^= LatestClaimedAwardId.GetHashCode(); - if (LotteryTotalAwardAmount != 0L) hash ^= LotteryTotalAwardAmount.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (LotteryCode != 0L) { - output.WriteRawTag(8); - output.WriteInt64(LotteryCode); - } - if (issueTimestamp_ != null) { - output.WriteRawTag(18); - output.WriteMessage(IssueTimestamp); - } - awardIdList_.WriteTo(output, _repeated_awardIdList_codec); - if (owner_ != null) { - output.WriteRawTag(34); - output.WriteMessage(Owner); - } - if (LatestClaimedAwardId != 0L) { - output.WriteRawTag(40); - output.WriteInt64(LatestClaimedAwardId); - } - if (LotteryTotalAwardAmount != 0L) { - output.WriteRawTag(48); - output.WriteInt64(LotteryTotalAwardAmount); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (LotteryCode != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(LotteryCode); - } - if (issueTimestamp_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(IssueTimestamp); - } - size += awardIdList_.CalculateSize(_repeated_awardIdList_codec); - if (owner_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Owner); - } - if (LatestClaimedAwardId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(LatestClaimedAwardId); - } - if (LotteryTotalAwardAmount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(LotteryTotalAwardAmount); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Lottery other) { - if (other == null) { - return; - } - if (other.LotteryCode != 0L) { - LotteryCode = other.LotteryCode; - } - if (other.issueTimestamp_ != null) { - if (issueTimestamp_ == null) { - IssueTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - IssueTimestamp.MergeFrom(other.IssueTimestamp); - } - awardIdList_.Add(other.awardIdList_); - if (other.owner_ != null) { - if (owner_ == null) { - Owner = new global::AElf.Types.Address(); - } - Owner.MergeFrom(other.Owner); - } - if (other.LatestClaimedAwardId != 0L) { - LatestClaimedAwardId = other.LatestClaimedAwardId; - } - if (other.LotteryTotalAwardAmount != 0L) { - LotteryTotalAwardAmount = other.LotteryTotalAwardAmount; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - LotteryCode = input.ReadInt64(); - break; - } - case 18: { - if (issueTimestamp_ == null) { - IssueTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(IssueTimestamp); - break; - } - case 26: - case 24: { - awardIdList_.AddEntriesFrom(input, _repeated_awardIdList_codec); - break; - } - case 34: { - if (owner_ == null) { - Owner = new global::AElf.Types.Address(); - } - input.ReadMessage(Owner); - break; - } - case 40: { - LatestClaimedAwardId = input.ReadInt64(); - break; - } - case 48: { - LotteryTotalAwardAmount = input.ReadInt64(); - break; - } - } - } - } - - } - - /// - /// Show lottery codes. - /// - public sealed partial class Int64List : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Int64List()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Lottery.LotteryContractReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Int64List() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Int64List(Int64List other) : this() { - value_ = other.value_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Int64List Clone() { - return new Int64List(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_value_codec - = pb::FieldCodec.ForInt64(10); - private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Value { - get { return value_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Int64List); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Int64List other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!value_.Equals(other.value_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= value_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - value_.WriteTo(output, _repeated_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += value_.CalculateSize(_repeated_value_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Int64List other) { - if (other == null) { - return; - } - value_.Add(other.value_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: - case 8: { - value_.AddEntriesFrom(input, _repeated_value_codec); - break; - } - } - } - } - - } - - public sealed partial class Award : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Award()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Lottery.LotteryContractReflection.Descriptor.MessageTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Award() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Award(Award other) : this() { - awardId_ = other.awardId_; - awardAmount_ = other.awardAmount_; - lotteryCode_ = other.lotteryCode_; - isClaimed_ = other.isClaimed_; - owner_ = other.owner_ != null ? other.owner_.Clone() : null; - period_ = other.period_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Award Clone() { - return new Award(this); - } - - /// Field number for the "award_id" field. - public const int AwardIdFieldNumber = 1; - private long awardId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long AwardId { - get { return awardId_; } - set { - awardId_ = value; - } - } - - /// Field number for the "award_amount" field. - public const int AwardAmountFieldNumber = 2; - private long awardAmount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long AwardAmount { - get { return awardAmount_; } - set { - awardAmount_ = value; - } - } - - /// Field number for the "lottery_code" field. - public const int LotteryCodeFieldNumber = 3; - private long lotteryCode_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long LotteryCode { - get { return lotteryCode_; } - set { - lotteryCode_ = value; - } - } - - /// Field number for the "is_claimed" field. - public const int IsClaimedFieldNumber = 4; - private bool isClaimed_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsClaimed { - get { return isClaimed_; } - set { - isClaimed_ = value; - } - } - - /// Field number for the "owner" field. - public const int OwnerFieldNumber = 5; - private global::AElf.Types.Address owner_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Owner { - get { return owner_; } - set { - owner_ = value; - } - } - - /// Field number for the "period" field. - public const int PeriodFieldNumber = 6; - private int period_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Period { - get { return period_; } - set { - period_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Award); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Award other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (AwardId != other.AwardId) return false; - if (AwardAmount != other.AwardAmount) return false; - if (LotteryCode != other.LotteryCode) return false; - if (IsClaimed != other.IsClaimed) return false; - if (!object.Equals(Owner, other.Owner)) return false; - if (Period != other.Period) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (AwardId != 0L) hash ^= AwardId.GetHashCode(); - if (AwardAmount != 0L) hash ^= AwardAmount.GetHashCode(); - if (LotteryCode != 0L) hash ^= LotteryCode.GetHashCode(); - if (IsClaimed != false) hash ^= IsClaimed.GetHashCode(); - if (owner_ != null) hash ^= Owner.GetHashCode(); - if (Period != 0) hash ^= Period.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (AwardId != 0L) { - output.WriteRawTag(8); - output.WriteInt64(AwardId); - } - if (AwardAmount != 0L) { - output.WriteRawTag(16); - output.WriteInt64(AwardAmount); - } - if (LotteryCode != 0L) { - output.WriteRawTag(24); - output.WriteInt64(LotteryCode); - } - if (IsClaimed != false) { - output.WriteRawTag(32); - output.WriteBool(IsClaimed); - } - if (owner_ != null) { - output.WriteRawTag(42); - output.WriteMessage(Owner); - } - if (Period != 0) { - output.WriteRawTag(48); - output.WriteInt32(Period); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (AwardId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(AwardId); - } - if (AwardAmount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(AwardAmount); - } - if (LotteryCode != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(LotteryCode); - } - if (IsClaimed != false) { - size += 1 + 1; - } - if (owner_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Owner); - } - if (Period != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Period); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Award other) { - if (other == null) { - return; - } - if (other.AwardId != 0L) { - AwardId = other.AwardId; - } - if (other.AwardAmount != 0L) { - AwardAmount = other.AwardAmount; - } - if (other.LotteryCode != 0L) { - LotteryCode = other.LotteryCode; - } - if (other.IsClaimed != false) { - IsClaimed = other.IsClaimed; - } - if (other.owner_ != null) { - if (owner_ == null) { - Owner = new global::AElf.Types.Address(); - } - Owner.MergeFrom(other.Owner); - } - if (other.Period != 0) { - Period = other.Period; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - AwardId = input.ReadInt64(); - break; - } - case 16: { - AwardAmount = input.ReadInt64(); - break; - } - case 24: { - LotteryCode = input.ReadInt64(); - break; - } - case 32: { - IsClaimed = input.ReadBool(); - break; - } - case 42: { - if (owner_ == null) { - Owner = new global::AElf.Types.Address(); - } - input.ReadMessage(Owner); - break; - } - case 48: { - Period = input.ReadInt32(); - break; - } - } - } - } - - } - - public sealed partial class AwardList : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AwardList()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Lottery.LotteryContractReflection.Descriptor.MessageTypes[5]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AwardList() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AwardList(AwardList other) : this() { - value_ = other.value_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AwardList Clone() { - return new AwardList(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_value_codec - = pb::FieldCodec.ForMessage(10, global::AElf.Contracts.Lottery.Award.Parser); - private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Value { - get { return value_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as AwardList); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(AwardList other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!value_.Equals(other.value_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= value_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - value_.WriteTo(output, _repeated_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += value_.CalculateSize(_repeated_value_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(AwardList other) { - if (other == null) { - return; - } - value_.Add(other.value_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - value_.AddEntriesFrom(input, _repeated_value_codec); - break; - } - } - } - } - - } - - public sealed partial class PeriodAward : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PeriodAward()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Lottery.LotteryContractReflection.Descriptor.MessageTypes[6]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public PeriodAward() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public PeriodAward(PeriodAward other) : this() { - periodId_ = other.periodId_; - startTimestamp_ = other.startTimestamp_ != null ? other.startTimestamp_.Clone() : null; - endTimestamp_ = other.endTimestamp_ != null ? other.endTimestamp_.Clone() : null; - usedRandomHashes_ = other.usedRandomHashes_.Clone(); - startAwardId_ = other.startAwardId_; - endAwardId_ = other.endAwardId_; - drewAwardId_ = other.drewAwardId_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public PeriodAward Clone() { - return new PeriodAward(this); - } - - /// Field number for the "period_id" field. - public const int PeriodIdFieldNumber = 1; - private int periodId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int PeriodId { - get { return periodId_; } - set { - periodId_ = value; - } - } - - /// Field number for the "start_timestamp" field. - public const int StartTimestampFieldNumber = 2; - private global::Google.Protobuf.WellKnownTypes.Timestamp startTimestamp_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp StartTimestamp { - get { return startTimestamp_; } - set { - startTimestamp_ = value; - } - } - - /// Field number for the "end_timestamp" field. - public const int EndTimestampFieldNumber = 3; - private global::Google.Protobuf.WellKnownTypes.Timestamp endTimestamp_; - /// - /// Also draw timestamp - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp EndTimestamp { - get { return endTimestamp_; } - set { - endTimestamp_ = value; - } - } - - /// Field number for the "used_random_hashes" field. - public const int UsedRandomHashesFieldNumber = 4; - private static readonly pb::FieldCodec _repeated_usedRandomHashes_codec - = pb::FieldCodec.ForMessage(34, global::AElf.Types.Hash.Parser); - private readonly pbc::RepeatedField usedRandomHashes_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField UsedRandomHashes { - get { return usedRandomHashes_; } - } - - /// Field number for the "start_award_id" field. - public const int StartAwardIdFieldNumber = 5; - private long startAwardId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long StartAwardId { - get { return startAwardId_; } - set { - startAwardId_ = value; - } - } - - /// Field number for the "end_award_id" field. - public const int EndAwardIdFieldNumber = 6; - private long endAwardId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long EndAwardId { - get { return endAwardId_; } - set { - endAwardId_ = value; - } - } - - /// Field number for the "drew_award_id" field. - public const int DrewAwardIdFieldNumber = 7; - private long drewAwardId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long DrewAwardId { - get { return drewAwardId_; } - set { - drewAwardId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as PeriodAward); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(PeriodAward other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (PeriodId != other.PeriodId) return false; - if (!object.Equals(StartTimestamp, other.StartTimestamp)) return false; - if (!object.Equals(EndTimestamp, other.EndTimestamp)) return false; - if(!usedRandomHashes_.Equals(other.usedRandomHashes_)) return false; - if (StartAwardId != other.StartAwardId) return false; - if (EndAwardId != other.EndAwardId) return false; - if (DrewAwardId != other.DrewAwardId) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (PeriodId != 0) hash ^= PeriodId.GetHashCode(); - if (startTimestamp_ != null) hash ^= StartTimestamp.GetHashCode(); - if (endTimestamp_ != null) hash ^= EndTimestamp.GetHashCode(); - hash ^= usedRandomHashes_.GetHashCode(); - if (StartAwardId != 0L) hash ^= StartAwardId.GetHashCode(); - if (EndAwardId != 0L) hash ^= EndAwardId.GetHashCode(); - if (DrewAwardId != 0L) hash ^= DrewAwardId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (PeriodId != 0) { - output.WriteRawTag(8); - output.WriteInt32(PeriodId); - } - if (startTimestamp_ != null) { - output.WriteRawTag(18); - output.WriteMessage(StartTimestamp); - } - if (endTimestamp_ != null) { - output.WriteRawTag(26); - output.WriteMessage(EndTimestamp); - } - usedRandomHashes_.WriteTo(output, _repeated_usedRandomHashes_codec); - if (StartAwardId != 0L) { - output.WriteRawTag(40); - output.WriteInt64(StartAwardId); - } - if (EndAwardId != 0L) { - output.WriteRawTag(48); - output.WriteInt64(EndAwardId); - } - if (DrewAwardId != 0L) { - output.WriteRawTag(56); - output.WriteInt64(DrewAwardId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (PeriodId != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(PeriodId); - } - if (startTimestamp_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(StartTimestamp); - } - if (endTimestamp_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(EndTimestamp); - } - size += usedRandomHashes_.CalculateSize(_repeated_usedRandomHashes_codec); - if (StartAwardId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(StartAwardId); - } - if (EndAwardId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(EndAwardId); - } - if (DrewAwardId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(DrewAwardId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(PeriodAward other) { - if (other == null) { - return; - } - if (other.PeriodId != 0) { - PeriodId = other.PeriodId; - } - if (other.startTimestamp_ != null) { - if (startTimestamp_ == null) { - StartTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - StartTimestamp.MergeFrom(other.StartTimestamp); - } - if (other.endTimestamp_ != null) { - if (endTimestamp_ == null) { - EndTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - EndTimestamp.MergeFrom(other.EndTimestamp); - } - usedRandomHashes_.Add(other.usedRandomHashes_); - if (other.StartAwardId != 0L) { - StartAwardId = other.StartAwardId; - } - if (other.EndAwardId != 0L) { - EndAwardId = other.EndAwardId; - } - if (other.DrewAwardId != 0L) { - DrewAwardId = other.DrewAwardId; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - PeriodId = input.ReadInt32(); - break; - } - case 18: { - if (startTimestamp_ == null) { - StartTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(StartTimestamp); - break; - } - case 26: { - if (endTimestamp_ == null) { - EndTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(EndTimestamp); - break; - } - case 34: { - usedRandomHashes_.AddEntriesFrom(input, _repeated_usedRandomHashes_codec); - break; - } - case 40: { - StartAwardId = input.ReadInt64(); - break; - } - case 48: { - EndAwardId = input.ReadInt64(); - break; - } - case 56: { - DrewAwardId = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class DrawInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DrawInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Lottery.LotteryContractReflection.Descriptor.MessageTypes[7]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DrawInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DrawInput(DrawInput other) : this() { - periodId_ = other.periodId_; - nextAwardList_ = other.nextAwardList_.Clone(); - toAwardId_ = other.toAwardId_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DrawInput Clone() { - return new DrawInput(this); - } - - /// Field number for the "period_id" field. - public const int PeriodIdFieldNumber = 1; - private int periodId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int PeriodId { - get { return periodId_; } - set { - periodId_ = value; - } - } - - /// Field number for the "next_award_list" field. - public const int NextAwardListFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_nextAwardList_codec - = pb::FieldCodec.ForInt64(18); - private readonly pbc::RepeatedField nextAwardList_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NextAwardList { - get { return nextAwardList_; } - } - - /// Field number for the "to_award_id" field. - public const int ToAwardIdFieldNumber = 3; - private long toAwardId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ToAwardId { - get { return toAwardId_; } - set { - toAwardId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as DrawInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DrawInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (PeriodId != other.PeriodId) return false; - if(!nextAwardList_.Equals(other.nextAwardList_)) return false; - if (ToAwardId != other.ToAwardId) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (PeriodId != 0) hash ^= PeriodId.GetHashCode(); - hash ^= nextAwardList_.GetHashCode(); - if (ToAwardId != 0L) hash ^= ToAwardId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (PeriodId != 0) { - output.WriteRawTag(8); - output.WriteInt32(PeriodId); - } - nextAwardList_.WriteTo(output, _repeated_nextAwardList_codec); - if (ToAwardId != 0L) { - output.WriteRawTag(24); - output.WriteInt64(ToAwardId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (PeriodId != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(PeriodId); - } - size += nextAwardList_.CalculateSize(_repeated_nextAwardList_codec); - if (ToAwardId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(ToAwardId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DrawInput other) { - if (other == null) { - return; - } - if (other.PeriodId != 0) { - PeriodId = other.PeriodId; - } - nextAwardList_.Add(other.nextAwardList_); - if (other.ToAwardId != 0L) { - ToAwardId = other.ToAwardId; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - PeriodId = input.ReadInt32(); - break; - } - case 18: - case 16: { - nextAwardList_.AddEntriesFrom(input, _repeated_nextAwardList_codec); - break; - } - case 24: { - ToAwardId = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class GetAwardListInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetAwardListInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Lottery.LotteryContractReflection.Descriptor.MessageTypes[8]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetAwardListInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetAwardListInput(GetAwardListInput other) : this() { - periodId_ = other.periodId_; - startIndex_ = other.startIndex_; - count_ = other.count_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetAwardListInput Clone() { - return new GetAwardListInput(this); - } - - /// Field number for the "period_id" field. - public const int PeriodIdFieldNumber = 1; - private int periodId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int PeriodId { - get { return periodId_; } - set { - periodId_ = value; - } - } - - /// Field number for the "start_index" field. - public const int StartIndexFieldNumber = 2; - private long startIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long StartIndex { - get { return startIndex_; } - set { - startIndex_ = value; - } - } - - /// Field number for the "count" field. - public const int CountFieldNumber = 3; - private int count_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Count { - get { return count_; } - set { - count_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GetAwardListInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GetAwardListInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (PeriodId != other.PeriodId) return false; - if (StartIndex != other.StartIndex) return false; - if (Count != other.Count) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (PeriodId != 0) hash ^= PeriodId.GetHashCode(); - if (StartIndex != 0L) hash ^= StartIndex.GetHashCode(); - if (Count != 0) hash ^= Count.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (PeriodId != 0) { - output.WriteRawTag(8); - output.WriteInt32(PeriodId); - } - if (StartIndex != 0L) { - output.WriteRawTag(16); - output.WriteInt64(StartIndex); - } - if (Count != 0) { - output.WriteRawTag(24); - output.WriteInt32(Count); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (PeriodId != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(PeriodId); - } - if (StartIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(StartIndex); - } - if (Count != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Count); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GetAwardListInput other) { - if (other == null) { - return; - } - if (other.PeriodId != 0) { - PeriodId = other.PeriodId; - } - if (other.StartIndex != 0L) { - StartIndex = other.StartIndex; - } - if (other.Count != 0) { - Count = other.Count; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - PeriodId = input.ReadInt32(); - break; - } - case 16: { - StartIndex = input.ReadInt64(); - break; - } - case 24: { - Count = input.ReadInt32(); - break; - } - } - } - } - - } - - public sealed partial class AwardAmountMap : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AwardAmountMap()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Lottery.LotteryContractReflection.Descriptor.MessageTypes[9]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AwardAmountMap() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AwardAmountMap(AwardAmountMap other) : this() { - value_ = other.value_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AwardAmountMap Clone() { - return new AwardAmountMap(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private static readonly pbc::MapField.Codec _map_value_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt64(8, 0L), pb::FieldCodec.ForInt64(16, 0L), 10); - private readonly pbc::MapField value_ = new pbc::MapField(); - /// - /// Lottery Code -> Award Amount - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField Value { - get { return value_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as AwardAmountMap); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(AwardAmountMap other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!Value.Equals(other.Value)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - value_.WriteTo(output, _map_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += value_.CalculateSize(_map_value_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(AwardAmountMap other) { - if (other == null) { - return; - } - value_.Add(other.value_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - value_.AddEntriesFrom(input, _map_value_codec); - break; - } - } - } - } - - } - - public sealed partial class DrewFinished : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DrewFinished()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Lottery.LotteryContractReflection.Descriptor.MessageTypes[10]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DrewFinished() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DrewFinished(DrewFinished other) : this() { - periodId_ = other.periodId_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DrewFinished Clone() { - return new DrewFinished(this); - } - - /// Field number for the "period_id" field. - public const int PeriodIdFieldNumber = 1; - private long periodId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long PeriodId { - get { return periodId_; } - set { - periodId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as DrewFinished); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DrewFinished other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (PeriodId != other.PeriodId) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (PeriodId != 0L) hash ^= PeriodId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (PeriodId != 0L) { - output.WriteRawTag(8); - output.WriteInt64(PeriodId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (PeriodId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(PeriodId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DrewFinished other) { - if (other == null) { - return; - } - if (other.PeriodId != 0L) { - PeriodId = other.PeriodId; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - PeriodId = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class DrewUnfinished : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DrewUnfinished()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Lottery.LotteryContractReflection.Descriptor.MessageTypes[11]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DrewUnfinished() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DrewUnfinished(DrewUnfinished other) : this() { - periodId_ = other.periodId_; - toAwardId_ = other.toAwardId_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DrewUnfinished Clone() { - return new DrewUnfinished(this); - } - - /// Field number for the "period_id" field. - public const int PeriodIdFieldNumber = 1; - private long periodId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long PeriodId { - get { return periodId_; } - set { - periodId_ = value; - } - } - - /// Field number for the "to_award_id" field. - public const int ToAwardIdFieldNumber = 2; - private long toAwardId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ToAwardId { - get { return toAwardId_; } - set { - toAwardId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as DrewUnfinished); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DrewUnfinished other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (PeriodId != other.PeriodId) return false; - if (ToAwardId != other.ToAwardId) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (PeriodId != 0L) hash ^= PeriodId.GetHashCode(); - if (ToAwardId != 0L) hash ^= ToAwardId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (PeriodId != 0L) { - output.WriteRawTag(8); - output.WriteInt64(PeriodId); - } - if (ToAwardId != 0L) { - output.WriteRawTag(16); - output.WriteInt64(ToAwardId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (PeriodId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(PeriodId); - } - if (ToAwardId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(ToAwardId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DrewUnfinished other) { - if (other == null) { - return; - } - if (other.PeriodId != 0L) { - PeriodId = other.PeriodId; - } - if (other.ToAwardId != 0L) { - ToAwardId = other.ToAwardId; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - PeriodId = input.ReadInt64(); - break; - } - case 16: { - ToAwardId = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class Staked : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Staked()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Lottery.LotteryContractReflection.Descriptor.MessageTypes[12]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Staked() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Staked(Staked other) : this() { - user_ = other.user_ != null ? other.user_.Clone() : null; - amount_ = other.amount_; - lotteryCodeList_ = other.lotteryCodeList_ != null ? other.lotteryCodeList_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Staked Clone() { - return new Staked(this); - } - - /// Field number for the "user" field. - public const int UserFieldNumber = 1; - private global::AElf.Types.Address user_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address User { - get { return user_; } - set { - user_ = value; - } - } - - /// Field number for the "amount" field. - public const int AmountFieldNumber = 2; - private long amount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Amount { - get { return amount_; } - set { - amount_ = value; - } - } - - /// Field number for the "lottery_code_list" field. - public const int LotteryCodeListFieldNumber = 3; - private global::AElf.Contracts.Lottery.Int64List lotteryCodeList_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Lottery.Int64List LotteryCodeList { - get { return lotteryCodeList_; } - set { - lotteryCodeList_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Staked); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Staked other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(User, other.User)) return false; - if (Amount != other.Amount) return false; - if (!object.Equals(LotteryCodeList, other.LotteryCodeList)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (user_ != null) hash ^= User.GetHashCode(); - if (Amount != 0L) hash ^= Amount.GetHashCode(); - if (lotteryCodeList_ != null) hash ^= LotteryCodeList.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (user_ != null) { - output.WriteRawTag(10); - output.WriteMessage(User); - } - if (Amount != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Amount); - } - if (lotteryCodeList_ != null) { - output.WriteRawTag(26); - output.WriteMessage(LotteryCodeList); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (user_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(User); - } - if (Amount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Amount); - } - if (lotteryCodeList_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(LotteryCodeList); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Staked other) { - if (other == null) { - return; - } - if (other.user_ != null) { - if (user_ == null) { - User = new global::AElf.Types.Address(); - } - User.MergeFrom(other.User); - } - if (other.Amount != 0L) { - Amount = other.Amount; - } - if (other.lotteryCodeList_ != null) { - if (lotteryCodeList_ == null) { - LotteryCodeList = new global::AElf.Contracts.Lottery.Int64List(); - } - LotteryCodeList.MergeFrom(other.LotteryCodeList); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (user_ == null) { - User = new global::AElf.Types.Address(); - } - input.ReadMessage(User); - break; - } - case 16: { - Amount = input.ReadInt64(); - break; - } - case 26: { - if (lotteryCodeList_ == null) { - LotteryCodeList = new global::AElf.Contracts.Lottery.Int64List(); - } - input.ReadMessage(LotteryCodeList); - break; - } - } - } - } - - } - - public sealed partial class Redeemed : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Redeemed()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Lottery.LotteryContractReflection.Descriptor.MessageTypes[13]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Redeemed() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Redeemed(Redeemed other) : this() { - user_ = other.user_ != null ? other.user_.Clone() : null; - amount_ = other.amount_; - periodId_ = other.periodId_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Redeemed Clone() { - return new Redeemed(this); - } - - /// Field number for the "user" field. - public const int UserFieldNumber = 1; - private global::AElf.Types.Address user_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address User { - get { return user_; } - set { - user_ = value; - } - } - - /// Field number for the "amount" field. - public const int AmountFieldNumber = 2; - private long amount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Amount { - get { return amount_; } - set { - amount_ = value; - } - } - - /// Field number for the "period_id" field. - public const int PeriodIdFieldNumber = 3; - private long periodId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long PeriodId { - get { return periodId_; } - set { - periodId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Redeemed); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Redeemed other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(User, other.User)) return false; - if (Amount != other.Amount) return false; - if (PeriodId != other.PeriodId) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (user_ != null) hash ^= User.GetHashCode(); - if (Amount != 0L) hash ^= Amount.GetHashCode(); - if (PeriodId != 0L) hash ^= PeriodId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (user_ != null) { - output.WriteRawTag(10); - output.WriteMessage(User); - } - if (Amount != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Amount); - } - if (PeriodId != 0L) { - output.WriteRawTag(24); - output.WriteInt64(PeriodId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (user_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(User); - } - if (Amount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Amount); - } - if (PeriodId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(PeriodId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Redeemed other) { - if (other == null) { - return; - } - if (other.user_ != null) { - if (user_ == null) { - User = new global::AElf.Types.Address(); - } - User.MergeFrom(other.User); - } - if (other.Amount != 0L) { - Amount = other.Amount; - } - if (other.PeriodId != 0L) { - PeriodId = other.PeriodId; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (user_ == null) { - User = new global::AElf.Types.Address(); - } - input.ReadMessage(User); - break; - } - case 16: { - Amount = input.ReadInt64(); - break; - } - case 24: { - PeriodId = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class Claimed : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Claimed()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Lottery.LotteryContractReflection.Descriptor.MessageTypes[14]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Claimed() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Claimed(Claimed other) : this() { - user_ = other.user_ != null ? other.user_.Clone() : null; - amount_ = other.amount_; - periodId_ = other.periodId_; - claimedLotteryCodeList_ = other.claimedLotteryCodeList_ != null ? other.claimedLotteryCodeList_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Claimed Clone() { - return new Claimed(this); - } - - /// Field number for the "user" field. - public const int UserFieldNumber = 1; - private global::AElf.Types.Address user_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address User { - get { return user_; } - set { - user_ = value; - } - } - - /// Field number for the "amount" field. - public const int AmountFieldNumber = 2; - private long amount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Amount { - get { return amount_; } - set { - amount_ = value; - } - } - - /// Field number for the "period_id" field. - public const int PeriodIdFieldNumber = 3; - private long periodId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long PeriodId { - get { return periodId_; } - set { - periodId_ = value; - } - } - - /// Field number for the "claimed_lottery_code_list" field. - public const int ClaimedLotteryCodeListFieldNumber = 4; - private global::AElf.Contracts.Lottery.Int64List claimedLotteryCodeList_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Lottery.Int64List ClaimedLotteryCodeList { - get { return claimedLotteryCodeList_; } - set { - claimedLotteryCodeList_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Claimed); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Claimed other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(User, other.User)) return false; - if (Amount != other.Amount) return false; - if (PeriodId != other.PeriodId) return false; - if (!object.Equals(ClaimedLotteryCodeList, other.ClaimedLotteryCodeList)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (user_ != null) hash ^= User.GetHashCode(); - if (Amount != 0L) hash ^= Amount.GetHashCode(); - if (PeriodId != 0L) hash ^= PeriodId.GetHashCode(); - if (claimedLotteryCodeList_ != null) hash ^= ClaimedLotteryCodeList.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (user_ != null) { - output.WriteRawTag(10); - output.WriteMessage(User); - } - if (Amount != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Amount); - } - if (PeriodId != 0L) { - output.WriteRawTag(24); - output.WriteInt64(PeriodId); - } - if (claimedLotteryCodeList_ != null) { - output.WriteRawTag(34); - output.WriteMessage(ClaimedLotteryCodeList); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (user_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(User); - } - if (Amount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Amount); - } - if (PeriodId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(PeriodId); - } - if (claimedLotteryCodeList_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ClaimedLotteryCodeList); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Claimed other) { - if (other == null) { - return; - } - if (other.user_ != null) { - if (user_ == null) { - User = new global::AElf.Types.Address(); - } - User.MergeFrom(other.User); - } - if (other.Amount != 0L) { - Amount = other.Amount; - } - if (other.PeriodId != 0L) { - PeriodId = other.PeriodId; - } - if (other.claimedLotteryCodeList_ != null) { - if (claimedLotteryCodeList_ == null) { - ClaimedLotteryCodeList = new global::AElf.Contracts.Lottery.Int64List(); - } - ClaimedLotteryCodeList.MergeFrom(other.ClaimedLotteryCodeList); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (user_ == null) { - User = new global::AElf.Types.Address(); - } - input.ReadMessage(User); - break; - } - case 16: { - Amount = input.ReadInt64(); - break; - } - case 24: { - PeriodId = input.ReadInt64(); - break; - } - case 34: { - if (claimedLotteryCodeList_ == null) { - ClaimedLotteryCodeList = new global::AElf.Contracts.Lottery.Int64List(); - } - input.ReadMessage(ClaimedLotteryCodeList); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/src/AElf.EventHandler/Dto/MTGeneratorc.cs b/src/AElf.EventHandler/Dto/MTGeneratorc.cs deleted file mode 100644 index decd622d..00000000 --- a/src/AElf.EventHandler/Dto/MTGeneratorc.cs +++ /dev/null @@ -1,157 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: merkle_tree_generator.proto -// -#pragma warning disable 0414, 1591 -#region Designer generated code - -using System.Collections.Generic; -using aelf = global::AElf.CSharp.Core; - -namespace AElf.Contracts.MerkleTreeGeneratorContract { - - #region Events - internal partial class ReceiptMakerRegistered : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - new ReceiptMakerRegistered - { - ReceiptMakerAddress = ReceiptMakerAddress - }, - }; - } - - public ReceiptMakerRegistered GetNonIndexed() - { - return new ReceiptMakerRegistered - { - }; - } - } - - internal partial class ReceiptMakerUnRegistered : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - new ReceiptMakerUnRegistered - { - ReceiptMakerAddress = ReceiptMakerAddress - }, - }; - } - - public ReceiptMakerUnRegistered GetNonIndexed() - { - return new ReceiptMakerUnRegistered - { - }; - } - } - - #endregion - internal static partial class MerkleTreeGeneratorContractContainer - { - static readonly string __ServiceName = "MerkleTreeGeneratorContract"; - - #region Marshallers - static readonly aelf::Marshaller __Marshaller_InitializeInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.MerkleTreeGeneratorContract.InitializeInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_Empty = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_RegisterReceiptMakerInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.MerkleTreeGeneratorContract.RegisterReceiptMakerInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_aelf_Address = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Types.Address.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_Int64Value = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Int64Value.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_GetMerkleTreeInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.MerkleTreeGeneratorContract.GetMerkleTreeInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_GetMerkleTreeOutput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.MerkleTreeGeneratorContract.GetMerkleTreeOutput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_GetReceiptMakerOutput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.MerkleTreeGeneratorContract.GetReceiptMakerOutput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_GetMerklePathInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.MerkleTreeGeneratorContract.GetMerklePathInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_aelf_MerklePath = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Types.MerklePath.Parser.ParseFrom); - #endregion - - #region Methods - static readonly aelf::Method __Method_Initialize = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "Initialize", - __Marshaller_InitializeInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_RegisterReceiptMaker = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "RegisterReceiptMaker", - __Marshaller_RegisterReceiptMakerInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_UnRegisterReceiptMaker = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "UnRegisterReceiptMaker", - __Marshaller_aelf_Address, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_GetFullTreeCount = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetFullTreeCount", - __Marshaller_aelf_Address, - __Marshaller_google_protobuf_Int64Value); - - static readonly aelf::Method __Method_GetMerkleTree = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetMerkleTree", - __Marshaller_GetMerkleTreeInput, - __Marshaller_GetMerkleTreeOutput); - - static readonly aelf::Method __Method_GetReceiptMaker = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetReceiptMaker", - __Marshaller_aelf_Address, - __Marshaller_GetReceiptMakerOutput); - - static readonly aelf::Method __Method_GetMerklePath = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetMerklePath", - __Marshaller_GetMerklePathInput, - __Marshaller_aelf_MerklePath); - - #endregion - - #region Descriptors - public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor - { - get { return global::AElf.Contracts.MerkleTreeGeneratorContract.MerkleTreeGeneratorReflection.Descriptor.Services[0]; } - } - - public static global::System.Collections.Generic.IReadOnlyList Descriptors - { - get - { - return new global::System.Collections.Generic.List() - { - global::AElf.Contracts.MerkleTreeGeneratorContract.MerkleTreeGeneratorReflection.Descriptor.Services[0], - }; - } - } - #endregion - - public class MerkleTreeGeneratorContractReferenceState : global::AElf.Sdk.CSharp.State.ContractReferenceState - { - internal global::AElf.Sdk.CSharp.State.MethodReference Initialize { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference RegisterReceiptMaker { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference UnRegisterReceiptMaker { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference GetFullTreeCount { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference GetMerkleTree { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference GetReceiptMaker { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference GetMerklePath { get; set; } - } - } -} -#endregion - diff --git a/src/AElf.EventHandler/Dto/MTGeneratorg.cs b/src/AElf.EventHandler/Dto/MTGeneratorg.cs deleted file mode 100644 index 658964c1..00000000 --- a/src/AElf.EventHandler/Dto/MTGeneratorg.cs +++ /dev/null @@ -1,1776 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: merkle_tree_generator.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace AElf.Contracts.MerkleTreeGeneratorContract { - - /// Holder for reflection information generated from merkle_tree_generator.proto - internal static partial class MerkleTreeGeneratorReflection { - - #region Descriptor - /// File descriptor for merkle_tree_generator.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static MerkleTreeGeneratorReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChttZXJrbGVfdHJlZV9nZW5lcmF0b3IucHJvdG8aD2FlbGYvY29yZS5wcm90", - "bxoSYWVsZi9vcHRpb25zLnByb3RvGhtnb29nbGUvcHJvdG9idWYvZW1wdHku", - "cHJvdG8aE3JlY2VpcHRfbWFrZXIucHJvdG8aHmdvb2dsZS9wcm90b2J1Zi93", - "cmFwcGVycy5wcm90byIvCg9Jbml0aWFsaXplSW5wdXQSHAoFb3duZXIYASAB", - "KAsyDS5hZWxmLkFkZHJlc3MiaQoZUmVnaXN0ZXJSZWNlaXB0TWFrZXJJbnB1", - "dBIsChVyZWNlaXB0X21ha2VyX2FkZHJlc3MYASABKAsyDS5hZWxmLkFkZHJl", - "c3MSHgoWbWVya2xlX3RyZWVfbGVhZl9saW1pdBgCIAEoBSJkChJHZXRNZXJr", - "bGVUcmVlSW5wdXQSLAoVcmVjZWlwdF9tYWtlcl9hZGRyZXNzGAEgASgLMg0u", - "YWVsZi5BZGRyZXNzEiAKGGV4cGVjdGVkX2Z1bGxfdHJlZV9pbmRleBgCIAEo", - "AyJ6ChNHZXRNZXJrbGVUcmVlT3V0cHV0EiQKEG1lcmtsZV90cmVlX3Jvb3QY", - "ASABKAsyCi5hZWxmLkhhc2gSEwoLZmlyc3RfaW5kZXgYAiABKAMSEgoKbGFz", - "dF9pbmRleBgDIAEoAxIUCgxpc19mdWxsX3RyZWUYBCABKAgiXAoMUmVjZWlw", - "dE1ha2VyEiwKFXJlY2VpcHRfbWFrZXJfYWRkcmVzcxgBIAEoCzINLmFlbGYu", - "QWRkcmVzcxIeChZtZXJrbGVfdHJlZV9sZWFmX2xpbWl0GAIgASgFInsKCk1l", - "cmtsZVRyZWUSJAoQbWVya2xlX3RyZWVfcm9vdBgBIAEoCzIKLmFlbGYuSGFz", - "aBIYChBmaXJzdF9sZWFmX2luZGV4GAIgASgDEhcKD2xhc3RfbGVhZl9pbmRl", - "eBgDIAEoAxIUCgxpc19mdWxsX3RyZWUYBCABKAgiZQoVR2V0UmVjZWlwdE1h", - "a2VyT3V0cHV0EiwKFXJlY2VpcHRfbWFrZXJfYWRkcmVzcxgBIAEoCzINLmFl", - "bGYuQWRkcmVzcxIeChZtZXJrbGVfdHJlZV9sZWFmX2xpbWl0GAIgASgFImcK", - "EkdldE1lcmtsZVBhdGhJbnB1dBIkCg1yZWNlaXB0X21ha2VyGAEgASgLMg0u", - "YWVsZi5BZGRyZXNzEhIKCnJlY2VpcHRfaWQYAiABKAMSFwoPbGFzdF9sZWFm", - "X2luZGV4GAMgASgDIlMKFlJlY2VpcHRNYWtlclJlZ2lzdGVyZWQSMwoVcmVj", - "ZWlwdF9tYWtlcl9hZGRyZXNzGAEgASgLMg0uYWVsZi5BZGRyZXNzQgWIj/UB", - "AToEoLsYASJVChhSZWNlaXB0TWFrZXJVblJlZ2lzdGVyZWQSMwoVcmVjZWlw", - "dF9tYWtlcl9hZGRyZXNzGAEgASgLMg0uYWVsZi5BZGRyZXNzQgWIj/UBAToE", - "oLsYATLEBAobTWVya2xlVHJlZUdlbmVyYXRvckNvbnRyYWN0EjgKCkluaXRp", - "YWxpemUSEC5Jbml0aWFsaXplSW5wdXQaFi5nb29nbGUucHJvdG9idWYuRW1w", - "dHkiABJMChRSZWdpc3RlclJlY2VpcHRNYWtlchIaLlJlZ2lzdGVyUmVjZWlw", - "dE1ha2VySW5wdXQaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiABJBChZVblJl", - "Z2lzdGVyUmVjZWlwdE1ha2VyEg0uYWVsZi5BZGRyZXNzGhYuZ29vZ2xlLnBy", - "b3RvYnVmLkVtcHR5IgASRQoQR2V0RnVsbFRyZWVDb3VudBINLmFlbGYuQWRk", - "cmVzcxobLmdvb2dsZS5wcm90b2J1Zi5JbnQ2NFZhbHVlIgWIifcBARJBCg1H", - "ZXRNZXJrbGVUcmVlEhMuR2V0TWVya2xlVHJlZUlucHV0GhQuR2V0TWVya2xl", - "VHJlZU91dHB1dCIFiIn3AQESPwoPR2V0UmVjZWlwdE1ha2VyEg0uYWVsZi5B", - "ZGRyZXNzGhYuR2V0UmVjZWlwdE1ha2VyT3V0cHV0IgWIifcBARI9Cg1HZXRN", - "ZXJrbGVQYXRoEhMuR2V0TWVya2xlUGF0aElucHV0GhAuYWVsZi5NZXJrbGVQ", - "YXRoIgWIifcBARpQssz2AUtBRWxmLkNvbnRyYWN0cy5NZXJrbGVUcmVlR2Vu", - "ZXJhdG9yQ29udHJhY3QuTWVya2xlVHJlZUdlbmVyYXRvckNvbnRyYWN0U3Rh", - "dGVCLaoCKkFFbGYuQ29udHJhY3RzLk1lcmtsZVRyZWVHZW5lcmF0b3JDb250", - "cmFjdGIGcHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::AElf.Types.CoreReflection.Descriptor, global::AElf.OptionsReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::AElf.Contracts.ReceiptMakerContract.ReceiptMakerReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.MerkleTreeGeneratorContract.InitializeInput), global::AElf.Contracts.MerkleTreeGeneratorContract.InitializeInput.Parser, new[]{ "Owner" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.MerkleTreeGeneratorContract.RegisterReceiptMakerInput), global::AElf.Contracts.MerkleTreeGeneratorContract.RegisterReceiptMakerInput.Parser, new[]{ "ReceiptMakerAddress", "MerkleTreeLeafLimit" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.MerkleTreeGeneratorContract.GetMerkleTreeInput), global::AElf.Contracts.MerkleTreeGeneratorContract.GetMerkleTreeInput.Parser, new[]{ "ReceiptMakerAddress", "ExpectedFullTreeIndex" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.MerkleTreeGeneratorContract.GetMerkleTreeOutput), global::AElf.Contracts.MerkleTreeGeneratorContract.GetMerkleTreeOutput.Parser, new[]{ "MerkleTreeRoot", "FirstIndex", "LastIndex", "IsFullTree" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.MerkleTreeGeneratorContract.ReceiptMaker), global::AElf.Contracts.MerkleTreeGeneratorContract.ReceiptMaker.Parser, new[]{ "ReceiptMakerAddress", "MerkleTreeLeafLimit" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.MerkleTreeGeneratorContract.MerkleTree), global::AElf.Contracts.MerkleTreeGeneratorContract.MerkleTree.Parser, new[]{ "MerkleTreeRoot", "FirstLeafIndex", "LastLeafIndex", "IsFullTree" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.MerkleTreeGeneratorContract.GetReceiptMakerOutput), global::AElf.Contracts.MerkleTreeGeneratorContract.GetReceiptMakerOutput.Parser, new[]{ "ReceiptMakerAddress", "MerkleTreeLeafLimit" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.MerkleTreeGeneratorContract.GetMerklePathInput), global::AElf.Contracts.MerkleTreeGeneratorContract.GetMerklePathInput.Parser, new[]{ "ReceiptMaker", "ReceiptId", "LastLeafIndex" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.MerkleTreeGeneratorContract.ReceiptMakerRegistered), global::AElf.Contracts.MerkleTreeGeneratorContract.ReceiptMakerRegistered.Parser, new[]{ "ReceiptMakerAddress" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.MerkleTreeGeneratorContract.ReceiptMakerUnRegistered), global::AElf.Contracts.MerkleTreeGeneratorContract.ReceiptMakerUnRegistered.Parser, new[]{ "ReceiptMakerAddress" }, null, null, null, null) - })); - } - #endregion - - } - #region Messages - internal sealed partial class InitializeInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new InitializeInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.MerkleTreeGeneratorContract.MerkleTreeGeneratorReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitializeInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitializeInput(InitializeInput other) : this() { - owner_ = other.owner_ != null ? other.owner_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitializeInput Clone() { - return new InitializeInput(this); - } - - /// Field number for the "owner" field. - public const int OwnerFieldNumber = 1; - private global::AElf.Types.Address owner_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Owner { - get { return owner_; } - set { - owner_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as InitializeInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(InitializeInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Owner, other.Owner)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (owner_ != null) hash ^= Owner.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (owner_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Owner); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (owner_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Owner); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(InitializeInput other) { - if (other == null) { - return; - } - if (other.owner_ != null) { - if (owner_ == null) { - Owner = new global::AElf.Types.Address(); - } - Owner.MergeFrom(other.Owner); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (owner_ == null) { - Owner = new global::AElf.Types.Address(); - } - input.ReadMessage(Owner); - break; - } - } - } - } - - } - - internal sealed partial class RegisterReceiptMakerInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegisterReceiptMakerInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.MerkleTreeGeneratorContract.MerkleTreeGeneratorReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RegisterReceiptMakerInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RegisterReceiptMakerInput(RegisterReceiptMakerInput other) : this() { - receiptMakerAddress_ = other.receiptMakerAddress_ != null ? other.receiptMakerAddress_.Clone() : null; - merkleTreeLeafLimit_ = other.merkleTreeLeafLimit_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RegisterReceiptMakerInput Clone() { - return new RegisterReceiptMakerInput(this); - } - - /// Field number for the "receipt_maker_address" field. - public const int ReceiptMakerAddressFieldNumber = 1; - private global::AElf.Types.Address receiptMakerAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address ReceiptMakerAddress { - get { return receiptMakerAddress_; } - set { - receiptMakerAddress_ = value; - } - } - - /// Field number for the "merkle_tree_leaf_limit" field. - public const int MerkleTreeLeafLimitFieldNumber = 2; - private int merkleTreeLeafLimit_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int MerkleTreeLeafLimit { - get { return merkleTreeLeafLimit_; } - set { - merkleTreeLeafLimit_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as RegisterReceiptMakerInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(RegisterReceiptMakerInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(ReceiptMakerAddress, other.ReceiptMakerAddress)) return false; - if (MerkleTreeLeafLimit != other.MerkleTreeLeafLimit) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (receiptMakerAddress_ != null) hash ^= ReceiptMakerAddress.GetHashCode(); - if (MerkleTreeLeafLimit != 0) hash ^= MerkleTreeLeafLimit.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (receiptMakerAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(ReceiptMakerAddress); - } - if (MerkleTreeLeafLimit != 0) { - output.WriteRawTag(16); - output.WriteInt32(MerkleTreeLeafLimit); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (receiptMakerAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ReceiptMakerAddress); - } - if (MerkleTreeLeafLimit != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(MerkleTreeLeafLimit); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(RegisterReceiptMakerInput other) { - if (other == null) { - return; - } - if (other.receiptMakerAddress_ != null) { - if (receiptMakerAddress_ == null) { - ReceiptMakerAddress = new global::AElf.Types.Address(); - } - ReceiptMakerAddress.MergeFrom(other.ReceiptMakerAddress); - } - if (other.MerkleTreeLeafLimit != 0) { - MerkleTreeLeafLimit = other.MerkleTreeLeafLimit; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (receiptMakerAddress_ == null) { - ReceiptMakerAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(ReceiptMakerAddress); - break; - } - case 16: { - MerkleTreeLeafLimit = input.ReadInt32(); - break; - } - } - } - } - - } - - internal sealed partial class GetMerkleTreeInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetMerkleTreeInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.MerkleTreeGeneratorContract.MerkleTreeGeneratorReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetMerkleTreeInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetMerkleTreeInput(GetMerkleTreeInput other) : this() { - receiptMakerAddress_ = other.receiptMakerAddress_ != null ? other.receiptMakerAddress_.Clone() : null; - expectedFullTreeIndex_ = other.expectedFullTreeIndex_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetMerkleTreeInput Clone() { - return new GetMerkleTreeInput(this); - } - - /// Field number for the "receipt_maker_address" field. - public const int ReceiptMakerAddressFieldNumber = 1; - private global::AElf.Types.Address receiptMakerAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address ReceiptMakerAddress { - get { return receiptMakerAddress_; } - set { - receiptMakerAddress_ = value; - } - } - - /// Field number for the "expected_full_tree_index" field. - public const int ExpectedFullTreeIndexFieldNumber = 2; - private long expectedFullTreeIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ExpectedFullTreeIndex { - get { return expectedFullTreeIndex_; } - set { - expectedFullTreeIndex_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GetMerkleTreeInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GetMerkleTreeInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(ReceiptMakerAddress, other.ReceiptMakerAddress)) return false; - if (ExpectedFullTreeIndex != other.ExpectedFullTreeIndex) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (receiptMakerAddress_ != null) hash ^= ReceiptMakerAddress.GetHashCode(); - if (ExpectedFullTreeIndex != 0L) hash ^= ExpectedFullTreeIndex.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (receiptMakerAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(ReceiptMakerAddress); - } - if (ExpectedFullTreeIndex != 0L) { - output.WriteRawTag(16); - output.WriteInt64(ExpectedFullTreeIndex); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (receiptMakerAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ReceiptMakerAddress); - } - if (ExpectedFullTreeIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(ExpectedFullTreeIndex); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GetMerkleTreeInput other) { - if (other == null) { - return; - } - if (other.receiptMakerAddress_ != null) { - if (receiptMakerAddress_ == null) { - ReceiptMakerAddress = new global::AElf.Types.Address(); - } - ReceiptMakerAddress.MergeFrom(other.ReceiptMakerAddress); - } - if (other.ExpectedFullTreeIndex != 0L) { - ExpectedFullTreeIndex = other.ExpectedFullTreeIndex; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (receiptMakerAddress_ == null) { - ReceiptMakerAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(ReceiptMakerAddress); - break; - } - case 16: { - ExpectedFullTreeIndex = input.ReadInt64(); - break; - } - } - } - } - - } - - internal sealed partial class GetMerkleTreeOutput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetMerkleTreeOutput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.MerkleTreeGeneratorContract.MerkleTreeGeneratorReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetMerkleTreeOutput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetMerkleTreeOutput(GetMerkleTreeOutput other) : this() { - merkleTreeRoot_ = other.merkleTreeRoot_ != null ? other.merkleTreeRoot_.Clone() : null; - firstIndex_ = other.firstIndex_; - lastIndex_ = other.lastIndex_; - isFullTree_ = other.isFullTree_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetMerkleTreeOutput Clone() { - return new GetMerkleTreeOutput(this); - } - - /// Field number for the "merkle_tree_root" field. - public const int MerkleTreeRootFieldNumber = 1; - private global::AElf.Types.Hash merkleTreeRoot_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash MerkleTreeRoot { - get { return merkleTreeRoot_; } - set { - merkleTreeRoot_ = value; - } - } - - /// Field number for the "first_index" field. - public const int FirstIndexFieldNumber = 2; - private long firstIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long FirstIndex { - get { return firstIndex_; } - set { - firstIndex_ = value; - } - } - - /// Field number for the "last_index" field. - public const int LastIndexFieldNumber = 3; - private long lastIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long LastIndex { - get { return lastIndex_; } - set { - lastIndex_ = value; - } - } - - /// Field number for the "is_full_tree" field. - public const int IsFullTreeFieldNumber = 4; - private bool isFullTree_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsFullTree { - get { return isFullTree_; } - set { - isFullTree_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GetMerkleTreeOutput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GetMerkleTreeOutput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(MerkleTreeRoot, other.MerkleTreeRoot)) return false; - if (FirstIndex != other.FirstIndex) return false; - if (LastIndex != other.LastIndex) return false; - if (IsFullTree != other.IsFullTree) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (merkleTreeRoot_ != null) hash ^= MerkleTreeRoot.GetHashCode(); - if (FirstIndex != 0L) hash ^= FirstIndex.GetHashCode(); - if (LastIndex != 0L) hash ^= LastIndex.GetHashCode(); - if (IsFullTree != false) hash ^= IsFullTree.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (merkleTreeRoot_ != null) { - output.WriteRawTag(10); - output.WriteMessage(MerkleTreeRoot); - } - if (FirstIndex != 0L) { - output.WriteRawTag(16); - output.WriteInt64(FirstIndex); - } - if (LastIndex != 0L) { - output.WriteRawTag(24); - output.WriteInt64(LastIndex); - } - if (IsFullTree != false) { - output.WriteRawTag(32); - output.WriteBool(IsFullTree); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (merkleTreeRoot_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(MerkleTreeRoot); - } - if (FirstIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(FirstIndex); - } - if (LastIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(LastIndex); - } - if (IsFullTree != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GetMerkleTreeOutput other) { - if (other == null) { - return; - } - if (other.merkleTreeRoot_ != null) { - if (merkleTreeRoot_ == null) { - MerkleTreeRoot = new global::AElf.Types.Hash(); - } - MerkleTreeRoot.MergeFrom(other.MerkleTreeRoot); - } - if (other.FirstIndex != 0L) { - FirstIndex = other.FirstIndex; - } - if (other.LastIndex != 0L) { - LastIndex = other.LastIndex; - } - if (other.IsFullTree != false) { - IsFullTree = other.IsFullTree; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (merkleTreeRoot_ == null) { - MerkleTreeRoot = new global::AElf.Types.Hash(); - } - input.ReadMessage(MerkleTreeRoot); - break; - } - case 16: { - FirstIndex = input.ReadInt64(); - break; - } - case 24: { - LastIndex = input.ReadInt64(); - break; - } - case 32: { - IsFullTree = input.ReadBool(); - break; - } - } - } - } - - } - - internal sealed partial class ReceiptMaker : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReceiptMaker()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.MerkleTreeGeneratorContract.MerkleTreeGeneratorReflection.Descriptor.MessageTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReceiptMaker() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReceiptMaker(ReceiptMaker other) : this() { - receiptMakerAddress_ = other.receiptMakerAddress_ != null ? other.receiptMakerAddress_.Clone() : null; - merkleTreeLeafLimit_ = other.merkleTreeLeafLimit_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReceiptMaker Clone() { - return new ReceiptMaker(this); - } - - /// Field number for the "receipt_maker_address" field. - public const int ReceiptMakerAddressFieldNumber = 1; - private global::AElf.Types.Address receiptMakerAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address ReceiptMakerAddress { - get { return receiptMakerAddress_; } - set { - receiptMakerAddress_ = value; - } - } - - /// Field number for the "merkle_tree_leaf_limit" field. - public const int MerkleTreeLeafLimitFieldNumber = 2; - private int merkleTreeLeafLimit_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int MerkleTreeLeafLimit { - get { return merkleTreeLeafLimit_; } - set { - merkleTreeLeafLimit_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ReceiptMaker); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ReceiptMaker other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(ReceiptMakerAddress, other.ReceiptMakerAddress)) return false; - if (MerkleTreeLeafLimit != other.MerkleTreeLeafLimit) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (receiptMakerAddress_ != null) hash ^= ReceiptMakerAddress.GetHashCode(); - if (MerkleTreeLeafLimit != 0) hash ^= MerkleTreeLeafLimit.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (receiptMakerAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(ReceiptMakerAddress); - } - if (MerkleTreeLeafLimit != 0) { - output.WriteRawTag(16); - output.WriteInt32(MerkleTreeLeafLimit); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (receiptMakerAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ReceiptMakerAddress); - } - if (MerkleTreeLeafLimit != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(MerkleTreeLeafLimit); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ReceiptMaker other) { - if (other == null) { - return; - } - if (other.receiptMakerAddress_ != null) { - if (receiptMakerAddress_ == null) { - ReceiptMakerAddress = new global::AElf.Types.Address(); - } - ReceiptMakerAddress.MergeFrom(other.ReceiptMakerAddress); - } - if (other.MerkleTreeLeafLimit != 0) { - MerkleTreeLeafLimit = other.MerkleTreeLeafLimit; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (receiptMakerAddress_ == null) { - ReceiptMakerAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(ReceiptMakerAddress); - break; - } - case 16: { - MerkleTreeLeafLimit = input.ReadInt32(); - break; - } - } - } - } - - } - - internal sealed partial class MerkleTree : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MerkleTree()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.MerkleTreeGeneratorContract.MerkleTreeGeneratorReflection.Descriptor.MessageTypes[5]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MerkleTree() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MerkleTree(MerkleTree other) : this() { - merkleTreeRoot_ = other.merkleTreeRoot_ != null ? other.merkleTreeRoot_.Clone() : null; - firstLeafIndex_ = other.firstLeafIndex_; - lastLeafIndex_ = other.lastLeafIndex_; - isFullTree_ = other.isFullTree_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MerkleTree Clone() { - return new MerkleTree(this); - } - - /// Field number for the "merkle_tree_root" field. - public const int MerkleTreeRootFieldNumber = 1; - private global::AElf.Types.Hash merkleTreeRoot_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash MerkleTreeRoot { - get { return merkleTreeRoot_; } - set { - merkleTreeRoot_ = value; - } - } - - /// Field number for the "first_leaf_index" field. - public const int FirstLeafIndexFieldNumber = 2; - private long firstLeafIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long FirstLeafIndex { - get { return firstLeafIndex_; } - set { - firstLeafIndex_ = value; - } - } - - /// Field number for the "last_leaf_index" field. - public const int LastLeafIndexFieldNumber = 3; - private long lastLeafIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long LastLeafIndex { - get { return lastLeafIndex_; } - set { - lastLeafIndex_ = value; - } - } - - /// Field number for the "is_full_tree" field. - public const int IsFullTreeFieldNumber = 4; - private bool isFullTree_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsFullTree { - get { return isFullTree_; } - set { - isFullTree_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MerkleTree); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MerkleTree other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(MerkleTreeRoot, other.MerkleTreeRoot)) return false; - if (FirstLeafIndex != other.FirstLeafIndex) return false; - if (LastLeafIndex != other.LastLeafIndex) return false; - if (IsFullTree != other.IsFullTree) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (merkleTreeRoot_ != null) hash ^= MerkleTreeRoot.GetHashCode(); - if (FirstLeafIndex != 0L) hash ^= FirstLeafIndex.GetHashCode(); - if (LastLeafIndex != 0L) hash ^= LastLeafIndex.GetHashCode(); - if (IsFullTree != false) hash ^= IsFullTree.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (merkleTreeRoot_ != null) { - output.WriteRawTag(10); - output.WriteMessage(MerkleTreeRoot); - } - if (FirstLeafIndex != 0L) { - output.WriteRawTag(16); - output.WriteInt64(FirstLeafIndex); - } - if (LastLeafIndex != 0L) { - output.WriteRawTag(24); - output.WriteInt64(LastLeafIndex); - } - if (IsFullTree != false) { - output.WriteRawTag(32); - output.WriteBool(IsFullTree); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (merkleTreeRoot_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(MerkleTreeRoot); - } - if (FirstLeafIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(FirstLeafIndex); - } - if (LastLeafIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(LastLeafIndex); - } - if (IsFullTree != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MerkleTree other) { - if (other == null) { - return; - } - if (other.merkleTreeRoot_ != null) { - if (merkleTreeRoot_ == null) { - MerkleTreeRoot = new global::AElf.Types.Hash(); - } - MerkleTreeRoot.MergeFrom(other.MerkleTreeRoot); - } - if (other.FirstLeafIndex != 0L) { - FirstLeafIndex = other.FirstLeafIndex; - } - if (other.LastLeafIndex != 0L) { - LastLeafIndex = other.LastLeafIndex; - } - if (other.IsFullTree != false) { - IsFullTree = other.IsFullTree; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (merkleTreeRoot_ == null) { - MerkleTreeRoot = new global::AElf.Types.Hash(); - } - input.ReadMessage(MerkleTreeRoot); - break; - } - case 16: { - FirstLeafIndex = input.ReadInt64(); - break; - } - case 24: { - LastLeafIndex = input.ReadInt64(); - break; - } - case 32: { - IsFullTree = input.ReadBool(); - break; - } - } - } - } - - } - - internal sealed partial class GetReceiptMakerOutput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetReceiptMakerOutput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.MerkleTreeGeneratorContract.MerkleTreeGeneratorReflection.Descriptor.MessageTypes[6]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetReceiptMakerOutput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetReceiptMakerOutput(GetReceiptMakerOutput other) : this() { - receiptMakerAddress_ = other.receiptMakerAddress_ != null ? other.receiptMakerAddress_.Clone() : null; - merkleTreeLeafLimit_ = other.merkleTreeLeafLimit_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetReceiptMakerOutput Clone() { - return new GetReceiptMakerOutput(this); - } - - /// Field number for the "receipt_maker_address" field. - public const int ReceiptMakerAddressFieldNumber = 1; - private global::AElf.Types.Address receiptMakerAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address ReceiptMakerAddress { - get { return receiptMakerAddress_; } - set { - receiptMakerAddress_ = value; - } - } - - /// Field number for the "merkle_tree_leaf_limit" field. - public const int MerkleTreeLeafLimitFieldNumber = 2; - private int merkleTreeLeafLimit_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int MerkleTreeLeafLimit { - get { return merkleTreeLeafLimit_; } - set { - merkleTreeLeafLimit_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GetReceiptMakerOutput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GetReceiptMakerOutput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(ReceiptMakerAddress, other.ReceiptMakerAddress)) return false; - if (MerkleTreeLeafLimit != other.MerkleTreeLeafLimit) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (receiptMakerAddress_ != null) hash ^= ReceiptMakerAddress.GetHashCode(); - if (MerkleTreeLeafLimit != 0) hash ^= MerkleTreeLeafLimit.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (receiptMakerAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(ReceiptMakerAddress); - } - if (MerkleTreeLeafLimit != 0) { - output.WriteRawTag(16); - output.WriteInt32(MerkleTreeLeafLimit); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (receiptMakerAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ReceiptMakerAddress); - } - if (MerkleTreeLeafLimit != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(MerkleTreeLeafLimit); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GetReceiptMakerOutput other) { - if (other == null) { - return; - } - if (other.receiptMakerAddress_ != null) { - if (receiptMakerAddress_ == null) { - ReceiptMakerAddress = new global::AElf.Types.Address(); - } - ReceiptMakerAddress.MergeFrom(other.ReceiptMakerAddress); - } - if (other.MerkleTreeLeafLimit != 0) { - MerkleTreeLeafLimit = other.MerkleTreeLeafLimit; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (receiptMakerAddress_ == null) { - ReceiptMakerAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(ReceiptMakerAddress); - break; - } - case 16: { - MerkleTreeLeafLimit = input.ReadInt32(); - break; - } - } - } - } - - } - - internal sealed partial class GetMerklePathInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetMerklePathInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.MerkleTreeGeneratorContract.MerkleTreeGeneratorReflection.Descriptor.MessageTypes[7]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetMerklePathInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetMerklePathInput(GetMerklePathInput other) : this() { - receiptMaker_ = other.receiptMaker_ != null ? other.receiptMaker_.Clone() : null; - receiptId_ = other.receiptId_; - lastLeafIndex_ = other.lastLeafIndex_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetMerklePathInput Clone() { - return new GetMerklePathInput(this); - } - - /// Field number for the "receipt_maker" field. - public const int ReceiptMakerFieldNumber = 1; - private global::AElf.Types.Address receiptMaker_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address ReceiptMaker { - get { return receiptMaker_; } - set { - receiptMaker_ = value; - } - } - - /// Field number for the "receipt_id" field. - public const int ReceiptIdFieldNumber = 2; - private long receiptId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ReceiptId { - get { return receiptId_; } - set { - receiptId_ = value; - } - } - - /// Field number for the "last_leaf_index" field. - public const int LastLeafIndexFieldNumber = 3; - private long lastLeafIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long LastLeafIndex { - get { return lastLeafIndex_; } - set { - lastLeafIndex_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GetMerklePathInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GetMerklePathInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(ReceiptMaker, other.ReceiptMaker)) return false; - if (ReceiptId != other.ReceiptId) return false; - if (LastLeafIndex != other.LastLeafIndex) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (receiptMaker_ != null) hash ^= ReceiptMaker.GetHashCode(); - if (ReceiptId != 0L) hash ^= ReceiptId.GetHashCode(); - if (LastLeafIndex != 0L) hash ^= LastLeafIndex.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (receiptMaker_ != null) { - output.WriteRawTag(10); - output.WriteMessage(ReceiptMaker); - } - if (ReceiptId != 0L) { - output.WriteRawTag(16); - output.WriteInt64(ReceiptId); - } - if (LastLeafIndex != 0L) { - output.WriteRawTag(24); - output.WriteInt64(LastLeafIndex); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (receiptMaker_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ReceiptMaker); - } - if (ReceiptId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(ReceiptId); - } - if (LastLeafIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(LastLeafIndex); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GetMerklePathInput other) { - if (other == null) { - return; - } - if (other.receiptMaker_ != null) { - if (receiptMaker_ == null) { - ReceiptMaker = new global::AElf.Types.Address(); - } - ReceiptMaker.MergeFrom(other.ReceiptMaker); - } - if (other.ReceiptId != 0L) { - ReceiptId = other.ReceiptId; - } - if (other.LastLeafIndex != 0L) { - LastLeafIndex = other.LastLeafIndex; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (receiptMaker_ == null) { - ReceiptMaker = new global::AElf.Types.Address(); - } - input.ReadMessage(ReceiptMaker); - break; - } - case 16: { - ReceiptId = input.ReadInt64(); - break; - } - case 24: { - LastLeafIndex = input.ReadInt64(); - break; - } - } - } - } - - } - - internal sealed partial class ReceiptMakerRegistered : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReceiptMakerRegistered()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.MerkleTreeGeneratorContract.MerkleTreeGeneratorReflection.Descriptor.MessageTypes[8]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReceiptMakerRegistered() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReceiptMakerRegistered(ReceiptMakerRegistered other) : this() { - receiptMakerAddress_ = other.receiptMakerAddress_ != null ? other.receiptMakerAddress_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReceiptMakerRegistered Clone() { - return new ReceiptMakerRegistered(this); - } - - /// Field number for the "receipt_maker_address" field. - public const int ReceiptMakerAddressFieldNumber = 1; - private global::AElf.Types.Address receiptMakerAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address ReceiptMakerAddress { - get { return receiptMakerAddress_; } - set { - receiptMakerAddress_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ReceiptMakerRegistered); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ReceiptMakerRegistered other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(ReceiptMakerAddress, other.ReceiptMakerAddress)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (receiptMakerAddress_ != null) hash ^= ReceiptMakerAddress.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (receiptMakerAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(ReceiptMakerAddress); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (receiptMakerAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ReceiptMakerAddress); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ReceiptMakerRegistered other) { - if (other == null) { - return; - } - if (other.receiptMakerAddress_ != null) { - if (receiptMakerAddress_ == null) { - ReceiptMakerAddress = new global::AElf.Types.Address(); - } - ReceiptMakerAddress.MergeFrom(other.ReceiptMakerAddress); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (receiptMakerAddress_ == null) { - ReceiptMakerAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(ReceiptMakerAddress); - break; - } - } - } - } - - } - - internal sealed partial class ReceiptMakerUnRegistered : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReceiptMakerUnRegistered()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.MerkleTreeGeneratorContract.MerkleTreeGeneratorReflection.Descriptor.MessageTypes[9]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReceiptMakerUnRegistered() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReceiptMakerUnRegistered(ReceiptMakerUnRegistered other) : this() { - receiptMakerAddress_ = other.receiptMakerAddress_ != null ? other.receiptMakerAddress_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReceiptMakerUnRegistered Clone() { - return new ReceiptMakerUnRegistered(this); - } - - /// Field number for the "receipt_maker_address" field. - public const int ReceiptMakerAddressFieldNumber = 1; - private global::AElf.Types.Address receiptMakerAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address ReceiptMakerAddress { - get { return receiptMakerAddress_; } - set { - receiptMakerAddress_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ReceiptMakerUnRegistered); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ReceiptMakerUnRegistered other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(ReceiptMakerAddress, other.ReceiptMakerAddress)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (receiptMakerAddress_ != null) hash ^= ReceiptMakerAddress.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (receiptMakerAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(ReceiptMakerAddress); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (receiptMakerAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ReceiptMakerAddress); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ReceiptMakerUnRegistered other) { - if (other == null) { - return; - } - if (other.receiptMakerAddress_ != null) { - if (receiptMakerAddress_ == null) { - ReceiptMakerAddress = new global::AElf.Types.Address(); - } - ReceiptMakerAddress.MergeFrom(other.ReceiptMakerAddress); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (receiptMakerAddress_ == null) { - ReceiptMakerAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(ReceiptMakerAddress); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/src/AElf.EventHandler/Dto/MTRecorderContractc.cs b/src/AElf.EventHandler/Dto/MTRecorderContractc.cs deleted file mode 100644 index bd590115..00000000 --- a/src/AElf.EventHandler/Dto/MTRecorderContractc.cs +++ /dev/null @@ -1,215 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: merkle_tree_recorder.proto -// -#pragma warning disable 0414, 1591 -#region Designer generated code - -using System.Collections.Generic; -using aelf = global::AElf.CSharp.Core; - -namespace MTRecorder { - - #region Events - public partial class RecorderCreated : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public RecorderCreated GetNonIndexed() - { - return new RecorderCreated - { - Admin = Admin, - MaximalLeafCount = MaximalLeafCount, - RecorderId = RecorderId, - }; - } - } - - public partial class MerkleTreeRecorded : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - new MerkleTreeRecorded - { - RecorderId = RecorderId - }, - }; - } - - public MerkleTreeRecorded GetNonIndexed() - { - return new MerkleTreeRecorded - { - LastLeafIndex = LastLeafIndex, - }; - } - } - - #endregion - public static partial class MerkleTreeRecorderContractContainer - { - static readonly string __ServiceName = "MTRecorder.MerkleTreeRecorderContract"; - - #region Marshallers - static readonly aelf::Marshaller __Marshaller_acs1_MethodFees = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Standards.ACS1.MethodFees.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_Empty = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_AuthorityInfo = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AuthorityInfo.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_StringValue = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.StringValue.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_MTRecorder_Recorder = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::MTRecorder.Recorder.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_MTRecorder_RecordMerkleTreeInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::MTRecorder.RecordMerkleTreeInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_aelf_Address = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Types.Address.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_MTRecorder_MerkleProofInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::MTRecorder.MerkleProofInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_BoolValue = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.BoolValue.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_MTRecorder_GetLeafLocatedMerkleTreeInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::MTRecorder.GetLeafLocatedMerkleTreeInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_MTRecorder_GetLeafLocatedMerkleTreeOutput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::MTRecorder.GetLeafLocatedMerkleTreeOutput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_MTRecorder_GetMerkleTreeInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::MTRecorder.GetMerkleTreeInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_MTRecorder_MerkleTree = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::MTRecorder.MerkleTree.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_MTRecorder_RecorderIdInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::MTRecorder.RecorderIdInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_Int64Value = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Int64Value.Parser.ParseFrom); - #endregion - - #region Methods - static readonly aelf::Method __Method_SetMethodFee = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "SetMethodFee", - __Marshaller_acs1_MethodFees, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_ChangeMethodFeeController = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "ChangeMethodFeeController", - __Marshaller_AuthorityInfo, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_GetMethodFee = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetMethodFee", - __Marshaller_google_protobuf_StringValue, - __Marshaller_acs1_MethodFees); - - static readonly aelf::Method __Method_GetMethodFeeController = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetMethodFeeController", - __Marshaller_google_protobuf_Empty, - __Marshaller_AuthorityInfo); - - static readonly aelf::Method __Method_Initialize = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "Initialize", - __Marshaller_google_protobuf_Empty, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_CreateRecorder = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "CreateRecorder", - __Marshaller_MTRecorder_Recorder, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_RecordMerkleTree = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "RecordMerkleTree", - __Marshaller_MTRecorder_RecordMerkleTreeInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_ChangeOwner = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "ChangeOwner", - __Marshaller_aelf_Address, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_MerkleProof = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "MerkleProof", - __Marshaller_MTRecorder_MerkleProofInput, - __Marshaller_google_protobuf_BoolValue); - - static readonly aelf::Method __Method_GetLeafLocatedMerkleTree = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetLeafLocatedMerkleTree", - __Marshaller_MTRecorder_GetLeafLocatedMerkleTreeInput, - __Marshaller_MTRecorder_GetLeafLocatedMerkleTreeOutput); - - static readonly aelf::Method __Method_GetMerkleTree = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetMerkleTree", - __Marshaller_MTRecorder_GetMerkleTreeInput, - __Marshaller_MTRecorder_MerkleTree); - - static readonly aelf::Method __Method_GetOwner = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetOwner", - __Marshaller_google_protobuf_Empty, - __Marshaller_aelf_Address); - - static readonly aelf::Method __Method_GetRecorder = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetRecorder", - __Marshaller_MTRecorder_RecorderIdInput, - __Marshaller_MTRecorder_Recorder); - - static readonly aelf::Method __Method_GetRecorderCount = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetRecorderCount", - __Marshaller_google_protobuf_Empty, - __Marshaller_google_protobuf_Int64Value); - - static readonly aelf::Method __Method_GetLastRecordedLeafIndex = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetLastRecordedLeafIndex", - __Marshaller_MTRecorder_RecorderIdInput, - __Marshaller_google_protobuf_Int64Value); - - static readonly aelf::Method __Method_GetSatisfiedTreeCount = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetSatisfiedTreeCount", - __Marshaller_MTRecorder_RecorderIdInput, - __Marshaller_google_protobuf_Int64Value); - - #endregion - - #region Descriptors - public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor - { - get { return global::MTRecorder.MerkleTreeRecorderReflection.Descriptor.Services[0]; } - } - - public static global::System.Collections.Generic.IReadOnlyList Descriptors - { - get - { - return new global::System.Collections.Generic.List() - { - global::AElf.Standards.ACS1.Acs1Reflection.Descriptor.Services[0], - global::MTRecorder.MerkleTreeRecorderReflection.Descriptor.Services[0], - }; - } - } - #endregion - } -} -#endregion - diff --git a/src/AElf.EventHandler/Dto/MTRecorderContractg.cs b/src/AElf.EventHandler/Dto/MTRecorderContractg.cs deleted file mode 100644 index cf141456..00000000 --- a/src/AElf.EventHandler/Dto/MTRecorderContractg.cs +++ /dev/null @@ -1,1842 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: merkle_tree_recorder.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace MTRecorder { - - /// Holder for reflection information generated from merkle_tree_recorder.proto - public static partial class MerkleTreeRecorderReflection { - - #region Descriptor - /// File descriptor for merkle_tree_recorder.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static MerkleTreeRecorderReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChptZXJrbGVfdHJlZV9yZWNvcmRlci5wcm90bxIKTVRSZWNvcmRlchoPYWVs", - "Zi9jb3JlLnByb3RvGgphY3MxLnByb3RvIkQKCFJlY29yZGVyEhwKBWFkbWlu", - "GAEgASgLMg0uYWVsZi5BZGRyZXNzEhoKEm1heGltYWxfbGVhZl9jb3VudBgC", - "IAEoAyJrChVSZWNvcmRNZXJrbGVUcmVlSW5wdXQSEwoLcmVjb3JkZXJfaWQY", - "ASABKAMSFwoPbGFzdF9sZWFmX2luZGV4GAIgASgDEiQKEG1lcmtsZV90cmVl", - "X3Jvb3QYAyABKAsyCi5hZWxmLkhhc2giZQoKTWVya2xlVHJlZRIXCg9sYXN0", - "X2xlYWZfaW5kZXgYASABKAMSGAoQZmlyc3RfbGVhZl9pbmRleBgCIAEoAxIk", - "ChBtZXJrbGVfdHJlZV9yb290GAMgASgLMgouYWVsZi5IYXNoIkgKHUdldExl", - "YWZMb2NhdGVkTWVya2xlVHJlZUlucHV0EhIKCmxlYWZfaW5kZXgYASABKAMS", - "EwoLcmVjb3JkZXJfaWQYAiABKAMiZwoeR2V0TGVhZkxvY2F0ZWRNZXJrbGVU", - "cmVlT3V0cHV0EhcKD2xhc3RfbGVhZl9pbmRleBgBIAEoAxIYChBmaXJzdF9s", - "ZWFmX2luZGV4GAIgASgDEhIKCnRyZWVfaW5kZXgYAyABKAMiQgoSR2V0TWVy", - "a2xlVHJlZUlucHV0EhMKC3JlY29yZGVyX2lkGAEgASgDEhcKD2xhc3RfbGVh", - "Zl9pbmRleBgCIAEoAyKGAQoQTWVya2xlUHJvb2ZJbnB1dBIXCg9sYXN0X2xl", - "YWZfaW5kZXgYASABKAMSHQoJbGVhZl9ub2RlGAIgASgLMgouYWVsZi5IYXNo", - "EiUKC21lcmtsZV9wYXRoGAMgASgLMhAuYWVsZi5NZXJrbGVQYXRoEhMKC3Jl", - "Y29yZGVyX2lkGAQgASgDIiYKD1JlY29yZGVySWRJbnB1dBITCgtyZWNvcmRl", - "cl9pZBgBIAEoAyJmCg9SZWNvcmRlckNyZWF0ZWQSHAoFYWRtaW4YASABKAsy", - "DS5hZWxmLkFkZHJlc3MSGgoSbWF4aW1hbF9sZWFmX2NvdW50GAIgASgDEhMK", - "C3JlY29yZGVyX2lkGAMgASgDOgSguxgBIk8KEk1lcmtsZVRyZWVSZWNvcmRl", - "ZBIaCgtyZWNvcmRlcl9pZBgBIAEoA0IFiI/1AQESFwoPbGFzdF9sZWFmX2lu", - "ZGV4GAIgASgDOgSguxgBMqIIChpNZXJrbGVUcmVlUmVjb3JkZXJDb250cmFj", - "dBI+CgpJbml0aWFsaXplEhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5GhYuZ29v", - "Z2xlLnByb3RvYnVmLkVtcHR5IgASQAoOQ3JlYXRlUmVjb3JkZXISFC5NVFJl", - "Y29yZGVyLlJlY29yZGVyGhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IgASTwoQ", - "UmVjb3JkTWVya2xlVHJlZRIhLk1UUmVjb3JkZXIuUmVjb3JkTWVya2xlVHJl", - "ZUlucHV0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IgASNgoLQ2hhbmdlT3du", - "ZXISDS5hZWxmLkFkZHJlc3MaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiABJO", - "CgtNZXJrbGVQcm9vZhIcLk1UUmVjb3JkZXIuTWVya2xlUHJvb2ZJbnB1dBoa", - "Lmdvb2dsZS5wcm90b2J1Zi5Cb29sVmFsdWUiBYiJ9wEBEngKGEdldExlYWZM", - "b2NhdGVkTWVya2xlVHJlZRIpLk1UUmVjb3JkZXIuR2V0TGVhZkxvY2F0ZWRN", - "ZXJrbGVUcmVlSW5wdXQaKi5NVFJlY29yZGVyLkdldExlYWZMb2NhdGVkTWVy", - "a2xlVHJlZU91dHB1dCIFiIn3AQESTgoNR2V0TWVya2xlVHJlZRIeLk1UUmVj", - "b3JkZXIuR2V0TWVya2xlVHJlZUlucHV0GhYuTVRSZWNvcmRlci5NZXJrbGVU", - "cmVlIgWIifcBARI4CghHZXRPd25lchIWLmdvb2dsZS5wcm90b2J1Zi5FbXB0", - "eRoNLmFlbGYuQWRkcmVzcyIFiIn3AQESRwoLR2V0UmVjb3JkZXISGy5NVFJl", - "Y29yZGVyLlJlY29yZGVySWRJbnB1dBoULk1UUmVjb3JkZXIuUmVjb3JkZXIi", - "BYiJ9wEBEk4KEEdldFJlY29yZGVyQ291bnQSFi5nb29nbGUucHJvdG9idWYu", - "RW1wdHkaGy5nb29nbGUucHJvdG9idWYuSW50NjRWYWx1ZSIFiIn3AQESWwoY", - "R2V0TGFzdFJlY29yZGVkTGVhZkluZGV4EhsuTVRSZWNvcmRlci5SZWNvcmRl", - "cklkSW5wdXQaGy5nb29nbGUucHJvdG9idWYuSW50NjRWYWx1ZSIFiIn3AQES", - "WAoVR2V0U2F0aXNmaWVkVHJlZUNvdW50EhsuTVRSZWNvcmRlci5SZWNvcmRl", - "cklkSW5wdXQaGy5nb29nbGUucHJvdG9idWYuSW50NjRWYWx1ZSIFiIn3AQEa", - "VbLM9gFBQUVsZi5Db250cmFjdHMuTWVya2xlVHJlZVJlY29yZGVyLk1lcmts", - "ZVRyZWVSZWNvcmRlckNvbnRyYWN0U3RhdGXKyvYBCmFjczEucHJvdG9iBnBy", - "b3RvMw==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::AElf.Types.CoreReflection.Descriptor, global::AElf.Standards.ACS1.Acs1Reflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::MTRecorder.Recorder), global::MTRecorder.Recorder.Parser, new[]{ "Admin", "MaximalLeafCount" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::MTRecorder.RecordMerkleTreeInput), global::MTRecorder.RecordMerkleTreeInput.Parser, new[]{ "RecorderId", "LastLeafIndex", "MerkleTreeRoot" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::MTRecorder.MerkleTree), global::MTRecorder.MerkleTree.Parser, new[]{ "LastLeafIndex", "FirstLeafIndex", "MerkleTreeRoot" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::MTRecorder.GetLeafLocatedMerkleTreeInput), global::MTRecorder.GetLeafLocatedMerkleTreeInput.Parser, new[]{ "LeafIndex", "RecorderId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::MTRecorder.GetLeafLocatedMerkleTreeOutput), global::MTRecorder.GetLeafLocatedMerkleTreeOutput.Parser, new[]{ "LastLeafIndex", "FirstLeafIndex", "TreeIndex" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::MTRecorder.GetMerkleTreeInput), global::MTRecorder.GetMerkleTreeInput.Parser, new[]{ "RecorderId", "LastLeafIndex" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::MTRecorder.MerkleProofInput), global::MTRecorder.MerkleProofInput.Parser, new[]{ "LastLeafIndex", "LeafNode", "MerklePath", "RecorderId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::MTRecorder.RecorderIdInput), global::MTRecorder.RecorderIdInput.Parser, new[]{ "RecorderId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::MTRecorder.RecorderCreated), global::MTRecorder.RecorderCreated.Parser, new[]{ "Admin", "MaximalLeafCount", "RecorderId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::MTRecorder.MerkleTreeRecorded), global::MTRecorder.MerkleTreeRecorded.Parser, new[]{ "RecorderId", "LastLeafIndex" }, null, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class Recorder : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Recorder()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::MTRecorder.MerkleTreeRecorderReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Recorder() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Recorder(Recorder other) : this() { - admin_ = other.admin_ != null ? other.admin_.Clone() : null; - maximalLeafCount_ = other.maximalLeafCount_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Recorder Clone() { - return new Recorder(this); - } - - /// Field number for the "admin" field. - public const int AdminFieldNumber = 1; - private global::AElf.Types.Address admin_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Admin { - get { return admin_; } - set { - admin_ = value; - } - } - - /// Field number for the "maximal_leaf_count" field. - public const int MaximalLeafCountFieldNumber = 2; - private long maximalLeafCount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long MaximalLeafCount { - get { return maximalLeafCount_; } - set { - maximalLeafCount_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Recorder); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Recorder other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Admin, other.Admin)) return false; - if (MaximalLeafCount != other.MaximalLeafCount) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (admin_ != null) hash ^= Admin.GetHashCode(); - if (MaximalLeafCount != 0L) hash ^= MaximalLeafCount.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (admin_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Admin); - } - if (MaximalLeafCount != 0L) { - output.WriteRawTag(16); - output.WriteInt64(MaximalLeafCount); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (admin_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Admin); - } - if (MaximalLeafCount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(MaximalLeafCount); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Recorder other) { - if (other == null) { - return; - } - if (other.admin_ != null) { - if (admin_ == null) { - Admin = new global::AElf.Types.Address(); - } - Admin.MergeFrom(other.Admin); - } - if (other.MaximalLeafCount != 0L) { - MaximalLeafCount = other.MaximalLeafCount; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (admin_ == null) { - Admin = new global::AElf.Types.Address(); - } - input.ReadMessage(Admin); - break; - } - case 16: { - MaximalLeafCount = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class RecordMerkleTreeInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RecordMerkleTreeInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::MTRecorder.MerkleTreeRecorderReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RecordMerkleTreeInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RecordMerkleTreeInput(RecordMerkleTreeInput other) : this() { - recorderId_ = other.recorderId_; - lastLeafIndex_ = other.lastLeafIndex_; - merkleTreeRoot_ = other.merkleTreeRoot_ != null ? other.merkleTreeRoot_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RecordMerkleTreeInput Clone() { - return new RecordMerkleTreeInput(this); - } - - /// Field number for the "recorder_id" field. - public const int RecorderIdFieldNumber = 1; - private long recorderId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RecorderId { - get { return recorderId_; } - set { - recorderId_ = value; - } - } - - /// Field number for the "last_leaf_index" field. - public const int LastLeafIndexFieldNumber = 2; - private long lastLeafIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long LastLeafIndex { - get { return lastLeafIndex_; } - set { - lastLeafIndex_ = value; - } - } - - /// Field number for the "merkle_tree_root" field. - public const int MerkleTreeRootFieldNumber = 3; - private global::AElf.Types.Hash merkleTreeRoot_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash MerkleTreeRoot { - get { return merkleTreeRoot_; } - set { - merkleTreeRoot_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as RecordMerkleTreeInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(RecordMerkleTreeInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (RecorderId != other.RecorderId) return false; - if (LastLeafIndex != other.LastLeafIndex) return false; - if (!object.Equals(MerkleTreeRoot, other.MerkleTreeRoot)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (RecorderId != 0L) hash ^= RecorderId.GetHashCode(); - if (LastLeafIndex != 0L) hash ^= LastLeafIndex.GetHashCode(); - if (merkleTreeRoot_ != null) hash ^= MerkleTreeRoot.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (RecorderId != 0L) { - output.WriteRawTag(8); - output.WriteInt64(RecorderId); - } - if (LastLeafIndex != 0L) { - output.WriteRawTag(16); - output.WriteInt64(LastLeafIndex); - } - if (merkleTreeRoot_ != null) { - output.WriteRawTag(26); - output.WriteMessage(MerkleTreeRoot); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (RecorderId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RecorderId); - } - if (LastLeafIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(LastLeafIndex); - } - if (merkleTreeRoot_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(MerkleTreeRoot); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(RecordMerkleTreeInput other) { - if (other == null) { - return; - } - if (other.RecorderId != 0L) { - RecorderId = other.RecorderId; - } - if (other.LastLeafIndex != 0L) { - LastLeafIndex = other.LastLeafIndex; - } - if (other.merkleTreeRoot_ != null) { - if (merkleTreeRoot_ == null) { - MerkleTreeRoot = new global::AElf.Types.Hash(); - } - MerkleTreeRoot.MergeFrom(other.MerkleTreeRoot); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - RecorderId = input.ReadInt64(); - break; - } - case 16: { - LastLeafIndex = input.ReadInt64(); - break; - } - case 26: { - if (merkleTreeRoot_ == null) { - MerkleTreeRoot = new global::AElf.Types.Hash(); - } - input.ReadMessage(MerkleTreeRoot); - break; - } - } - } - } - - } - - public sealed partial class MerkleTree : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MerkleTree()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::MTRecorder.MerkleTreeRecorderReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MerkleTree() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MerkleTree(MerkleTree other) : this() { - lastLeafIndex_ = other.lastLeafIndex_; - firstLeafIndex_ = other.firstLeafIndex_; - merkleTreeRoot_ = other.merkleTreeRoot_ != null ? other.merkleTreeRoot_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MerkleTree Clone() { - return new MerkleTree(this); - } - - /// Field number for the "last_leaf_index" field. - public const int LastLeafIndexFieldNumber = 1; - private long lastLeafIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long LastLeafIndex { - get { return lastLeafIndex_; } - set { - lastLeafIndex_ = value; - } - } - - /// Field number for the "first_leaf_index" field. - public const int FirstLeafIndexFieldNumber = 2; - private long firstLeafIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long FirstLeafIndex { - get { return firstLeafIndex_; } - set { - firstLeafIndex_ = value; - } - } - - /// Field number for the "merkle_tree_root" field. - public const int MerkleTreeRootFieldNumber = 3; - private global::AElf.Types.Hash merkleTreeRoot_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash MerkleTreeRoot { - get { return merkleTreeRoot_; } - set { - merkleTreeRoot_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MerkleTree); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MerkleTree other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (LastLeafIndex != other.LastLeafIndex) return false; - if (FirstLeafIndex != other.FirstLeafIndex) return false; - if (!object.Equals(MerkleTreeRoot, other.MerkleTreeRoot)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (LastLeafIndex != 0L) hash ^= LastLeafIndex.GetHashCode(); - if (FirstLeafIndex != 0L) hash ^= FirstLeafIndex.GetHashCode(); - if (merkleTreeRoot_ != null) hash ^= MerkleTreeRoot.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (LastLeafIndex != 0L) { - output.WriteRawTag(8); - output.WriteInt64(LastLeafIndex); - } - if (FirstLeafIndex != 0L) { - output.WriteRawTag(16); - output.WriteInt64(FirstLeafIndex); - } - if (merkleTreeRoot_ != null) { - output.WriteRawTag(26); - output.WriteMessage(MerkleTreeRoot); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (LastLeafIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(LastLeafIndex); - } - if (FirstLeafIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(FirstLeafIndex); - } - if (merkleTreeRoot_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(MerkleTreeRoot); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MerkleTree other) { - if (other == null) { - return; - } - if (other.LastLeafIndex != 0L) { - LastLeafIndex = other.LastLeafIndex; - } - if (other.FirstLeafIndex != 0L) { - FirstLeafIndex = other.FirstLeafIndex; - } - if (other.merkleTreeRoot_ != null) { - if (merkleTreeRoot_ == null) { - MerkleTreeRoot = new global::AElf.Types.Hash(); - } - MerkleTreeRoot.MergeFrom(other.MerkleTreeRoot); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - LastLeafIndex = input.ReadInt64(); - break; - } - case 16: { - FirstLeafIndex = input.ReadInt64(); - break; - } - case 26: { - if (merkleTreeRoot_ == null) { - MerkleTreeRoot = new global::AElf.Types.Hash(); - } - input.ReadMessage(MerkleTreeRoot); - break; - } - } - } - } - - } - - public sealed partial class GetLeafLocatedMerkleTreeInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetLeafLocatedMerkleTreeInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::MTRecorder.MerkleTreeRecorderReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetLeafLocatedMerkleTreeInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetLeafLocatedMerkleTreeInput(GetLeafLocatedMerkleTreeInput other) : this() { - leafIndex_ = other.leafIndex_; - recorderId_ = other.recorderId_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetLeafLocatedMerkleTreeInput Clone() { - return new GetLeafLocatedMerkleTreeInput(this); - } - - /// Field number for the "leaf_index" field. - public const int LeafIndexFieldNumber = 1; - private long leafIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long LeafIndex { - get { return leafIndex_; } - set { - leafIndex_ = value; - } - } - - /// Field number for the "recorder_id" field. - public const int RecorderIdFieldNumber = 2; - private long recorderId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RecorderId { - get { return recorderId_; } - set { - recorderId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GetLeafLocatedMerkleTreeInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GetLeafLocatedMerkleTreeInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (LeafIndex != other.LeafIndex) return false; - if (RecorderId != other.RecorderId) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (LeafIndex != 0L) hash ^= LeafIndex.GetHashCode(); - if (RecorderId != 0L) hash ^= RecorderId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (LeafIndex != 0L) { - output.WriteRawTag(8); - output.WriteInt64(LeafIndex); - } - if (RecorderId != 0L) { - output.WriteRawTag(16); - output.WriteInt64(RecorderId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (LeafIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(LeafIndex); - } - if (RecorderId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RecorderId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GetLeafLocatedMerkleTreeInput other) { - if (other == null) { - return; - } - if (other.LeafIndex != 0L) { - LeafIndex = other.LeafIndex; - } - if (other.RecorderId != 0L) { - RecorderId = other.RecorderId; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - LeafIndex = input.ReadInt64(); - break; - } - case 16: { - RecorderId = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class GetLeafLocatedMerkleTreeOutput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetLeafLocatedMerkleTreeOutput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::MTRecorder.MerkleTreeRecorderReflection.Descriptor.MessageTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetLeafLocatedMerkleTreeOutput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetLeafLocatedMerkleTreeOutput(GetLeafLocatedMerkleTreeOutput other) : this() { - lastLeafIndex_ = other.lastLeafIndex_; - firstLeafIndex_ = other.firstLeafIndex_; - treeIndex_ = other.treeIndex_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetLeafLocatedMerkleTreeOutput Clone() { - return new GetLeafLocatedMerkleTreeOutput(this); - } - - /// Field number for the "last_leaf_index" field. - public const int LastLeafIndexFieldNumber = 1; - private long lastLeafIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long LastLeafIndex { - get { return lastLeafIndex_; } - set { - lastLeafIndex_ = value; - } - } - - /// Field number for the "first_leaf_index" field. - public const int FirstLeafIndexFieldNumber = 2; - private long firstLeafIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long FirstLeafIndex { - get { return firstLeafIndex_; } - set { - firstLeafIndex_ = value; - } - } - - /// Field number for the "tree_index" field. - public const int TreeIndexFieldNumber = 3; - private long treeIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long TreeIndex { - get { return treeIndex_; } - set { - treeIndex_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GetLeafLocatedMerkleTreeOutput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GetLeafLocatedMerkleTreeOutput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (LastLeafIndex != other.LastLeafIndex) return false; - if (FirstLeafIndex != other.FirstLeafIndex) return false; - if (TreeIndex != other.TreeIndex) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (LastLeafIndex != 0L) hash ^= LastLeafIndex.GetHashCode(); - if (FirstLeafIndex != 0L) hash ^= FirstLeafIndex.GetHashCode(); - if (TreeIndex != 0L) hash ^= TreeIndex.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (LastLeafIndex != 0L) { - output.WriteRawTag(8); - output.WriteInt64(LastLeafIndex); - } - if (FirstLeafIndex != 0L) { - output.WriteRawTag(16); - output.WriteInt64(FirstLeafIndex); - } - if (TreeIndex != 0L) { - output.WriteRawTag(24); - output.WriteInt64(TreeIndex); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (LastLeafIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(LastLeafIndex); - } - if (FirstLeafIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(FirstLeafIndex); - } - if (TreeIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(TreeIndex); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GetLeafLocatedMerkleTreeOutput other) { - if (other == null) { - return; - } - if (other.LastLeafIndex != 0L) { - LastLeafIndex = other.LastLeafIndex; - } - if (other.FirstLeafIndex != 0L) { - FirstLeafIndex = other.FirstLeafIndex; - } - if (other.TreeIndex != 0L) { - TreeIndex = other.TreeIndex; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - LastLeafIndex = input.ReadInt64(); - break; - } - case 16: { - FirstLeafIndex = input.ReadInt64(); - break; - } - case 24: { - TreeIndex = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class GetMerkleTreeInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetMerkleTreeInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::MTRecorder.MerkleTreeRecorderReflection.Descriptor.MessageTypes[5]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetMerkleTreeInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetMerkleTreeInput(GetMerkleTreeInput other) : this() { - recorderId_ = other.recorderId_; - lastLeafIndex_ = other.lastLeafIndex_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetMerkleTreeInput Clone() { - return new GetMerkleTreeInput(this); - } - - /// Field number for the "recorder_id" field. - public const int RecorderIdFieldNumber = 1; - private long recorderId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RecorderId { - get { return recorderId_; } - set { - recorderId_ = value; - } - } - - /// Field number for the "last_leaf_index" field. - public const int LastLeafIndexFieldNumber = 2; - private long lastLeafIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long LastLeafIndex { - get { return lastLeafIndex_; } - set { - lastLeafIndex_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GetMerkleTreeInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GetMerkleTreeInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (RecorderId != other.RecorderId) return false; - if (LastLeafIndex != other.LastLeafIndex) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (RecorderId != 0L) hash ^= RecorderId.GetHashCode(); - if (LastLeafIndex != 0L) hash ^= LastLeafIndex.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (RecorderId != 0L) { - output.WriteRawTag(8); - output.WriteInt64(RecorderId); - } - if (LastLeafIndex != 0L) { - output.WriteRawTag(16); - output.WriteInt64(LastLeafIndex); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (RecorderId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RecorderId); - } - if (LastLeafIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(LastLeafIndex); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GetMerkleTreeInput other) { - if (other == null) { - return; - } - if (other.RecorderId != 0L) { - RecorderId = other.RecorderId; - } - if (other.LastLeafIndex != 0L) { - LastLeafIndex = other.LastLeafIndex; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - RecorderId = input.ReadInt64(); - break; - } - case 16: { - LastLeafIndex = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class MerkleProofInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MerkleProofInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::MTRecorder.MerkleTreeRecorderReflection.Descriptor.MessageTypes[6]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MerkleProofInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MerkleProofInput(MerkleProofInput other) : this() { - lastLeafIndex_ = other.lastLeafIndex_; - leafNode_ = other.leafNode_ != null ? other.leafNode_.Clone() : null; - merklePath_ = other.merklePath_ != null ? other.merklePath_.Clone() : null; - recorderId_ = other.recorderId_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MerkleProofInput Clone() { - return new MerkleProofInput(this); - } - - /// Field number for the "last_leaf_index" field. - public const int LastLeafIndexFieldNumber = 1; - private long lastLeafIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long LastLeafIndex { - get { return lastLeafIndex_; } - set { - lastLeafIndex_ = value; - } - } - - /// Field number for the "leaf_node" field. - public const int LeafNodeFieldNumber = 2; - private global::AElf.Types.Hash leafNode_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash LeafNode { - get { return leafNode_; } - set { - leafNode_ = value; - } - } - - /// Field number for the "merkle_path" field. - public const int MerklePathFieldNumber = 3; - private global::AElf.Types.MerklePath merklePath_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.MerklePath MerklePath { - get { return merklePath_; } - set { - merklePath_ = value; - } - } - - /// Field number for the "recorder_id" field. - public const int RecorderIdFieldNumber = 4; - private long recorderId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RecorderId { - get { return recorderId_; } - set { - recorderId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MerkleProofInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MerkleProofInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (LastLeafIndex != other.LastLeafIndex) return false; - if (!object.Equals(LeafNode, other.LeafNode)) return false; - if (!object.Equals(MerklePath, other.MerklePath)) return false; - if (RecorderId != other.RecorderId) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (LastLeafIndex != 0L) hash ^= LastLeafIndex.GetHashCode(); - if (leafNode_ != null) hash ^= LeafNode.GetHashCode(); - if (merklePath_ != null) hash ^= MerklePath.GetHashCode(); - if (RecorderId != 0L) hash ^= RecorderId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (LastLeafIndex != 0L) { - output.WriteRawTag(8); - output.WriteInt64(LastLeafIndex); - } - if (leafNode_ != null) { - output.WriteRawTag(18); - output.WriteMessage(LeafNode); - } - if (merklePath_ != null) { - output.WriteRawTag(26); - output.WriteMessage(MerklePath); - } - if (RecorderId != 0L) { - output.WriteRawTag(32); - output.WriteInt64(RecorderId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (LastLeafIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(LastLeafIndex); - } - if (leafNode_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(LeafNode); - } - if (merklePath_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(MerklePath); - } - if (RecorderId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RecorderId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MerkleProofInput other) { - if (other == null) { - return; - } - if (other.LastLeafIndex != 0L) { - LastLeafIndex = other.LastLeafIndex; - } - if (other.leafNode_ != null) { - if (leafNode_ == null) { - LeafNode = new global::AElf.Types.Hash(); - } - LeafNode.MergeFrom(other.LeafNode); - } - if (other.merklePath_ != null) { - if (merklePath_ == null) { - MerklePath = new global::AElf.Types.MerklePath(); - } - MerklePath.MergeFrom(other.MerklePath); - } - if (other.RecorderId != 0L) { - RecorderId = other.RecorderId; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - LastLeafIndex = input.ReadInt64(); - break; - } - case 18: { - if (leafNode_ == null) { - LeafNode = new global::AElf.Types.Hash(); - } - input.ReadMessage(LeafNode); - break; - } - case 26: { - if (merklePath_ == null) { - MerklePath = new global::AElf.Types.MerklePath(); - } - input.ReadMessage(MerklePath); - break; - } - case 32: { - RecorderId = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class RecorderIdInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RecorderIdInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::MTRecorder.MerkleTreeRecorderReflection.Descriptor.MessageTypes[7]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RecorderIdInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RecorderIdInput(RecorderIdInput other) : this() { - recorderId_ = other.recorderId_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RecorderIdInput Clone() { - return new RecorderIdInput(this); - } - - /// Field number for the "recorder_id" field. - public const int RecorderIdFieldNumber = 1; - private long recorderId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RecorderId { - get { return recorderId_; } - set { - recorderId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as RecorderIdInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(RecorderIdInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (RecorderId != other.RecorderId) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (RecorderId != 0L) hash ^= RecorderId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (RecorderId != 0L) { - output.WriteRawTag(8); - output.WriteInt64(RecorderId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (RecorderId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RecorderId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(RecorderIdInput other) { - if (other == null) { - return; - } - if (other.RecorderId != 0L) { - RecorderId = other.RecorderId; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - RecorderId = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class RecorderCreated : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RecorderCreated()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::MTRecorder.MerkleTreeRecorderReflection.Descriptor.MessageTypes[8]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RecorderCreated() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RecorderCreated(RecorderCreated other) : this() { - admin_ = other.admin_ != null ? other.admin_.Clone() : null; - maximalLeafCount_ = other.maximalLeafCount_; - recorderId_ = other.recorderId_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RecorderCreated Clone() { - return new RecorderCreated(this); - } - - /// Field number for the "admin" field. - public const int AdminFieldNumber = 1; - private global::AElf.Types.Address admin_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Admin { - get { return admin_; } - set { - admin_ = value; - } - } - - /// Field number for the "maximal_leaf_count" field. - public const int MaximalLeafCountFieldNumber = 2; - private long maximalLeafCount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long MaximalLeafCount { - get { return maximalLeafCount_; } - set { - maximalLeafCount_ = value; - } - } - - /// Field number for the "recorder_id" field. - public const int RecorderIdFieldNumber = 3; - private long recorderId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RecorderId { - get { return recorderId_; } - set { - recorderId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as RecorderCreated); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(RecorderCreated other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Admin, other.Admin)) return false; - if (MaximalLeafCount != other.MaximalLeafCount) return false; - if (RecorderId != other.RecorderId) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (admin_ != null) hash ^= Admin.GetHashCode(); - if (MaximalLeafCount != 0L) hash ^= MaximalLeafCount.GetHashCode(); - if (RecorderId != 0L) hash ^= RecorderId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (admin_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Admin); - } - if (MaximalLeafCount != 0L) { - output.WriteRawTag(16); - output.WriteInt64(MaximalLeafCount); - } - if (RecorderId != 0L) { - output.WriteRawTag(24); - output.WriteInt64(RecorderId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (admin_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Admin); - } - if (MaximalLeafCount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(MaximalLeafCount); - } - if (RecorderId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RecorderId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(RecorderCreated other) { - if (other == null) { - return; - } - if (other.admin_ != null) { - if (admin_ == null) { - Admin = new global::AElf.Types.Address(); - } - Admin.MergeFrom(other.Admin); - } - if (other.MaximalLeafCount != 0L) { - MaximalLeafCount = other.MaximalLeafCount; - } - if (other.RecorderId != 0L) { - RecorderId = other.RecorderId; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (admin_ == null) { - Admin = new global::AElf.Types.Address(); - } - input.ReadMessage(Admin); - break; - } - case 16: { - MaximalLeafCount = input.ReadInt64(); - break; - } - case 24: { - RecorderId = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class MerkleTreeRecorded : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MerkleTreeRecorded()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::MTRecorder.MerkleTreeRecorderReflection.Descriptor.MessageTypes[9]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MerkleTreeRecorded() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MerkleTreeRecorded(MerkleTreeRecorded other) : this() { - recorderId_ = other.recorderId_; - lastLeafIndex_ = other.lastLeafIndex_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MerkleTreeRecorded Clone() { - return new MerkleTreeRecorded(this); - } - - /// Field number for the "recorder_id" field. - public const int RecorderIdFieldNumber = 1; - private long recorderId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RecorderId { - get { return recorderId_; } - set { - recorderId_ = value; - } - } - - /// Field number for the "last_leaf_index" field. - public const int LastLeafIndexFieldNumber = 2; - private long lastLeafIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long LastLeafIndex { - get { return lastLeafIndex_; } - set { - lastLeafIndex_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MerkleTreeRecorded); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MerkleTreeRecorded other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (RecorderId != other.RecorderId) return false; - if (LastLeafIndex != other.LastLeafIndex) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (RecorderId != 0L) hash ^= RecorderId.GetHashCode(); - if (LastLeafIndex != 0L) hash ^= LastLeafIndex.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (RecorderId != 0L) { - output.WriteRawTag(8); - output.WriteInt64(RecorderId); - } - if (LastLeafIndex != 0L) { - output.WriteRawTag(16); - output.WriteInt64(LastLeafIndex); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (RecorderId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RecorderId); - } - if (LastLeafIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(LastLeafIndex); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MerkleTreeRecorded other) { - if (other == null) { - return; - } - if (other.RecorderId != 0L) { - RecorderId = other.RecorderId; - } - if (other.LastLeafIndex != 0L) { - LastLeafIndex = other.LastLeafIndex; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - RecorderId = input.ReadInt64(); - break; - } - case 16: { - LastLeafIndex = input.ReadInt64(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/src/AElf.EventHandler/Dto/OracleContractc.cs b/src/AElf.EventHandler/Dto/OracleContractc.cs deleted file mode 100644 index ad98e4da..00000000 --- a/src/AElf.EventHandler/Dto/OracleContractc.cs +++ /dev/null @@ -1,571 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: oracle_contract.proto -// -#pragma warning disable 0414, 1591 -#region Designer generated code - -using System.Collections.Generic; -using aelf = global::AElf.CSharp.Core; - -namespace AElf.Contracts.Oracle { - - #region Events - internal partial class QueryCreated : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public QueryCreated GetNonIndexed() - { - return new QueryCreated - { - Payment = Payment, - CallbackInfo = CallbackInfo, - AggregatorContractAddress = AggregatorContractAddress, - DesignatedNodeList = DesignatedNodeList, - QueryInfo = QueryInfo, - AggregateThreshold = AggregateThreshold, - QuerySender = QuerySender, - QueryId = QueryId, - Token = Token, - MaximumPermissibleDeviation = MaximumPermissibleDeviation, - AggregateOption = AggregateOption, - TaskId = TaskId, - }; - } - } - - internal partial class QueryTaskCreated : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public QueryTaskCreated GetNonIndexed() - { - return new QueryTaskCreated - { - EachPayment = EachPayment, - SupposedQueryTimes = SupposedQueryTimes, - QueryInfo = QueryInfo, - EndTime = EndTime, - DesignatedNodeList = DesignatedNodeList, - AggregatorContractAddress = AggregatorContractAddress, - CallbackInfo = CallbackInfo, - Creator = Creator, - AggregateThreshold = AggregateThreshold, - AggregateOption = AggregateOption, - }; - } - } - - internal partial class QueryCancelled : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public QueryCancelled GetNonIndexed() - { - return new QueryCancelled - { - QueryId = QueryId, - }; - } - } - - internal partial class SufficientCommitmentsCollected : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public SufficientCommitmentsCollected GetNonIndexed() - { - return new SufficientCommitmentsCollected - { - QueryId = QueryId, - }; - } - } - - internal partial class Committed : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public Committed GetNonIndexed() - { - return new Committed - { - QueryId = QueryId, - OracleNodeAddress = OracleNodeAddress, - Commitment = Commitment, - }; - } - } - - internal partial class CommitmentRevealed : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public CommitmentRevealed GetNonIndexed() - { - return new CommitmentRevealed - { - QueryId = QueryId, - OracleNodeAddress = OracleNodeAddress, - Commitment = Commitment, - RevealData = RevealData, - Salt = Salt, - }; - } - } - - internal partial class CommitmentRevealFailed : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public CommitmentRevealFailed GetNonIndexed() - { - return new CommitmentRevealFailed - { - QueryId = QueryId, - OracleNodeAddress = OracleNodeAddress, - Commitment = Commitment, - RevealData = RevealData, - Salt = Salt, - }; - } - } - - internal partial class QueryCompletedWithAggregation : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public QueryCompletedWithAggregation GetNonIndexed() - { - return new QueryCompletedWithAggregation - { - QueryId = QueryId, - Result = Result, - }; - } - } - - internal partial class QueryCompletedWithoutAggregation : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public QueryCompletedWithoutAggregation GetNonIndexed() - { - return new QueryCompletedWithoutAggregation - { - QueryId = QueryId, - Result = Result, - }; - } - } - - internal partial class TokenLocked : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public TokenLocked GetNonIndexed() - { - return new TokenLocked - { - OracleNodeAddress = OracleNodeAddress, - FromAddress = FromAddress, - LockedAmount = LockedAmount, - }; - } - } - - #endregion - internal static partial class OracleContractContainer - { - static readonly string __ServiceName = "OracleContract"; - - #region Marshallers - static readonly aelf::Marshaller __Marshaller_InitializeInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.InitializeInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_Empty = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_QueryInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.QueryInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_aelf_Hash = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Types.Hash.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_CommitInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.CommitInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_RevealInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.RevealInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_CreateQueryTaskInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.CreateQueryTaskInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_TaskQueryInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.TaskQueryInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_CompleteQueryTaskInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.CompleteQueryTaskInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_aelf_Address = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Types.Address.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_CreateRegimentInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.CreateRegimentInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_JoinRegimentInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.JoinRegimentInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_LeaveRegimentInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.LeaveRegimentInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_AddRegimentMemberInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.AddRegimentMemberInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_DeleteRegimentMemberInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.DeleteRegimentMemberInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_TransferRegimentOwnershipInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.TransferRegimentOwnershipInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_AddAdminsInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.AddAdminsInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_DeleteAdminsInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.DeleteAdminsInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_LockTokensInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.LockTokensInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_UnlockTokensInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.UnlockTokensInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_OracleNodeThreshold = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.OracleNodeThreshold.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_Int32Value = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Int32Value.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_QueryRecord = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.QueryRecord.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_CommitmentMap = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.CommitmentMap.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_StringValue = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.StringValue.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_Int64Value = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Int64Value.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_AddressList = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.AddressList.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_QueryTask = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Oracle.QueryTask.Parser.ParseFrom); - #endregion - - #region Methods - static readonly aelf::Method __Method_Initialize = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "Initialize", - __Marshaller_InitializeInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_InitializeAndCreateToken = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "InitializeAndCreateToken", - __Marshaller_InitializeInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_Query = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "Query", - __Marshaller_QueryInput, - __Marshaller_aelf_Hash); - - static readonly aelf::Method __Method_Commit = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "Commit", - __Marshaller_CommitInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_Reveal = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "Reveal", - __Marshaller_RevealInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_CancelQuery = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "CancelQuery", - __Marshaller_aelf_Hash, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_CreateQueryTask = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "CreateQueryTask", - __Marshaller_CreateQueryTaskInput, - __Marshaller_aelf_Hash); - - static readonly aelf::Method __Method_TaskQuery = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "TaskQuery", - __Marshaller_TaskQueryInput, - __Marshaller_aelf_Hash); - - static readonly aelf::Method __Method_CompleteQueryTask = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "CompleteQueryTask", - __Marshaller_CompleteQueryTaskInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_ChangeController = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "ChangeController", - __Marshaller_aelf_Address, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_CreateRegiment = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "CreateRegiment", - __Marshaller_CreateRegimentInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_JoinRegiment = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "JoinRegiment", - __Marshaller_JoinRegimentInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_LeaveRegiment = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "LeaveRegiment", - __Marshaller_LeaveRegimentInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_AddRegimentMember = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "AddRegimentMember", - __Marshaller_AddRegimentMemberInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_DeleteRegimentMember = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "DeleteRegimentMember", - __Marshaller_DeleteRegimentMemberInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_TransferRegimentOwnership = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "TransferRegimentOwnership", - __Marshaller_TransferRegimentOwnershipInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_AddAdmins = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "AddAdmins", - __Marshaller_AddAdminsInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_DeleteAdmins = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "DeleteAdmins", - __Marshaller_DeleteAdminsInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_LockTokens = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "LockTokens", - __Marshaller_LockTokensInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_UnlockTokens = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "UnlockTokens", - __Marshaller_UnlockTokensInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_SetThreshold = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "SetThreshold", - __Marshaller_OracleNodeThreshold, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_ChangeDefaultExpirationSeconds = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "ChangeDefaultExpirationSeconds", - __Marshaller_google_protobuf_Int32Value, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_EnableChargeFee = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "EnableChargeFee", - __Marshaller_google_protobuf_Empty, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_AddPostPayAddress = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "AddPostPayAddress", - __Marshaller_aelf_Address, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_RemovePostPayAddress = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "RemovePostPayAddress", - __Marshaller_aelf_Address, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_GetController = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetController", - __Marshaller_google_protobuf_Empty, - __Marshaller_aelf_Address); - - static readonly aelf::Method __Method_GetQueryRecord = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetQueryRecord", - __Marshaller_aelf_Hash, - __Marshaller_QueryRecord); - - static readonly aelf::Method __Method_GetCommitmentMap = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetCommitmentMap", - __Marshaller_aelf_Hash, - __Marshaller_CommitmentMap); - - static readonly aelf::Method __Method_GetOracleTokenSymbol = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetOracleTokenSymbol", - __Marshaller_google_protobuf_Empty, - __Marshaller_google_protobuf_StringValue); - - static readonly aelf::Method __Method_GetLockedTokensAmount = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetLockedTokensAmount", - __Marshaller_aelf_Address, - __Marshaller_google_protobuf_Int64Value); - - static readonly aelf::Method __Method_GetThreshold = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetThreshold", - __Marshaller_google_protobuf_Empty, - __Marshaller_OracleNodeThreshold); - - static readonly aelf::Method __Method_GetDefaultExpirationSeconds = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetDefaultExpirationSeconds", - __Marshaller_google_protobuf_Empty, - __Marshaller_google_protobuf_Int32Value); - - static readonly aelf::Method __Method_GetHelpfulNodeList = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetHelpfulNodeList", - __Marshaller_aelf_Hash, - __Marshaller_AddressList); - - static readonly aelf::Method __Method_GetQueryTask = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetQueryTask", - __Marshaller_aelf_Hash, - __Marshaller_QueryTask); - - static readonly aelf::Method __Method_GetRegimentMemberList = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetRegimentMemberList", - __Marshaller_aelf_Address, - __Marshaller_AddressList); - - #endregion - - #region Descriptors - public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor - { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.Services[0]; } - } - - public static global::System.Collections.Generic.IReadOnlyList Descriptors - { - get - { - return new global::System.Collections.Generic.List() - { - global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.Services[0], - }; - } - } - #endregion - - public class OracleContractReferenceState : global::AElf.Sdk.CSharp.State.ContractReferenceState - { - internal global::AElf.Sdk.CSharp.State.MethodReference Initialize { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference InitializeAndCreateToken { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference Query { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference Commit { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference Reveal { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference CancelQuery { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference CreateQueryTask { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference TaskQuery { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference CompleteQueryTask { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference ChangeController { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference CreateRegiment { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference JoinRegiment { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference LeaveRegiment { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference AddRegimentMember { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference DeleteRegimentMember { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference TransferRegimentOwnership { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference AddAdmins { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference DeleteAdmins { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference LockTokens { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference UnlockTokens { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference SetThreshold { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference ChangeDefaultExpirationSeconds { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference EnableChargeFee { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference AddPostPayAddress { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference RemovePostPayAddress { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference GetController { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference GetQueryRecord { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference GetCommitmentMap { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference GetOracleTokenSymbol { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference GetLockedTokensAmount { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference GetThreshold { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference GetDefaultExpirationSeconds { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference GetHelpfulNodeList { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference GetQueryTask { get; set; } - internal global::AElf.Sdk.CSharp.State.MethodReference GetRegimentMemberList { get; set; } - } - } -} -#endregion - diff --git a/src/AElf.EventHandler/Dto/OracleContractg.cs b/src/AElf.EventHandler/Dto/OracleContractg.cs deleted file mode 100644 index 61ed64f4..00000000 --- a/src/AElf.EventHandler/Dto/OracleContractg.cs +++ /dev/null @@ -1,8705 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: oracle_contract.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace AElf.Contracts.Oracle { - - /// Holder for reflection information generated from oracle_contract.proto - internal static partial class OracleContractReflection { - - #region Descriptor - /// File descriptor for oracle_contract.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static OracleContractReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChVvcmFjbGVfY29udHJhY3QucHJvdG8aD2FlbGYvY29yZS5wcm90bxoSYWVs", - "Zi9vcHRpb25zLnByb3RvGhtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8a", - "H2dvb2dsZS9wcm90b2J1Zi90aW1lc3RhbXAucHJvdG8aHmdvb2dsZS9wcm90", - "b2J1Zi93cmFwcGVycy5wcm90byLpAQoPSW5pdGlhbGl6ZUlucHV0EiIKGm1p", - "bmltdW1fb3JhY2xlX25vZGVzX2NvdW50GAEgASgFEiAKGGRlZmF1bHRfcmV2", - "ZWFsX3RocmVzaG9sZBgCIAEoBRIjChtkZWZhdWx0X2FnZ3JlZ2F0ZV90aHJl", - "c2hvbGQYAyABKAUSIgoaZGVmYXVsdF9leHBpcmF0aW9uX3NlY29uZHMYBCAB", - "KAUSFQoNaXNfY2hhcmdlX2ZlZRgFIAEoCBIwChlyZWdpbWVudF9jb250cmFj", - "dF9hZGRyZXNzGAYgASgLMg0uYWVsZi5BZGRyZXNzIqYCCgpRdWVyeUlucHV0", - "Eg8KB3BheW1lbnQYASABKAMSJAoNY2FsbGJhY2tfaW5mbxgCIAEoCzINLkNh", - "bGxiYWNrSW5mbxIyChthZ2dyZWdhdG9yX2NvbnRyYWN0X2FkZHJlc3MYAyAB", - "KAsyDS5hZWxmLkFkZHJlc3MSKgoUZGVzaWduYXRlZF9ub2RlX2xpc3QYBCAB", - "KAsyDC5BZGRyZXNzTGlzdBIeCgpxdWVyeV9pbmZvGAUgASgLMgouUXVlcnlJ", - "bmZvEhsKE2FnZ3JlZ2F0ZV90aHJlc2hvbGQYBiABKAUSDQoFdG9rZW4YByAB", - "KAkSGAoQYWdncmVnYXRlX29wdGlvbhgIIAEoBRIbCgd0YXNrX2lkGAkgASgL", - "MgouYWVsZi5IYXNoIowCChRDcmVhdGVRdWVyeVRhc2tJbnB1dBIUCgxlYWNo", - "X3BheW1lbnQYASABKAMSHAoUc3VwcG9zZWRfcXVlcnlfdGltZXMYAiABKAUS", - "HgoKcXVlcnlfaW5mbxgDIAEoCzIKLlF1ZXJ5SW5mbxIsCghlbmRfdGltZRgE", - "IAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXASJAoNY2FsbGJhY2tf", - "aW5mbxgFIAEoCzINLkNhbGxiYWNrSW5mbxIyChthZ2dyZWdhdG9yX2NvbnRy", - "YWN0X2FkZHJlc3MYBiABKAsyDS5hZWxmLkFkZHJlc3MSGAoQYWdncmVnYXRl", - "X29wdGlvbhgHIAEoBSItCg5UYXNrUXVlcnlJbnB1dBIbCgd0YXNrX2lkGAEg", - "ASgLMgouYWVsZi5IYXNoIn4KFkNvbXBsZXRlUXVlcnlUYXNrSW5wdXQSGwoH", - "dGFza19pZBgBIAEoCzIKLmFlbGYuSGFzaBIqChRkZXNpZ25hdGVkX25vZGVf", - "bGlzdBgCIAEoCzIMLkFkZHJlc3NMaXN0EhsKE2FnZ3JlZ2F0ZV90aHJlc2hv", - "bGQYAyABKAUiTAoMQ2FsbGJhY2tJbmZvEicKEGNvbnRyYWN0X2FkZHJlc3MY", - "ASABKAsyDS5hZWxmLkFkZHJlc3MSEwoLbWV0aG9kX25hbWUYAiABKAkiKwoL", - "QWRkcmVzc0xpc3QSHAoFdmFsdWUYASADKAsyDS5hZWxmLkFkZHJlc3MiqAUK", - "C1F1ZXJ5UmVjb3JkEioKFGRlc2lnbmF0ZWRfbm9kZV9saXN0GAEgASgLMgwu", - "QWRkcmVzc0xpc3QSMgobYWdncmVnYXRvcl9jb250cmFjdF9hZGRyZXNzGAIg", - "ASgLMg0uYWVsZi5BZGRyZXNzEjgKFGV4cGlyYXRpb25fdGltZXN0YW1wGAMg", - "ASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIrCiNpc19zdWZmaWNp", - "ZW50X2NvbW1pdG1lbnRzX2NvbGxlY3RlZBgEIAEoCBIkChxpc19zdWZmaWNp", - "ZW50X2RhdGFfY29sbGVjdGVkGAUgASgIEhQKDGZpbmFsX3Jlc3VsdBgGIAEo", - "CRIPCgdwYXltZW50GAcgASgDEiQKDWNhbGxiYWNrX2luZm8YCCABKAsyDS5D", - "YWxsYmFja0luZm8SHAoIcXVlcnlfaWQYCSABKAsyCi5hZWxmLkhhc2gSGwoT", - "YWdncmVnYXRlX3RocmVzaG9sZBgKIAEoBRIjCgxxdWVyeV9zZW5kZXIYCyAB", - "KAsyDS5hZWxmLkFkZHJlc3MSIAoYaXNfY29tbWl0X3N0YWdlX2ZpbmlzaGVk", - "GAwgASgIEhkKEWNvbW1pdG1lbnRzX2NvdW50GA0gASgFEhQKDGlzX2NhbmNl", - "bGxlZBgOIAEoCBIeCgpxdWVyeV9pbmZvGA8gASgLMgouUXVlcnlJbmZvEg0K", - "BXRva2VuGBAgASgJEiIKDGRhdGFfcmVjb3JkcxgRIAEoCzIMLkRhdGFSZWNv", - "cmRzEhgKEGFnZ3JlZ2F0ZV9vcHRpb24YEiABKAUSGwoHdGFza19pZBgTIAEo", - "CzIKLmFlbGYuSGFzaBIiChppc19wYWlkX3RvX29yYWNsZV9jb250cmFjdBgU", - "IAEoCCJ9ChNDcmVhdGVSZWdpbWVudElucHV0Eh4KB21hbmFnZXIYASABKAsy", - "DS5hZWxmLkFkZHJlc3MSKgoTaW5pdGlhbF9tZW1iZXJfbGlzdBgCIAMoCzIN", - "LmFlbGYuQWRkcmVzcxIaChJpc19hcHByb3ZlX3RvX2pvaW4YAyABKAgiZwoR", - "Sm9pblJlZ2ltZW50SW5wdXQSJwoQcmVnaW1lbnRfYWRkcmVzcxgBIAEoCzIN", - "LmFlbGYuQWRkcmVzcxIpChJuZXdfbWVtYmVyX2FkZHJlc3MYAiABKAsyDS5h", - "ZWxmLkFkZHJlc3MiagoSTGVhdmVSZWdpbWVudElucHV0EicKEHJlZ2ltZW50", - "X2FkZHJlc3MYASABKAsyDS5hZWxmLkFkZHJlc3MSKwoUbGVhdmVfbWVtYmVy", - "X2FkZHJlc3MYAiABKAsyDS5hZWxmLkFkZHJlc3MibAoWQWRkUmVnaW1lbnRN", - "ZW1iZXJJbnB1dBInChByZWdpbWVudF9hZGRyZXNzGAEgASgLMg0uYWVsZi5B", - "ZGRyZXNzEikKEm5ld19tZW1iZXJfYWRkcmVzcxgCIAEoCzINLmFlbGYuQWRk", - "cmVzcyJyChlEZWxldGVSZWdpbWVudE1lbWJlcklucHV0EicKEHJlZ2ltZW50", - "X2FkZHJlc3MYASABKAsyDS5hZWxmLkFkZHJlc3MSLAoVZGVsZXRlX21lbWJl", - "cl9hZGRyZXNzGAIgASgLMg0uYWVsZi5BZGRyZXNzIqMBCh5UcmFuc2ZlclJl", - "Z2ltZW50T3duZXJzaGlwSW5wdXQSJwoQcmVnaW1lbnRfYWRkcmVzcxgBIAEo", - "CzINLmFlbGYuQWRkcmVzcxIqChNuZXdfbWFuYWdlcl9hZGRyZXNzGAIgASgL", - "Mg0uYWVsZi5BZGRyZXNzEiwKFW9yaWdpbl9zZW5kZXJfYWRkcmVzcxgDIAEo", - "CzINLmFlbGYuQWRkcmVzcyKKAQoOQWRkQWRtaW5zSW5wdXQSJwoQcmVnaW1l", - "bnRfYWRkcmVzcxgBIAEoCzINLmFlbGYuQWRkcmVzcxIhCgpuZXdfYWRtaW5z", - "GAIgAygLMg0uYWVsZi5BZGRyZXNzEiwKFW9yaWdpbl9zZW5kZXJfYWRkcmVz", - "cxgDIAEoCzINLmFlbGYuQWRkcmVzcyKQAQoRRGVsZXRlQWRtaW5zSW5wdXQS", - "JwoQcmVnaW1lbnRfYWRkcmVzcxgBIAEoCzINLmFlbGYuQWRkcmVzcxIkCg1k", - "ZWxldGVfYWRtaW5zGAIgAygLMg0uYWVsZi5BZGRyZXNzEiwKFW9yaWdpbl9z", - "ZW5kZXJfYWRkcmVzcxgDIAEoCzINLmFlbGYuQWRkcmVzcyKIAwoJUXVlcnlU", - "YXNrEhQKDGVhY2hfcGF5bWVudBgBIAEoAxIcChRzdXBwb3NlZF9xdWVyeV90", - "aW1lcxgCIAEoBRIeCgpxdWVyeV9pbmZvGAMgASgLMgouUXVlcnlJbmZvEiwK", - "CGVuZF90aW1lGAQgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIq", - "ChRkZXNpZ25hdGVkX25vZGVfbGlzdBgFIAEoCzIMLkFkZHJlc3NMaXN0EjIK", - "G2FnZ3JlZ2F0b3JfY29udHJhY3RfYWRkcmVzcxgGIAEoCzINLmFlbGYuQWRk", - "cmVzcxIcChRhY3R1YWxfcXVlcmllZF90aW1lcxgHIAEoBRIkCg1jYWxsYmFj", - "a19pbmZvGAggASgLMg0uQ2FsbGJhY2tJbmZvEh4KB2NyZWF0b3IYCSABKAsy", - "DS5hZWxmLkFkZHJlc3MSGwoTYWdncmVnYXRlX3RocmVzaG9sZBgKIAEoBRIY", - "ChBhZ2dyZWdhdGVfb3B0aW9uGAsgASgFIksKC0NvbW1pdElucHV0EhwKCHF1", - "ZXJ5X2lkGAEgASgLMgouYWVsZi5IYXNoEh4KCmNvbW1pdG1lbnQYAiABKAsy", - "Ci5hZWxmLkhhc2giUwoLUmV2ZWFsSW5wdXQSHAoIcXVlcnlfaWQYASABKAsy", - "Ci5hZWxmLkhhc2gSDAoEZGF0YRgCIAEoCRIYCgRzYWx0GAMgASgLMgouYWVs", - "Zi5IYXNoInMKDUNvbW1pdG1lbnRNYXASKAoFdmFsdWUYASADKAsyGS5Db21t", - "aXRtZW50TWFwLlZhbHVlRW50cnkaOAoKVmFsdWVFbnRyeRILCgNrZXkYASAB", - "KAkSGQoFdmFsdWUYAiABKAsyCi5hZWxmLkhhc2g6AjgBIoABChNPcmFjbGVO", - "b2RlVGhyZXNob2xkEiIKGm1pbmltdW1fb3JhY2xlX25vZGVzX2NvdW50GAEg", - "ASgFEiAKGGRlZmF1bHRfcmV2ZWFsX3RocmVzaG9sZBgCIAEoBRIjChtkZWZh", - "dWx0X2FnZ3JlZ2F0ZV90aHJlc2hvbGQYAyABKAUiMgoKUmVzdWx0TGlzdBIP", - "CgdyZXN1bHRzGAEgAygJEhMKC2ZyZXF1ZW5jaWVzGAIgAygFIjoKCkRhdGFS", - "ZWNvcmQSHgoHYWRkcmVzcxgBIAEoCzINLmFlbGYuQWRkcmVzcxIMCgRkYXRh", - "GAIgASgJIikKC0RhdGFSZWNvcmRzEhoKBXZhbHVlGAEgAygLMgsuRGF0YVJl", - "Y29yZCKJAQoLUGxhaW5SZXN1bHQSIgoMZGF0YV9yZWNvcmRzGAEgASgLMgwu", - "RGF0YVJlY29yZHMSJwoQcmVnaW1lbnRfYWRkcmVzcxgCIAEoCzINLmFlbGYu", - "QWRkcmVzcxIeCgpxdWVyeV9pbmZvGAMgASgLMgouUXVlcnlJbmZvEg0KBXRv", - "a2VuGAQgASgJIlIKD0xvY2tUb2tlbnNJbnB1dBIqChNvcmFjbGVfbm9kZV9h", - "ZGRyZXNzGAEgASgLMg0uYWVsZi5BZGRyZXNzEhMKC2xvY2tfYW1vdW50GAIg", - "ASgDIlgKEVVubG9ja1Rva2Vuc0lucHV0EioKE29yYWNsZV9ub2RlX2FkZHJl", - "c3MYASABKAsyDS5hZWxmLkFkZHJlc3MSFwoPd2l0aGRyYXdfYW1vdW50GAIg", - "ASgDIisKCVF1ZXJ5SW5mbxINCgV0aXRsZRgBIAEoCRIPCgdvcHRpb25zGAIg", - "AygJIpgDCgxRdWVyeUNyZWF0ZWQSDwoHcGF5bWVudBgBIAEoAxIkCg1jYWxs", - "YmFja19pbmZvGAIgASgLMg0uQ2FsbGJhY2tJbmZvEjIKG2FnZ3JlZ2F0b3Jf", - "Y29udHJhY3RfYWRkcmVzcxgDIAEoCzINLmFlbGYuQWRkcmVzcxIqChRkZXNp", - "Z25hdGVkX25vZGVfbGlzdBgEIAEoCzIMLkFkZHJlc3NMaXN0Eh4KCnF1ZXJ5", - "X2luZm8YBSABKAsyCi5RdWVyeUluZm8SGwoTYWdncmVnYXRlX3RocmVzaG9s", - "ZBgGIAEoBRIjCgxxdWVyeV9zZW5kZXIYByABKAsyDS5hZWxmLkFkZHJlc3MS", - "HAoIcXVlcnlfaWQYCCABKAsyCi5hZWxmLkhhc2gSDQoFdG9rZW4YCSABKAkS", - "JQodbWF4aW11bV9wZXJtaXNzaWJsZV9kZXZpYXRpb24YCiABKAUSGAoQYWdn", - "cmVnYXRlX29wdGlvbhgLIAEoBRIbCgd0YXNrX2lkGAwgASgLMgouYWVsZi5I", - "YXNoOgSguxgBIvcCChBRdWVyeVRhc2tDcmVhdGVkEhQKDGVhY2hfcGF5bWVu", - "dBgBIAEoAxIcChRzdXBwb3NlZF9xdWVyeV90aW1lcxgCIAEoBRIeCgpxdWVy", - "eV9pbmZvGAMgASgLMgouUXVlcnlJbmZvEiwKCGVuZF90aW1lGAQgASgLMhou", - "Z29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcBIqChRkZXNpZ25hdGVkX25vZGVf", - "bGlzdBgFIAEoCzIMLkFkZHJlc3NMaXN0EjIKG2FnZ3JlZ2F0b3JfY29udHJh", - "Y3RfYWRkcmVzcxgGIAEoCzINLmFlbGYuQWRkcmVzcxIkCg1jYWxsYmFja19p", - "bmZvGAcgASgLMg0uQ2FsbGJhY2tJbmZvEh4KB2NyZWF0b3IYCCABKAsyDS5h", - "ZWxmLkFkZHJlc3MSGwoTYWdncmVnYXRlX3RocmVzaG9sZBgJIAEoBRIYChBh", - "Z2dyZWdhdGVfb3B0aW9uGAogASgFOgSguxgBIjQKDlF1ZXJ5Q2FuY2VsbGVk", - "EhwKCHF1ZXJ5X2lkGAEgASgLMgouYWVsZi5IYXNoOgSguxgBIkQKHlN1ZmZp", - "Y2llbnRDb21taXRtZW50c0NvbGxlY3RlZBIcCghxdWVyeV9pZBgBIAEoCzIK", - "LmFlbGYuSGFzaDoEoLsYASJ7CglDb21taXR0ZWQSHAoIcXVlcnlfaWQYASAB", - "KAsyCi5hZWxmLkhhc2gSKgoTb3JhY2xlX25vZGVfYWRkcmVzcxgCIAEoCzIN", - "LmFlbGYuQWRkcmVzcxIeCgpjb21taXRtZW50GAMgASgLMgouYWVsZi5IYXNo", - "OgSguxgBIrMBChJDb21taXRtZW50UmV2ZWFsZWQSHAoIcXVlcnlfaWQYASAB", - "KAsyCi5hZWxmLkhhc2gSKgoTb3JhY2xlX25vZGVfYWRkcmVzcxgCIAEoCzIN", - "LmFlbGYuQWRkcmVzcxIeCgpjb21taXRtZW50GAMgASgLMgouYWVsZi5IYXNo", - "EhMKC3JldmVhbF9kYXRhGAQgASgJEhgKBHNhbHQYBSABKAsyCi5hZWxmLkhh", - "c2g6BKC7GAEitwEKFkNvbW1pdG1lbnRSZXZlYWxGYWlsZWQSHAoIcXVlcnlf", - "aWQYASABKAsyCi5hZWxmLkhhc2gSKgoTb3JhY2xlX25vZGVfYWRkcmVzcxgC", - "IAEoCzINLmFlbGYuQWRkcmVzcxIeCgpjb21taXRtZW50GAMgASgLMgouYWVs", - "Zi5IYXNoEhMKC3JldmVhbF9kYXRhGAQgASgJEhgKBHNhbHQYBSABKAsyCi5h", - "ZWxmLkhhc2g6BKC7GAEiUwodUXVlcnlDb21wbGV0ZWRXaXRoQWdncmVnYXRp", - "b24SHAoIcXVlcnlfaWQYASABKAsyCi5hZWxmLkhhc2gSDgoGcmVzdWx0GAIg", - "ASgJOgSguxgBImQKIFF1ZXJ5Q29tcGxldGVkV2l0aG91dEFnZ3JlZ2F0aW9u", - "EhwKCHF1ZXJ5X2lkGAEgASgLMgouYWVsZi5IYXNoEhwKBnJlc3VsdBgCIAEo", - "CzIMLlBsYWluUmVzdWx0OgSguxgBInsKC1Rva2VuTG9ja2VkEioKE29yYWNs", - "ZV9ub2RlX2FkZHJlc3MYASABKAsyDS5hZWxmLkFkZHJlc3MSIwoMZnJvbV9h", - "ZGRyZXNzGAIgASgLMg0uYWVsZi5BZGRyZXNzEhUKDWxvY2tlZF9hbW91bnQY", - "AyABKAM6BKC7GAEy7hEKDk9yYWNsZUNvbnRyYWN0EjgKCkluaXRpYWxpemUS", - "EC5Jbml0aWFsaXplSW5wdXQaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiABJG", - "ChhJbml0aWFsaXplQW5kQ3JlYXRlVG9rZW4SEC5Jbml0aWFsaXplSW5wdXQa", - "Fi5nb29nbGUucHJvdG9idWYuRW1wdHkiABIiCgVRdWVyeRILLlF1ZXJ5SW5w", - "dXQaCi5hZWxmLkhhc2giABIwCgZDb21taXQSDC5Db21taXRJbnB1dBoWLmdv", - "b2dsZS5wcm90b2J1Zi5FbXB0eSIAEjAKBlJldmVhbBIMLlJldmVhbElucHV0", - "GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IgASMwoLQ2FuY2VsUXVlcnkSCi5h", - "ZWxmLkhhc2gaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiABI2Cg9DcmVhdGVR", - "dWVyeVRhc2sSFS5DcmVhdGVRdWVyeVRhc2tJbnB1dBoKLmFlbGYuSGFzaCIA", - "EioKCVRhc2tRdWVyeRIPLlRhc2tRdWVyeUlucHV0GgouYWVsZi5IYXNoIgAS", - "RgoRQ29tcGxldGVRdWVyeVRhc2sSFy5Db21wbGV0ZVF1ZXJ5VGFza0lucHV0", - "GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IgASOwoQQ2hhbmdlQ29udHJvbGxl", - "chINLmFlbGYuQWRkcmVzcxoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIAEkAK", - "DkNyZWF0ZVJlZ2ltZW50EhQuQ3JlYXRlUmVnaW1lbnRJbnB1dBoWLmdvb2ds", - "ZS5wcm90b2J1Zi5FbXB0eSIAEjwKDEpvaW5SZWdpbWVudBISLkpvaW5SZWdp", - "bWVudElucHV0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IgASPgoNTGVhdmVS", - "ZWdpbWVudBITLkxlYXZlUmVnaW1lbnRJbnB1dBoWLmdvb2dsZS5wcm90b2J1", - "Zi5FbXB0eSIAEkYKEUFkZFJlZ2ltZW50TWVtYmVyEhcuQWRkUmVnaW1lbnRN", - "ZW1iZXJJbnB1dBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIAEkwKFERlbGV0", - "ZVJlZ2ltZW50TWVtYmVyEhouRGVsZXRlUmVnaW1lbnRNZW1iZXJJbnB1dBoW", - "Lmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIAElYKGVRyYW5zZmVyUmVnaW1lbnRP", - "d25lcnNoaXASHy5UcmFuc2ZlclJlZ2ltZW50T3duZXJzaGlwSW5wdXQaFi5n", - "b29nbGUucHJvdG9idWYuRW1wdHkiABI2CglBZGRBZG1pbnMSDy5BZGRBZG1p", - "bnNJbnB1dBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIAEjwKDERlbGV0ZUFk", - "bWlucxISLkRlbGV0ZUFkbWluc0lucHV0GhYuZ29vZ2xlLnByb3RvYnVmLkVt", - "cHR5IgASOAoKTG9ja1Rva2VucxIQLkxvY2tUb2tlbnNJbnB1dBoWLmdvb2ds", - "ZS5wcm90b2J1Zi5FbXB0eSIAEjwKDFVubG9ja1Rva2VucxISLlVubG9ja1Rv", - "a2Vuc0lucHV0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IgASPgoMU2V0VGhy", - "ZXNob2xkEhQuT3JhY2xlTm9kZVRocmVzaG9sZBoWLmdvb2dsZS5wcm90b2J1", - "Zi5FbXB0eSIAElcKHkNoYW5nZURlZmF1bHRFeHBpcmF0aW9uU2Vjb25kcxIb", - "Lmdvb2dsZS5wcm90b2J1Zi5JbnQzMlZhbHVlGhYuZ29vZ2xlLnByb3RvYnVm", - "LkVtcHR5IgASQwoPRW5hYmxlQ2hhcmdlRmVlEhYuZ29vZ2xlLnByb3RvYnVm", - "LkVtcHR5GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IgASPAoRQWRkUG9zdFBh", - "eUFkZHJlc3MSDS5hZWxmLkFkZHJlc3MaFi5nb29nbGUucHJvdG9idWYuRW1w", - "dHkiABI/ChRSZW1vdmVQb3N0UGF5QWRkcmVzcxINLmFlbGYuQWRkcmVzcxoW", - "Lmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIAEj0KDUdldENvbnRyb2xsZXISFi5n", - "b29nbGUucHJvdG9idWYuRW1wdHkaDS5hZWxmLkFkZHJlc3MiBYiJ9wEBEjEK", - "DkdldFF1ZXJ5UmVjb3JkEgouYWVsZi5IYXNoGgwuUXVlcnlSZWNvcmQiBYiJ", - "9wEBEjUKEEdldENvbW1pdG1lbnRNYXASCi5hZWxmLkhhc2gaDi5Db21taXRt", - "ZW50TWFwIgWIifcBARJTChRHZXRPcmFjbGVUb2tlblN5bWJvbBIWLmdvb2ds", - "ZS5wcm90b2J1Zi5FbXB0eRocLmdvb2dsZS5wcm90b2J1Zi5TdHJpbmdWYWx1", - "ZSIFiIn3AQESSgoVR2V0TG9ja2VkVG9rZW5zQW1vdW50Eg0uYWVsZi5BZGRy", - "ZXNzGhsuZ29vZ2xlLnByb3RvYnVmLkludDY0VmFsdWUiBYiJ9wEBEkMKDEdl", - "dFRocmVzaG9sZBIWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eRoULk9yYWNsZU5v", - "ZGVUaHJlc2hvbGQiBYiJ9wEBElkKG0dldERlZmF1bHRFeHBpcmF0aW9uU2Vj", - "b25kcxIWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eRobLmdvb2dsZS5wcm90b2J1", - "Zi5JbnQzMlZhbHVlIgWIifcBARI1ChJHZXRIZWxwZnVsTm9kZUxpc3QSCi5h", - "ZWxmLkhhc2gaDC5BZGRyZXNzTGlzdCIFiIn3AQESLQoMR2V0UXVlcnlUYXNr", - "EgouYWVsZi5IYXNoGgouUXVlcnlUYXNrIgWIifcBARI7ChVHZXRSZWdpbWVu", - "dE1lbWJlckxpc3QSDS5hZWxmLkFkZHJlc3MaDC5BZGRyZXNzTGlzdCIFiIn3", - "AQEaLrLM9gEpQUVsZi5Db250cmFjdHMuT3JhY2xlLk9yYWNsZUNvbnRyYWN0", - "U3RhdGVCGKoCFUFFbGYuQ29udHJhY3RzLk9yYWNsZWIGcHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::AElf.Types.CoreReflection.Descriptor, global::AElf.OptionsReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.InitializeInput), global::AElf.Contracts.Oracle.InitializeInput.Parser, new[]{ "MinimumOracleNodesCount", "DefaultRevealThreshold", "DefaultAggregateThreshold", "DefaultExpirationSeconds", "IsChargeFee", "RegimentContractAddress" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.QueryInput), global::AElf.Contracts.Oracle.QueryInput.Parser, new[]{ "Payment", "CallbackInfo", "AggregatorContractAddress", "DesignatedNodeList", "QueryInfo", "AggregateThreshold", "Token", "AggregateOption", "TaskId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.CreateQueryTaskInput), global::AElf.Contracts.Oracle.CreateQueryTaskInput.Parser, new[]{ "EachPayment", "SupposedQueryTimes", "QueryInfo", "EndTime", "CallbackInfo", "AggregatorContractAddress", "AggregateOption" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.TaskQueryInput), global::AElf.Contracts.Oracle.TaskQueryInput.Parser, new[]{ "TaskId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.CompleteQueryTaskInput), global::AElf.Contracts.Oracle.CompleteQueryTaskInput.Parser, new[]{ "TaskId", "DesignatedNodeList", "AggregateThreshold" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.CallbackInfo), global::AElf.Contracts.Oracle.CallbackInfo.Parser, new[]{ "ContractAddress", "MethodName" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.AddressList), global::AElf.Contracts.Oracle.AddressList.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.QueryRecord), global::AElf.Contracts.Oracle.QueryRecord.Parser, new[]{ "DesignatedNodeList", "AggregatorContractAddress", "ExpirationTimestamp", "IsSufficientCommitmentsCollected", "IsSufficientDataCollected", "FinalResult", "Payment", "CallbackInfo", "QueryId", "AggregateThreshold", "QuerySender", "IsCommitStageFinished", "CommitmentsCount", "IsCancelled", "QueryInfo", "Token", "DataRecords", "AggregateOption", "TaskId", "IsPaidToOracleContract" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.CreateRegimentInput), global::AElf.Contracts.Oracle.CreateRegimentInput.Parser, new[]{ "Manager", "InitialMemberList", "IsApproveToJoin" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.JoinRegimentInput), global::AElf.Contracts.Oracle.JoinRegimentInput.Parser, new[]{ "RegimentAddress", "NewMemberAddress" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.LeaveRegimentInput), global::AElf.Contracts.Oracle.LeaveRegimentInput.Parser, new[]{ "RegimentAddress", "LeaveMemberAddress" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.AddRegimentMemberInput), global::AElf.Contracts.Oracle.AddRegimentMemberInput.Parser, new[]{ "RegimentAddress", "NewMemberAddress" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.DeleteRegimentMemberInput), global::AElf.Contracts.Oracle.DeleteRegimentMemberInput.Parser, new[]{ "RegimentAddress", "DeleteMemberAddress" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.TransferRegimentOwnershipInput), global::AElf.Contracts.Oracle.TransferRegimentOwnershipInput.Parser, new[]{ "RegimentAddress", "NewManagerAddress", "OriginSenderAddress" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.AddAdminsInput), global::AElf.Contracts.Oracle.AddAdminsInput.Parser, new[]{ "RegimentAddress", "NewAdmins", "OriginSenderAddress" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.DeleteAdminsInput), global::AElf.Contracts.Oracle.DeleteAdminsInput.Parser, new[]{ "RegimentAddress", "DeleteAdmins", "OriginSenderAddress" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.QueryTask), global::AElf.Contracts.Oracle.QueryTask.Parser, new[]{ "EachPayment", "SupposedQueryTimes", "QueryInfo", "EndTime", "DesignatedNodeList", "AggregatorContractAddress", "ActualQueriedTimes", "CallbackInfo", "Creator", "AggregateThreshold", "AggregateOption" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.CommitInput), global::AElf.Contracts.Oracle.CommitInput.Parser, new[]{ "QueryId", "Commitment" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.RevealInput), global::AElf.Contracts.Oracle.RevealInput.Parser, new[]{ "QueryId", "Data", "Salt" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.CommitmentMap), global::AElf.Contracts.Oracle.CommitmentMap.Parser, new[]{ "Value" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.OracleNodeThreshold), global::AElf.Contracts.Oracle.OracleNodeThreshold.Parser, new[]{ "MinimumOracleNodesCount", "DefaultRevealThreshold", "DefaultAggregateThreshold" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.ResultList), global::AElf.Contracts.Oracle.ResultList.Parser, new[]{ "Results", "Frequencies" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.DataRecord), global::AElf.Contracts.Oracle.DataRecord.Parser, new[]{ "Address", "Data" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.DataRecords), global::AElf.Contracts.Oracle.DataRecords.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.PlainResult), global::AElf.Contracts.Oracle.PlainResult.Parser, new[]{ "DataRecords", "RegimentAddress", "QueryInfo", "Token" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.LockTokensInput), global::AElf.Contracts.Oracle.LockTokensInput.Parser, new[]{ "OracleNodeAddress", "LockAmount" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.UnlockTokensInput), global::AElf.Contracts.Oracle.UnlockTokensInput.Parser, new[]{ "OracleNodeAddress", "WithdrawAmount" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.QueryInfo), global::AElf.Contracts.Oracle.QueryInfo.Parser, new[]{ "Title", "Options" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.QueryCreated), global::AElf.Contracts.Oracle.QueryCreated.Parser, new[]{ "Payment", "CallbackInfo", "AggregatorContractAddress", "DesignatedNodeList", "QueryInfo", "AggregateThreshold", "QuerySender", "QueryId", "Token", "MaximumPermissibleDeviation", "AggregateOption", "TaskId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.QueryTaskCreated), global::AElf.Contracts.Oracle.QueryTaskCreated.Parser, new[]{ "EachPayment", "SupposedQueryTimes", "QueryInfo", "EndTime", "DesignatedNodeList", "AggregatorContractAddress", "CallbackInfo", "Creator", "AggregateThreshold", "AggregateOption" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.QueryCancelled), global::AElf.Contracts.Oracle.QueryCancelled.Parser, new[]{ "QueryId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.SufficientCommitmentsCollected), global::AElf.Contracts.Oracle.SufficientCommitmentsCollected.Parser, new[]{ "QueryId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.Committed), global::AElf.Contracts.Oracle.Committed.Parser, new[]{ "QueryId", "OracleNodeAddress", "Commitment" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.CommitmentRevealed), global::AElf.Contracts.Oracle.CommitmentRevealed.Parser, new[]{ "QueryId", "OracleNodeAddress", "Commitment", "RevealData", "Salt" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.CommitmentRevealFailed), global::AElf.Contracts.Oracle.CommitmentRevealFailed.Parser, new[]{ "QueryId", "OracleNodeAddress", "Commitment", "RevealData", "Salt" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.QueryCompletedWithAggregation), global::AElf.Contracts.Oracle.QueryCompletedWithAggregation.Parser, new[]{ "QueryId", "Result" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.QueryCompletedWithoutAggregation), global::AElf.Contracts.Oracle.QueryCompletedWithoutAggregation.Parser, new[]{ "QueryId", "Result" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Oracle.TokenLocked), global::AElf.Contracts.Oracle.TokenLocked.Parser, new[]{ "OracleNodeAddress", "FromAddress", "LockedAmount" }, null, null, null, null) - })); - } - #endregion - - } - #region Messages - internal sealed partial class InitializeInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new InitializeInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitializeInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitializeInput(InitializeInput other) : this() { - minimumOracleNodesCount_ = other.minimumOracleNodesCount_; - defaultRevealThreshold_ = other.defaultRevealThreshold_; - defaultAggregateThreshold_ = other.defaultAggregateThreshold_; - defaultExpirationSeconds_ = other.defaultExpirationSeconds_; - isChargeFee_ = other.isChargeFee_; - regimentContractAddress_ = other.regimentContractAddress_ != null ? other.regimentContractAddress_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitializeInput Clone() { - return new InitializeInput(this); - } - - /// Field number for the "minimum_oracle_nodes_count" field. - public const int MinimumOracleNodesCountFieldNumber = 1; - private int minimumOracleNodesCount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int MinimumOracleNodesCount { - get { return minimumOracleNodesCount_; } - set { - minimumOracleNodesCount_ = value; - } - } - - /// Field number for the "default_reveal_threshold" field. - public const int DefaultRevealThresholdFieldNumber = 2; - private int defaultRevealThreshold_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int DefaultRevealThreshold { - get { return defaultRevealThreshold_; } - set { - defaultRevealThreshold_ = value; - } - } - - /// Field number for the "default_aggregate_threshold" field. - public const int DefaultAggregateThresholdFieldNumber = 3; - private int defaultAggregateThreshold_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int DefaultAggregateThreshold { - get { return defaultAggregateThreshold_; } - set { - defaultAggregateThreshold_ = value; - } - } - - /// Field number for the "default_expiration_seconds" field. - public const int DefaultExpirationSecondsFieldNumber = 4; - private int defaultExpirationSeconds_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int DefaultExpirationSeconds { - get { return defaultExpirationSeconds_; } - set { - defaultExpirationSeconds_ = value; - } - } - - /// Field number for the "is_charge_fee" field. - public const int IsChargeFeeFieldNumber = 5; - private bool isChargeFee_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsChargeFee { - get { return isChargeFee_; } - set { - isChargeFee_ = value; - } - } - - /// Field number for the "regiment_contract_address" field. - public const int RegimentContractAddressFieldNumber = 6; - private global::AElf.Types.Address regimentContractAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address RegimentContractAddress { - get { return regimentContractAddress_; } - set { - regimentContractAddress_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as InitializeInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(InitializeInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (MinimumOracleNodesCount != other.MinimumOracleNodesCount) return false; - if (DefaultRevealThreshold != other.DefaultRevealThreshold) return false; - if (DefaultAggregateThreshold != other.DefaultAggregateThreshold) return false; - if (DefaultExpirationSeconds != other.DefaultExpirationSeconds) return false; - if (IsChargeFee != other.IsChargeFee) return false; - if (!object.Equals(RegimentContractAddress, other.RegimentContractAddress)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (MinimumOracleNodesCount != 0) hash ^= MinimumOracleNodesCount.GetHashCode(); - if (DefaultRevealThreshold != 0) hash ^= DefaultRevealThreshold.GetHashCode(); - if (DefaultAggregateThreshold != 0) hash ^= DefaultAggregateThreshold.GetHashCode(); - if (DefaultExpirationSeconds != 0) hash ^= DefaultExpirationSeconds.GetHashCode(); - if (IsChargeFee != false) hash ^= IsChargeFee.GetHashCode(); - if (regimentContractAddress_ != null) hash ^= RegimentContractAddress.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (MinimumOracleNodesCount != 0) { - output.WriteRawTag(8); - output.WriteInt32(MinimumOracleNodesCount); - } - if (DefaultRevealThreshold != 0) { - output.WriteRawTag(16); - output.WriteInt32(DefaultRevealThreshold); - } - if (DefaultAggregateThreshold != 0) { - output.WriteRawTag(24); - output.WriteInt32(DefaultAggregateThreshold); - } - if (DefaultExpirationSeconds != 0) { - output.WriteRawTag(32); - output.WriteInt32(DefaultExpirationSeconds); - } - if (IsChargeFee != false) { - output.WriteRawTag(40); - output.WriteBool(IsChargeFee); - } - if (regimentContractAddress_ != null) { - output.WriteRawTag(50); - output.WriteMessage(RegimentContractAddress); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (MinimumOracleNodesCount != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(MinimumOracleNodesCount); - } - if (DefaultRevealThreshold != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(DefaultRevealThreshold); - } - if (DefaultAggregateThreshold != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(DefaultAggregateThreshold); - } - if (DefaultExpirationSeconds != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(DefaultExpirationSeconds); - } - if (IsChargeFee != false) { - size += 1 + 1; - } - if (regimentContractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegimentContractAddress); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(InitializeInput other) { - if (other == null) { - return; - } - if (other.MinimumOracleNodesCount != 0) { - MinimumOracleNodesCount = other.MinimumOracleNodesCount; - } - if (other.DefaultRevealThreshold != 0) { - DefaultRevealThreshold = other.DefaultRevealThreshold; - } - if (other.DefaultAggregateThreshold != 0) { - DefaultAggregateThreshold = other.DefaultAggregateThreshold; - } - if (other.DefaultExpirationSeconds != 0) { - DefaultExpirationSeconds = other.DefaultExpirationSeconds; - } - if (other.IsChargeFee != false) { - IsChargeFee = other.IsChargeFee; - } - if (other.regimentContractAddress_ != null) { - if (regimentContractAddress_ == null) { - RegimentContractAddress = new global::AElf.Types.Address(); - } - RegimentContractAddress.MergeFrom(other.RegimentContractAddress); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - MinimumOracleNodesCount = input.ReadInt32(); - break; - } - case 16: { - DefaultRevealThreshold = input.ReadInt32(); - break; - } - case 24: { - DefaultAggregateThreshold = input.ReadInt32(); - break; - } - case 32: { - DefaultExpirationSeconds = input.ReadInt32(); - break; - } - case 40: { - IsChargeFee = input.ReadBool(); - break; - } - case 50: { - if (regimentContractAddress_ == null) { - RegimentContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(RegimentContractAddress); - break; - } - } - } - } - - } - - internal sealed partial class QueryInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryInput(QueryInput other) : this() { - payment_ = other.payment_; - callbackInfo_ = other.callbackInfo_ != null ? other.callbackInfo_.Clone() : null; - aggregatorContractAddress_ = other.aggregatorContractAddress_ != null ? other.aggregatorContractAddress_.Clone() : null; - designatedNodeList_ = other.designatedNodeList_ != null ? other.designatedNodeList_.Clone() : null; - queryInfo_ = other.queryInfo_ != null ? other.queryInfo_.Clone() : null; - aggregateThreshold_ = other.aggregateThreshold_; - token_ = other.token_; - aggregateOption_ = other.aggregateOption_; - taskId_ = other.taskId_ != null ? other.taskId_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryInput Clone() { - return new QueryInput(this); - } - - /// Field number for the "payment" field. - public const int PaymentFieldNumber = 1; - private long payment_; - /// - /// Maximum for this query option. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Payment { - get { return payment_; } - set { - payment_ = value; - } - } - - /// Field number for the "callback_info" field. - public const int CallbackInfoFieldNumber = 2; - private global::AElf.Contracts.Oracle.CallbackInfo callbackInfo_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.CallbackInfo CallbackInfo { - get { return callbackInfo_; } - set { - callbackInfo_ = value; - } - } - - /// Field number for the "aggregator_contract_address" field. - public const int AggregatorContractAddressFieldNumber = 3; - private global::AElf.Types.Address aggregatorContractAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address AggregatorContractAddress { - get { return aggregatorContractAddress_; } - set { - aggregatorContractAddress_ = value; - } - } - - /// Field number for the "designated_node_list" field. - public const int DesignatedNodeListFieldNumber = 4; - private global::AElf.Contracts.Oracle.AddressList designatedNodeList_; - /// - /// Will be regiment address if count is 1. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.AddressList DesignatedNodeList { - get { return designatedNodeList_; } - set { - designatedNodeList_ = value; - } - } - - /// Field number for the "query_info" field. - public const int QueryInfoFieldNumber = 5; - private global::AElf.Contracts.Oracle.QueryInfo queryInfo_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.QueryInfo QueryInfo { - get { return queryInfo_; } - set { - queryInfo_ = value; - } - } - - /// Field number for the "aggregate_threshold" field. - public const int AggregateThresholdFieldNumber = 6; - private int aggregateThreshold_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int AggregateThreshold { - get { return aggregateThreshold_; } - set { - aggregateThreshold_ = value; - } - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 7; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "aggregate_option" field. - public const int AggregateOptionFieldNumber = 8; - private int aggregateOption_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int AggregateOption { - get { return aggregateOption_; } - set { - aggregateOption_ = value; - } - } - - /// Field number for the "task_id" field. - public const int TaskIdFieldNumber = 9; - private global::AElf.Types.Hash taskId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash TaskId { - get { return taskId_; } - set { - taskId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as QueryInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueryInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Payment != other.Payment) return false; - if (!object.Equals(CallbackInfo, other.CallbackInfo)) return false; - if (!object.Equals(AggregatorContractAddress, other.AggregatorContractAddress)) return false; - if (!object.Equals(DesignatedNodeList, other.DesignatedNodeList)) return false; - if (!object.Equals(QueryInfo, other.QueryInfo)) return false; - if (AggregateThreshold != other.AggregateThreshold) return false; - if (Token != other.Token) return false; - if (AggregateOption != other.AggregateOption) return false; - if (!object.Equals(TaskId, other.TaskId)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Payment != 0L) hash ^= Payment.GetHashCode(); - if (callbackInfo_ != null) hash ^= CallbackInfo.GetHashCode(); - if (aggregatorContractAddress_ != null) hash ^= AggregatorContractAddress.GetHashCode(); - if (designatedNodeList_ != null) hash ^= DesignatedNodeList.GetHashCode(); - if (queryInfo_ != null) hash ^= QueryInfo.GetHashCode(); - if (AggregateThreshold != 0) hash ^= AggregateThreshold.GetHashCode(); - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (AggregateOption != 0) hash ^= AggregateOption.GetHashCode(); - if (taskId_ != null) hash ^= TaskId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Payment != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Payment); - } - if (callbackInfo_ != null) { - output.WriteRawTag(18); - output.WriteMessage(CallbackInfo); - } - if (aggregatorContractAddress_ != null) { - output.WriteRawTag(26); - output.WriteMessage(AggregatorContractAddress); - } - if (designatedNodeList_ != null) { - output.WriteRawTag(34); - output.WriteMessage(DesignatedNodeList); - } - if (queryInfo_ != null) { - output.WriteRawTag(42); - output.WriteMessage(QueryInfo); - } - if (AggregateThreshold != 0) { - output.WriteRawTag(48); - output.WriteInt32(AggregateThreshold); - } - if (Token.Length != 0) { - output.WriteRawTag(58); - output.WriteString(Token); - } - if (AggregateOption != 0) { - output.WriteRawTag(64); - output.WriteInt32(AggregateOption); - } - if (taskId_ != null) { - output.WriteRawTag(74); - output.WriteMessage(TaskId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Payment != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Payment); - } - if (callbackInfo_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(CallbackInfo); - } - if (aggregatorContractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(AggregatorContractAddress); - } - if (designatedNodeList_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(DesignatedNodeList); - } - if (queryInfo_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryInfo); - } - if (AggregateThreshold != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(AggregateThreshold); - } - if (Token.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (AggregateOption != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(AggregateOption); - } - if (taskId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(TaskId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueryInput other) { - if (other == null) { - return; - } - if (other.Payment != 0L) { - Payment = other.Payment; - } - if (other.callbackInfo_ != null) { - if (callbackInfo_ == null) { - CallbackInfo = new global::AElf.Contracts.Oracle.CallbackInfo(); - } - CallbackInfo.MergeFrom(other.CallbackInfo); - } - if (other.aggregatorContractAddress_ != null) { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - AggregatorContractAddress.MergeFrom(other.AggregatorContractAddress); - } - if (other.designatedNodeList_ != null) { - if (designatedNodeList_ == null) { - DesignatedNodeList = new global::AElf.Contracts.Oracle.AddressList(); - } - DesignatedNodeList.MergeFrom(other.DesignatedNodeList); - } - if (other.queryInfo_ != null) { - if (queryInfo_ == null) { - QueryInfo = new global::AElf.Contracts.Oracle.QueryInfo(); - } - QueryInfo.MergeFrom(other.QueryInfo); - } - if (other.AggregateThreshold != 0) { - AggregateThreshold = other.AggregateThreshold; - } - if (other.Token.Length != 0) { - Token = other.Token; - } - if (other.AggregateOption != 0) { - AggregateOption = other.AggregateOption; - } - if (other.taskId_ != null) { - if (taskId_ == null) { - TaskId = new global::AElf.Types.Hash(); - } - TaskId.MergeFrom(other.TaskId); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Payment = input.ReadInt64(); - break; - } - case 18: { - if (callbackInfo_ == null) { - CallbackInfo = new global::AElf.Contracts.Oracle.CallbackInfo(); - } - input.ReadMessage(CallbackInfo); - break; - } - case 26: { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(AggregatorContractAddress); - break; - } - case 34: { - if (designatedNodeList_ == null) { - DesignatedNodeList = new global::AElf.Contracts.Oracle.AddressList(); - } - input.ReadMessage(DesignatedNodeList); - break; - } - case 42: { - if (queryInfo_ == null) { - QueryInfo = new global::AElf.Contracts.Oracle.QueryInfo(); - } - input.ReadMessage(QueryInfo); - break; - } - case 48: { - AggregateThreshold = input.ReadInt32(); - break; - } - case 58: { - Token = input.ReadString(); - break; - } - case 64: { - AggregateOption = input.ReadInt32(); - break; - } - case 74: { - if (taskId_ == null) { - TaskId = new global::AElf.Types.Hash(); - } - input.ReadMessage(TaskId); - break; - } - } - } - } - - } - - internal sealed partial class CreateQueryTaskInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateQueryTaskInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CreateQueryTaskInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CreateQueryTaskInput(CreateQueryTaskInput other) : this() { - eachPayment_ = other.eachPayment_; - supposedQueryTimes_ = other.supposedQueryTimes_; - queryInfo_ = other.queryInfo_ != null ? other.queryInfo_.Clone() : null; - endTime_ = other.endTime_ != null ? other.endTime_.Clone() : null; - callbackInfo_ = other.callbackInfo_ != null ? other.callbackInfo_.Clone() : null; - aggregatorContractAddress_ = other.aggregatorContractAddress_ != null ? other.aggregatorContractAddress_.Clone() : null; - aggregateOption_ = other.aggregateOption_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CreateQueryTaskInput Clone() { - return new CreateQueryTaskInput(this); - } - - /// Field number for the "each_payment" field. - public const int EachPaymentFieldNumber = 1; - private long eachPayment_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long EachPayment { - get { return eachPayment_; } - set { - eachPayment_ = value; - } - } - - /// Field number for the "supposed_query_times" field. - public const int SupposedQueryTimesFieldNumber = 2; - private int supposedQueryTimes_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int SupposedQueryTimes { - get { return supposedQueryTimes_; } - set { - supposedQueryTimes_ = value; - } - } - - /// Field number for the "query_info" field. - public const int QueryInfoFieldNumber = 3; - private global::AElf.Contracts.Oracle.QueryInfo queryInfo_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.QueryInfo QueryInfo { - get { return queryInfo_; } - set { - queryInfo_ = value; - } - } - - /// Field number for the "end_time" field. - public const int EndTimeFieldNumber = 4; - private global::Google.Protobuf.WellKnownTypes.Timestamp endTime_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp EndTime { - get { return endTime_; } - set { - endTime_ = value; - } - } - - /// Field number for the "callback_info" field. - public const int CallbackInfoFieldNumber = 5; - private global::AElf.Contracts.Oracle.CallbackInfo callbackInfo_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.CallbackInfo CallbackInfo { - get { return callbackInfo_; } - set { - callbackInfo_ = value; - } - } - - /// Field number for the "aggregator_contract_address" field. - public const int AggregatorContractAddressFieldNumber = 6; - private global::AElf.Types.Address aggregatorContractAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address AggregatorContractAddress { - get { return aggregatorContractAddress_; } - set { - aggregatorContractAddress_ = value; - } - } - - /// Field number for the "aggregate_option" field. - public const int AggregateOptionFieldNumber = 7; - private int aggregateOption_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int AggregateOption { - get { return aggregateOption_; } - set { - aggregateOption_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as CreateQueryTaskInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(CreateQueryTaskInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (EachPayment != other.EachPayment) return false; - if (SupposedQueryTimes != other.SupposedQueryTimes) return false; - if (!object.Equals(QueryInfo, other.QueryInfo)) return false; - if (!object.Equals(EndTime, other.EndTime)) return false; - if (!object.Equals(CallbackInfo, other.CallbackInfo)) return false; - if (!object.Equals(AggregatorContractAddress, other.AggregatorContractAddress)) return false; - if (AggregateOption != other.AggregateOption) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (EachPayment != 0L) hash ^= EachPayment.GetHashCode(); - if (SupposedQueryTimes != 0) hash ^= SupposedQueryTimes.GetHashCode(); - if (queryInfo_ != null) hash ^= QueryInfo.GetHashCode(); - if (endTime_ != null) hash ^= EndTime.GetHashCode(); - if (callbackInfo_ != null) hash ^= CallbackInfo.GetHashCode(); - if (aggregatorContractAddress_ != null) hash ^= AggregatorContractAddress.GetHashCode(); - if (AggregateOption != 0) hash ^= AggregateOption.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (EachPayment != 0L) { - output.WriteRawTag(8); - output.WriteInt64(EachPayment); - } - if (SupposedQueryTimes != 0) { - output.WriteRawTag(16); - output.WriteInt32(SupposedQueryTimes); - } - if (queryInfo_ != null) { - output.WriteRawTag(26); - output.WriteMessage(QueryInfo); - } - if (endTime_ != null) { - output.WriteRawTag(34); - output.WriteMessage(EndTime); - } - if (callbackInfo_ != null) { - output.WriteRawTag(42); - output.WriteMessage(CallbackInfo); - } - if (aggregatorContractAddress_ != null) { - output.WriteRawTag(50); - output.WriteMessage(AggregatorContractAddress); - } - if (AggregateOption != 0) { - output.WriteRawTag(56); - output.WriteInt32(AggregateOption); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (EachPayment != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(EachPayment); - } - if (SupposedQueryTimes != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(SupposedQueryTimes); - } - if (queryInfo_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryInfo); - } - if (endTime_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(EndTime); - } - if (callbackInfo_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(CallbackInfo); - } - if (aggregatorContractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(AggregatorContractAddress); - } - if (AggregateOption != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(AggregateOption); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(CreateQueryTaskInput other) { - if (other == null) { - return; - } - if (other.EachPayment != 0L) { - EachPayment = other.EachPayment; - } - if (other.SupposedQueryTimes != 0) { - SupposedQueryTimes = other.SupposedQueryTimes; - } - if (other.queryInfo_ != null) { - if (queryInfo_ == null) { - QueryInfo = new global::AElf.Contracts.Oracle.QueryInfo(); - } - QueryInfo.MergeFrom(other.QueryInfo); - } - if (other.endTime_ != null) { - if (endTime_ == null) { - EndTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - EndTime.MergeFrom(other.EndTime); - } - if (other.callbackInfo_ != null) { - if (callbackInfo_ == null) { - CallbackInfo = new global::AElf.Contracts.Oracle.CallbackInfo(); - } - CallbackInfo.MergeFrom(other.CallbackInfo); - } - if (other.aggregatorContractAddress_ != null) { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - AggregatorContractAddress.MergeFrom(other.AggregatorContractAddress); - } - if (other.AggregateOption != 0) { - AggregateOption = other.AggregateOption; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - EachPayment = input.ReadInt64(); - break; - } - case 16: { - SupposedQueryTimes = input.ReadInt32(); - break; - } - case 26: { - if (queryInfo_ == null) { - QueryInfo = new global::AElf.Contracts.Oracle.QueryInfo(); - } - input.ReadMessage(QueryInfo); - break; - } - case 34: { - if (endTime_ == null) { - EndTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(EndTime); - break; - } - case 42: { - if (callbackInfo_ == null) { - CallbackInfo = new global::AElf.Contracts.Oracle.CallbackInfo(); - } - input.ReadMessage(CallbackInfo); - break; - } - case 50: { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(AggregatorContractAddress); - break; - } - case 56: { - AggregateOption = input.ReadInt32(); - break; - } - } - } - } - - } - - internal sealed partial class TaskQueryInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TaskQueryInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TaskQueryInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TaskQueryInput(TaskQueryInput other) : this() { - taskId_ = other.taskId_ != null ? other.taskId_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TaskQueryInput Clone() { - return new TaskQueryInput(this); - } - - /// Field number for the "task_id" field. - public const int TaskIdFieldNumber = 1; - private global::AElf.Types.Hash taskId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash TaskId { - get { return taskId_; } - set { - taskId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TaskQueryInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TaskQueryInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(TaskId, other.TaskId)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (taskId_ != null) hash ^= TaskId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (taskId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(TaskId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (taskId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(TaskId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TaskQueryInput other) { - if (other == null) { - return; - } - if (other.taskId_ != null) { - if (taskId_ == null) { - TaskId = new global::AElf.Types.Hash(); - } - TaskId.MergeFrom(other.TaskId); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (taskId_ == null) { - TaskId = new global::AElf.Types.Hash(); - } - input.ReadMessage(TaskId); - break; - } - } - } - } - - } - - internal sealed partial class CompleteQueryTaskInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CompleteQueryTaskInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CompleteQueryTaskInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CompleteQueryTaskInput(CompleteQueryTaskInput other) : this() { - taskId_ = other.taskId_ != null ? other.taskId_.Clone() : null; - designatedNodeList_ = other.designatedNodeList_ != null ? other.designatedNodeList_.Clone() : null; - aggregateThreshold_ = other.aggregateThreshold_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CompleteQueryTaskInput Clone() { - return new CompleteQueryTaskInput(this); - } - - /// Field number for the "task_id" field. - public const int TaskIdFieldNumber = 1; - private global::AElf.Types.Hash taskId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash TaskId { - get { return taskId_; } - set { - taskId_ = value; - } - } - - /// Field number for the "designated_node_list" field. - public const int DesignatedNodeListFieldNumber = 2; - private global::AElf.Contracts.Oracle.AddressList designatedNodeList_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.AddressList DesignatedNodeList { - get { return designatedNodeList_; } - set { - designatedNodeList_ = value; - } - } - - /// Field number for the "aggregate_threshold" field. - public const int AggregateThresholdFieldNumber = 3; - private int aggregateThreshold_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int AggregateThreshold { - get { return aggregateThreshold_; } - set { - aggregateThreshold_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as CompleteQueryTaskInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(CompleteQueryTaskInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(TaskId, other.TaskId)) return false; - if (!object.Equals(DesignatedNodeList, other.DesignatedNodeList)) return false; - if (AggregateThreshold != other.AggregateThreshold) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (taskId_ != null) hash ^= TaskId.GetHashCode(); - if (designatedNodeList_ != null) hash ^= DesignatedNodeList.GetHashCode(); - if (AggregateThreshold != 0) hash ^= AggregateThreshold.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (taskId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(TaskId); - } - if (designatedNodeList_ != null) { - output.WriteRawTag(18); - output.WriteMessage(DesignatedNodeList); - } - if (AggregateThreshold != 0) { - output.WriteRawTag(24); - output.WriteInt32(AggregateThreshold); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (taskId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(TaskId); - } - if (designatedNodeList_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(DesignatedNodeList); - } - if (AggregateThreshold != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(AggregateThreshold); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(CompleteQueryTaskInput other) { - if (other == null) { - return; - } - if (other.taskId_ != null) { - if (taskId_ == null) { - TaskId = new global::AElf.Types.Hash(); - } - TaskId.MergeFrom(other.TaskId); - } - if (other.designatedNodeList_ != null) { - if (designatedNodeList_ == null) { - DesignatedNodeList = new global::AElf.Contracts.Oracle.AddressList(); - } - DesignatedNodeList.MergeFrom(other.DesignatedNodeList); - } - if (other.AggregateThreshold != 0) { - AggregateThreshold = other.AggregateThreshold; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (taskId_ == null) { - TaskId = new global::AElf.Types.Hash(); - } - input.ReadMessage(TaskId); - break; - } - case 18: { - if (designatedNodeList_ == null) { - DesignatedNodeList = new global::AElf.Contracts.Oracle.AddressList(); - } - input.ReadMessage(DesignatedNodeList); - break; - } - case 24: { - AggregateThreshold = input.ReadInt32(); - break; - } - } - } - } - - } - - internal sealed partial class CallbackInfo : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CallbackInfo()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[5]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CallbackInfo() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CallbackInfo(CallbackInfo other) : this() { - contractAddress_ = other.contractAddress_ != null ? other.contractAddress_.Clone() : null; - methodName_ = other.methodName_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CallbackInfo Clone() { - return new CallbackInfo(this); - } - - /// Field number for the "contract_address" field. - public const int ContractAddressFieldNumber = 1; - private global::AElf.Types.Address contractAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address ContractAddress { - get { return contractAddress_; } - set { - contractAddress_ = value; - } - } - - /// Field number for the "method_name" field. - public const int MethodNameFieldNumber = 2; - private string methodName_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string MethodName { - get { return methodName_; } - set { - methodName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as CallbackInfo); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(CallbackInfo other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(ContractAddress, other.ContractAddress)) return false; - if (MethodName != other.MethodName) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (contractAddress_ != null) hash ^= ContractAddress.GetHashCode(); - if (MethodName.Length != 0) hash ^= MethodName.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (contractAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(ContractAddress); - } - if (MethodName.Length != 0) { - output.WriteRawTag(18); - output.WriteString(MethodName); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (contractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ContractAddress); - } - if (MethodName.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(MethodName); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(CallbackInfo other) { - if (other == null) { - return; - } - if (other.contractAddress_ != null) { - if (contractAddress_ == null) { - ContractAddress = new global::AElf.Types.Address(); - } - ContractAddress.MergeFrom(other.ContractAddress); - } - if (other.MethodName.Length != 0) { - MethodName = other.MethodName; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (contractAddress_ == null) { - ContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(ContractAddress); - break; - } - case 18: { - MethodName = input.ReadString(); - break; - } - } - } - } - - } - - internal sealed partial class AddressList : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AddressList()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[6]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AddressList() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AddressList(AddressList other) : this() { - value_ = other.value_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AddressList Clone() { - return new AddressList(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_value_codec - = pb::FieldCodec.ForMessage(10, global::AElf.Types.Address.Parser); - private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Value { - get { return value_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as AddressList); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(AddressList other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!value_.Equals(other.value_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= value_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - value_.WriteTo(output, _repeated_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += value_.CalculateSize(_repeated_value_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(AddressList other) { - if (other == null) { - return; - } - value_.Add(other.value_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - value_.AddEntriesFrom(input, _repeated_value_codec); - break; - } - } - } - } - - } - - internal sealed partial class QueryRecord : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryRecord()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[7]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryRecord() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryRecord(QueryRecord other) : this() { - designatedNodeList_ = other.designatedNodeList_ != null ? other.designatedNodeList_.Clone() : null; - aggregatorContractAddress_ = other.aggregatorContractAddress_ != null ? other.aggregatorContractAddress_.Clone() : null; - expirationTimestamp_ = other.expirationTimestamp_ != null ? other.expirationTimestamp_.Clone() : null; - isSufficientCommitmentsCollected_ = other.isSufficientCommitmentsCollected_; - isSufficientDataCollected_ = other.isSufficientDataCollected_; - finalResult_ = other.finalResult_; - payment_ = other.payment_; - callbackInfo_ = other.callbackInfo_ != null ? other.callbackInfo_.Clone() : null; - queryId_ = other.queryId_ != null ? other.queryId_.Clone() : null; - aggregateThreshold_ = other.aggregateThreshold_; - querySender_ = other.querySender_ != null ? other.querySender_.Clone() : null; - isCommitStageFinished_ = other.isCommitStageFinished_; - commitmentsCount_ = other.commitmentsCount_; - isCancelled_ = other.isCancelled_; - queryInfo_ = other.queryInfo_ != null ? other.queryInfo_.Clone() : null; - token_ = other.token_; - dataRecords_ = other.dataRecords_ != null ? other.dataRecords_.Clone() : null; - aggregateOption_ = other.aggregateOption_; - taskId_ = other.taskId_ != null ? other.taskId_.Clone() : null; - isPaidToOracleContract_ = other.isPaidToOracleContract_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryRecord Clone() { - return new QueryRecord(this); - } - - /// Field number for the "designated_node_list" field. - public const int DesignatedNodeListFieldNumber = 1; - private global::AElf.Contracts.Oracle.AddressList designatedNodeList_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.AddressList DesignatedNodeList { - get { return designatedNodeList_; } - set { - designatedNodeList_ = value; - } - } - - /// Field number for the "aggregator_contract_address" field. - public const int AggregatorContractAddressFieldNumber = 2; - private global::AElf.Types.Address aggregatorContractAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address AggregatorContractAddress { - get { return aggregatorContractAddress_; } - set { - aggregatorContractAddress_ = value; - } - } - - /// Field number for the "expiration_timestamp" field. - public const int ExpirationTimestampFieldNumber = 3; - private global::Google.Protobuf.WellKnownTypes.Timestamp expirationTimestamp_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp ExpirationTimestamp { - get { return expirationTimestamp_; } - set { - expirationTimestamp_ = value; - } - } - - /// Field number for the "is_sufficient_commitments_collected" field. - public const int IsSufficientCommitmentsCollectedFieldNumber = 4; - private bool isSufficientCommitmentsCollected_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsSufficientCommitmentsCollected { - get { return isSufficientCommitmentsCollected_; } - set { - isSufficientCommitmentsCollected_ = value; - } - } - - /// Field number for the "is_sufficient_data_collected" field. - public const int IsSufficientDataCollectedFieldNumber = 5; - private bool isSufficientDataCollected_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsSufficientDataCollected { - get { return isSufficientDataCollected_; } - set { - isSufficientDataCollected_ = value; - } - } - - /// Field number for the "final_result" field. - public const int FinalResultFieldNumber = 6; - private string finalResult_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string FinalResult { - get { return finalResult_; } - set { - finalResult_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "payment" field. - public const int PaymentFieldNumber = 7; - private long payment_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Payment { - get { return payment_; } - set { - payment_ = value; - } - } - - /// Field number for the "callback_info" field. - public const int CallbackInfoFieldNumber = 8; - private global::AElf.Contracts.Oracle.CallbackInfo callbackInfo_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.CallbackInfo CallbackInfo { - get { return callbackInfo_; } - set { - callbackInfo_ = value; - } - } - - /// Field number for the "query_id" field. - public const int QueryIdFieldNumber = 9; - private global::AElf.Types.Hash queryId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash QueryId { - get { return queryId_; } - set { - queryId_ = value; - } - } - - /// Field number for the "aggregate_threshold" field. - public const int AggregateThresholdFieldNumber = 10; - private int aggregateThreshold_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int AggregateThreshold { - get { return aggregateThreshold_; } - set { - aggregateThreshold_ = value; - } - } - - /// Field number for the "query_sender" field. - public const int QuerySenderFieldNumber = 11; - private global::AElf.Types.Address querySender_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address QuerySender { - get { return querySender_; } - set { - querySender_ = value; - } - } - - /// Field number for the "is_commit_stage_finished" field. - public const int IsCommitStageFinishedFieldNumber = 12; - private bool isCommitStageFinished_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsCommitStageFinished { - get { return isCommitStageFinished_; } - set { - isCommitStageFinished_ = value; - } - } - - /// Field number for the "commitments_count" field. - public const int CommitmentsCountFieldNumber = 13; - private int commitmentsCount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CommitmentsCount { - get { return commitmentsCount_; } - set { - commitmentsCount_ = value; - } - } - - /// Field number for the "is_cancelled" field. - public const int IsCancelledFieldNumber = 14; - private bool isCancelled_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsCancelled { - get { return isCancelled_; } - set { - isCancelled_ = value; - } - } - - /// Field number for the "query_info" field. - public const int QueryInfoFieldNumber = 15; - private global::AElf.Contracts.Oracle.QueryInfo queryInfo_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.QueryInfo QueryInfo { - get { return queryInfo_; } - set { - queryInfo_ = value; - } - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 16; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "data_records" field. - public const int DataRecordsFieldNumber = 17; - private global::AElf.Contracts.Oracle.DataRecords dataRecords_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.DataRecords DataRecords { - get { return dataRecords_; } - set { - dataRecords_ = value; - } - } - - /// Field number for the "aggregate_option" field. - public const int AggregateOptionFieldNumber = 18; - private int aggregateOption_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int AggregateOption { - get { return aggregateOption_; } - set { - aggregateOption_ = value; - } - } - - /// Field number for the "task_id" field. - public const int TaskIdFieldNumber = 19; - private global::AElf.Types.Hash taskId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash TaskId { - get { return taskId_; } - set { - taskId_ = value; - } - } - - /// Field number for the "is_paid_to_oracle_contract" field. - public const int IsPaidToOracleContractFieldNumber = 20; - private bool isPaidToOracleContract_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsPaidToOracleContract { - get { return isPaidToOracleContract_; } - set { - isPaidToOracleContract_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as QueryRecord); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueryRecord other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(DesignatedNodeList, other.DesignatedNodeList)) return false; - if (!object.Equals(AggregatorContractAddress, other.AggregatorContractAddress)) return false; - if (!object.Equals(ExpirationTimestamp, other.ExpirationTimestamp)) return false; - if (IsSufficientCommitmentsCollected != other.IsSufficientCommitmentsCollected) return false; - if (IsSufficientDataCollected != other.IsSufficientDataCollected) return false; - if (FinalResult != other.FinalResult) return false; - if (Payment != other.Payment) return false; - if (!object.Equals(CallbackInfo, other.CallbackInfo)) return false; - if (!object.Equals(QueryId, other.QueryId)) return false; - if (AggregateThreshold != other.AggregateThreshold) return false; - if (!object.Equals(QuerySender, other.QuerySender)) return false; - if (IsCommitStageFinished != other.IsCommitStageFinished) return false; - if (CommitmentsCount != other.CommitmentsCount) return false; - if (IsCancelled != other.IsCancelled) return false; - if (!object.Equals(QueryInfo, other.QueryInfo)) return false; - if (Token != other.Token) return false; - if (!object.Equals(DataRecords, other.DataRecords)) return false; - if (AggregateOption != other.AggregateOption) return false; - if (!object.Equals(TaskId, other.TaskId)) return false; - if (IsPaidToOracleContract != other.IsPaidToOracleContract) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (designatedNodeList_ != null) hash ^= DesignatedNodeList.GetHashCode(); - if (aggregatorContractAddress_ != null) hash ^= AggregatorContractAddress.GetHashCode(); - if (expirationTimestamp_ != null) hash ^= ExpirationTimestamp.GetHashCode(); - if (IsSufficientCommitmentsCollected != false) hash ^= IsSufficientCommitmentsCollected.GetHashCode(); - if (IsSufficientDataCollected != false) hash ^= IsSufficientDataCollected.GetHashCode(); - if (FinalResult.Length != 0) hash ^= FinalResult.GetHashCode(); - if (Payment != 0L) hash ^= Payment.GetHashCode(); - if (callbackInfo_ != null) hash ^= CallbackInfo.GetHashCode(); - if (queryId_ != null) hash ^= QueryId.GetHashCode(); - if (AggregateThreshold != 0) hash ^= AggregateThreshold.GetHashCode(); - if (querySender_ != null) hash ^= QuerySender.GetHashCode(); - if (IsCommitStageFinished != false) hash ^= IsCommitStageFinished.GetHashCode(); - if (CommitmentsCount != 0) hash ^= CommitmentsCount.GetHashCode(); - if (IsCancelled != false) hash ^= IsCancelled.GetHashCode(); - if (queryInfo_ != null) hash ^= QueryInfo.GetHashCode(); - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (dataRecords_ != null) hash ^= DataRecords.GetHashCode(); - if (AggregateOption != 0) hash ^= AggregateOption.GetHashCode(); - if (taskId_ != null) hash ^= TaskId.GetHashCode(); - if (IsPaidToOracleContract != false) hash ^= IsPaidToOracleContract.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (designatedNodeList_ != null) { - output.WriteRawTag(10); - output.WriteMessage(DesignatedNodeList); - } - if (aggregatorContractAddress_ != null) { - output.WriteRawTag(18); - output.WriteMessage(AggregatorContractAddress); - } - if (expirationTimestamp_ != null) { - output.WriteRawTag(26); - output.WriteMessage(ExpirationTimestamp); - } - if (IsSufficientCommitmentsCollected != false) { - output.WriteRawTag(32); - output.WriteBool(IsSufficientCommitmentsCollected); - } - if (IsSufficientDataCollected != false) { - output.WriteRawTag(40); - output.WriteBool(IsSufficientDataCollected); - } - if (FinalResult.Length != 0) { - output.WriteRawTag(50); - output.WriteString(FinalResult); - } - if (Payment != 0L) { - output.WriteRawTag(56); - output.WriteInt64(Payment); - } - if (callbackInfo_ != null) { - output.WriteRawTag(66); - output.WriteMessage(CallbackInfo); - } - if (queryId_ != null) { - output.WriteRawTag(74); - output.WriteMessage(QueryId); - } - if (AggregateThreshold != 0) { - output.WriteRawTag(80); - output.WriteInt32(AggregateThreshold); - } - if (querySender_ != null) { - output.WriteRawTag(90); - output.WriteMessage(QuerySender); - } - if (IsCommitStageFinished != false) { - output.WriteRawTag(96); - output.WriteBool(IsCommitStageFinished); - } - if (CommitmentsCount != 0) { - output.WriteRawTag(104); - output.WriteInt32(CommitmentsCount); - } - if (IsCancelled != false) { - output.WriteRawTag(112); - output.WriteBool(IsCancelled); - } - if (queryInfo_ != null) { - output.WriteRawTag(122); - output.WriteMessage(QueryInfo); - } - if (Token.Length != 0) { - output.WriteRawTag(130, 1); - output.WriteString(Token); - } - if (dataRecords_ != null) { - output.WriteRawTag(138, 1); - output.WriteMessage(DataRecords); - } - if (AggregateOption != 0) { - output.WriteRawTag(144, 1); - output.WriteInt32(AggregateOption); - } - if (taskId_ != null) { - output.WriteRawTag(154, 1); - output.WriteMessage(TaskId); - } - if (IsPaidToOracleContract != false) { - output.WriteRawTag(160, 1); - output.WriteBool(IsPaidToOracleContract); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (designatedNodeList_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(DesignatedNodeList); - } - if (aggregatorContractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(AggregatorContractAddress); - } - if (expirationTimestamp_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ExpirationTimestamp); - } - if (IsSufficientCommitmentsCollected != false) { - size += 1 + 1; - } - if (IsSufficientDataCollected != false) { - size += 1 + 1; - } - if (FinalResult.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(FinalResult); - } - if (Payment != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Payment); - } - if (callbackInfo_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(CallbackInfo); - } - if (queryId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryId); - } - if (AggregateThreshold != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(AggregateThreshold); - } - if (querySender_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QuerySender); - } - if (IsCommitStageFinished != false) { - size += 1 + 1; - } - if (CommitmentsCount != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(CommitmentsCount); - } - if (IsCancelled != false) { - size += 1 + 1; - } - if (queryInfo_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryInfo); - } - if (Token.Length != 0) { - size += 2 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (dataRecords_ != null) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(DataRecords); - } - if (AggregateOption != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32Size(AggregateOption); - } - if (taskId_ != null) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(TaskId); - } - if (IsPaidToOracleContract != false) { - size += 2 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueryRecord other) { - if (other == null) { - return; - } - if (other.designatedNodeList_ != null) { - if (designatedNodeList_ == null) { - DesignatedNodeList = new global::AElf.Contracts.Oracle.AddressList(); - } - DesignatedNodeList.MergeFrom(other.DesignatedNodeList); - } - if (other.aggregatorContractAddress_ != null) { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - AggregatorContractAddress.MergeFrom(other.AggregatorContractAddress); - } - if (other.expirationTimestamp_ != null) { - if (expirationTimestamp_ == null) { - ExpirationTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - ExpirationTimestamp.MergeFrom(other.ExpirationTimestamp); - } - if (other.IsSufficientCommitmentsCollected != false) { - IsSufficientCommitmentsCollected = other.IsSufficientCommitmentsCollected; - } - if (other.IsSufficientDataCollected != false) { - IsSufficientDataCollected = other.IsSufficientDataCollected; - } - if (other.FinalResult.Length != 0) { - FinalResult = other.FinalResult; - } - if (other.Payment != 0L) { - Payment = other.Payment; - } - if (other.callbackInfo_ != null) { - if (callbackInfo_ == null) { - CallbackInfo = new global::AElf.Contracts.Oracle.CallbackInfo(); - } - CallbackInfo.MergeFrom(other.CallbackInfo); - } - if (other.queryId_ != null) { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - QueryId.MergeFrom(other.QueryId); - } - if (other.AggregateThreshold != 0) { - AggregateThreshold = other.AggregateThreshold; - } - if (other.querySender_ != null) { - if (querySender_ == null) { - QuerySender = new global::AElf.Types.Address(); - } - QuerySender.MergeFrom(other.QuerySender); - } - if (other.IsCommitStageFinished != false) { - IsCommitStageFinished = other.IsCommitStageFinished; - } - if (other.CommitmentsCount != 0) { - CommitmentsCount = other.CommitmentsCount; - } - if (other.IsCancelled != false) { - IsCancelled = other.IsCancelled; - } - if (other.queryInfo_ != null) { - if (queryInfo_ == null) { - QueryInfo = new global::AElf.Contracts.Oracle.QueryInfo(); - } - QueryInfo.MergeFrom(other.QueryInfo); - } - if (other.Token.Length != 0) { - Token = other.Token; - } - if (other.dataRecords_ != null) { - if (dataRecords_ == null) { - DataRecords = new global::AElf.Contracts.Oracle.DataRecords(); - } - DataRecords.MergeFrom(other.DataRecords); - } - if (other.AggregateOption != 0) { - AggregateOption = other.AggregateOption; - } - if (other.taskId_ != null) { - if (taskId_ == null) { - TaskId = new global::AElf.Types.Hash(); - } - TaskId.MergeFrom(other.TaskId); - } - if (other.IsPaidToOracleContract != false) { - IsPaidToOracleContract = other.IsPaidToOracleContract; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (designatedNodeList_ == null) { - DesignatedNodeList = new global::AElf.Contracts.Oracle.AddressList(); - } - input.ReadMessage(DesignatedNodeList); - break; - } - case 18: { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(AggregatorContractAddress); - break; - } - case 26: { - if (expirationTimestamp_ == null) { - ExpirationTimestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(ExpirationTimestamp); - break; - } - case 32: { - IsSufficientCommitmentsCollected = input.ReadBool(); - break; - } - case 40: { - IsSufficientDataCollected = input.ReadBool(); - break; - } - case 50: { - FinalResult = input.ReadString(); - break; - } - case 56: { - Payment = input.ReadInt64(); - break; - } - case 66: { - if (callbackInfo_ == null) { - CallbackInfo = new global::AElf.Contracts.Oracle.CallbackInfo(); - } - input.ReadMessage(CallbackInfo); - break; - } - case 74: { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - input.ReadMessage(QueryId); - break; - } - case 80: { - AggregateThreshold = input.ReadInt32(); - break; - } - case 90: { - if (querySender_ == null) { - QuerySender = new global::AElf.Types.Address(); - } - input.ReadMessage(QuerySender); - break; - } - case 96: { - IsCommitStageFinished = input.ReadBool(); - break; - } - case 104: { - CommitmentsCount = input.ReadInt32(); - break; - } - case 112: { - IsCancelled = input.ReadBool(); - break; - } - case 122: { - if (queryInfo_ == null) { - QueryInfo = new global::AElf.Contracts.Oracle.QueryInfo(); - } - input.ReadMessage(QueryInfo); - break; - } - case 130: { - Token = input.ReadString(); - break; - } - case 138: { - if (dataRecords_ == null) { - DataRecords = new global::AElf.Contracts.Oracle.DataRecords(); - } - input.ReadMessage(DataRecords); - break; - } - case 144: { - AggregateOption = input.ReadInt32(); - break; - } - case 154: { - if (taskId_ == null) { - TaskId = new global::AElf.Types.Hash(); - } - input.ReadMessage(TaskId); - break; - } - case 160: { - IsPaidToOracleContract = input.ReadBool(); - break; - } - } - } - } - - } - - internal sealed partial class CreateRegimentInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CreateRegimentInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[8]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CreateRegimentInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CreateRegimentInput(CreateRegimentInput other) : this() { - manager_ = other.manager_ != null ? other.manager_.Clone() : null; - initialMemberList_ = other.initialMemberList_.Clone(); - isApproveToJoin_ = other.isApproveToJoin_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CreateRegimentInput Clone() { - return new CreateRegimentInput(this); - } - - /// Field number for the "manager" field. - public const int ManagerFieldNumber = 1; - private global::AElf.Types.Address manager_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Manager { - get { return manager_; } - set { - manager_ = value; - } - } - - /// Field number for the "initial_member_list" field. - public const int InitialMemberListFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_initialMemberList_codec - = pb::FieldCodec.ForMessage(18, global::AElf.Types.Address.Parser); - private readonly pbc::RepeatedField initialMemberList_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField InitialMemberList { - get { return initialMemberList_; } - } - - /// Field number for the "is_approve_to_join" field. - public const int IsApproveToJoinFieldNumber = 3; - private bool isApproveToJoin_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsApproveToJoin { - get { return isApproveToJoin_; } - set { - isApproveToJoin_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as CreateRegimentInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(CreateRegimentInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Manager, other.Manager)) return false; - if(!initialMemberList_.Equals(other.initialMemberList_)) return false; - if (IsApproveToJoin != other.IsApproveToJoin) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (manager_ != null) hash ^= Manager.GetHashCode(); - hash ^= initialMemberList_.GetHashCode(); - if (IsApproveToJoin != false) hash ^= IsApproveToJoin.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (manager_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Manager); - } - initialMemberList_.WriteTo(output, _repeated_initialMemberList_codec); - if (IsApproveToJoin != false) { - output.WriteRawTag(24); - output.WriteBool(IsApproveToJoin); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (manager_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Manager); - } - size += initialMemberList_.CalculateSize(_repeated_initialMemberList_codec); - if (IsApproveToJoin != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(CreateRegimentInput other) { - if (other == null) { - return; - } - if (other.manager_ != null) { - if (manager_ == null) { - Manager = new global::AElf.Types.Address(); - } - Manager.MergeFrom(other.Manager); - } - initialMemberList_.Add(other.initialMemberList_); - if (other.IsApproveToJoin != false) { - IsApproveToJoin = other.IsApproveToJoin; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (manager_ == null) { - Manager = new global::AElf.Types.Address(); - } - input.ReadMessage(Manager); - break; - } - case 18: { - initialMemberList_.AddEntriesFrom(input, _repeated_initialMemberList_codec); - break; - } - case 24: { - IsApproveToJoin = input.ReadBool(); - break; - } - } - } - } - - } - - internal sealed partial class JoinRegimentInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new JoinRegimentInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[9]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public JoinRegimentInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public JoinRegimentInput(JoinRegimentInput other) : this() { - regimentAddress_ = other.regimentAddress_ != null ? other.regimentAddress_.Clone() : null; - newMemberAddress_ = other.newMemberAddress_ != null ? other.newMemberAddress_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public JoinRegimentInput Clone() { - return new JoinRegimentInput(this); - } - - /// Field number for the "regiment_address" field. - public const int RegimentAddressFieldNumber = 1; - private global::AElf.Types.Address regimentAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address RegimentAddress { - get { return regimentAddress_; } - set { - regimentAddress_ = value; - } - } - - /// Field number for the "new_member_address" field. - public const int NewMemberAddressFieldNumber = 2; - private global::AElf.Types.Address newMemberAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address NewMemberAddress { - get { return newMemberAddress_; } - set { - newMemberAddress_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as JoinRegimentInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(JoinRegimentInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(RegimentAddress, other.RegimentAddress)) return false; - if (!object.Equals(NewMemberAddress, other.NewMemberAddress)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (regimentAddress_ != null) hash ^= RegimentAddress.GetHashCode(); - if (newMemberAddress_ != null) hash ^= NewMemberAddress.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (regimentAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(RegimentAddress); - } - if (newMemberAddress_ != null) { - output.WriteRawTag(18); - output.WriteMessage(NewMemberAddress); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (regimentAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegimentAddress); - } - if (newMemberAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(NewMemberAddress); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(JoinRegimentInput other) { - if (other == null) { - return; - } - if (other.regimentAddress_ != null) { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - RegimentAddress.MergeFrom(other.RegimentAddress); - } - if (other.newMemberAddress_ != null) { - if (newMemberAddress_ == null) { - NewMemberAddress = new global::AElf.Types.Address(); - } - NewMemberAddress.MergeFrom(other.NewMemberAddress); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(RegimentAddress); - break; - } - case 18: { - if (newMemberAddress_ == null) { - NewMemberAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(NewMemberAddress); - break; - } - } - } - } - - } - - internal sealed partial class LeaveRegimentInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new LeaveRegimentInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[10]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public LeaveRegimentInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public LeaveRegimentInput(LeaveRegimentInput other) : this() { - regimentAddress_ = other.regimentAddress_ != null ? other.regimentAddress_.Clone() : null; - leaveMemberAddress_ = other.leaveMemberAddress_ != null ? other.leaveMemberAddress_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public LeaveRegimentInput Clone() { - return new LeaveRegimentInput(this); - } - - /// Field number for the "regiment_address" field. - public const int RegimentAddressFieldNumber = 1; - private global::AElf.Types.Address regimentAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address RegimentAddress { - get { return regimentAddress_; } - set { - regimentAddress_ = value; - } - } - - /// Field number for the "leave_member_address" field. - public const int LeaveMemberAddressFieldNumber = 2; - private global::AElf.Types.Address leaveMemberAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address LeaveMemberAddress { - get { return leaveMemberAddress_; } - set { - leaveMemberAddress_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as LeaveRegimentInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(LeaveRegimentInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(RegimentAddress, other.RegimentAddress)) return false; - if (!object.Equals(LeaveMemberAddress, other.LeaveMemberAddress)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (regimentAddress_ != null) hash ^= RegimentAddress.GetHashCode(); - if (leaveMemberAddress_ != null) hash ^= LeaveMemberAddress.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (regimentAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(RegimentAddress); - } - if (leaveMemberAddress_ != null) { - output.WriteRawTag(18); - output.WriteMessage(LeaveMemberAddress); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (regimentAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegimentAddress); - } - if (leaveMemberAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(LeaveMemberAddress); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(LeaveRegimentInput other) { - if (other == null) { - return; - } - if (other.regimentAddress_ != null) { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - RegimentAddress.MergeFrom(other.RegimentAddress); - } - if (other.leaveMemberAddress_ != null) { - if (leaveMemberAddress_ == null) { - LeaveMemberAddress = new global::AElf.Types.Address(); - } - LeaveMemberAddress.MergeFrom(other.LeaveMemberAddress); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(RegimentAddress); - break; - } - case 18: { - if (leaveMemberAddress_ == null) { - LeaveMemberAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(LeaveMemberAddress); - break; - } - } - } - } - - } - - internal sealed partial class AddRegimentMemberInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AddRegimentMemberInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[11]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AddRegimentMemberInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AddRegimentMemberInput(AddRegimentMemberInput other) : this() { - regimentAddress_ = other.regimentAddress_ != null ? other.regimentAddress_.Clone() : null; - newMemberAddress_ = other.newMemberAddress_ != null ? other.newMemberAddress_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AddRegimentMemberInput Clone() { - return new AddRegimentMemberInput(this); - } - - /// Field number for the "regiment_address" field. - public const int RegimentAddressFieldNumber = 1; - private global::AElf.Types.Address regimentAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address RegimentAddress { - get { return regimentAddress_; } - set { - regimentAddress_ = value; - } - } - - /// Field number for the "new_member_address" field. - public const int NewMemberAddressFieldNumber = 2; - private global::AElf.Types.Address newMemberAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address NewMemberAddress { - get { return newMemberAddress_; } - set { - newMemberAddress_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as AddRegimentMemberInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(AddRegimentMemberInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(RegimentAddress, other.RegimentAddress)) return false; - if (!object.Equals(NewMemberAddress, other.NewMemberAddress)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (regimentAddress_ != null) hash ^= RegimentAddress.GetHashCode(); - if (newMemberAddress_ != null) hash ^= NewMemberAddress.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (regimentAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(RegimentAddress); - } - if (newMemberAddress_ != null) { - output.WriteRawTag(18); - output.WriteMessage(NewMemberAddress); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (regimentAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegimentAddress); - } - if (newMemberAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(NewMemberAddress); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(AddRegimentMemberInput other) { - if (other == null) { - return; - } - if (other.regimentAddress_ != null) { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - RegimentAddress.MergeFrom(other.RegimentAddress); - } - if (other.newMemberAddress_ != null) { - if (newMemberAddress_ == null) { - NewMemberAddress = new global::AElf.Types.Address(); - } - NewMemberAddress.MergeFrom(other.NewMemberAddress); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(RegimentAddress); - break; - } - case 18: { - if (newMemberAddress_ == null) { - NewMemberAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(NewMemberAddress); - break; - } - } - } - } - - } - - internal sealed partial class DeleteRegimentMemberInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeleteRegimentMemberInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[12]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DeleteRegimentMemberInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DeleteRegimentMemberInput(DeleteRegimentMemberInput other) : this() { - regimentAddress_ = other.regimentAddress_ != null ? other.regimentAddress_.Clone() : null; - deleteMemberAddress_ = other.deleteMemberAddress_ != null ? other.deleteMemberAddress_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DeleteRegimentMemberInput Clone() { - return new DeleteRegimentMemberInput(this); - } - - /// Field number for the "regiment_address" field. - public const int RegimentAddressFieldNumber = 1; - private global::AElf.Types.Address regimentAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address RegimentAddress { - get { return regimentAddress_; } - set { - regimentAddress_ = value; - } - } - - /// Field number for the "delete_member_address" field. - public const int DeleteMemberAddressFieldNumber = 2; - private global::AElf.Types.Address deleteMemberAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address DeleteMemberAddress { - get { return deleteMemberAddress_; } - set { - deleteMemberAddress_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as DeleteRegimentMemberInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DeleteRegimentMemberInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(RegimentAddress, other.RegimentAddress)) return false; - if (!object.Equals(DeleteMemberAddress, other.DeleteMemberAddress)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (regimentAddress_ != null) hash ^= RegimentAddress.GetHashCode(); - if (deleteMemberAddress_ != null) hash ^= DeleteMemberAddress.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (regimentAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(RegimentAddress); - } - if (deleteMemberAddress_ != null) { - output.WriteRawTag(18); - output.WriteMessage(DeleteMemberAddress); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (regimentAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegimentAddress); - } - if (deleteMemberAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(DeleteMemberAddress); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DeleteRegimentMemberInput other) { - if (other == null) { - return; - } - if (other.regimentAddress_ != null) { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - RegimentAddress.MergeFrom(other.RegimentAddress); - } - if (other.deleteMemberAddress_ != null) { - if (deleteMemberAddress_ == null) { - DeleteMemberAddress = new global::AElf.Types.Address(); - } - DeleteMemberAddress.MergeFrom(other.DeleteMemberAddress); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(RegimentAddress); - break; - } - case 18: { - if (deleteMemberAddress_ == null) { - DeleteMemberAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(DeleteMemberAddress); - break; - } - } - } - } - - } - - internal sealed partial class TransferRegimentOwnershipInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TransferRegimentOwnershipInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[13]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TransferRegimentOwnershipInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TransferRegimentOwnershipInput(TransferRegimentOwnershipInput other) : this() { - regimentAddress_ = other.regimentAddress_ != null ? other.regimentAddress_.Clone() : null; - newManagerAddress_ = other.newManagerAddress_ != null ? other.newManagerAddress_.Clone() : null; - originSenderAddress_ = other.originSenderAddress_ != null ? other.originSenderAddress_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TransferRegimentOwnershipInput Clone() { - return new TransferRegimentOwnershipInput(this); - } - - /// Field number for the "regiment_address" field. - public const int RegimentAddressFieldNumber = 1; - private global::AElf.Types.Address regimentAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address RegimentAddress { - get { return regimentAddress_; } - set { - regimentAddress_ = value; - } - } - - /// Field number for the "new_manager_address" field. - public const int NewManagerAddressFieldNumber = 2; - private global::AElf.Types.Address newManagerAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address NewManagerAddress { - get { return newManagerAddress_; } - set { - newManagerAddress_ = value; - } - } - - /// Field number for the "origin_sender_address" field. - public const int OriginSenderAddressFieldNumber = 3; - private global::AElf.Types.Address originSenderAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address OriginSenderAddress { - get { return originSenderAddress_; } - set { - originSenderAddress_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TransferRegimentOwnershipInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TransferRegimentOwnershipInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(RegimentAddress, other.RegimentAddress)) return false; - if (!object.Equals(NewManagerAddress, other.NewManagerAddress)) return false; - if (!object.Equals(OriginSenderAddress, other.OriginSenderAddress)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (regimentAddress_ != null) hash ^= RegimentAddress.GetHashCode(); - if (newManagerAddress_ != null) hash ^= NewManagerAddress.GetHashCode(); - if (originSenderAddress_ != null) hash ^= OriginSenderAddress.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (regimentAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(RegimentAddress); - } - if (newManagerAddress_ != null) { - output.WriteRawTag(18); - output.WriteMessage(NewManagerAddress); - } - if (originSenderAddress_ != null) { - output.WriteRawTag(26); - output.WriteMessage(OriginSenderAddress); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (regimentAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegimentAddress); - } - if (newManagerAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(NewManagerAddress); - } - if (originSenderAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OriginSenderAddress); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TransferRegimentOwnershipInput other) { - if (other == null) { - return; - } - if (other.regimentAddress_ != null) { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - RegimentAddress.MergeFrom(other.RegimentAddress); - } - if (other.newManagerAddress_ != null) { - if (newManagerAddress_ == null) { - NewManagerAddress = new global::AElf.Types.Address(); - } - NewManagerAddress.MergeFrom(other.NewManagerAddress); - } - if (other.originSenderAddress_ != null) { - if (originSenderAddress_ == null) { - OriginSenderAddress = new global::AElf.Types.Address(); - } - OriginSenderAddress.MergeFrom(other.OriginSenderAddress); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(RegimentAddress); - break; - } - case 18: { - if (newManagerAddress_ == null) { - NewManagerAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(NewManagerAddress); - break; - } - case 26: { - if (originSenderAddress_ == null) { - OriginSenderAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(OriginSenderAddress); - break; - } - } - } - } - - } - - internal sealed partial class AddAdminsInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AddAdminsInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[14]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AddAdminsInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AddAdminsInput(AddAdminsInput other) : this() { - regimentAddress_ = other.regimentAddress_ != null ? other.regimentAddress_.Clone() : null; - newAdmins_ = other.newAdmins_.Clone(); - originSenderAddress_ = other.originSenderAddress_ != null ? other.originSenderAddress_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AddAdminsInput Clone() { - return new AddAdminsInput(this); - } - - /// Field number for the "regiment_address" field. - public const int RegimentAddressFieldNumber = 1; - private global::AElf.Types.Address regimentAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address RegimentAddress { - get { return regimentAddress_; } - set { - regimentAddress_ = value; - } - } - - /// Field number for the "new_admins" field. - public const int NewAdminsFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_newAdmins_codec - = pb::FieldCodec.ForMessage(18, global::AElf.Types.Address.Parser); - private readonly pbc::RepeatedField newAdmins_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField NewAdmins { - get { return newAdmins_; } - } - - /// Field number for the "origin_sender_address" field. - public const int OriginSenderAddressFieldNumber = 3; - private global::AElf.Types.Address originSenderAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address OriginSenderAddress { - get { return originSenderAddress_; } - set { - originSenderAddress_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as AddAdminsInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(AddAdminsInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(RegimentAddress, other.RegimentAddress)) return false; - if(!newAdmins_.Equals(other.newAdmins_)) return false; - if (!object.Equals(OriginSenderAddress, other.OriginSenderAddress)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (regimentAddress_ != null) hash ^= RegimentAddress.GetHashCode(); - hash ^= newAdmins_.GetHashCode(); - if (originSenderAddress_ != null) hash ^= OriginSenderAddress.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (regimentAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(RegimentAddress); - } - newAdmins_.WriteTo(output, _repeated_newAdmins_codec); - if (originSenderAddress_ != null) { - output.WriteRawTag(26); - output.WriteMessage(OriginSenderAddress); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (regimentAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegimentAddress); - } - size += newAdmins_.CalculateSize(_repeated_newAdmins_codec); - if (originSenderAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OriginSenderAddress); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(AddAdminsInput other) { - if (other == null) { - return; - } - if (other.regimentAddress_ != null) { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - RegimentAddress.MergeFrom(other.RegimentAddress); - } - newAdmins_.Add(other.newAdmins_); - if (other.originSenderAddress_ != null) { - if (originSenderAddress_ == null) { - OriginSenderAddress = new global::AElf.Types.Address(); - } - OriginSenderAddress.MergeFrom(other.OriginSenderAddress); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(RegimentAddress); - break; - } - case 18: { - newAdmins_.AddEntriesFrom(input, _repeated_newAdmins_codec); - break; - } - case 26: { - if (originSenderAddress_ == null) { - OriginSenderAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(OriginSenderAddress); - break; - } - } - } - } - - } - - internal sealed partial class DeleteAdminsInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeleteAdminsInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[15]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DeleteAdminsInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DeleteAdminsInput(DeleteAdminsInput other) : this() { - regimentAddress_ = other.regimentAddress_ != null ? other.regimentAddress_.Clone() : null; - deleteAdmins_ = other.deleteAdmins_.Clone(); - originSenderAddress_ = other.originSenderAddress_ != null ? other.originSenderAddress_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DeleteAdminsInput Clone() { - return new DeleteAdminsInput(this); - } - - /// Field number for the "regiment_address" field. - public const int RegimentAddressFieldNumber = 1; - private global::AElf.Types.Address regimentAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address RegimentAddress { - get { return regimentAddress_; } - set { - regimentAddress_ = value; - } - } - - /// Field number for the "delete_admins" field. - public const int DeleteAdminsFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_deleteAdmins_codec - = pb::FieldCodec.ForMessage(18, global::AElf.Types.Address.Parser); - private readonly pbc::RepeatedField deleteAdmins_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField DeleteAdmins { - get { return deleteAdmins_; } - } - - /// Field number for the "origin_sender_address" field. - public const int OriginSenderAddressFieldNumber = 3; - private global::AElf.Types.Address originSenderAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address OriginSenderAddress { - get { return originSenderAddress_; } - set { - originSenderAddress_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as DeleteAdminsInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DeleteAdminsInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(RegimentAddress, other.RegimentAddress)) return false; - if(!deleteAdmins_.Equals(other.deleteAdmins_)) return false; - if (!object.Equals(OriginSenderAddress, other.OriginSenderAddress)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (regimentAddress_ != null) hash ^= RegimentAddress.GetHashCode(); - hash ^= deleteAdmins_.GetHashCode(); - if (originSenderAddress_ != null) hash ^= OriginSenderAddress.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (regimentAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(RegimentAddress); - } - deleteAdmins_.WriteTo(output, _repeated_deleteAdmins_codec); - if (originSenderAddress_ != null) { - output.WriteRawTag(26); - output.WriteMessage(OriginSenderAddress); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (regimentAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegimentAddress); - } - size += deleteAdmins_.CalculateSize(_repeated_deleteAdmins_codec); - if (originSenderAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OriginSenderAddress); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DeleteAdminsInput other) { - if (other == null) { - return; - } - if (other.regimentAddress_ != null) { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - RegimentAddress.MergeFrom(other.RegimentAddress); - } - deleteAdmins_.Add(other.deleteAdmins_); - if (other.originSenderAddress_ != null) { - if (originSenderAddress_ == null) { - OriginSenderAddress = new global::AElf.Types.Address(); - } - OriginSenderAddress.MergeFrom(other.OriginSenderAddress); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(RegimentAddress); - break; - } - case 18: { - deleteAdmins_.AddEntriesFrom(input, _repeated_deleteAdmins_codec); - break; - } - case 26: { - if (originSenderAddress_ == null) { - OriginSenderAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(OriginSenderAddress); - break; - } - } - } - } - - } - - internal sealed partial class QueryTask : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryTask()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[16]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryTask() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryTask(QueryTask other) : this() { - eachPayment_ = other.eachPayment_; - supposedQueryTimes_ = other.supposedQueryTimes_; - queryInfo_ = other.queryInfo_ != null ? other.queryInfo_.Clone() : null; - endTime_ = other.endTime_ != null ? other.endTime_.Clone() : null; - designatedNodeList_ = other.designatedNodeList_ != null ? other.designatedNodeList_.Clone() : null; - aggregatorContractAddress_ = other.aggregatorContractAddress_ != null ? other.aggregatorContractAddress_.Clone() : null; - actualQueriedTimes_ = other.actualQueriedTimes_; - callbackInfo_ = other.callbackInfo_ != null ? other.callbackInfo_.Clone() : null; - creator_ = other.creator_ != null ? other.creator_.Clone() : null; - aggregateThreshold_ = other.aggregateThreshold_; - aggregateOption_ = other.aggregateOption_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryTask Clone() { - return new QueryTask(this); - } - - /// Field number for the "each_payment" field. - public const int EachPaymentFieldNumber = 1; - private long eachPayment_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long EachPayment { - get { return eachPayment_; } - set { - eachPayment_ = value; - } - } - - /// Field number for the "supposed_query_times" field. - public const int SupposedQueryTimesFieldNumber = 2; - private int supposedQueryTimes_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int SupposedQueryTimes { - get { return supposedQueryTimes_; } - set { - supposedQueryTimes_ = value; - } - } - - /// Field number for the "query_info" field. - public const int QueryInfoFieldNumber = 3; - private global::AElf.Contracts.Oracle.QueryInfo queryInfo_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.QueryInfo QueryInfo { - get { return queryInfo_; } - set { - queryInfo_ = value; - } - } - - /// Field number for the "end_time" field. - public const int EndTimeFieldNumber = 4; - private global::Google.Protobuf.WellKnownTypes.Timestamp endTime_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp EndTime { - get { return endTime_; } - set { - endTime_ = value; - } - } - - /// Field number for the "designated_node_list" field. - public const int DesignatedNodeListFieldNumber = 5; - private global::AElf.Contracts.Oracle.AddressList designatedNodeList_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.AddressList DesignatedNodeList { - get { return designatedNodeList_; } - set { - designatedNodeList_ = value; - } - } - - /// Field number for the "aggregator_contract_address" field. - public const int AggregatorContractAddressFieldNumber = 6; - private global::AElf.Types.Address aggregatorContractAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address AggregatorContractAddress { - get { return aggregatorContractAddress_; } - set { - aggregatorContractAddress_ = value; - } - } - - /// Field number for the "actual_queried_times" field. - public const int ActualQueriedTimesFieldNumber = 7; - private int actualQueriedTimes_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int ActualQueriedTimes { - get { return actualQueriedTimes_; } - set { - actualQueriedTimes_ = value; - } - } - - /// Field number for the "callback_info" field. - public const int CallbackInfoFieldNumber = 8; - private global::AElf.Contracts.Oracle.CallbackInfo callbackInfo_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.CallbackInfo CallbackInfo { - get { return callbackInfo_; } - set { - callbackInfo_ = value; - } - } - - /// Field number for the "creator" field. - public const int CreatorFieldNumber = 9; - private global::AElf.Types.Address creator_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Creator { - get { return creator_; } - set { - creator_ = value; - } - } - - /// Field number for the "aggregate_threshold" field. - public const int AggregateThresholdFieldNumber = 10; - private int aggregateThreshold_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int AggregateThreshold { - get { return aggregateThreshold_; } - set { - aggregateThreshold_ = value; - } - } - - /// Field number for the "aggregate_option" field. - public const int AggregateOptionFieldNumber = 11; - private int aggregateOption_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int AggregateOption { - get { return aggregateOption_; } - set { - aggregateOption_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as QueryTask); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueryTask other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (EachPayment != other.EachPayment) return false; - if (SupposedQueryTimes != other.SupposedQueryTimes) return false; - if (!object.Equals(QueryInfo, other.QueryInfo)) return false; - if (!object.Equals(EndTime, other.EndTime)) return false; - if (!object.Equals(DesignatedNodeList, other.DesignatedNodeList)) return false; - if (!object.Equals(AggregatorContractAddress, other.AggregatorContractAddress)) return false; - if (ActualQueriedTimes != other.ActualQueriedTimes) return false; - if (!object.Equals(CallbackInfo, other.CallbackInfo)) return false; - if (!object.Equals(Creator, other.Creator)) return false; - if (AggregateThreshold != other.AggregateThreshold) return false; - if (AggregateOption != other.AggregateOption) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (EachPayment != 0L) hash ^= EachPayment.GetHashCode(); - if (SupposedQueryTimes != 0) hash ^= SupposedQueryTimes.GetHashCode(); - if (queryInfo_ != null) hash ^= QueryInfo.GetHashCode(); - if (endTime_ != null) hash ^= EndTime.GetHashCode(); - if (designatedNodeList_ != null) hash ^= DesignatedNodeList.GetHashCode(); - if (aggregatorContractAddress_ != null) hash ^= AggregatorContractAddress.GetHashCode(); - if (ActualQueriedTimes != 0) hash ^= ActualQueriedTimes.GetHashCode(); - if (callbackInfo_ != null) hash ^= CallbackInfo.GetHashCode(); - if (creator_ != null) hash ^= Creator.GetHashCode(); - if (AggregateThreshold != 0) hash ^= AggregateThreshold.GetHashCode(); - if (AggregateOption != 0) hash ^= AggregateOption.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (EachPayment != 0L) { - output.WriteRawTag(8); - output.WriteInt64(EachPayment); - } - if (SupposedQueryTimes != 0) { - output.WriteRawTag(16); - output.WriteInt32(SupposedQueryTimes); - } - if (queryInfo_ != null) { - output.WriteRawTag(26); - output.WriteMessage(QueryInfo); - } - if (endTime_ != null) { - output.WriteRawTag(34); - output.WriteMessage(EndTime); - } - if (designatedNodeList_ != null) { - output.WriteRawTag(42); - output.WriteMessage(DesignatedNodeList); - } - if (aggregatorContractAddress_ != null) { - output.WriteRawTag(50); - output.WriteMessage(AggregatorContractAddress); - } - if (ActualQueriedTimes != 0) { - output.WriteRawTag(56); - output.WriteInt32(ActualQueriedTimes); - } - if (callbackInfo_ != null) { - output.WriteRawTag(66); - output.WriteMessage(CallbackInfo); - } - if (creator_ != null) { - output.WriteRawTag(74); - output.WriteMessage(Creator); - } - if (AggregateThreshold != 0) { - output.WriteRawTag(80); - output.WriteInt32(AggregateThreshold); - } - if (AggregateOption != 0) { - output.WriteRawTag(88); - output.WriteInt32(AggregateOption); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (EachPayment != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(EachPayment); - } - if (SupposedQueryTimes != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(SupposedQueryTimes); - } - if (queryInfo_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryInfo); - } - if (endTime_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(EndTime); - } - if (designatedNodeList_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(DesignatedNodeList); - } - if (aggregatorContractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(AggregatorContractAddress); - } - if (ActualQueriedTimes != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(ActualQueriedTimes); - } - if (callbackInfo_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(CallbackInfo); - } - if (creator_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Creator); - } - if (AggregateThreshold != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(AggregateThreshold); - } - if (AggregateOption != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(AggregateOption); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueryTask other) { - if (other == null) { - return; - } - if (other.EachPayment != 0L) { - EachPayment = other.EachPayment; - } - if (other.SupposedQueryTimes != 0) { - SupposedQueryTimes = other.SupposedQueryTimes; - } - if (other.queryInfo_ != null) { - if (queryInfo_ == null) { - QueryInfo = new global::AElf.Contracts.Oracle.QueryInfo(); - } - QueryInfo.MergeFrom(other.QueryInfo); - } - if (other.endTime_ != null) { - if (endTime_ == null) { - EndTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - EndTime.MergeFrom(other.EndTime); - } - if (other.designatedNodeList_ != null) { - if (designatedNodeList_ == null) { - DesignatedNodeList = new global::AElf.Contracts.Oracle.AddressList(); - } - DesignatedNodeList.MergeFrom(other.DesignatedNodeList); - } - if (other.aggregatorContractAddress_ != null) { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - AggregatorContractAddress.MergeFrom(other.AggregatorContractAddress); - } - if (other.ActualQueriedTimes != 0) { - ActualQueriedTimes = other.ActualQueriedTimes; - } - if (other.callbackInfo_ != null) { - if (callbackInfo_ == null) { - CallbackInfo = new global::AElf.Contracts.Oracle.CallbackInfo(); - } - CallbackInfo.MergeFrom(other.CallbackInfo); - } - if (other.creator_ != null) { - if (creator_ == null) { - Creator = new global::AElf.Types.Address(); - } - Creator.MergeFrom(other.Creator); - } - if (other.AggregateThreshold != 0) { - AggregateThreshold = other.AggregateThreshold; - } - if (other.AggregateOption != 0) { - AggregateOption = other.AggregateOption; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - EachPayment = input.ReadInt64(); - break; - } - case 16: { - SupposedQueryTimes = input.ReadInt32(); - break; - } - case 26: { - if (queryInfo_ == null) { - QueryInfo = new global::AElf.Contracts.Oracle.QueryInfo(); - } - input.ReadMessage(QueryInfo); - break; - } - case 34: { - if (endTime_ == null) { - EndTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(EndTime); - break; - } - case 42: { - if (designatedNodeList_ == null) { - DesignatedNodeList = new global::AElf.Contracts.Oracle.AddressList(); - } - input.ReadMessage(DesignatedNodeList); - break; - } - case 50: { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(AggregatorContractAddress); - break; - } - case 56: { - ActualQueriedTimes = input.ReadInt32(); - break; - } - case 66: { - if (callbackInfo_ == null) { - CallbackInfo = new global::AElf.Contracts.Oracle.CallbackInfo(); - } - input.ReadMessage(CallbackInfo); - break; - } - case 74: { - if (creator_ == null) { - Creator = new global::AElf.Types.Address(); - } - input.ReadMessage(Creator); - break; - } - case 80: { - AggregateThreshold = input.ReadInt32(); - break; - } - case 88: { - AggregateOption = input.ReadInt32(); - break; - } - } - } - } - - } - - internal sealed partial class CommitInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CommitInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[17]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CommitInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CommitInput(CommitInput other) : this() { - queryId_ = other.queryId_ != null ? other.queryId_.Clone() : null; - commitment_ = other.commitment_ != null ? other.commitment_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CommitInput Clone() { - return new CommitInput(this); - } - - /// Field number for the "query_id" field. - public const int QueryIdFieldNumber = 1; - private global::AElf.Types.Hash queryId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash QueryId { - get { return queryId_; } - set { - queryId_ = value; - } - } - - /// Field number for the "commitment" field. - public const int CommitmentFieldNumber = 2; - private global::AElf.Types.Hash commitment_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash Commitment { - get { return commitment_; } - set { - commitment_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as CommitInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(CommitInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(QueryId, other.QueryId)) return false; - if (!object.Equals(Commitment, other.Commitment)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (queryId_ != null) hash ^= QueryId.GetHashCode(); - if (commitment_ != null) hash ^= Commitment.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (queryId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(QueryId); - } - if (commitment_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Commitment); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (queryId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryId); - } - if (commitment_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Commitment); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(CommitInput other) { - if (other == null) { - return; - } - if (other.queryId_ != null) { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - QueryId.MergeFrom(other.QueryId); - } - if (other.commitment_ != null) { - if (commitment_ == null) { - Commitment = new global::AElf.Types.Hash(); - } - Commitment.MergeFrom(other.Commitment); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - input.ReadMessage(QueryId); - break; - } - case 18: { - if (commitment_ == null) { - Commitment = new global::AElf.Types.Hash(); - } - input.ReadMessage(Commitment); - break; - } - } - } - } - - } - - internal sealed partial class RevealInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RevealInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[18]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RevealInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RevealInput(RevealInput other) : this() { - queryId_ = other.queryId_ != null ? other.queryId_.Clone() : null; - data_ = other.data_; - salt_ = other.salt_ != null ? other.salt_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RevealInput Clone() { - return new RevealInput(this); - } - - /// Field number for the "query_id" field. - public const int QueryIdFieldNumber = 1; - private global::AElf.Types.Hash queryId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash QueryId { - get { return queryId_; } - set { - queryId_ = value; - } - } - - /// Field number for the "data" field. - public const int DataFieldNumber = 2; - private string data_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Data { - get { return data_; } - set { - data_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "salt" field. - public const int SaltFieldNumber = 3; - private global::AElf.Types.Hash salt_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash Salt { - get { return salt_; } - set { - salt_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as RevealInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(RevealInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(QueryId, other.QueryId)) return false; - if (Data != other.Data) return false; - if (!object.Equals(Salt, other.Salt)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (queryId_ != null) hash ^= QueryId.GetHashCode(); - if (Data.Length != 0) hash ^= Data.GetHashCode(); - if (salt_ != null) hash ^= Salt.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (queryId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(QueryId); - } - if (Data.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Data); - } - if (salt_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Salt); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (queryId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryId); - } - if (Data.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Data); - } - if (salt_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Salt); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(RevealInput other) { - if (other == null) { - return; - } - if (other.queryId_ != null) { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - QueryId.MergeFrom(other.QueryId); - } - if (other.Data.Length != 0) { - Data = other.Data; - } - if (other.salt_ != null) { - if (salt_ == null) { - Salt = new global::AElf.Types.Hash(); - } - Salt.MergeFrom(other.Salt); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - input.ReadMessage(QueryId); - break; - } - case 18: { - Data = input.ReadString(); - break; - } - case 26: { - if (salt_ == null) { - Salt = new global::AElf.Types.Hash(); - } - input.ReadMessage(Salt); - break; - } - } - } - } - - } - - internal sealed partial class CommitmentMap : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CommitmentMap()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[19]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CommitmentMap() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CommitmentMap(CommitmentMap other) : this() { - value_ = other.value_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CommitmentMap Clone() { - return new CommitmentMap(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private static readonly pbc::MapField.Codec _map_value_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::AElf.Types.Hash.Parser), 10); - private readonly pbc::MapField value_ = new pbc::MapField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField Value { - get { return value_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as CommitmentMap); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(CommitmentMap other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!Value.Equals(other.Value)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - value_.WriteTo(output, _map_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += value_.CalculateSize(_map_value_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(CommitmentMap other) { - if (other == null) { - return; - } - value_.Add(other.value_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - value_.AddEntriesFrom(input, _map_value_codec); - break; - } - } - } - } - - } - - internal sealed partial class OracleNodeThreshold : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OracleNodeThreshold()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[20]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OracleNodeThreshold() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OracleNodeThreshold(OracleNodeThreshold other) : this() { - minimumOracleNodesCount_ = other.minimumOracleNodesCount_; - defaultRevealThreshold_ = other.defaultRevealThreshold_; - defaultAggregateThreshold_ = other.defaultAggregateThreshold_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OracleNodeThreshold Clone() { - return new OracleNodeThreshold(this); - } - - /// Field number for the "minimum_oracle_nodes_count" field. - public const int MinimumOracleNodesCountFieldNumber = 1; - private int minimumOracleNodesCount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int MinimumOracleNodesCount { - get { return minimumOracleNodesCount_; } - set { - minimumOracleNodesCount_ = value; - } - } - - /// Field number for the "default_reveal_threshold" field. - public const int DefaultRevealThresholdFieldNumber = 2; - private int defaultRevealThreshold_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int DefaultRevealThreshold { - get { return defaultRevealThreshold_; } - set { - defaultRevealThreshold_ = value; - } - } - - /// Field number for the "default_aggregate_threshold" field. - public const int DefaultAggregateThresholdFieldNumber = 3; - private int defaultAggregateThreshold_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int DefaultAggregateThreshold { - get { return defaultAggregateThreshold_; } - set { - defaultAggregateThreshold_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as OracleNodeThreshold); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(OracleNodeThreshold other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (MinimumOracleNodesCount != other.MinimumOracleNodesCount) return false; - if (DefaultRevealThreshold != other.DefaultRevealThreshold) return false; - if (DefaultAggregateThreshold != other.DefaultAggregateThreshold) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (MinimumOracleNodesCount != 0) hash ^= MinimumOracleNodesCount.GetHashCode(); - if (DefaultRevealThreshold != 0) hash ^= DefaultRevealThreshold.GetHashCode(); - if (DefaultAggregateThreshold != 0) hash ^= DefaultAggregateThreshold.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (MinimumOracleNodesCount != 0) { - output.WriteRawTag(8); - output.WriteInt32(MinimumOracleNodesCount); - } - if (DefaultRevealThreshold != 0) { - output.WriteRawTag(16); - output.WriteInt32(DefaultRevealThreshold); - } - if (DefaultAggregateThreshold != 0) { - output.WriteRawTag(24); - output.WriteInt32(DefaultAggregateThreshold); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (MinimumOracleNodesCount != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(MinimumOracleNodesCount); - } - if (DefaultRevealThreshold != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(DefaultRevealThreshold); - } - if (DefaultAggregateThreshold != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(DefaultAggregateThreshold); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(OracleNodeThreshold other) { - if (other == null) { - return; - } - if (other.MinimumOracleNodesCount != 0) { - MinimumOracleNodesCount = other.MinimumOracleNodesCount; - } - if (other.DefaultRevealThreshold != 0) { - DefaultRevealThreshold = other.DefaultRevealThreshold; - } - if (other.DefaultAggregateThreshold != 0) { - DefaultAggregateThreshold = other.DefaultAggregateThreshold; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - MinimumOracleNodesCount = input.ReadInt32(); - break; - } - case 16: { - DefaultRevealThreshold = input.ReadInt32(); - break; - } - case 24: { - DefaultAggregateThreshold = input.ReadInt32(); - break; - } - } - } - } - - } - - internal sealed partial class ResultList : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ResultList()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[21]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ResultList() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ResultList(ResultList other) : this() { - results_ = other.results_.Clone(); - frequencies_ = other.frequencies_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ResultList Clone() { - return new ResultList(this); - } - - /// Field number for the "results" field. - public const int ResultsFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_results_codec - = pb::FieldCodec.ForString(10); - private readonly pbc::RepeatedField results_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Results { - get { return results_; } - } - - /// Field number for the "frequencies" field. - public const int FrequenciesFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_frequencies_codec - = pb::FieldCodec.ForInt32(18); - private readonly pbc::RepeatedField frequencies_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Frequencies { - get { return frequencies_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ResultList); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ResultList other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!results_.Equals(other.results_)) return false; - if(!frequencies_.Equals(other.frequencies_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= results_.GetHashCode(); - hash ^= frequencies_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - results_.WriteTo(output, _repeated_results_codec); - frequencies_.WriteTo(output, _repeated_frequencies_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += results_.CalculateSize(_repeated_results_codec); - size += frequencies_.CalculateSize(_repeated_frequencies_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ResultList other) { - if (other == null) { - return; - } - results_.Add(other.results_); - frequencies_.Add(other.frequencies_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - results_.AddEntriesFrom(input, _repeated_results_codec); - break; - } - case 18: - case 16: { - frequencies_.AddEntriesFrom(input, _repeated_frequencies_codec); - break; - } - } - } - } - - } - - internal sealed partial class DataRecord : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DataRecord()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[22]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DataRecord() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DataRecord(DataRecord other) : this() { - address_ = other.address_ != null ? other.address_.Clone() : null; - data_ = other.data_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DataRecord Clone() { - return new DataRecord(this); - } - - /// Field number for the "address" field. - public const int AddressFieldNumber = 1; - private global::AElf.Types.Address address_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Address { - get { return address_; } - set { - address_ = value; - } - } - - /// Field number for the "data" field. - public const int DataFieldNumber = 2; - private string data_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Data { - get { return data_; } - set { - data_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as DataRecord); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DataRecord other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Address, other.Address)) return false; - if (Data != other.Data) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (address_ != null) hash ^= Address.GetHashCode(); - if (Data.Length != 0) hash ^= Data.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (address_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Address); - } - if (Data.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Data); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (address_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Address); - } - if (Data.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Data); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DataRecord other) { - if (other == null) { - return; - } - if (other.address_ != null) { - if (address_ == null) { - Address = new global::AElf.Types.Address(); - } - Address.MergeFrom(other.Address); - } - if (other.Data.Length != 0) { - Data = other.Data; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (address_ == null) { - Address = new global::AElf.Types.Address(); - } - input.ReadMessage(Address); - break; - } - case 18: { - Data = input.ReadString(); - break; - } - } - } - } - - } - - internal sealed partial class DataRecords : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DataRecords()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[23]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DataRecords() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DataRecords(DataRecords other) : this() { - value_ = other.value_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public DataRecords Clone() { - return new DataRecords(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_value_codec - = pb::FieldCodec.ForMessage(10, global::AElf.Contracts.Oracle.DataRecord.Parser); - private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Value { - get { return value_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as DataRecords); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(DataRecords other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!value_.Equals(other.value_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= value_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - value_.WriteTo(output, _repeated_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += value_.CalculateSize(_repeated_value_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(DataRecords other) { - if (other == null) { - return; - } - value_.Add(other.value_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - value_.AddEntriesFrom(input, _repeated_value_codec); - break; - } - } - } - } - - } - - internal sealed partial class PlainResult : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PlainResult()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[24]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public PlainResult() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public PlainResult(PlainResult other) : this() { - dataRecords_ = other.dataRecords_ != null ? other.dataRecords_.Clone() : null; - regimentAddress_ = other.regimentAddress_ != null ? other.regimentAddress_.Clone() : null; - queryInfo_ = other.queryInfo_ != null ? other.queryInfo_.Clone() : null; - token_ = other.token_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public PlainResult Clone() { - return new PlainResult(this); - } - - /// Field number for the "data_records" field. - public const int DataRecordsFieldNumber = 1; - private global::AElf.Contracts.Oracle.DataRecords dataRecords_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.DataRecords DataRecords { - get { return dataRecords_; } - set { - dataRecords_ = value; - } - } - - /// Field number for the "regiment_address" field. - public const int RegimentAddressFieldNumber = 2; - private global::AElf.Types.Address regimentAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address RegimentAddress { - get { return regimentAddress_; } - set { - regimentAddress_ = value; - } - } - - /// Field number for the "query_info" field. - public const int QueryInfoFieldNumber = 3; - private global::AElf.Contracts.Oracle.QueryInfo queryInfo_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.QueryInfo QueryInfo { - get { return queryInfo_; } - set { - queryInfo_ = value; - } - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 4; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as PlainResult); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(PlainResult other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(DataRecords, other.DataRecords)) return false; - if (!object.Equals(RegimentAddress, other.RegimentAddress)) return false; - if (!object.Equals(QueryInfo, other.QueryInfo)) return false; - if (Token != other.Token) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (dataRecords_ != null) hash ^= DataRecords.GetHashCode(); - if (regimentAddress_ != null) hash ^= RegimentAddress.GetHashCode(); - if (queryInfo_ != null) hash ^= QueryInfo.GetHashCode(); - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (dataRecords_ != null) { - output.WriteRawTag(10); - output.WriteMessage(DataRecords); - } - if (regimentAddress_ != null) { - output.WriteRawTag(18); - output.WriteMessage(RegimentAddress); - } - if (queryInfo_ != null) { - output.WriteRawTag(26); - output.WriteMessage(QueryInfo); - } - if (Token.Length != 0) { - output.WriteRawTag(34); - output.WriteString(Token); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (dataRecords_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(DataRecords); - } - if (regimentAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(RegimentAddress); - } - if (queryInfo_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryInfo); - } - if (Token.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(PlainResult other) { - if (other == null) { - return; - } - if (other.dataRecords_ != null) { - if (dataRecords_ == null) { - DataRecords = new global::AElf.Contracts.Oracle.DataRecords(); - } - DataRecords.MergeFrom(other.DataRecords); - } - if (other.regimentAddress_ != null) { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - RegimentAddress.MergeFrom(other.RegimentAddress); - } - if (other.queryInfo_ != null) { - if (queryInfo_ == null) { - QueryInfo = new global::AElf.Contracts.Oracle.QueryInfo(); - } - QueryInfo.MergeFrom(other.QueryInfo); - } - if (other.Token.Length != 0) { - Token = other.Token; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (dataRecords_ == null) { - DataRecords = new global::AElf.Contracts.Oracle.DataRecords(); - } - input.ReadMessage(DataRecords); - break; - } - case 18: { - if (regimentAddress_ == null) { - RegimentAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(RegimentAddress); - break; - } - case 26: { - if (queryInfo_ == null) { - QueryInfo = new global::AElf.Contracts.Oracle.QueryInfo(); - } - input.ReadMessage(QueryInfo); - break; - } - case 34: { - Token = input.ReadString(); - break; - } - } - } - } - - } - - internal sealed partial class LockTokensInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new LockTokensInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[25]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public LockTokensInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public LockTokensInput(LockTokensInput other) : this() { - oracleNodeAddress_ = other.oracleNodeAddress_ != null ? other.oracleNodeAddress_.Clone() : null; - lockAmount_ = other.lockAmount_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public LockTokensInput Clone() { - return new LockTokensInput(this); - } - - /// Field number for the "oracle_node_address" field. - public const int OracleNodeAddressFieldNumber = 1; - private global::AElf.Types.Address oracleNodeAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address OracleNodeAddress { - get { return oracleNodeAddress_; } - set { - oracleNodeAddress_ = value; - } - } - - /// Field number for the "lock_amount" field. - public const int LockAmountFieldNumber = 2; - private long lockAmount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long LockAmount { - get { return lockAmount_; } - set { - lockAmount_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as LockTokensInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(LockTokensInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(OracleNodeAddress, other.OracleNodeAddress)) return false; - if (LockAmount != other.LockAmount) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (oracleNodeAddress_ != null) hash ^= OracleNodeAddress.GetHashCode(); - if (LockAmount != 0L) hash ^= LockAmount.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (oracleNodeAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(OracleNodeAddress); - } - if (LockAmount != 0L) { - output.WriteRawTag(16); - output.WriteInt64(LockAmount); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (oracleNodeAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OracleNodeAddress); - } - if (LockAmount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(LockAmount); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(LockTokensInput other) { - if (other == null) { - return; - } - if (other.oracleNodeAddress_ != null) { - if (oracleNodeAddress_ == null) { - OracleNodeAddress = new global::AElf.Types.Address(); - } - OracleNodeAddress.MergeFrom(other.OracleNodeAddress); - } - if (other.LockAmount != 0L) { - LockAmount = other.LockAmount; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (oracleNodeAddress_ == null) { - OracleNodeAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(OracleNodeAddress); - break; - } - case 16: { - LockAmount = input.ReadInt64(); - break; - } - } - } - } - - } - - internal sealed partial class UnlockTokensInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UnlockTokensInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[26]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UnlockTokensInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UnlockTokensInput(UnlockTokensInput other) : this() { - oracleNodeAddress_ = other.oracleNodeAddress_ != null ? other.oracleNodeAddress_.Clone() : null; - withdrawAmount_ = other.withdrawAmount_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public UnlockTokensInput Clone() { - return new UnlockTokensInput(this); - } - - /// Field number for the "oracle_node_address" field. - public const int OracleNodeAddressFieldNumber = 1; - private global::AElf.Types.Address oracleNodeAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address OracleNodeAddress { - get { return oracleNodeAddress_; } - set { - oracleNodeAddress_ = value; - } - } - - /// Field number for the "withdraw_amount" field. - public const int WithdrawAmountFieldNumber = 2; - private long withdrawAmount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long WithdrawAmount { - get { return withdrawAmount_; } - set { - withdrawAmount_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as UnlockTokensInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(UnlockTokensInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(OracleNodeAddress, other.OracleNodeAddress)) return false; - if (WithdrawAmount != other.WithdrawAmount) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (oracleNodeAddress_ != null) hash ^= OracleNodeAddress.GetHashCode(); - if (WithdrawAmount != 0L) hash ^= WithdrawAmount.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (oracleNodeAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(OracleNodeAddress); - } - if (WithdrawAmount != 0L) { - output.WriteRawTag(16); - output.WriteInt64(WithdrawAmount); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (oracleNodeAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OracleNodeAddress); - } - if (WithdrawAmount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(WithdrawAmount); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(UnlockTokensInput other) { - if (other == null) { - return; - } - if (other.oracleNodeAddress_ != null) { - if (oracleNodeAddress_ == null) { - OracleNodeAddress = new global::AElf.Types.Address(); - } - OracleNodeAddress.MergeFrom(other.OracleNodeAddress); - } - if (other.WithdrawAmount != 0L) { - WithdrawAmount = other.WithdrawAmount; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (oracleNodeAddress_ == null) { - OracleNodeAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(OracleNodeAddress); - break; - } - case 16: { - WithdrawAmount = input.ReadInt64(); - break; - } - } - } - } - - } - - internal sealed partial class QueryInfo : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryInfo()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[27]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryInfo() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryInfo(QueryInfo other) : this() { - title_ = other.title_; - options_ = other.options_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryInfo Clone() { - return new QueryInfo(this); - } - - /// Field number for the "title" field. - public const int TitleFieldNumber = 1; - private string title_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Title { - get { return title_; } - set { - title_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "options" field. - public const int OptionsFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_options_codec - = pb::FieldCodec.ForString(18); - private readonly pbc::RepeatedField options_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Options { - get { return options_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as QueryInfo); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueryInfo other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Title != other.Title) return false; - if(!options_.Equals(other.options_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Title.Length != 0) hash ^= Title.GetHashCode(); - hash ^= options_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Title.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Title); - } - options_.WriteTo(output, _repeated_options_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Title.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Title); - } - size += options_.CalculateSize(_repeated_options_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueryInfo other) { - if (other == null) { - return; - } - if (other.Title.Length != 0) { - Title = other.Title; - } - options_.Add(other.options_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Title = input.ReadString(); - break; - } - case 18: { - options_.AddEntriesFrom(input, _repeated_options_codec); - break; - } - } - } - } - - } - - /// - /// Events - /// - internal sealed partial class QueryCreated : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryCreated()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[28]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryCreated() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryCreated(QueryCreated other) : this() { - payment_ = other.payment_; - callbackInfo_ = other.callbackInfo_ != null ? other.callbackInfo_.Clone() : null; - aggregatorContractAddress_ = other.aggregatorContractAddress_ != null ? other.aggregatorContractAddress_.Clone() : null; - designatedNodeList_ = other.designatedNodeList_ != null ? other.designatedNodeList_.Clone() : null; - queryInfo_ = other.queryInfo_ != null ? other.queryInfo_.Clone() : null; - aggregateThreshold_ = other.aggregateThreshold_; - querySender_ = other.querySender_ != null ? other.querySender_.Clone() : null; - queryId_ = other.queryId_ != null ? other.queryId_.Clone() : null; - token_ = other.token_; - maximumPermissibleDeviation_ = other.maximumPermissibleDeviation_; - aggregateOption_ = other.aggregateOption_; - taskId_ = other.taskId_ != null ? other.taskId_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryCreated Clone() { - return new QueryCreated(this); - } - - /// Field number for the "payment" field. - public const int PaymentFieldNumber = 1; - private long payment_; - /// - /// Maximum for this query option. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Payment { - get { return payment_; } - set { - payment_ = value; - } - } - - /// Field number for the "callback_info" field. - public const int CallbackInfoFieldNumber = 2; - private global::AElf.Contracts.Oracle.CallbackInfo callbackInfo_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.CallbackInfo CallbackInfo { - get { return callbackInfo_; } - set { - callbackInfo_ = value; - } - } - - /// Field number for the "aggregator_contract_address" field. - public const int AggregatorContractAddressFieldNumber = 3; - private global::AElf.Types.Address aggregatorContractAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address AggregatorContractAddress { - get { return aggregatorContractAddress_; } - set { - aggregatorContractAddress_ = value; - } - } - - /// Field number for the "designated_node_list" field. - public const int DesignatedNodeListFieldNumber = 4; - private global::AElf.Contracts.Oracle.AddressList designatedNodeList_; - /// - /// Will be regiment address if count is 1. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.AddressList DesignatedNodeList { - get { return designatedNodeList_; } - set { - designatedNodeList_ = value; - } - } - - /// Field number for the "query_info" field. - public const int QueryInfoFieldNumber = 5; - private global::AElf.Contracts.Oracle.QueryInfo queryInfo_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.QueryInfo QueryInfo { - get { return queryInfo_; } - set { - queryInfo_ = value; - } - } - - /// Field number for the "aggregate_threshold" field. - public const int AggregateThresholdFieldNumber = 6; - private int aggregateThreshold_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int AggregateThreshold { - get { return aggregateThreshold_; } - set { - aggregateThreshold_ = value; - } - } - - /// Field number for the "query_sender" field. - public const int QuerySenderFieldNumber = 7; - private global::AElf.Types.Address querySender_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address QuerySender { - get { return querySender_; } - set { - querySender_ = value; - } - } - - /// Field number for the "query_id" field. - public const int QueryIdFieldNumber = 8; - private global::AElf.Types.Hash queryId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash QueryId { - get { return queryId_; } - set { - queryId_ = value; - } - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 9; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "maximum_permissible_deviation" field. - public const int MaximumPermissibleDeviationFieldNumber = 10; - private int maximumPermissibleDeviation_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int MaximumPermissibleDeviation { - get { return maximumPermissibleDeviation_; } - set { - maximumPermissibleDeviation_ = value; - } - } - - /// Field number for the "aggregate_option" field. - public const int AggregateOptionFieldNumber = 11; - private int aggregateOption_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int AggregateOption { - get { return aggregateOption_; } - set { - aggregateOption_ = value; - } - } - - /// Field number for the "task_id" field. - public const int TaskIdFieldNumber = 12; - private global::AElf.Types.Hash taskId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash TaskId { - get { return taskId_; } - set { - taskId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as QueryCreated); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueryCreated other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Payment != other.Payment) return false; - if (!object.Equals(CallbackInfo, other.CallbackInfo)) return false; - if (!object.Equals(AggregatorContractAddress, other.AggregatorContractAddress)) return false; - if (!object.Equals(DesignatedNodeList, other.DesignatedNodeList)) return false; - if (!object.Equals(QueryInfo, other.QueryInfo)) return false; - if (AggregateThreshold != other.AggregateThreshold) return false; - if (!object.Equals(QuerySender, other.QuerySender)) return false; - if (!object.Equals(QueryId, other.QueryId)) return false; - if (Token != other.Token) return false; - if (MaximumPermissibleDeviation != other.MaximumPermissibleDeviation) return false; - if (AggregateOption != other.AggregateOption) return false; - if (!object.Equals(TaskId, other.TaskId)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Payment != 0L) hash ^= Payment.GetHashCode(); - if (callbackInfo_ != null) hash ^= CallbackInfo.GetHashCode(); - if (aggregatorContractAddress_ != null) hash ^= AggregatorContractAddress.GetHashCode(); - if (designatedNodeList_ != null) hash ^= DesignatedNodeList.GetHashCode(); - if (queryInfo_ != null) hash ^= QueryInfo.GetHashCode(); - if (AggregateThreshold != 0) hash ^= AggregateThreshold.GetHashCode(); - if (querySender_ != null) hash ^= QuerySender.GetHashCode(); - if (queryId_ != null) hash ^= QueryId.GetHashCode(); - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (MaximumPermissibleDeviation != 0) hash ^= MaximumPermissibleDeviation.GetHashCode(); - if (AggregateOption != 0) hash ^= AggregateOption.GetHashCode(); - if (taskId_ != null) hash ^= TaskId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Payment != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Payment); - } - if (callbackInfo_ != null) { - output.WriteRawTag(18); - output.WriteMessage(CallbackInfo); - } - if (aggregatorContractAddress_ != null) { - output.WriteRawTag(26); - output.WriteMessage(AggregatorContractAddress); - } - if (designatedNodeList_ != null) { - output.WriteRawTag(34); - output.WriteMessage(DesignatedNodeList); - } - if (queryInfo_ != null) { - output.WriteRawTag(42); - output.WriteMessage(QueryInfo); - } - if (AggregateThreshold != 0) { - output.WriteRawTag(48); - output.WriteInt32(AggregateThreshold); - } - if (querySender_ != null) { - output.WriteRawTag(58); - output.WriteMessage(QuerySender); - } - if (queryId_ != null) { - output.WriteRawTag(66); - output.WriteMessage(QueryId); - } - if (Token.Length != 0) { - output.WriteRawTag(74); - output.WriteString(Token); - } - if (MaximumPermissibleDeviation != 0) { - output.WriteRawTag(80); - output.WriteInt32(MaximumPermissibleDeviation); - } - if (AggregateOption != 0) { - output.WriteRawTag(88); - output.WriteInt32(AggregateOption); - } - if (taskId_ != null) { - output.WriteRawTag(98); - output.WriteMessage(TaskId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Payment != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Payment); - } - if (callbackInfo_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(CallbackInfo); - } - if (aggregatorContractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(AggregatorContractAddress); - } - if (designatedNodeList_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(DesignatedNodeList); - } - if (queryInfo_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryInfo); - } - if (AggregateThreshold != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(AggregateThreshold); - } - if (querySender_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QuerySender); - } - if (queryId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryId); - } - if (Token.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (MaximumPermissibleDeviation != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(MaximumPermissibleDeviation); - } - if (AggregateOption != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(AggregateOption); - } - if (taskId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(TaskId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueryCreated other) { - if (other == null) { - return; - } - if (other.Payment != 0L) { - Payment = other.Payment; - } - if (other.callbackInfo_ != null) { - if (callbackInfo_ == null) { - CallbackInfo = new global::AElf.Contracts.Oracle.CallbackInfo(); - } - CallbackInfo.MergeFrom(other.CallbackInfo); - } - if (other.aggregatorContractAddress_ != null) { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - AggregatorContractAddress.MergeFrom(other.AggregatorContractAddress); - } - if (other.designatedNodeList_ != null) { - if (designatedNodeList_ == null) { - DesignatedNodeList = new global::AElf.Contracts.Oracle.AddressList(); - } - DesignatedNodeList.MergeFrom(other.DesignatedNodeList); - } - if (other.queryInfo_ != null) { - if (queryInfo_ == null) { - QueryInfo = new global::AElf.Contracts.Oracle.QueryInfo(); - } - QueryInfo.MergeFrom(other.QueryInfo); - } - if (other.AggregateThreshold != 0) { - AggregateThreshold = other.AggregateThreshold; - } - if (other.querySender_ != null) { - if (querySender_ == null) { - QuerySender = new global::AElf.Types.Address(); - } - QuerySender.MergeFrom(other.QuerySender); - } - if (other.queryId_ != null) { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - QueryId.MergeFrom(other.QueryId); - } - if (other.Token.Length != 0) { - Token = other.Token; - } - if (other.MaximumPermissibleDeviation != 0) { - MaximumPermissibleDeviation = other.MaximumPermissibleDeviation; - } - if (other.AggregateOption != 0) { - AggregateOption = other.AggregateOption; - } - if (other.taskId_ != null) { - if (taskId_ == null) { - TaskId = new global::AElf.Types.Hash(); - } - TaskId.MergeFrom(other.TaskId); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Payment = input.ReadInt64(); - break; - } - case 18: { - if (callbackInfo_ == null) { - CallbackInfo = new global::AElf.Contracts.Oracle.CallbackInfo(); - } - input.ReadMessage(CallbackInfo); - break; - } - case 26: { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(AggregatorContractAddress); - break; - } - case 34: { - if (designatedNodeList_ == null) { - DesignatedNodeList = new global::AElf.Contracts.Oracle.AddressList(); - } - input.ReadMessage(DesignatedNodeList); - break; - } - case 42: { - if (queryInfo_ == null) { - QueryInfo = new global::AElf.Contracts.Oracle.QueryInfo(); - } - input.ReadMessage(QueryInfo); - break; - } - case 48: { - AggregateThreshold = input.ReadInt32(); - break; - } - case 58: { - if (querySender_ == null) { - QuerySender = new global::AElf.Types.Address(); - } - input.ReadMessage(QuerySender); - break; - } - case 66: { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - input.ReadMessage(QueryId); - break; - } - case 74: { - Token = input.ReadString(); - break; - } - case 80: { - MaximumPermissibleDeviation = input.ReadInt32(); - break; - } - case 88: { - AggregateOption = input.ReadInt32(); - break; - } - case 98: { - if (taskId_ == null) { - TaskId = new global::AElf.Types.Hash(); - } - input.ReadMessage(TaskId); - break; - } - } - } - } - - } - - internal sealed partial class QueryTaskCreated : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryTaskCreated()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[29]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryTaskCreated() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryTaskCreated(QueryTaskCreated other) : this() { - eachPayment_ = other.eachPayment_; - supposedQueryTimes_ = other.supposedQueryTimes_; - queryInfo_ = other.queryInfo_ != null ? other.queryInfo_.Clone() : null; - endTime_ = other.endTime_ != null ? other.endTime_.Clone() : null; - designatedNodeList_ = other.designatedNodeList_ != null ? other.designatedNodeList_.Clone() : null; - aggregatorContractAddress_ = other.aggregatorContractAddress_ != null ? other.aggregatorContractAddress_.Clone() : null; - callbackInfo_ = other.callbackInfo_ != null ? other.callbackInfo_.Clone() : null; - creator_ = other.creator_ != null ? other.creator_.Clone() : null; - aggregateThreshold_ = other.aggregateThreshold_; - aggregateOption_ = other.aggregateOption_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryTaskCreated Clone() { - return new QueryTaskCreated(this); - } - - /// Field number for the "each_payment" field. - public const int EachPaymentFieldNumber = 1; - private long eachPayment_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long EachPayment { - get { return eachPayment_; } - set { - eachPayment_ = value; - } - } - - /// Field number for the "supposed_query_times" field. - public const int SupposedQueryTimesFieldNumber = 2; - private int supposedQueryTimes_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int SupposedQueryTimes { - get { return supposedQueryTimes_; } - set { - supposedQueryTimes_ = value; - } - } - - /// Field number for the "query_info" field. - public const int QueryInfoFieldNumber = 3; - private global::AElf.Contracts.Oracle.QueryInfo queryInfo_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.QueryInfo QueryInfo { - get { return queryInfo_; } - set { - queryInfo_ = value; - } - } - - /// Field number for the "end_time" field. - public const int EndTimeFieldNumber = 4; - private global::Google.Protobuf.WellKnownTypes.Timestamp endTime_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp EndTime { - get { return endTime_; } - set { - endTime_ = value; - } - } - - /// Field number for the "designated_node_list" field. - public const int DesignatedNodeListFieldNumber = 5; - private global::AElf.Contracts.Oracle.AddressList designatedNodeList_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.AddressList DesignatedNodeList { - get { return designatedNodeList_; } - set { - designatedNodeList_ = value; - } - } - - /// Field number for the "aggregator_contract_address" field. - public const int AggregatorContractAddressFieldNumber = 6; - private global::AElf.Types.Address aggregatorContractAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address AggregatorContractAddress { - get { return aggregatorContractAddress_; } - set { - aggregatorContractAddress_ = value; - } - } - - /// Field number for the "callback_info" field. - public const int CallbackInfoFieldNumber = 7; - private global::AElf.Contracts.Oracle.CallbackInfo callbackInfo_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.CallbackInfo CallbackInfo { - get { return callbackInfo_; } - set { - callbackInfo_ = value; - } - } - - /// Field number for the "creator" field. - public const int CreatorFieldNumber = 8; - private global::AElf.Types.Address creator_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Creator { - get { return creator_; } - set { - creator_ = value; - } - } - - /// Field number for the "aggregate_threshold" field. - public const int AggregateThresholdFieldNumber = 9; - private int aggregateThreshold_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int AggregateThreshold { - get { return aggregateThreshold_; } - set { - aggregateThreshold_ = value; - } - } - - /// Field number for the "aggregate_option" field. - public const int AggregateOptionFieldNumber = 10; - private int aggregateOption_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int AggregateOption { - get { return aggregateOption_; } - set { - aggregateOption_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as QueryTaskCreated); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueryTaskCreated other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (EachPayment != other.EachPayment) return false; - if (SupposedQueryTimes != other.SupposedQueryTimes) return false; - if (!object.Equals(QueryInfo, other.QueryInfo)) return false; - if (!object.Equals(EndTime, other.EndTime)) return false; - if (!object.Equals(DesignatedNodeList, other.DesignatedNodeList)) return false; - if (!object.Equals(AggregatorContractAddress, other.AggregatorContractAddress)) return false; - if (!object.Equals(CallbackInfo, other.CallbackInfo)) return false; - if (!object.Equals(Creator, other.Creator)) return false; - if (AggregateThreshold != other.AggregateThreshold) return false; - if (AggregateOption != other.AggregateOption) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (EachPayment != 0L) hash ^= EachPayment.GetHashCode(); - if (SupposedQueryTimes != 0) hash ^= SupposedQueryTimes.GetHashCode(); - if (queryInfo_ != null) hash ^= QueryInfo.GetHashCode(); - if (endTime_ != null) hash ^= EndTime.GetHashCode(); - if (designatedNodeList_ != null) hash ^= DesignatedNodeList.GetHashCode(); - if (aggregatorContractAddress_ != null) hash ^= AggregatorContractAddress.GetHashCode(); - if (callbackInfo_ != null) hash ^= CallbackInfo.GetHashCode(); - if (creator_ != null) hash ^= Creator.GetHashCode(); - if (AggregateThreshold != 0) hash ^= AggregateThreshold.GetHashCode(); - if (AggregateOption != 0) hash ^= AggregateOption.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (EachPayment != 0L) { - output.WriteRawTag(8); - output.WriteInt64(EachPayment); - } - if (SupposedQueryTimes != 0) { - output.WriteRawTag(16); - output.WriteInt32(SupposedQueryTimes); - } - if (queryInfo_ != null) { - output.WriteRawTag(26); - output.WriteMessage(QueryInfo); - } - if (endTime_ != null) { - output.WriteRawTag(34); - output.WriteMessage(EndTime); - } - if (designatedNodeList_ != null) { - output.WriteRawTag(42); - output.WriteMessage(DesignatedNodeList); - } - if (aggregatorContractAddress_ != null) { - output.WriteRawTag(50); - output.WriteMessage(AggregatorContractAddress); - } - if (callbackInfo_ != null) { - output.WriteRawTag(58); - output.WriteMessage(CallbackInfo); - } - if (creator_ != null) { - output.WriteRawTag(66); - output.WriteMessage(Creator); - } - if (AggregateThreshold != 0) { - output.WriteRawTag(72); - output.WriteInt32(AggregateThreshold); - } - if (AggregateOption != 0) { - output.WriteRawTag(80); - output.WriteInt32(AggregateOption); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (EachPayment != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(EachPayment); - } - if (SupposedQueryTimes != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(SupposedQueryTimes); - } - if (queryInfo_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryInfo); - } - if (endTime_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(EndTime); - } - if (designatedNodeList_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(DesignatedNodeList); - } - if (aggregatorContractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(AggregatorContractAddress); - } - if (callbackInfo_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(CallbackInfo); - } - if (creator_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Creator); - } - if (AggregateThreshold != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(AggregateThreshold); - } - if (AggregateOption != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(AggregateOption); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueryTaskCreated other) { - if (other == null) { - return; - } - if (other.EachPayment != 0L) { - EachPayment = other.EachPayment; - } - if (other.SupposedQueryTimes != 0) { - SupposedQueryTimes = other.SupposedQueryTimes; - } - if (other.queryInfo_ != null) { - if (queryInfo_ == null) { - QueryInfo = new global::AElf.Contracts.Oracle.QueryInfo(); - } - QueryInfo.MergeFrom(other.QueryInfo); - } - if (other.endTime_ != null) { - if (endTime_ == null) { - EndTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - EndTime.MergeFrom(other.EndTime); - } - if (other.designatedNodeList_ != null) { - if (designatedNodeList_ == null) { - DesignatedNodeList = new global::AElf.Contracts.Oracle.AddressList(); - } - DesignatedNodeList.MergeFrom(other.DesignatedNodeList); - } - if (other.aggregatorContractAddress_ != null) { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - AggregatorContractAddress.MergeFrom(other.AggregatorContractAddress); - } - if (other.callbackInfo_ != null) { - if (callbackInfo_ == null) { - CallbackInfo = new global::AElf.Contracts.Oracle.CallbackInfo(); - } - CallbackInfo.MergeFrom(other.CallbackInfo); - } - if (other.creator_ != null) { - if (creator_ == null) { - Creator = new global::AElf.Types.Address(); - } - Creator.MergeFrom(other.Creator); - } - if (other.AggregateThreshold != 0) { - AggregateThreshold = other.AggregateThreshold; - } - if (other.AggregateOption != 0) { - AggregateOption = other.AggregateOption; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - EachPayment = input.ReadInt64(); - break; - } - case 16: { - SupposedQueryTimes = input.ReadInt32(); - break; - } - case 26: { - if (queryInfo_ == null) { - QueryInfo = new global::AElf.Contracts.Oracle.QueryInfo(); - } - input.ReadMessage(QueryInfo); - break; - } - case 34: { - if (endTime_ == null) { - EndTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(EndTime); - break; - } - case 42: { - if (designatedNodeList_ == null) { - DesignatedNodeList = new global::AElf.Contracts.Oracle.AddressList(); - } - input.ReadMessage(DesignatedNodeList); - break; - } - case 50: { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(AggregatorContractAddress); - break; - } - case 58: { - if (callbackInfo_ == null) { - CallbackInfo = new global::AElf.Contracts.Oracle.CallbackInfo(); - } - input.ReadMessage(CallbackInfo); - break; - } - case 66: { - if (creator_ == null) { - Creator = new global::AElf.Types.Address(); - } - input.ReadMessage(Creator); - break; - } - case 72: { - AggregateThreshold = input.ReadInt32(); - break; - } - case 80: { - AggregateOption = input.ReadInt32(); - break; - } - } - } - } - - } - - internal sealed partial class QueryCancelled : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryCancelled()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[30]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryCancelled() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryCancelled(QueryCancelled other) : this() { - queryId_ = other.queryId_ != null ? other.queryId_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryCancelled Clone() { - return new QueryCancelled(this); - } - - /// Field number for the "query_id" field. - public const int QueryIdFieldNumber = 1; - private global::AElf.Types.Hash queryId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash QueryId { - get { return queryId_; } - set { - queryId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as QueryCancelled); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueryCancelled other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(QueryId, other.QueryId)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (queryId_ != null) hash ^= QueryId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (queryId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(QueryId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (queryId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueryCancelled other) { - if (other == null) { - return; - } - if (other.queryId_ != null) { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - QueryId.MergeFrom(other.QueryId); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - input.ReadMessage(QueryId); - break; - } - } - } - } - - } - - internal sealed partial class SufficientCommitmentsCollected : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SufficientCommitmentsCollected()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[31]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SufficientCommitmentsCollected() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SufficientCommitmentsCollected(SufficientCommitmentsCollected other) : this() { - queryId_ = other.queryId_ != null ? other.queryId_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SufficientCommitmentsCollected Clone() { - return new SufficientCommitmentsCollected(this); - } - - /// Field number for the "query_id" field. - public const int QueryIdFieldNumber = 1; - private global::AElf.Types.Hash queryId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash QueryId { - get { return queryId_; } - set { - queryId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SufficientCommitmentsCollected); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SufficientCommitmentsCollected other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(QueryId, other.QueryId)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (queryId_ != null) hash ^= QueryId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (queryId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(QueryId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (queryId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SufficientCommitmentsCollected other) { - if (other == null) { - return; - } - if (other.queryId_ != null) { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - QueryId.MergeFrom(other.QueryId); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - input.ReadMessage(QueryId); - break; - } - } - } - } - - } - - internal sealed partial class Committed : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Committed()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[32]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Committed() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Committed(Committed other) : this() { - queryId_ = other.queryId_ != null ? other.queryId_.Clone() : null; - oracleNodeAddress_ = other.oracleNodeAddress_ != null ? other.oracleNodeAddress_.Clone() : null; - commitment_ = other.commitment_ != null ? other.commitment_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Committed Clone() { - return new Committed(this); - } - - /// Field number for the "query_id" field. - public const int QueryIdFieldNumber = 1; - private global::AElf.Types.Hash queryId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash QueryId { - get { return queryId_; } - set { - queryId_ = value; - } - } - - /// Field number for the "oracle_node_address" field. - public const int OracleNodeAddressFieldNumber = 2; - private global::AElf.Types.Address oracleNodeAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address OracleNodeAddress { - get { return oracleNodeAddress_; } - set { - oracleNodeAddress_ = value; - } - } - - /// Field number for the "commitment" field. - public const int CommitmentFieldNumber = 3; - private global::AElf.Types.Hash commitment_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash Commitment { - get { return commitment_; } - set { - commitment_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Committed); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Committed other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(QueryId, other.QueryId)) return false; - if (!object.Equals(OracleNodeAddress, other.OracleNodeAddress)) return false; - if (!object.Equals(Commitment, other.Commitment)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (queryId_ != null) hash ^= QueryId.GetHashCode(); - if (oracleNodeAddress_ != null) hash ^= OracleNodeAddress.GetHashCode(); - if (commitment_ != null) hash ^= Commitment.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (queryId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(QueryId); - } - if (oracleNodeAddress_ != null) { - output.WriteRawTag(18); - output.WriteMessage(OracleNodeAddress); - } - if (commitment_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Commitment); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (queryId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryId); - } - if (oracleNodeAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OracleNodeAddress); - } - if (commitment_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Commitment); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Committed other) { - if (other == null) { - return; - } - if (other.queryId_ != null) { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - QueryId.MergeFrom(other.QueryId); - } - if (other.oracleNodeAddress_ != null) { - if (oracleNodeAddress_ == null) { - OracleNodeAddress = new global::AElf.Types.Address(); - } - OracleNodeAddress.MergeFrom(other.OracleNodeAddress); - } - if (other.commitment_ != null) { - if (commitment_ == null) { - Commitment = new global::AElf.Types.Hash(); - } - Commitment.MergeFrom(other.Commitment); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - input.ReadMessage(QueryId); - break; - } - case 18: { - if (oracleNodeAddress_ == null) { - OracleNodeAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(OracleNodeAddress); - break; - } - case 26: { - if (commitment_ == null) { - Commitment = new global::AElf.Types.Hash(); - } - input.ReadMessage(Commitment); - break; - } - } - } - } - - } - - internal sealed partial class CommitmentRevealed : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CommitmentRevealed()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[33]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CommitmentRevealed() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CommitmentRevealed(CommitmentRevealed other) : this() { - queryId_ = other.queryId_ != null ? other.queryId_.Clone() : null; - oracleNodeAddress_ = other.oracleNodeAddress_ != null ? other.oracleNodeAddress_.Clone() : null; - commitment_ = other.commitment_ != null ? other.commitment_.Clone() : null; - revealData_ = other.revealData_; - salt_ = other.salt_ != null ? other.salt_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CommitmentRevealed Clone() { - return new CommitmentRevealed(this); - } - - /// Field number for the "query_id" field. - public const int QueryIdFieldNumber = 1; - private global::AElf.Types.Hash queryId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash QueryId { - get { return queryId_; } - set { - queryId_ = value; - } - } - - /// Field number for the "oracle_node_address" field. - public const int OracleNodeAddressFieldNumber = 2; - private global::AElf.Types.Address oracleNodeAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address OracleNodeAddress { - get { return oracleNodeAddress_; } - set { - oracleNodeAddress_ = value; - } - } - - /// Field number for the "commitment" field. - public const int CommitmentFieldNumber = 3; - private global::AElf.Types.Hash commitment_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash Commitment { - get { return commitment_; } - set { - commitment_ = value; - } - } - - /// Field number for the "reveal_data" field. - public const int RevealDataFieldNumber = 4; - private string revealData_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string RevealData { - get { return revealData_; } - set { - revealData_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "salt" field. - public const int SaltFieldNumber = 5; - private global::AElf.Types.Hash salt_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash Salt { - get { return salt_; } - set { - salt_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as CommitmentRevealed); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(CommitmentRevealed other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(QueryId, other.QueryId)) return false; - if (!object.Equals(OracleNodeAddress, other.OracleNodeAddress)) return false; - if (!object.Equals(Commitment, other.Commitment)) return false; - if (RevealData != other.RevealData) return false; - if (!object.Equals(Salt, other.Salt)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (queryId_ != null) hash ^= QueryId.GetHashCode(); - if (oracleNodeAddress_ != null) hash ^= OracleNodeAddress.GetHashCode(); - if (commitment_ != null) hash ^= Commitment.GetHashCode(); - if (RevealData.Length != 0) hash ^= RevealData.GetHashCode(); - if (salt_ != null) hash ^= Salt.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (queryId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(QueryId); - } - if (oracleNodeAddress_ != null) { - output.WriteRawTag(18); - output.WriteMessage(OracleNodeAddress); - } - if (commitment_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Commitment); - } - if (RevealData.Length != 0) { - output.WriteRawTag(34); - output.WriteString(RevealData); - } - if (salt_ != null) { - output.WriteRawTag(42); - output.WriteMessage(Salt); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (queryId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryId); - } - if (oracleNodeAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OracleNodeAddress); - } - if (commitment_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Commitment); - } - if (RevealData.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(RevealData); - } - if (salt_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Salt); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(CommitmentRevealed other) { - if (other == null) { - return; - } - if (other.queryId_ != null) { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - QueryId.MergeFrom(other.QueryId); - } - if (other.oracleNodeAddress_ != null) { - if (oracleNodeAddress_ == null) { - OracleNodeAddress = new global::AElf.Types.Address(); - } - OracleNodeAddress.MergeFrom(other.OracleNodeAddress); - } - if (other.commitment_ != null) { - if (commitment_ == null) { - Commitment = new global::AElf.Types.Hash(); - } - Commitment.MergeFrom(other.Commitment); - } - if (other.RevealData.Length != 0) { - RevealData = other.RevealData; - } - if (other.salt_ != null) { - if (salt_ == null) { - Salt = new global::AElf.Types.Hash(); - } - Salt.MergeFrom(other.Salt); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - input.ReadMessage(QueryId); - break; - } - case 18: { - if (oracleNodeAddress_ == null) { - OracleNodeAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(OracleNodeAddress); - break; - } - case 26: { - if (commitment_ == null) { - Commitment = new global::AElf.Types.Hash(); - } - input.ReadMessage(Commitment); - break; - } - case 34: { - RevealData = input.ReadString(); - break; - } - case 42: { - if (salt_ == null) { - Salt = new global::AElf.Types.Hash(); - } - input.ReadMessage(Salt); - break; - } - } - } - } - - } - - internal sealed partial class CommitmentRevealFailed : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CommitmentRevealFailed()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[34]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CommitmentRevealFailed() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CommitmentRevealFailed(CommitmentRevealFailed other) : this() { - queryId_ = other.queryId_ != null ? other.queryId_.Clone() : null; - oracleNodeAddress_ = other.oracleNodeAddress_ != null ? other.oracleNodeAddress_.Clone() : null; - commitment_ = other.commitment_ != null ? other.commitment_.Clone() : null; - revealData_ = other.revealData_; - salt_ = other.salt_ != null ? other.salt_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public CommitmentRevealFailed Clone() { - return new CommitmentRevealFailed(this); - } - - /// Field number for the "query_id" field. - public const int QueryIdFieldNumber = 1; - private global::AElf.Types.Hash queryId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash QueryId { - get { return queryId_; } - set { - queryId_ = value; - } - } - - /// Field number for the "oracle_node_address" field. - public const int OracleNodeAddressFieldNumber = 2; - private global::AElf.Types.Address oracleNodeAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address OracleNodeAddress { - get { return oracleNodeAddress_; } - set { - oracleNodeAddress_ = value; - } - } - - /// Field number for the "commitment" field. - public const int CommitmentFieldNumber = 3; - private global::AElf.Types.Hash commitment_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash Commitment { - get { return commitment_; } - set { - commitment_ = value; - } - } - - /// Field number for the "reveal_data" field. - public const int RevealDataFieldNumber = 4; - private string revealData_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string RevealData { - get { return revealData_; } - set { - revealData_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "salt" field. - public const int SaltFieldNumber = 5; - private global::AElf.Types.Hash salt_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash Salt { - get { return salt_; } - set { - salt_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as CommitmentRevealFailed); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(CommitmentRevealFailed other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(QueryId, other.QueryId)) return false; - if (!object.Equals(OracleNodeAddress, other.OracleNodeAddress)) return false; - if (!object.Equals(Commitment, other.Commitment)) return false; - if (RevealData != other.RevealData) return false; - if (!object.Equals(Salt, other.Salt)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (queryId_ != null) hash ^= QueryId.GetHashCode(); - if (oracleNodeAddress_ != null) hash ^= OracleNodeAddress.GetHashCode(); - if (commitment_ != null) hash ^= Commitment.GetHashCode(); - if (RevealData.Length != 0) hash ^= RevealData.GetHashCode(); - if (salt_ != null) hash ^= Salt.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (queryId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(QueryId); - } - if (oracleNodeAddress_ != null) { - output.WriteRawTag(18); - output.WriteMessage(OracleNodeAddress); - } - if (commitment_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Commitment); - } - if (RevealData.Length != 0) { - output.WriteRawTag(34); - output.WriteString(RevealData); - } - if (salt_ != null) { - output.WriteRawTag(42); - output.WriteMessage(Salt); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (queryId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryId); - } - if (oracleNodeAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OracleNodeAddress); - } - if (commitment_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Commitment); - } - if (RevealData.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(RevealData); - } - if (salt_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Salt); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(CommitmentRevealFailed other) { - if (other == null) { - return; - } - if (other.queryId_ != null) { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - QueryId.MergeFrom(other.QueryId); - } - if (other.oracleNodeAddress_ != null) { - if (oracleNodeAddress_ == null) { - OracleNodeAddress = new global::AElf.Types.Address(); - } - OracleNodeAddress.MergeFrom(other.OracleNodeAddress); - } - if (other.commitment_ != null) { - if (commitment_ == null) { - Commitment = new global::AElf.Types.Hash(); - } - Commitment.MergeFrom(other.Commitment); - } - if (other.RevealData.Length != 0) { - RevealData = other.RevealData; - } - if (other.salt_ != null) { - if (salt_ == null) { - Salt = new global::AElf.Types.Hash(); - } - Salt.MergeFrom(other.Salt); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - input.ReadMessage(QueryId); - break; - } - case 18: { - if (oracleNodeAddress_ == null) { - OracleNodeAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(OracleNodeAddress); - break; - } - case 26: { - if (commitment_ == null) { - Commitment = new global::AElf.Types.Hash(); - } - input.ReadMessage(Commitment); - break; - } - case 34: { - RevealData = input.ReadString(); - break; - } - case 42: { - if (salt_ == null) { - Salt = new global::AElf.Types.Hash(); - } - input.ReadMessage(Salt); - break; - } - } - } - } - - } - - internal sealed partial class QueryCompletedWithAggregation : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryCompletedWithAggregation()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[35]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryCompletedWithAggregation() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryCompletedWithAggregation(QueryCompletedWithAggregation other) : this() { - queryId_ = other.queryId_ != null ? other.queryId_.Clone() : null; - result_ = other.result_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryCompletedWithAggregation Clone() { - return new QueryCompletedWithAggregation(this); - } - - /// Field number for the "query_id" field. - public const int QueryIdFieldNumber = 1; - private global::AElf.Types.Hash queryId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash QueryId { - get { return queryId_; } - set { - queryId_ = value; - } - } - - /// Field number for the "result" field. - public const int ResultFieldNumber = 2; - private string result_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Result { - get { return result_; } - set { - result_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as QueryCompletedWithAggregation); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueryCompletedWithAggregation other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(QueryId, other.QueryId)) return false; - if (Result != other.Result) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (queryId_ != null) hash ^= QueryId.GetHashCode(); - if (Result.Length != 0) hash ^= Result.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (queryId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(QueryId); - } - if (Result.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Result); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (queryId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryId); - } - if (Result.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Result); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueryCompletedWithAggregation other) { - if (other == null) { - return; - } - if (other.queryId_ != null) { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - QueryId.MergeFrom(other.QueryId); - } - if (other.Result.Length != 0) { - Result = other.Result; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - input.ReadMessage(QueryId); - break; - } - case 18: { - Result = input.ReadString(); - break; - } - } - } - } - - } - - internal sealed partial class QueryCompletedWithoutAggregation : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryCompletedWithoutAggregation()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[36]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryCompletedWithoutAggregation() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryCompletedWithoutAggregation(QueryCompletedWithoutAggregation other) : this() { - queryId_ = other.queryId_ != null ? other.queryId_.Clone() : null; - result_ = other.result_ != null ? other.result_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryCompletedWithoutAggregation Clone() { - return new QueryCompletedWithoutAggregation(this); - } - - /// Field number for the "query_id" field. - public const int QueryIdFieldNumber = 1; - private global::AElf.Types.Hash queryId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash QueryId { - get { return queryId_; } - set { - queryId_ = value; - } - } - - /// Field number for the "result" field. - public const int ResultFieldNumber = 2; - private global::AElf.Contracts.Oracle.PlainResult result_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Oracle.PlainResult Result { - get { return result_; } - set { - result_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as QueryCompletedWithoutAggregation); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueryCompletedWithoutAggregation other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(QueryId, other.QueryId)) return false; - if (!object.Equals(Result, other.Result)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (queryId_ != null) hash ^= QueryId.GetHashCode(); - if (result_ != null) hash ^= Result.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (queryId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(QueryId); - } - if (result_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Result); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (queryId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryId); - } - if (result_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Result); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueryCompletedWithoutAggregation other) { - if (other == null) { - return; - } - if (other.queryId_ != null) { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - QueryId.MergeFrom(other.QueryId); - } - if (other.result_ != null) { - if (result_ == null) { - Result = new global::AElf.Contracts.Oracle.PlainResult(); - } - Result.MergeFrom(other.Result); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - input.ReadMessage(QueryId); - break; - } - case 18: { - if (result_ == null) { - Result = new global::AElf.Contracts.Oracle.PlainResult(); - } - input.ReadMessage(Result); - break; - } - } - } - } - - } - - internal sealed partial class TokenLocked : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TokenLocked()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Oracle.OracleContractReflection.Descriptor.MessageTypes[37]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TokenLocked() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TokenLocked(TokenLocked other) : this() { - oracleNodeAddress_ = other.oracleNodeAddress_ != null ? other.oracleNodeAddress_.Clone() : null; - fromAddress_ = other.fromAddress_ != null ? other.fromAddress_.Clone() : null; - lockedAmount_ = other.lockedAmount_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TokenLocked Clone() { - return new TokenLocked(this); - } - - /// Field number for the "oracle_node_address" field. - public const int OracleNodeAddressFieldNumber = 1; - private global::AElf.Types.Address oracleNodeAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address OracleNodeAddress { - get { return oracleNodeAddress_; } - set { - oracleNodeAddress_ = value; - } - } - - /// Field number for the "from_address" field. - public const int FromAddressFieldNumber = 2; - private global::AElf.Types.Address fromAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address FromAddress { - get { return fromAddress_; } - set { - fromAddress_ = value; - } - } - - /// Field number for the "locked_amount" field. - public const int LockedAmountFieldNumber = 3; - private long lockedAmount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long LockedAmount { - get { return lockedAmount_; } - set { - lockedAmount_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TokenLocked); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TokenLocked other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(OracleNodeAddress, other.OracleNodeAddress)) return false; - if (!object.Equals(FromAddress, other.FromAddress)) return false; - if (LockedAmount != other.LockedAmount) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (oracleNodeAddress_ != null) hash ^= OracleNodeAddress.GetHashCode(); - if (fromAddress_ != null) hash ^= FromAddress.GetHashCode(); - if (LockedAmount != 0L) hash ^= LockedAmount.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (oracleNodeAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(OracleNodeAddress); - } - if (fromAddress_ != null) { - output.WriteRawTag(18); - output.WriteMessage(FromAddress); - } - if (LockedAmount != 0L) { - output.WriteRawTag(24); - output.WriteInt64(LockedAmount); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (oracleNodeAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OracleNodeAddress); - } - if (fromAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(FromAddress); - } - if (LockedAmount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(LockedAmount); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TokenLocked other) { - if (other == null) { - return; - } - if (other.oracleNodeAddress_ != null) { - if (oracleNodeAddress_ == null) { - OracleNodeAddress = new global::AElf.Types.Address(); - } - OracleNodeAddress.MergeFrom(other.OracleNodeAddress); - } - if (other.fromAddress_ != null) { - if (fromAddress_ == null) { - FromAddress = new global::AElf.Types.Address(); - } - FromAddress.MergeFrom(other.FromAddress); - } - if (other.LockedAmount != 0L) { - LockedAmount = other.LockedAmount; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (oracleNodeAddress_ == null) { - OracleNodeAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(OracleNodeAddress); - break; - } - case 18: { - if (fromAddress_ == null) { - FromAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(FromAddress); - break; - } - case 24: { - LockedAmount = input.ReadInt64(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/src/AElf.EventHandler/Dto/OracleUserContractc.cs b/src/AElf.EventHandler/Dto/OracleUserContractc.cs deleted file mode 100644 index d1d587d4..00000000 --- a/src/AElf.EventHandler/Dto/OracleUserContractc.cs +++ /dev/null @@ -1,90 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: oracle_user_contract.proto -// -#pragma warning disable 0414, 1591 -#region Designer generated code - -using System.Collections.Generic; -using aelf = global::AElf.CSharp.Core; - -namespace AElf.Contracts.OracleUser { - - #region Events - public partial class QueryDataRecorded : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public QueryDataRecorded GetNonIndexed() - { - return new QueryDataRecorded - { - Data = Data, - Timestamp = Timestamp, - }; - } - } - - #endregion - public static partial class OracleUserContractContainer - { - static readonly string __ServiceName = "OracleUserContract"; - - #region Marshallers - static readonly aelf::Marshaller __Marshaller_QueryTemperatureInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.OracleUser.QueryTemperatureInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_aelf_Hash = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Types.Hash.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_CallbackInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::CallbackInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_Empty = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_TemperatureRecordList = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.OracleUser.TemperatureRecordList.Parser.ParseFrom); - #endregion - - #region Methods - static readonly aelf::Method __Method_QueryTemperature = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "QueryTemperature", - __Marshaller_QueryTemperatureInput, - __Marshaller_aelf_Hash); - - static readonly aelf::Method __Method_RecordTemperature = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "RecordTemperature", - __Marshaller_CallbackInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_GetHistoryTemperatures = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetHistoryTemperatures", - __Marshaller_google_protobuf_Empty, - __Marshaller_TemperatureRecordList); - - #endregion - - #region Descriptors - public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor - { - get { return global::AElf.Contracts.OracleUser.OracleUserContractReflection.Descriptor.Services[0]; } - } - - public static global::System.Collections.Generic.IReadOnlyList Descriptors - { - get - { - return new global::System.Collections.Generic.List() - { - global::AElf.Contracts.OracleUser.OracleUserContractReflection.Descriptor.Services[0], - }; - } - } - #endregion - } -} -#endregion - diff --git a/src/AElf.EventHandler/Dto/OracleUserContractg.cs b/src/AElf.EventHandler/Dto/OracleUserContractg.cs deleted file mode 100644 index a00b26aa..00000000 --- a/src/AElf.EventHandler/Dto/OracleUserContractg.cs +++ /dev/null @@ -1,950 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: oracle_user_contract.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace AElf.Contracts.OracleUser { - - /// Holder for reflection information generated from oracle_user_contract.proto - public static partial class OracleUserContractReflection { - - #region Descriptor - /// File descriptor for oracle_user_contract.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static OracleUserContractReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChpvcmFjbGVfdXNlcl9jb250cmFjdC5wcm90bxoPYWVsZi9jb3JlLnByb3Rv", - "GhJhZWxmL29wdGlvbnMucHJvdG8aG2dvb2dsZS9wcm90b2J1Zi9lbXB0eS5w", - "cm90bxofZ29vZ2xlL3Byb3RvYnVmL3RpbWVzdGFtcC5wcm90bxoUY2FsbGJh", - "Y2tfaW5wdXQucHJvdG8iwQEKFVF1ZXJ5VGVtcGVyYXR1cmVJbnB1dBIuChdv", - "cmFjbGVfY29udHJhY3RfYWRkcmVzcxgBIAEoCzINLmFlbGYuQWRkcmVzcxIy", - "ChthZ2dyZWdhdG9yX2NvbnRyYWN0X2FkZHJlc3MYAiABKAsyDS5hZWxmLkFk", - "ZHJlc3MSJwoQZGVzaWduYXRlZF9ub2RlcxgDIAMoCzINLmFlbGYuQWRkcmVz", - "cxIbChNhZ2dyZWdhdGVfdGhyZXNob2xkGAQgASgFIlcKEVRlbXBlcmF0dXJl", - "UmVjb3JkEhMKC3RlbXBlcmF0dXJlGAEgASgJEi0KCXRpbWVzdGFtcBgCIAEo", - "CzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXAiOgoVVGVtcGVyYXR1cmVS", - "ZWNvcmRMaXN0EiEKBXZhbHVlGAEgAygLMhIuVGVtcGVyYXR1cmVSZWNvcmQi", - "VgoRUXVlcnlEYXRhUmVjb3JkZWQSDAoEZGF0YRgBIAEoCRItCgl0aW1lc3Rh", - "bXAYAiABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wOgSguxgBMpYC", - "ChJPcmFjbGVVc2VyQ29udHJhY3QSOAoQUXVlcnlUZW1wZXJhdHVyZRIWLlF1", - "ZXJ5VGVtcGVyYXR1cmVJbnB1dBoKLmFlbGYuSGFzaCIAEj0KEVJlY29yZFRl", - "bXBlcmF0dXJlEg4uQ2FsbGJhY2tJbnB1dBoWLmdvb2dsZS5wcm90b2J1Zi5F", - "bXB0eSIAEk8KFkdldEhpc3RvcnlUZW1wZXJhdHVyZXMSFi5nb29nbGUucHJv", - "dG9idWYuRW1wdHkaFi5UZW1wZXJhdHVyZVJlY29yZExpc3QiBYiJ9wEBGjay", - "zPYBMUFFbGYuQ29udHJhY3RzLk9yYWNsZVVzZXIuT3JhY2xlVXNlckNvbnRy", - "YWN0U3RhdGVCHKoCGUFFbGYuQ29udHJhY3RzLk9yYWNsZVVzZXJiBnByb3Rv", - "Mw==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::AElf.Types.CoreReflection.Descriptor, global::AElf.OptionsReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::CallbackInputReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.OracleUser.QueryTemperatureInput), global::AElf.Contracts.OracleUser.QueryTemperatureInput.Parser, new[]{ "OracleContractAddress", "AggregatorContractAddress", "DesignatedNodes", "AggregateThreshold" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.OracleUser.TemperatureRecord), global::AElf.Contracts.OracleUser.TemperatureRecord.Parser, new[]{ "Temperature", "Timestamp" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.OracleUser.TemperatureRecordList), global::AElf.Contracts.OracleUser.TemperatureRecordList.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.OracleUser.QueryDataRecorded), global::AElf.Contracts.OracleUser.QueryDataRecorded.Parser, new[]{ "Data", "Timestamp" }, null, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class QueryTemperatureInput : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryTemperatureInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.OracleUser.OracleUserContractReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryTemperatureInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryTemperatureInput(QueryTemperatureInput other) : this() { - oracleContractAddress_ = other.oracleContractAddress_ != null ? other.oracleContractAddress_.Clone() : null; - aggregatorContractAddress_ = other.aggregatorContractAddress_ != null ? other.aggregatorContractAddress_.Clone() : null; - designatedNodes_ = other.designatedNodes_.Clone(); - aggregateThreshold_ = other.aggregateThreshold_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryTemperatureInput Clone() { - return new QueryTemperatureInput(this); - } - - /// Field number for the "oracle_contract_address" field. - public const int OracleContractAddressFieldNumber = 1; - private global::AElf.Types.Address oracleContractAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address OracleContractAddress { - get { return oracleContractAddress_; } - set { - oracleContractAddress_ = value; - } - } - - /// Field number for the "aggregator_contract_address" field. - public const int AggregatorContractAddressFieldNumber = 2; - private global::AElf.Types.Address aggregatorContractAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address AggregatorContractAddress { - get { return aggregatorContractAddress_; } - set { - aggregatorContractAddress_ = value; - } - } - - /// Field number for the "designated_nodes" field. - public const int DesignatedNodesFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_designatedNodes_codec - = pb::FieldCodec.ForMessage(26, global::AElf.Types.Address.Parser); - private readonly pbc::RepeatedField designatedNodes_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField DesignatedNodes { - get { return designatedNodes_; } - } - - /// Field number for the "aggregate_threshold" field. - public const int AggregateThresholdFieldNumber = 4; - private int aggregateThreshold_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int AggregateThreshold { - get { return aggregateThreshold_; } - set { - aggregateThreshold_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as QueryTemperatureInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueryTemperatureInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(OracleContractAddress, other.OracleContractAddress)) return false; - if (!object.Equals(AggregatorContractAddress, other.AggregatorContractAddress)) return false; - if(!designatedNodes_.Equals(other.designatedNodes_)) return false; - if (AggregateThreshold != other.AggregateThreshold) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (oracleContractAddress_ != null) hash ^= OracleContractAddress.GetHashCode(); - if (aggregatorContractAddress_ != null) hash ^= AggregatorContractAddress.GetHashCode(); - hash ^= designatedNodes_.GetHashCode(); - if (AggregateThreshold != 0) hash ^= AggregateThreshold.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (oracleContractAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(OracleContractAddress); - } - if (aggregatorContractAddress_ != null) { - output.WriteRawTag(18); - output.WriteMessage(AggregatorContractAddress); - } - designatedNodes_.WriteTo(output, _repeated_designatedNodes_codec); - if (AggregateThreshold != 0) { - output.WriteRawTag(32); - output.WriteInt32(AggregateThreshold); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (oracleContractAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(OracleContractAddress); - } - if (aggregatorContractAddress_ != null) { - output.WriteRawTag(18); - output.WriteMessage(AggregatorContractAddress); - } - designatedNodes_.WriteTo(ref output, _repeated_designatedNodes_codec); - if (AggregateThreshold != 0) { - output.WriteRawTag(32); - output.WriteInt32(AggregateThreshold); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (oracleContractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OracleContractAddress); - } - if (aggregatorContractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(AggregatorContractAddress); - } - size += designatedNodes_.CalculateSize(_repeated_designatedNodes_codec); - if (AggregateThreshold != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(AggregateThreshold); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueryTemperatureInput other) { - if (other == null) { - return; - } - if (other.oracleContractAddress_ != null) { - if (oracleContractAddress_ == null) { - OracleContractAddress = new global::AElf.Types.Address(); - } - OracleContractAddress.MergeFrom(other.OracleContractAddress); - } - if (other.aggregatorContractAddress_ != null) { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - AggregatorContractAddress.MergeFrom(other.AggregatorContractAddress); - } - designatedNodes_.Add(other.designatedNodes_); - if (other.AggregateThreshold != 0) { - AggregateThreshold = other.AggregateThreshold; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (oracleContractAddress_ == null) { - OracleContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(OracleContractAddress); - break; - } - case 18: { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(AggregatorContractAddress); - break; - } - case 26: { - designatedNodes_.AddEntriesFrom(input, _repeated_designatedNodes_codec); - break; - } - case 32: { - AggregateThreshold = input.ReadInt32(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - if (oracleContractAddress_ == null) { - OracleContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(OracleContractAddress); - break; - } - case 18: { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(AggregatorContractAddress); - break; - } - case 26: { - designatedNodes_.AddEntriesFrom(ref input, _repeated_designatedNodes_codec); - break; - } - case 32: { - AggregateThreshold = input.ReadInt32(); - break; - } - } - } - } - #endif - - } - - public sealed partial class TemperatureRecord : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TemperatureRecord()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.OracleUser.OracleUserContractReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TemperatureRecord() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TemperatureRecord(TemperatureRecord other) : this() { - temperature_ = other.temperature_; - timestamp_ = other.timestamp_ != null ? other.timestamp_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TemperatureRecord Clone() { - return new TemperatureRecord(this); - } - - /// Field number for the "temperature" field. - public const int TemperatureFieldNumber = 1; - private string temperature_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Temperature { - get { return temperature_; } - set { - temperature_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "timestamp" field. - public const int TimestampFieldNumber = 2; - private global::Google.Protobuf.WellKnownTypes.Timestamp timestamp_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp Timestamp { - get { return timestamp_; } - set { - timestamp_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TemperatureRecord); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TemperatureRecord other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Temperature != other.Temperature) return false; - if (!object.Equals(Timestamp, other.Timestamp)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Temperature.Length != 0) hash ^= Temperature.GetHashCode(); - if (timestamp_ != null) hash ^= Timestamp.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Temperature.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Temperature); - } - if (timestamp_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Timestamp); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Temperature.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Temperature); - } - if (timestamp_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Timestamp); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Temperature.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Temperature); - } - if (timestamp_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Timestamp); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TemperatureRecord other) { - if (other == null) { - return; - } - if (other.Temperature.Length != 0) { - Temperature = other.Temperature; - } - if (other.timestamp_ != null) { - if (timestamp_ == null) { - Timestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - Timestamp.MergeFrom(other.Timestamp); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Temperature = input.ReadString(); - break; - } - case 18: { - if (timestamp_ == null) { - Timestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(Timestamp); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Temperature = input.ReadString(); - break; - } - case 18: { - if (timestamp_ == null) { - Timestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(Timestamp); - break; - } - } - } - } - #endif - - } - - public sealed partial class TemperatureRecordList : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TemperatureRecordList()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.OracleUser.OracleUserContractReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TemperatureRecordList() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TemperatureRecordList(TemperatureRecordList other) : this() { - value_ = other.value_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TemperatureRecordList Clone() { - return new TemperatureRecordList(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_value_codec - = pb::FieldCodec.ForMessage(10, global::AElf.Contracts.OracleUser.TemperatureRecord.Parser); - private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Value { - get { return value_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TemperatureRecordList); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TemperatureRecordList other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!value_.Equals(other.value_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= value_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - value_.WriteTo(output, _repeated_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - value_.WriteTo(ref output, _repeated_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += value_.CalculateSize(_repeated_value_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TemperatureRecordList other) { - if (other == null) { - return; - } - value_.Add(other.value_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - value_.AddEntriesFrom(input, _repeated_value_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - value_.AddEntriesFrom(ref input, _repeated_value_codec); - break; - } - } - } - } - #endif - - } - - /// - /// Events - /// - public sealed partial class QueryDataRecorded : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryDataRecorded()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.OracleUser.OracleUserContractReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryDataRecorded() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryDataRecorded(QueryDataRecorded other) : this() { - data_ = other.data_; - timestamp_ = other.timestamp_ != null ? other.timestamp_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryDataRecorded Clone() { - return new QueryDataRecorded(this); - } - - /// Field number for the "data" field. - public const int DataFieldNumber = 1; - private string data_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Data { - get { return data_; } - set { - data_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "timestamp" field. - public const int TimestampFieldNumber = 2; - private global::Google.Protobuf.WellKnownTypes.Timestamp timestamp_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Google.Protobuf.WellKnownTypes.Timestamp Timestamp { - get { return timestamp_; } - set { - timestamp_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as QueryDataRecorded); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueryDataRecorded other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Data != other.Data) return false; - if (!object.Equals(Timestamp, other.Timestamp)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Data.Length != 0) hash ^= Data.GetHashCode(); - if (timestamp_ != null) hash ^= Timestamp.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Data.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Data); - } - if (timestamp_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Timestamp); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Data.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Data); - } - if (timestamp_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Timestamp); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Data.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Data); - } - if (timestamp_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Timestamp); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueryDataRecorded other) { - if (other == null) { - return; - } - if (other.Data.Length != 0) { - Data = other.Data; - } - if (other.timestamp_ != null) { - if (timestamp_ == null) { - Timestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - Timestamp.MergeFrom(other.Timestamp); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Data = input.ReadString(); - break; - } - case 18: { - if (timestamp_ == null) { - Timestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(Timestamp); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Data = input.ReadString(); - break; - } - case 18: { - if (timestamp_ == null) { - Timestamp = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(Timestamp); - break; - } - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/src/AElf.EventHandler/Dto/ReceiptInfo.cs b/src/AElf.EventHandler/Dto/ReceiptInfo.cs deleted file mode 100644 index 5c898c0b..00000000 --- a/src/AElf.EventHandler/Dto/ReceiptInfo.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Numerics; -using AElf.Types; -using Nethereum.ABI.FunctionEncoding.Attributes; - -namespace AElf.EventHandler -{ - [FunctionOutput] - public class ReceiptInfo : IFunctionOutputDTO - { - [Parameter("bytes32", 1)] public byte[] ReceiptId { get; set; } - - [Parameter("string", 2)] public string TargetAddress { get; set; } - - [Parameter("uint256", 3)] public BigInteger Amount { get; set; } - - public override string ToString() - { - if (ReceiptId == null) - { - return "Receipt Id is null"; - } - - return $"{Hash.LoadFromByteArray(ReceiptId)}, {Address.FromBase58(TargetAddress)}, {Amount.ToString()}"; - } - } -} \ No newline at end of file diff --git a/src/AElf.EventHandler/Dto/ReceiptMakerg.cs b/src/AElf.EventHandler/Dto/ReceiptMakerg.cs deleted file mode 100644 index a020fbfa..00000000 --- a/src/AElf.EventHandler/Dto/ReceiptMakerg.cs +++ /dev/null @@ -1,333 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: receipt_maker.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace AElf.Contracts.ReceiptMakerContract { - - /// Holder for reflection information generated from receipt_maker.proto - public static partial class ReceiptMakerReflection { - - #region Descriptor - /// File descriptor for receipt_maker.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static ReceiptMakerReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChNyZWNlaXB0X21ha2VyLnByb3RvGg9hZWxmL2NvcmUucHJvdG8aEmFlbGYv", - "b3B0aW9ucy5wcm90bxobZ29vZ2xlL3Byb3RvYnVmL2VtcHR5LnByb3RvGh5n", - "b29nbGUvcHJvdG9idWYvd3JhcHBlcnMucHJvdG8iTAoXR2V0UmVjZWlwdEhh", - "c2hMaXN0SW5wdXQSGAoQZmlyc3RfbGVhZl9pbmRleBgBIAEoAxIXCg9sYXN0", - "X2xlYWZfaW5kZXgYAiABKAMiQQoYR2V0UmVjZWlwdEhhc2hMaXN0T3V0cHV0", - "EiUKEXJlY2VpcHRfaGFzaF9saXN0GAEgAygLMgouYWVsZi5IYXNoMvkBChRS", - "ZWNlaXB0TWFrZXJDb250cmFjdBJNCg9HZXRSZWNlaXB0Q291bnQSFi5nb29n", - "bGUucHJvdG9idWYuRW1wdHkaGy5nb29nbGUucHJvdG9idWYuSW50NjRWYWx1", - "ZSIFiIn3AQESQAoOR2V0UmVjZWlwdEhhc2gSGy5nb29nbGUucHJvdG9idWYu", - "SW50NjRWYWx1ZRoKLmFlbGYuSGFzaCIFiIn3AQESUAoSR2V0UmVjZWlwdEhh", - "c2hMaXN0EhguR2V0UmVjZWlwdEhhc2hMaXN0SW5wdXQaGS5HZXRSZWNlaXB0", - "SGFzaExpc3RPdXRwdXQiBYiJ9wEBQiaqAiNBRWxmLkNvbnRyYWN0cy5SZWNl", - "aXB0TWFrZXJDb250cmFjdGIGcHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::AElf.Types.CoreReflection.Descriptor, global::AElf.OptionsReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.ReceiptMakerContract.GetReceiptHashListInput), global::AElf.Contracts.ReceiptMakerContract.GetReceiptHashListInput.Parser, new[]{ "FirstLeafIndex", "LastLeafIndex" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.ReceiptMakerContract.GetReceiptHashListOutput), global::AElf.Contracts.ReceiptMakerContract.GetReceiptHashListOutput.Parser, new[]{ "ReceiptHashList" }, null, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class GetReceiptHashListInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetReceiptHashListInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.ReceiptMakerContract.ReceiptMakerReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetReceiptHashListInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetReceiptHashListInput(GetReceiptHashListInput other) : this() { - firstLeafIndex_ = other.firstLeafIndex_; - lastLeafIndex_ = other.lastLeafIndex_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetReceiptHashListInput Clone() { - return new GetReceiptHashListInput(this); - } - - /// Field number for the "first_leaf_index" field. - public const int FirstLeafIndexFieldNumber = 1; - private long firstLeafIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long FirstLeafIndex { - get { return firstLeafIndex_; } - set { - firstLeafIndex_ = value; - } - } - - /// Field number for the "last_leaf_index" field. - public const int LastLeafIndexFieldNumber = 2; - private long lastLeafIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long LastLeafIndex { - get { return lastLeafIndex_; } - set { - lastLeafIndex_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GetReceiptHashListInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GetReceiptHashListInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (FirstLeafIndex != other.FirstLeafIndex) return false; - if (LastLeafIndex != other.LastLeafIndex) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (FirstLeafIndex != 0L) hash ^= FirstLeafIndex.GetHashCode(); - if (LastLeafIndex != 0L) hash ^= LastLeafIndex.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (FirstLeafIndex != 0L) { - output.WriteRawTag(8); - output.WriteInt64(FirstLeafIndex); - } - if (LastLeafIndex != 0L) { - output.WriteRawTag(16); - output.WriteInt64(LastLeafIndex); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (FirstLeafIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(FirstLeafIndex); - } - if (LastLeafIndex != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(LastLeafIndex); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GetReceiptHashListInput other) { - if (other == null) { - return; - } - if (other.FirstLeafIndex != 0L) { - FirstLeafIndex = other.FirstLeafIndex; - } - if (other.LastLeafIndex != 0L) { - LastLeafIndex = other.LastLeafIndex; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - FirstLeafIndex = input.ReadInt64(); - break; - } - case 16: { - LastLeafIndex = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class GetReceiptHashListOutput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetReceiptHashListOutput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.ReceiptMakerContract.ReceiptMakerReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetReceiptHashListOutput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetReceiptHashListOutput(GetReceiptHashListOutput other) : this() { - receiptHashList_ = other.receiptHashList_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetReceiptHashListOutput Clone() { - return new GetReceiptHashListOutput(this); - } - - /// Field number for the "receipt_hash_list" field. - public const int ReceiptHashListFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_receiptHashList_codec - = pb::FieldCodec.ForMessage(10, global::AElf.Types.Hash.Parser); - private readonly pbc::RepeatedField receiptHashList_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField ReceiptHashList { - get { return receiptHashList_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GetReceiptHashListOutput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GetReceiptHashListOutput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!receiptHashList_.Equals(other.receiptHashList_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= receiptHashList_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - receiptHashList_.WriteTo(output, _repeated_receiptHashList_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += receiptHashList_.CalculateSize(_repeated_receiptHashList_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GetReceiptHashListOutput other) { - if (other == null) { - return; - } - receiptHashList_.Add(other.receiptHashList_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - receiptHashList_.AddEntriesFrom(input, _repeated_receiptHashList_codec); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/src/AElf.EventHandler/Dto/ReportContractc.cs b/src/AElf.EventHandler/Dto/ReportContractc.cs deleted file mode 100644 index ecb73f27..00000000 --- a/src/AElf.EventHandler/Dto/ReportContractc.cs +++ /dev/null @@ -1,365 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: report_contract.proto -// -#pragma warning disable 0414, 1591 -#region Designer generated code - -using System.Collections.Generic; -using aelf = global::AElf.CSharp.Core; - -namespace AElf.Contracts.Report { - - #region Events - public partial class ReportProposed : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public ReportProposed GetNonIndexed() - { - return new ReportProposed - { - RawReport = RawReport, - ObserverAssociationAddress = ObserverAssociationAddress, - Token = Token, - RoundId = RoundId, - }; - } - } - - public partial class ReportConfirmed : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public ReportConfirmed GetNonIndexed() - { - return new ReportConfirmed - { - RoundId = RoundId, - Signature = Signature, - ObserverAssociationAddress = ObserverAssociationAddress, - Token = Token, - IsAllNodeConfirmed = IsAllNodeConfirmed, - }; - } - } - - public partial class OffChainAggregationRegistered : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public OffChainAggregationRegistered GetNonIndexed() - { - return new OffChainAggregationRegistered - { - Token = Token, - OffChainQueryInfoList = OffChainQueryInfoList, - ObserverAssociationAddress = ObserverAssociationAddress, - ConfigDigest = ConfigDigest, - AggregateThreshold = AggregateThreshold, - AggregatorContractAddress = AggregatorContractAddress, - ChainType = ChainType, - Register = Register, - }; - } - } - - public partial class MerkleReportNodeAdded : aelf::IEvent - { - public global::System.Collections.Generic.IEnumerable GetIndexed() - { - return new List - { - }; - } - - public MerkleReportNodeAdded GetNonIndexed() - { - return new MerkleReportNodeAdded - { - Token = Token, - NodeIndex = NodeIndex, - NodeRoundId = NodeRoundId, - AggregatedData = AggregatedData, - }; - } - } - - #endregion - /// - /// the contract definition: a gRPC service definition. - /// - public static partial class ReportContractContainer - { - static readonly string __ServiceName = "ReportContract"; - - #region Marshallers - static readonly aelf::Marshaller __Marshaller_InitializeInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Report.InitializeInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_Empty = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Empty.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_QueryOracleInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Report.QueryOracleInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_aelf_Hash = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Types.Hash.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_ConfirmReportInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Report.ConfirmReportInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_RejectReportInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Report.RejectReportInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_Int64Value = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.Int64Value.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_CallbackInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::CallbackInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_Report = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Report.Report.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_RegisterOffChainAggregationInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Report.RegisterOffChainAggregationInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_OffChainAggregationInfo = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Report.OffChainAggregationInfo.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_AddOffChainQueryInfoInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Report.AddOffChainQueryInfoInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_RemoveOffChainQueryInfoInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Report.RemoveOffChainQueryInfoInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_aelf_Address = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Types.Address.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_GetMerklePathInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Report.GetMerklePathInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_aelf_MerklePath = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Types.MerklePath.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_GetReportInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Report.GetReportInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_GetSignatureInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Report.GetSignatureInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_StringValue = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.StringValue.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_ReportQueryRecord = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Report.ReportQueryRecord.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_GetRawReportInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Report.GetRawReportInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_GenerateRawReportInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Report.GenerateRawReportInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_GetSignatureMapInput = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Report.GetSignatureMapInput.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_SignatureMap = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::AElf.Contracts.Report.SignatureMap.Parser.ParseFrom); - static readonly aelf::Marshaller __Marshaller_google_protobuf_BoolValue = aelf::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Google.Protobuf.WellKnownTypes.BoolValue.Parser.ParseFrom); - #endregion - - #region Methods - static readonly aelf::Method __Method_Initialize = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "Initialize", - __Marshaller_InitializeInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_QueryOracle = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "QueryOracle", - __Marshaller_QueryOracleInput, - __Marshaller_aelf_Hash); - - static readonly aelf::Method __Method_CancelQueryOracle = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "CancelQueryOracle", - __Marshaller_aelf_Hash, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_ConfirmReport = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "ConfirmReport", - __Marshaller_ConfirmReportInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_RejectReport = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "RejectReport", - __Marshaller_RejectReportInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_AdjustAmercementAmount = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "AdjustAmercementAmount", - __Marshaller_google_protobuf_Int64Value, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_ProposeReport = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "ProposeReport", - __Marshaller_CallbackInput, - __Marshaller_Report); - - static readonly aelf::Method __Method_MortgageTokens = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "MortgageTokens", - __Marshaller_google_protobuf_Int64Value, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_WithdrawTokens = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "WithdrawTokens", - __Marshaller_google_protobuf_Int64Value, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_ApplyObserver = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "ApplyObserver", - __Marshaller_google_protobuf_Empty, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_QuitObserver = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "QuitObserver", - __Marshaller_google_protobuf_Empty, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_AdjustApplyObserverFee = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "AdjustApplyObserverFee", - __Marshaller_google_protobuf_Int64Value, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_AdjustReportFee = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "AdjustReportFee", - __Marshaller_google_protobuf_Int64Value, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_RegisterOffChainAggregation = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "RegisterOffChainAggregation", - __Marshaller_RegisterOffChainAggregationInput, - __Marshaller_OffChainAggregationInfo); - - static readonly aelf::Method __Method_AddOffChainQueryInfo = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "AddOffChainQueryInfo", - __Marshaller_AddOffChainQueryInfoInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_RemoveOffChainQueryInfo = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "RemoveOffChainQueryInfo", - __Marshaller_RemoveOffChainQueryInfoInput, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_AddRegisterWhiteList = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "AddRegisterWhiteList", - __Marshaller_aelf_Address, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_RemoveFromRegisterWhiteList = new aelf::Method( - aelf::MethodType.Action, - __ServiceName, - "RemoveFromRegisterWhiteList", - __Marshaller_aelf_Address, - __Marshaller_google_protobuf_Empty); - - static readonly aelf::Method __Method_GetMerklePath = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetMerklePath", - __Marshaller_GetMerklePathInput, - __Marshaller_aelf_MerklePath); - - static readonly aelf::Method __Method_GetReport = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetReport", - __Marshaller_GetReportInput, - __Marshaller_Report); - - static readonly aelf::Method __Method_GetSignature = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetSignature", - __Marshaller_GetSignatureInput, - __Marshaller_google_protobuf_StringValue); - - static readonly aelf::Method __Method_GetOffChainAggregationInfo = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetOffChainAggregationInfo", - __Marshaller_google_protobuf_StringValue, - __Marshaller_OffChainAggregationInfo); - - static readonly aelf::Method __Method_GetReportQueryRecord = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetReportQueryRecord", - __Marshaller_aelf_Hash, - __Marshaller_ReportQueryRecord); - - static readonly aelf::Method __Method_GetCurrentRoundId = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetCurrentRoundId", - __Marshaller_google_protobuf_StringValue, - __Marshaller_google_protobuf_Int64Value); - - static readonly aelf::Method __Method_GetRawReport = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetRawReport", - __Marshaller_GetRawReportInput, - __Marshaller_google_protobuf_StringValue); - - static readonly aelf::Method __Method_GenerateRawReport = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GenerateRawReport", - __Marshaller_GenerateRawReportInput, - __Marshaller_google_protobuf_StringValue); - - static readonly aelf::Method __Method_GetSignatureMap = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "GetSignatureMap", - __Marshaller_GetSignatureMapInput, - __Marshaller_SignatureMap); - - static readonly aelf::Method __Method_IsInRegisterWhiteList = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "IsInRegisterWhiteList", - __Marshaller_aelf_Address, - __Marshaller_google_protobuf_BoolValue); - - static readonly aelf::Method __Method_IsObserver = new aelf::Method( - aelf::MethodType.View, - __ServiceName, - "IsObserver", - __Marshaller_aelf_Address, - __Marshaller_google_protobuf_BoolValue); - - #endregion - - #region Descriptors - public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor - { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.Services[0]; } - } - - public static global::System.Collections.Generic.IReadOnlyList Descriptors - { - get - { - return new global::System.Collections.Generic.List() - { - global::AElf.Contracts.Report.ReportContractReflection.Descriptor.Services[0], - }; - } - } - #endregion - } -} -#endregion - diff --git a/src/AElf.EventHandler/Dto/ReportContractg.cs b/src/AElf.EventHandler/Dto/ReportContractg.cs deleted file mode 100644 index 090ea96b..00000000 --- a/src/AElf.EventHandler/Dto/ReportContractg.cs +++ /dev/null @@ -1,5524 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: report_contract.proto -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace AElf.Contracts.Report { - - /// Holder for reflection information generated from report_contract.proto - public static partial class ReportContractReflection { - - #region Descriptor - /// File descriptor for report_contract.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static ReportContractReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChVyZXBvcnRfY29udHJhY3QucHJvdG8aD2FlbGYvY29yZS5wcm90bxoSYWVs", - "Zi9vcHRpb25zLnByb3RvGhtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8a", - "H2dvb2dsZS9wcm90b2J1Zi90aW1lc3RhbXAucHJvdG8aHmdvb2dsZS9wcm90", - "b2J1Zi93cmFwcGVycy5wcm90bxoUY2FsbGJhY2tfaW5wdXQucHJvdG8ipQEK", - "D0luaXRpYWxpemVJbnB1dBIuChdvcmFjbGVfY29udHJhY3RfYWRkcmVzcxgB", - "IAEoCzINLmFlbGYuQWRkcmVzcxISCgpyZXBvcnRfZmVlGAIgASgDEhoKEmFw", - "cGx5X29ic2VydmVyX2ZlZRgDIAEoAxIyChtpbml0aWFsX3JlZ2lzdGVyX3do", - "aXRlX2xpc3QYBCADKAsyDS5hZWxmLkFkZHJlc3MilwEKEFF1ZXJ5T3JhY2xl", - "SW5wdXQSDwoHcGF5bWVudBgBIAEoAxINCgV0b2tlbhgCIAEoCRIbChNhZ2dy", - "ZWdhdGVfdGhyZXNob2xkGAMgASgFEjIKG2FnZ3JlZ2F0b3JfY29udHJhY3Rf", - "YWRkcmVzcxgEIAEoCzINLmFlbGYuQWRkcmVzcxISCgpub2RlX2luZGV4GAUg", - "ASgFIkgKEkNvbmZpcm1SZXBvcnRJbnB1dBINCgV0b2tlbhgBIAEoCRIQCghy", - "b3VuZF9pZBgCIAEoAxIRCglzaWduYXR1cmUYAyABKAkiWwoRUmVqZWN0UmVw", - "b3J0SW5wdXQSDQoFdG9rZW4YASABKAkSEAoIcm91bmRfaWQYAiABKAMSJQoO", - "YWNjdXNpbmdfbm9kZXMYAyADKAsyDS5hZWxmLkFkZHJlc3MimAEKBlJlcG9y", - "dBIcCghxdWVyeV9pZBgBIAEoCzIKLmFlbGYuSGFzaBIQCghyb3VuZF9pZBgC", - "IAEoAxIjCgxvYnNlcnZhdGlvbnMYAyABKAsyDS5PYnNlcnZhdGlvbnMSFwoP", - "YWdncmVnYXRlZF9kYXRhGAQgASgMEiAKCW9ic2VydmVycxgFIAMoCzINLk9i", - "c2VydmVyTGlzdCKoAQoRUmVwb3J0UXVlcnlSZWNvcmQSKgoTb3JpZ2luX3F1", - "ZXJ5X3NlbmRlchgBIAEoCzINLmFlbGYuQWRkcmVzcxIXCg9wYWlkX3JlcG9y", - "dF9mZWUYAiABKAMSEwoLaXNfcmVqZWN0ZWQYAyABKAgSHQoVaXNfYWxsX25v", - "ZGVfY29uZmlybWVkGAQgASgIEhoKEm5vZGVfY29uZmlybV9jb3VudBgFIAEo", - "AyIsCgxPYnNlcnZlckxpc3QSHAoFdmFsdWUYASADKAsyDS5hZWxmLkFkZHJl", - "c3MiNwoSUHJvcG9zZVJlcG9ydElucHV0EiEKDXF1ZXJ5X2lkX2xpc3QYASAD", - "KAsyCi5hZWxmLkhhc2giKwoMT2JzZXJ2YXRpb25zEhsKBXZhbHVlGAEgAygL", - "MgwuT2JzZXJ2YXRpb24iKAoLT2JzZXJ2YXRpb24SCwoDa2V5GAEgASgJEgwK", - "BGRhdGEYAiABKAkiVAoRR2V0U2lnbmF0dXJlSW5wdXQSDQoFdG9rZW4YASAB", - "KAkSEAoIcm91bmRfaWQYAiABKAMSHgoHYWRkcmVzcxgDIAEoCzINLmFlbGYu", - "QWRkcmVzcyI3ChRHZXRTaWduYXR1cmVNYXBJbnB1dBINCgV0b2tlbhgBIAEo", - "CRIQCghyb3VuZF9pZBgCIAEoAyJlCgxTaWduYXR1cmVNYXASJwoFdmFsdWUY", - "ASADKAsyGC5TaWduYXR1cmVNYXAuVmFsdWVFbnRyeRosCgpWYWx1ZUVudHJ5", - "EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAEiyAIKF09mZkNoYWlu", - "QWdncmVnYXRpb25JbmZvEg0KBXRva2VuGAEgASgJEjkKGW9mZl9jaGFpbl9x", - "dWVyeV9pbmZvX2xpc3QYAiABKAsyFi5PZmZDaGFpblF1ZXJ5SW5mb0xpc3QS", - "Mwocb2JzZXJ2ZXJfYXNzb2NpYXRpb25fYWRkcmVzcxgDIAEoCzINLmFlbGYu", - "QWRkcmVzcxIVCg1jb25maWdfZGlnZXN0GAQgASgMEhsKE2FnZ3JlZ2F0ZV90", - "aHJlc2hvbGQYBSABKAUSMgobYWdncmVnYXRvcl9jb250cmFjdF9hZGRyZXNz", - "GAYgASgLMg0uYWVsZi5BZGRyZXNzEhEKCXJvdW5kX2lkcxgHIAMoAxISCgpj", - "aGFpbl90eXBlGAggASgJEh8KCHJlZ2lzdGVyGAkgASgLMg0uYWVsZi5BZGRy", - "ZXNzIq8CCiBSZWdpc3Rlck9mZkNoYWluQWdncmVnYXRpb25JbnB1dBIkCg1v", - "YnNlcnZlcl9saXN0GAEgASgLMg0uT2JzZXJ2ZXJMaXN0EjkKGW9mZl9jaGFp", - "bl9xdWVyeV9pbmZvX2xpc3QYAiABKAsyFi5PZmZDaGFpblF1ZXJ5SW5mb0xp", - "c3QSDQoFdG9rZW4YAyABKAkSFQoNY29uZmlnX2RpZ2VzdBgEIAEoDBIbChNh", - "Z2dyZWdhdGVfdGhyZXNob2xkGAUgASgFEjIKG2FnZ3JlZ2F0b3JfY29udHJh", - "Y3RfYWRkcmVzcxgGIAEoCzINLmFlbGYuQWRkcmVzcxISCgpjaGFpbl90eXBl", - "GAcgASgJEh8KCHJlZ2lzdGVyGAggASgLMg0uYWVsZi5BZGRyZXNzIkYKEU9m", - "ZkNoYWluUXVlcnlJbmZvEhQKDHVybF90b19xdWVyeRgBIAEoCRIbChNhdHRy", - "aWJ1dGVzX3RvX2ZldGNoGAIgAygJIjEKDkdldFJlcG9ydElucHV0Eg0KBXRv", - "a2VuGAEgASgJEhAKCHJvdW5kX2lkGAIgASgDIkkKEkdldE1lcmtsZVBhdGhJ", - "bnB1dBINCgV0b2tlbhgBIAEoCRIQCghyb3VuZF9pZBgCIAEoAxISCgpub2Rl", - "X2luZGV4GAMgASgFIjQKEUdldFJhd1JlcG9ydElucHV0Eg0KBXRva2VuGAEg", - "ASgJEhAKCHJvdW5kX2lkGAIgASgDIm0KFkdlbmVyYXRlUmF3UmVwb3J0SW5w", - "dXQSFwoGcmVwb3J0GAEgASgLMgcuUmVwb3J0EhUKDWNvbmZpZ19kaWdlc3QY", - "AiABKAwSIwoMb3JnYW5pemF0aW9uGAMgASgLMg0uYWVsZi5BZGRyZXNzIjoK", - "FU9mZkNoYWluUXVlcnlJbmZvTGlzdBIhCgV2YWx1ZRgBIAMoCzISLk9mZkNo", - "YWluUXVlcnlJbmZvIlwKGUFkZE9mZkNoYWluUXVlcnlJbmZvSW5wdXQSDQoF", - "dG9rZW4YASABKAkSMAoUb2ZmX2NoYWluX3F1ZXJ5X2luZm8YAiABKAsyEi5P", - "ZmZDaGFpblF1ZXJ5SW5mbyJIChxSZW1vdmVPZmZDaGFpblF1ZXJ5SW5mb0lu", - "cHV0Eg0KBXRva2VuGAEgASgJEhkKEXJlbW92ZV9ub2RlX2luZGV4GAIgASgF", - "IoABCg5SZXBvcnRQcm9wb3NlZBISCgpyYXdfcmVwb3J0GAEgASgJEjMKHG9i", - "c2VydmVyX2Fzc29jaWF0aW9uX2FkZHJlc3MYAiABKAsyDS5hZWxmLkFkZHJl", - "c3MSDQoFdG9rZW4YAyABKAkSEAoIcm91bmRfaWQYBCABKAM6BKC7GAEinwEK", - "D1JlcG9ydENvbmZpcm1lZBIQCghyb3VuZF9pZBgBIAEoAxIRCglzaWduYXR1", - "cmUYAiABKAkSMwocb2JzZXJ2ZXJfYXNzb2NpYXRpb25fYWRkcmVzcxgDIAEo", - "CzINLmFlbGYuQWRkcmVzcxINCgV0b2tlbhgEIAEoCRIdChVpc19hbGxfbm9k", - "ZV9jb25maXJtZWQYBSABKAg6BKC7GAEiwQIKHU9mZkNoYWluQWdncmVnYXRp", - "b25SZWdpc3RlcmVkEg0KBXRva2VuGAEgASgJEjkKGW9mZl9jaGFpbl9xdWVy", - "eV9pbmZvX2xpc3QYAiABKAsyFi5PZmZDaGFpblF1ZXJ5SW5mb0xpc3QSMwoc", - "b2JzZXJ2ZXJfYXNzb2NpYXRpb25fYWRkcmVzcxgDIAEoCzINLmFlbGYuQWRk", - "cmVzcxIVCg1jb25maWdfZGlnZXN0GAQgASgMEhsKE2FnZ3JlZ2F0ZV90aHJl", - "c2hvbGQYBSABKAUSMgobYWdncmVnYXRvcl9jb250cmFjdF9hZGRyZXNzGAYg", - "ASgLMg0uYWVsZi5BZGRyZXNzEhIKCmNoYWluX3R5cGUYByABKAkSHwoIcmVn", - "aXN0ZXIYCCABKAsyDS5hZWxmLkFkZHJlc3M6BKC7GAEicAoVTWVya2xlUmVw", - "b3J0Tm9kZUFkZGVkEg0KBXRva2VuGAEgASgJEhIKCm5vZGVfaW5kZXgYAiAB", - "KAUSFQoNbm9kZV9yb3VuZF9pZBgDIAEoAxIXCg9hZ2dyZWdhdGVkX2RhdGEY", - "BCABKAk6BKC7GAEyqxAKDlJlcG9ydENvbnRyYWN0EjgKCkluaXRpYWxpemUS", - "EC5Jbml0aWFsaXplSW5wdXQaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiABIu", - "CgtRdWVyeU9yYWNsZRIRLlF1ZXJ5T3JhY2xlSW5wdXQaCi5hZWxmLkhhc2gi", - "ABI5ChFDYW5jZWxRdWVyeU9yYWNsZRIKLmFlbGYuSGFzaBoWLmdvb2dsZS5w", - "cm90b2J1Zi5FbXB0eSIAEj4KDUNvbmZpcm1SZXBvcnQSEy5Db25maXJtUmVw", - "b3J0SW5wdXQaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiABI8CgxSZWplY3RS", - "ZXBvcnQSEi5SZWplY3RSZXBvcnRJbnB1dBoWLmdvb2dsZS5wcm90b2J1Zi5F", - "bXB0eSIAEk8KFkFkanVzdEFtZXJjZW1lbnRBbW91bnQSGy5nb29nbGUucHJv", - "dG9idWYuSW50NjRWYWx1ZRoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIAEioK", - "DVByb3Bvc2VSZXBvcnQSDi5DYWxsYmFja0lucHV0GgcuUmVwb3J0IgASRwoO", - "TW9ydGdhZ2VUb2tlbnMSGy5nb29nbGUucHJvdG9idWYuSW50NjRWYWx1ZRoW", - "Lmdvb2dsZS5wcm90b2J1Zi5FbXB0eSIAEkcKDldpdGhkcmF3VG9rZW5zEhsu", - "Z29vZ2xlLnByb3RvYnVmLkludDY0VmFsdWUaFi5nb29nbGUucHJvdG9idWYu", - "RW1wdHkiABJBCg1BcHBseU9ic2VydmVyEhYuZ29vZ2xlLnByb3RvYnVmLkVt", - "cHR5GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IgASQAoMUXVpdE9ic2VydmVy", - "EhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5GhYuZ29vZ2xlLnByb3RvYnVmLkVt", - "cHR5IgASTwoWQWRqdXN0QXBwbHlPYnNlcnZlckZlZRIbLmdvb2dsZS5wcm90", - "b2J1Zi5JbnQ2NFZhbHVlGhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IgASSAoP", - "QWRqdXN0UmVwb3J0RmVlEhsuZ29vZ2xlLnByb3RvYnVmLkludDY0VmFsdWUa", - "Fi5nb29nbGUucHJvdG9idWYuRW1wdHkiABJcChtSZWdpc3Rlck9mZkNoYWlu", - "QWdncmVnYXRpb24SIS5SZWdpc3Rlck9mZkNoYWluQWdncmVnYXRpb25JbnB1", - "dBoYLk9mZkNoYWluQWdncmVnYXRpb25JbmZvIgASTAoUQWRkT2ZmQ2hhaW5R", - "dWVyeUluZm8SGi5BZGRPZmZDaGFpblF1ZXJ5SW5mb0lucHV0GhYuZ29vZ2xl", - "LnByb3RvYnVmLkVtcHR5IgASUgoXUmVtb3ZlT2ZmQ2hhaW5RdWVyeUluZm8S", - "HS5SZW1vdmVPZmZDaGFpblF1ZXJ5SW5mb0lucHV0GhYuZ29vZ2xlLnByb3Rv", - "YnVmLkVtcHR5IgASPwoUQWRkUmVnaXN0ZXJXaGl0ZUxpc3QSDS5hZWxmLkFk", - "ZHJlc3MaFi5nb29nbGUucHJvdG9idWYuRW1wdHkiABJGChtSZW1vdmVGcm9t", - "UmVnaXN0ZXJXaGl0ZUxpc3QSDS5hZWxmLkFkZHJlc3MaFi5nb29nbGUucHJv", - "dG9idWYuRW1wdHkiABI9Cg1HZXRNZXJrbGVQYXRoEhMuR2V0TWVya2xlUGF0", - "aElucHV0GhAuYWVsZi5NZXJrbGVQYXRoIgWIifcBARIsCglHZXRSZXBvcnQS", - "Dy5HZXRSZXBvcnRJbnB1dBoHLlJlcG9ydCIFiIn3AQESRwoMR2V0U2lnbmF0", - "dXJlEhIuR2V0U2lnbmF0dXJlSW5wdXQaHC5nb29nbGUucHJvdG9idWYuU3Ry", - "aW5nVmFsdWUiBYiJ9wEBElsKGkdldE9mZkNoYWluQWdncmVnYXRpb25JbmZv", - "EhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlGhguT2ZmQ2hhaW5BZ2dy", - "ZWdhdGlvbkluZm8iBYiJ9wEBEj0KFEdldFJlcG9ydFF1ZXJ5UmVjb3JkEgou", - "YWVsZi5IYXNoGhIuUmVwb3J0UXVlcnlSZWNvcmQiBYiJ9wEBElUKEUdldEN1", - "cnJlbnRSb3VuZElkEhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlGhsu", - "Z29vZ2xlLnByb3RvYnVmLkludDY0VmFsdWUiBYiJ9wEBEkcKDEdldFJhd1Jl", - "cG9ydBISLkdldFJhd1JlcG9ydElucHV0GhwuZ29vZ2xlLnByb3RvYnVmLlN0", - "cmluZ1ZhbHVlIgWIifcBARJRChFHZW5lcmF0ZVJhd1JlcG9ydBIXLkdlbmVy", - "YXRlUmF3UmVwb3J0SW5wdXQaHC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFs", - "dWUiBYiJ9wEBEj4KD0dldFNpZ25hdHVyZU1hcBIVLkdldFNpZ25hdHVyZU1h", - "cElucHV0Gg0uU2lnbmF0dXJlTWFwIgWIifcBARJJChVJc0luUmVnaXN0ZXJX", - "aGl0ZUxpc3QSDS5hZWxmLkFkZHJlc3MaGi5nb29nbGUucHJvdG9idWYuQm9v", - "bFZhbHVlIgWIifcBARI+CgpJc09ic2VydmVyEg0uYWVsZi5BZGRyZXNzGhou", - "Z29vZ2xlLnByb3RvYnVmLkJvb2xWYWx1ZSIFiIn3AQEaLrLM9gEpQUVsZi5D", - "b250cmFjdHMuUmVwb3J0LlJlcG9ydENvbnRyYWN0U3RhdGVCGKoCFUFFbGYu", - "Q29udHJhY3RzLlJlcG9ydGIGcHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::AElf.Types.CoreReflection.Descriptor, global::AElf.OptionsReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, global::CallbackInputReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.InitializeInput), global::AElf.Contracts.Report.InitializeInput.Parser, new[]{ "OracleContractAddress", "ReportFee", "ApplyObserverFee", "InitialRegisterWhiteList" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.QueryOracleInput), global::AElf.Contracts.Report.QueryOracleInput.Parser, new[]{ "Payment", "Token", "AggregateThreshold", "AggregatorContractAddress", "NodeIndex" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.ConfirmReportInput), global::AElf.Contracts.Report.ConfirmReportInput.Parser, new[]{ "Token", "RoundId", "Signature" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.RejectReportInput), global::AElf.Contracts.Report.RejectReportInput.Parser, new[]{ "Token", "RoundId", "AccusingNodes" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.Report), global::AElf.Contracts.Report.Report.Parser, new[]{ "QueryId", "RoundId", "Observations", "AggregatedData", "Observers" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.ReportQueryRecord), global::AElf.Contracts.Report.ReportQueryRecord.Parser, new[]{ "OriginQuerySender", "PaidReportFee", "IsRejected", "IsAllNodeConfirmed", "NodeConfirmCount" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.ObserverList), global::AElf.Contracts.Report.ObserverList.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.ProposeReportInput), global::AElf.Contracts.Report.ProposeReportInput.Parser, new[]{ "QueryIdList" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.Observations), global::AElf.Contracts.Report.Observations.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.Observation), global::AElf.Contracts.Report.Observation.Parser, new[]{ "Key", "Data" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.GetSignatureInput), global::AElf.Contracts.Report.GetSignatureInput.Parser, new[]{ "Token", "RoundId", "Address" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.GetSignatureMapInput), global::AElf.Contracts.Report.GetSignatureMapInput.Parser, new[]{ "Token", "RoundId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.SignatureMap), global::AElf.Contracts.Report.SignatureMap.Parser, new[]{ "Value" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.OffChainAggregationInfo), global::AElf.Contracts.Report.OffChainAggregationInfo.Parser, new[]{ "Token", "OffChainQueryInfoList", "ObserverAssociationAddress", "ConfigDigest", "AggregateThreshold", "AggregatorContractAddress", "RoundIds", "ChainType", "Register" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.RegisterOffChainAggregationInput), global::AElf.Contracts.Report.RegisterOffChainAggregationInput.Parser, new[]{ "ObserverList", "OffChainQueryInfoList", "Token", "ConfigDigest", "AggregateThreshold", "AggregatorContractAddress", "ChainType", "Register" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.OffChainQueryInfo), global::AElf.Contracts.Report.OffChainQueryInfo.Parser, new[]{ "Title", "Options" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.GetReportInput), global::AElf.Contracts.Report.GetReportInput.Parser, new[]{ "Token", "RoundId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.GetMerklePathInput), global::AElf.Contracts.Report.GetMerklePathInput.Parser, new[]{ "Token", "RoundId", "NodeIndex" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.GetRawReportInput), global::AElf.Contracts.Report.GetRawReportInput.Parser, new[]{ "Token", "RoundId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.GenerateRawReportInput), global::AElf.Contracts.Report.GenerateRawReportInput.Parser, new[]{ "Report", "ConfigDigest", "Organization" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.OffChainQueryInfoList), global::AElf.Contracts.Report.OffChainQueryInfoList.Parser, new[]{ "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.AddOffChainQueryInfoInput), global::AElf.Contracts.Report.AddOffChainQueryInfoInput.Parser, new[]{ "Token", "OffChainQueryInfo" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.RemoveOffChainQueryInfoInput), global::AElf.Contracts.Report.RemoveOffChainQueryInfoInput.Parser, new[]{ "Token", "RemoveNodeIndex" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.ReportProposed), global::AElf.Contracts.Report.ReportProposed.Parser, new[]{ "RawReport", "ObserverAssociationAddress", "Token", "RoundId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.ReportConfirmed), global::AElf.Contracts.Report.ReportConfirmed.Parser, new[]{ "RoundId", "Signature", "ObserverAssociationAddress", "Token", "IsAllNodeConfirmed" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.OffChainAggregationRegistered), global::AElf.Contracts.Report.OffChainAggregationRegistered.Parser, new[]{ "Token", "OffChainQueryInfoList", "ObserverAssociationAddress", "ConfigDigest", "AggregateThreshold", "AggregatorContractAddress", "ChainType", "Register" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::AElf.Contracts.Report.MerkleReportNodeAdded), global::AElf.Contracts.Report.MerkleReportNodeAdded.Parser, new[]{ "Token", "NodeIndex", "NodeRoundId", "AggregatedData" }, null, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class InitializeInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new InitializeInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitializeInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitializeInput(InitializeInput other) : this() { - oracleContractAddress_ = other.oracleContractAddress_ != null ? other.oracleContractAddress_.Clone() : null; - reportFee_ = other.reportFee_; - applyObserverFee_ = other.applyObserverFee_; - initialRegisterWhiteList_ = other.initialRegisterWhiteList_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public InitializeInput Clone() { - return new InitializeInput(this); - } - - /// Field number for the "oracle_contract_address" field. - public const int OracleContractAddressFieldNumber = 1; - private global::AElf.Types.Address oracleContractAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address OracleContractAddress { - get { return oracleContractAddress_; } - set { - oracleContractAddress_ = value; - } - } - - /// Field number for the "report_fee" field. - public const int ReportFeeFieldNumber = 2; - private long reportFee_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ReportFee { - get { return reportFee_; } - set { - reportFee_ = value; - } - } - - /// Field number for the "apply_observer_fee" field. - public const int ApplyObserverFeeFieldNumber = 3; - private long applyObserverFee_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ApplyObserverFee { - get { return applyObserverFee_; } - set { - applyObserverFee_ = value; - } - } - - /// Field number for the "initial_register_white_list" field. - public const int InitialRegisterWhiteListFieldNumber = 4; - private static readonly pb::FieldCodec _repeated_initialRegisterWhiteList_codec - = pb::FieldCodec.ForMessage(34, global::AElf.Types.Address.Parser); - private readonly pbc::RepeatedField initialRegisterWhiteList_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField InitialRegisterWhiteList { - get { return initialRegisterWhiteList_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as InitializeInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(InitializeInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(OracleContractAddress, other.OracleContractAddress)) return false; - if (ReportFee != other.ReportFee) return false; - if (ApplyObserverFee != other.ApplyObserverFee) return false; - if(!initialRegisterWhiteList_.Equals(other.initialRegisterWhiteList_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (oracleContractAddress_ != null) hash ^= OracleContractAddress.GetHashCode(); - if (ReportFee != 0L) hash ^= ReportFee.GetHashCode(); - if (ApplyObserverFee != 0L) hash ^= ApplyObserverFee.GetHashCode(); - hash ^= initialRegisterWhiteList_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (oracleContractAddress_ != null) { - output.WriteRawTag(10); - output.WriteMessage(OracleContractAddress); - } - if (ReportFee != 0L) { - output.WriteRawTag(16); - output.WriteInt64(ReportFee); - } - if (ApplyObserverFee != 0L) { - output.WriteRawTag(24); - output.WriteInt64(ApplyObserverFee); - } - initialRegisterWhiteList_.WriteTo(output, _repeated_initialRegisterWhiteList_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (oracleContractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OracleContractAddress); - } - if (ReportFee != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(ReportFee); - } - if (ApplyObserverFee != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(ApplyObserverFee); - } - size += initialRegisterWhiteList_.CalculateSize(_repeated_initialRegisterWhiteList_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(InitializeInput other) { - if (other == null) { - return; - } - if (other.oracleContractAddress_ != null) { - if (oracleContractAddress_ == null) { - OracleContractAddress = new global::AElf.Types.Address(); - } - OracleContractAddress.MergeFrom(other.OracleContractAddress); - } - if (other.ReportFee != 0L) { - ReportFee = other.ReportFee; - } - if (other.ApplyObserverFee != 0L) { - ApplyObserverFee = other.ApplyObserverFee; - } - initialRegisterWhiteList_.Add(other.initialRegisterWhiteList_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (oracleContractAddress_ == null) { - OracleContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(OracleContractAddress); - break; - } - case 16: { - ReportFee = input.ReadInt64(); - break; - } - case 24: { - ApplyObserverFee = input.ReadInt64(); - break; - } - case 34: { - initialRegisterWhiteList_.AddEntriesFrom(input, _repeated_initialRegisterWhiteList_codec); - break; - } - } - } - } - - } - - public sealed partial class QueryOracleInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new QueryOracleInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryOracleInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryOracleInput(QueryOracleInput other) : this() { - payment_ = other.payment_; - token_ = other.token_; - aggregateThreshold_ = other.aggregateThreshold_; - aggregatorContractAddress_ = other.aggregatorContractAddress_ != null ? other.aggregatorContractAddress_.Clone() : null; - nodeIndex_ = other.nodeIndex_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public QueryOracleInput Clone() { - return new QueryOracleInput(this); - } - - /// Field number for the "payment" field. - public const int PaymentFieldNumber = 1; - private long payment_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Payment { - get { return payment_; } - set { - payment_ = value; - } - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 2; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "aggregate_threshold" field. - public const int AggregateThresholdFieldNumber = 3; - private int aggregateThreshold_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int AggregateThreshold { - get { return aggregateThreshold_; } - set { - aggregateThreshold_ = value; - } - } - - /// Field number for the "aggregator_contract_address" field. - public const int AggregatorContractAddressFieldNumber = 4; - private global::AElf.Types.Address aggregatorContractAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address AggregatorContractAddress { - get { return aggregatorContractAddress_; } - set { - aggregatorContractAddress_ = value; - } - } - - /// Field number for the "node_index" field. - public const int NodeIndexFieldNumber = 5; - private int nodeIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int NodeIndex { - get { return nodeIndex_; } - set { - nodeIndex_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as QueryOracleInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(QueryOracleInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Payment != other.Payment) return false; - if (Token != other.Token) return false; - if (AggregateThreshold != other.AggregateThreshold) return false; - if (!object.Equals(AggregatorContractAddress, other.AggregatorContractAddress)) return false; - if (NodeIndex != other.NodeIndex) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Payment != 0L) hash ^= Payment.GetHashCode(); - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (AggregateThreshold != 0) hash ^= AggregateThreshold.GetHashCode(); - if (aggregatorContractAddress_ != null) hash ^= AggregatorContractAddress.GetHashCode(); - if (NodeIndex != 0) hash ^= NodeIndex.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Payment != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Payment); - } - if (Token.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Token); - } - if (AggregateThreshold != 0) { - output.WriteRawTag(24); - output.WriteInt32(AggregateThreshold); - } - if (aggregatorContractAddress_ != null) { - output.WriteRawTag(34); - output.WriteMessage(AggregatorContractAddress); - } - if (NodeIndex != 0) { - output.WriteRawTag(40); - output.WriteInt32(NodeIndex); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Payment != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Payment); - } - if (Token.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (AggregateThreshold != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(AggregateThreshold); - } - if (aggregatorContractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(AggregatorContractAddress); - } - if (NodeIndex != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(NodeIndex); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(QueryOracleInput other) { - if (other == null) { - return; - } - if (other.Payment != 0L) { - Payment = other.Payment; - } - if (other.Token.Length != 0) { - Token = other.Token; - } - if (other.AggregateThreshold != 0) { - AggregateThreshold = other.AggregateThreshold; - } - if (other.aggregatorContractAddress_ != null) { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - AggregatorContractAddress.MergeFrom(other.AggregatorContractAddress); - } - if (other.NodeIndex != 0) { - NodeIndex = other.NodeIndex; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Payment = input.ReadInt64(); - break; - } - case 18: { - Token = input.ReadString(); - break; - } - case 24: { - AggregateThreshold = input.ReadInt32(); - break; - } - case 34: { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(AggregatorContractAddress); - break; - } - case 40: { - NodeIndex = input.ReadInt32(); - break; - } - } - } - } - - } - - public sealed partial class ConfirmReportInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConfirmReportInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ConfirmReportInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ConfirmReportInput(ConfirmReportInput other) : this() { - token_ = other.token_; - roundId_ = other.roundId_; - signature_ = other.signature_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ConfirmReportInput Clone() { - return new ConfirmReportInput(this); - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 1; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "round_id" field. - public const int RoundIdFieldNumber = 2; - private long roundId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RoundId { - get { return roundId_; } - set { - roundId_ = value; - } - } - - /// Field number for the "signature" field. - public const int SignatureFieldNumber = 3; - private string signature_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Signature { - get { return signature_; } - set { - signature_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ConfirmReportInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ConfirmReportInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Token != other.Token) return false; - if (RoundId != other.RoundId) return false; - if (Signature != other.Signature) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (RoundId != 0L) hash ^= RoundId.GetHashCode(); - if (Signature.Length != 0) hash ^= Signature.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Token.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Token); - } - if (RoundId != 0L) { - output.WriteRawTag(16); - output.WriteInt64(RoundId); - } - if (Signature.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Signature); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Token.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (RoundId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RoundId); - } - if (Signature.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Signature); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ConfirmReportInput other) { - if (other == null) { - return; - } - if (other.Token.Length != 0) { - Token = other.Token; - } - if (other.RoundId != 0L) { - RoundId = other.RoundId; - } - if (other.Signature.Length != 0) { - Signature = other.Signature; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Token = input.ReadString(); - break; - } - case 16: { - RoundId = input.ReadInt64(); - break; - } - case 26: { - Signature = input.ReadString(); - break; - } - } - } - } - - } - - public sealed partial class RejectReportInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RejectReportInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RejectReportInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RejectReportInput(RejectReportInput other) : this() { - token_ = other.token_; - roundId_ = other.roundId_; - accusingNodes_ = other.accusingNodes_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RejectReportInput Clone() { - return new RejectReportInput(this); - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 1; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "round_id" field. - public const int RoundIdFieldNumber = 2; - private long roundId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RoundId { - get { return roundId_; } - set { - roundId_ = value; - } - } - - /// Field number for the "accusing_nodes" field. - public const int AccusingNodesFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_accusingNodes_codec - = pb::FieldCodec.ForMessage(26, global::AElf.Types.Address.Parser); - private readonly pbc::RepeatedField accusingNodes_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField AccusingNodes { - get { return accusingNodes_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as RejectReportInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(RejectReportInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Token != other.Token) return false; - if (RoundId != other.RoundId) return false; - if(!accusingNodes_.Equals(other.accusingNodes_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (RoundId != 0L) hash ^= RoundId.GetHashCode(); - hash ^= accusingNodes_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Token.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Token); - } - if (RoundId != 0L) { - output.WriteRawTag(16); - output.WriteInt64(RoundId); - } - accusingNodes_.WriteTo(output, _repeated_accusingNodes_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Token.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (RoundId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RoundId); - } - size += accusingNodes_.CalculateSize(_repeated_accusingNodes_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(RejectReportInput other) { - if (other == null) { - return; - } - if (other.Token.Length != 0) { - Token = other.Token; - } - if (other.RoundId != 0L) { - RoundId = other.RoundId; - } - accusingNodes_.Add(other.accusingNodes_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Token = input.ReadString(); - break; - } - case 16: { - RoundId = input.ReadInt64(); - break; - } - case 26: { - accusingNodes_.AddEntriesFrom(input, _repeated_accusingNodes_codec); - break; - } - } - } - } - - } - - public sealed partial class Report : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Report()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Report() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Report(Report other) : this() { - queryId_ = other.queryId_ != null ? other.queryId_.Clone() : null; - roundId_ = other.roundId_; - observations_ = other.observations_ != null ? other.observations_.Clone() : null; - aggregatedData_ = other.aggregatedData_; - observers_ = other.observers_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Report Clone() { - return new Report(this); - } - - /// Field number for the "query_id" field. - public const int QueryIdFieldNumber = 1; - private global::AElf.Types.Hash queryId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Hash QueryId { - get { return queryId_; } - set { - queryId_ = value; - } - } - - /// Field number for the "round_id" field. - public const int RoundIdFieldNumber = 2; - private long roundId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RoundId { - get { return roundId_; } - set { - roundId_ = value; - } - } - - /// Field number for the "observations" field. - public const int ObservationsFieldNumber = 3; - private global::AElf.Contracts.Report.Observations observations_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Report.Observations Observations { - get { return observations_; } - set { - observations_ = value; - } - } - - /// Field number for the "aggregated_data" field. - public const int AggregatedDataFieldNumber = 4; - private pb::ByteString aggregatedData_ = pb::ByteString.Empty; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString AggregatedData { - get { return aggregatedData_; } - set { - aggregatedData_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "observers" field. - public const int ObserversFieldNumber = 5; - private static readonly pb::FieldCodec _repeated_observers_codec - = pb::FieldCodec.ForMessage(42, global::AElf.Contracts.Report.ObserverList.Parser); - private readonly pbc::RepeatedField observers_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Observers { - get { return observers_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Report); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Report other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(QueryId, other.QueryId)) return false; - if (RoundId != other.RoundId) return false; - if (!object.Equals(Observations, other.Observations)) return false; - if (AggregatedData != other.AggregatedData) return false; - if(!observers_.Equals(other.observers_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (queryId_ != null) hash ^= QueryId.GetHashCode(); - if (RoundId != 0L) hash ^= RoundId.GetHashCode(); - if (observations_ != null) hash ^= Observations.GetHashCode(); - if (AggregatedData.Length != 0) hash ^= AggregatedData.GetHashCode(); - hash ^= observers_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (queryId_ != null) { - output.WriteRawTag(10); - output.WriteMessage(QueryId); - } - if (RoundId != 0L) { - output.WriteRawTag(16); - output.WriteInt64(RoundId); - } - if (observations_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Observations); - } - if (AggregatedData.Length != 0) { - output.WriteRawTag(34); - output.WriteBytes(AggregatedData); - } - observers_.WriteTo(output, _repeated_observers_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (queryId_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(QueryId); - } - if (RoundId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RoundId); - } - if (observations_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Observations); - } - if (AggregatedData.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(AggregatedData); - } - size += observers_.CalculateSize(_repeated_observers_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Report other) { - if (other == null) { - return; - } - if (other.queryId_ != null) { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - QueryId.MergeFrom(other.QueryId); - } - if (other.RoundId != 0L) { - RoundId = other.RoundId; - } - if (other.observations_ != null) { - if (observations_ == null) { - Observations = new global::AElf.Contracts.Report.Observations(); - } - Observations.MergeFrom(other.Observations); - } - if (other.AggregatedData.Length != 0) { - AggregatedData = other.AggregatedData; - } - observers_.Add(other.observers_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (queryId_ == null) { - QueryId = new global::AElf.Types.Hash(); - } - input.ReadMessage(QueryId); - break; - } - case 16: { - RoundId = input.ReadInt64(); - break; - } - case 26: { - if (observations_ == null) { - Observations = new global::AElf.Contracts.Report.Observations(); - } - input.ReadMessage(Observations); - break; - } - case 34: { - AggregatedData = input.ReadBytes(); - break; - } - case 42: { - observers_.AddEntriesFrom(input, _repeated_observers_codec); - break; - } - } - } - } - - } - - public sealed partial class ReportQueryRecord : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReportQueryRecord()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[5]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReportQueryRecord() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReportQueryRecord(ReportQueryRecord other) : this() { - originQuerySender_ = other.originQuerySender_ != null ? other.originQuerySender_.Clone() : null; - paidReportFee_ = other.paidReportFee_; - isRejected_ = other.isRejected_; - isAllNodeConfirmed_ = other.isAllNodeConfirmed_; - nodeConfirmCount_ = other.nodeConfirmCount_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReportQueryRecord Clone() { - return new ReportQueryRecord(this); - } - - /// Field number for the "origin_query_sender" field. - public const int OriginQuerySenderFieldNumber = 1; - private global::AElf.Types.Address originQuerySender_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address OriginQuerySender { - get { return originQuerySender_; } - set { - originQuerySender_ = value; - } - } - - /// Field number for the "paid_report_fee" field. - public const int PaidReportFeeFieldNumber = 2; - private long paidReportFee_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long PaidReportFee { - get { return paidReportFee_; } - set { - paidReportFee_ = value; - } - } - - /// Field number for the "is_rejected" field. - public const int IsRejectedFieldNumber = 3; - private bool isRejected_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsRejected { - get { return isRejected_; } - set { - isRejected_ = value; - } - } - - /// Field number for the "is_all_node_confirmed" field. - public const int IsAllNodeConfirmedFieldNumber = 4; - private bool isAllNodeConfirmed_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsAllNodeConfirmed { - get { return isAllNodeConfirmed_; } - set { - isAllNodeConfirmed_ = value; - } - } - - /// Field number for the "node_confirm_count" field. - public const int NodeConfirmCountFieldNumber = 5; - private long nodeConfirmCount_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long NodeConfirmCount { - get { return nodeConfirmCount_; } - set { - nodeConfirmCount_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ReportQueryRecord); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ReportQueryRecord other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(OriginQuerySender, other.OriginQuerySender)) return false; - if (PaidReportFee != other.PaidReportFee) return false; - if (IsRejected != other.IsRejected) return false; - if (IsAllNodeConfirmed != other.IsAllNodeConfirmed) return false; - if (NodeConfirmCount != other.NodeConfirmCount) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (originQuerySender_ != null) hash ^= OriginQuerySender.GetHashCode(); - if (PaidReportFee != 0L) hash ^= PaidReportFee.GetHashCode(); - if (IsRejected != false) hash ^= IsRejected.GetHashCode(); - if (IsAllNodeConfirmed != false) hash ^= IsAllNodeConfirmed.GetHashCode(); - if (NodeConfirmCount != 0L) hash ^= NodeConfirmCount.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (originQuerySender_ != null) { - output.WriteRawTag(10); - output.WriteMessage(OriginQuerySender); - } - if (PaidReportFee != 0L) { - output.WriteRawTag(16); - output.WriteInt64(PaidReportFee); - } - if (IsRejected != false) { - output.WriteRawTag(24); - output.WriteBool(IsRejected); - } - if (IsAllNodeConfirmed != false) { - output.WriteRawTag(32); - output.WriteBool(IsAllNodeConfirmed); - } - if (NodeConfirmCount != 0L) { - output.WriteRawTag(40); - output.WriteInt64(NodeConfirmCount); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (originQuerySender_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OriginQuerySender); - } - if (PaidReportFee != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(PaidReportFee); - } - if (IsRejected != false) { - size += 1 + 1; - } - if (IsAllNodeConfirmed != false) { - size += 1 + 1; - } - if (NodeConfirmCount != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(NodeConfirmCount); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ReportQueryRecord other) { - if (other == null) { - return; - } - if (other.originQuerySender_ != null) { - if (originQuerySender_ == null) { - OriginQuerySender = new global::AElf.Types.Address(); - } - OriginQuerySender.MergeFrom(other.OriginQuerySender); - } - if (other.PaidReportFee != 0L) { - PaidReportFee = other.PaidReportFee; - } - if (other.IsRejected != false) { - IsRejected = other.IsRejected; - } - if (other.IsAllNodeConfirmed != false) { - IsAllNodeConfirmed = other.IsAllNodeConfirmed; - } - if (other.NodeConfirmCount != 0L) { - NodeConfirmCount = other.NodeConfirmCount; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (originQuerySender_ == null) { - OriginQuerySender = new global::AElf.Types.Address(); - } - input.ReadMessage(OriginQuerySender); - break; - } - case 16: { - PaidReportFee = input.ReadInt64(); - break; - } - case 24: { - IsRejected = input.ReadBool(); - break; - } - case 32: { - IsAllNodeConfirmed = input.ReadBool(); - break; - } - case 40: { - NodeConfirmCount = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class ObserverList : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ObserverList()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[6]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ObserverList() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ObserverList(ObserverList other) : this() { - value_ = other.value_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ObserverList Clone() { - return new ObserverList(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_value_codec - = pb::FieldCodec.ForMessage(10, global::AElf.Types.Address.Parser); - private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Value { - get { return value_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ObserverList); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ObserverList other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!value_.Equals(other.value_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= value_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - value_.WriteTo(output, _repeated_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += value_.CalculateSize(_repeated_value_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ObserverList other) { - if (other == null) { - return; - } - value_.Add(other.value_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - value_.AddEntriesFrom(input, _repeated_value_codec); - break; - } - } - } - } - - } - - public sealed partial class ProposeReportInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ProposeReportInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[7]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ProposeReportInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ProposeReportInput(ProposeReportInput other) : this() { - queryIdList_ = other.queryIdList_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ProposeReportInput Clone() { - return new ProposeReportInput(this); - } - - /// Field number for the "query_id_list" field. - public const int QueryIdListFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_queryIdList_codec - = pb::FieldCodec.ForMessage(10, global::AElf.Types.Hash.Parser); - private readonly pbc::RepeatedField queryIdList_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField QueryIdList { - get { return queryIdList_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ProposeReportInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ProposeReportInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!queryIdList_.Equals(other.queryIdList_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= queryIdList_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - queryIdList_.WriteTo(output, _repeated_queryIdList_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += queryIdList_.CalculateSize(_repeated_queryIdList_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ProposeReportInput other) { - if (other == null) { - return; - } - queryIdList_.Add(other.queryIdList_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - queryIdList_.AddEntriesFrom(input, _repeated_queryIdList_codec); - break; - } - } - } - } - - } - - public sealed partial class Observations : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Observations()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[8]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Observations() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Observations(Observations other) : this() { - value_ = other.value_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Observations Clone() { - return new Observations(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_value_codec - = pb::FieldCodec.ForMessage(10, global::AElf.Contracts.Report.Observation.Parser); - private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Value { - get { return value_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Observations); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Observations other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!value_.Equals(other.value_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= value_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - value_.WriteTo(output, _repeated_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += value_.CalculateSize(_repeated_value_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Observations other) { - if (other == null) { - return; - } - value_.Add(other.value_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - value_.AddEntriesFrom(input, _repeated_value_codec); - break; - } - } - } - } - - } - - public sealed partial class Observation : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Observation()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[9]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Observation() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Observation(Observation other) : this() { - key_ = other.key_; - data_ = other.data_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Observation Clone() { - return new Observation(this); - } - - /// Field number for the "key" field. - public const int KeyFieldNumber = 1; - private string key_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Key { - get { return key_; } - set { - key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "data" field. - public const int DataFieldNumber = 2; - private string data_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Data { - get { return data_; } - set { - data_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Observation); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Observation other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Key != other.Key) return false; - if (Data != other.Data) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Key.Length != 0) hash ^= Key.GetHashCode(); - if (Data.Length != 0) hash ^= Data.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Key.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Key); - } - if (Data.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Data); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Key.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); - } - if (Data.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Data); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Observation other) { - if (other == null) { - return; - } - if (other.Key.Length != 0) { - Key = other.Key; - } - if (other.Data.Length != 0) { - Data = other.Data; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Key = input.ReadString(); - break; - } - case 18: { - Data = input.ReadString(); - break; - } - } - } - } - - } - - public sealed partial class GetSignatureInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetSignatureInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[10]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetSignatureInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetSignatureInput(GetSignatureInput other) : this() { - token_ = other.token_; - roundId_ = other.roundId_; - address_ = other.address_ != null ? other.address_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetSignatureInput Clone() { - return new GetSignatureInput(this); - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 1; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "round_id" field. - public const int RoundIdFieldNumber = 2; - private long roundId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RoundId { - get { return roundId_; } - set { - roundId_ = value; - } - } - - /// Field number for the "address" field. - public const int AddressFieldNumber = 3; - private global::AElf.Types.Address address_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Address { - get { return address_; } - set { - address_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GetSignatureInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GetSignatureInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Token != other.Token) return false; - if (RoundId != other.RoundId) return false; - if (!object.Equals(Address, other.Address)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (RoundId != 0L) hash ^= RoundId.GetHashCode(); - if (address_ != null) hash ^= Address.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Token.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Token); - } - if (RoundId != 0L) { - output.WriteRawTag(16); - output.WriteInt64(RoundId); - } - if (address_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Address); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Token.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (RoundId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RoundId); - } - if (address_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Address); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GetSignatureInput other) { - if (other == null) { - return; - } - if (other.Token.Length != 0) { - Token = other.Token; - } - if (other.RoundId != 0L) { - RoundId = other.RoundId; - } - if (other.address_ != null) { - if (address_ == null) { - Address = new global::AElf.Types.Address(); - } - Address.MergeFrom(other.Address); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Token = input.ReadString(); - break; - } - case 16: { - RoundId = input.ReadInt64(); - break; - } - case 26: { - if (address_ == null) { - Address = new global::AElf.Types.Address(); - } - input.ReadMessage(Address); - break; - } - } - } - } - - } - - public sealed partial class GetSignatureMapInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetSignatureMapInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[11]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetSignatureMapInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetSignatureMapInput(GetSignatureMapInput other) : this() { - token_ = other.token_; - roundId_ = other.roundId_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetSignatureMapInput Clone() { - return new GetSignatureMapInput(this); - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 1; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "round_id" field. - public const int RoundIdFieldNumber = 2; - private long roundId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RoundId { - get { return roundId_; } - set { - roundId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GetSignatureMapInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GetSignatureMapInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Token != other.Token) return false; - if (RoundId != other.RoundId) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (RoundId != 0L) hash ^= RoundId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Token.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Token); - } - if (RoundId != 0L) { - output.WriteRawTag(16); - output.WriteInt64(RoundId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Token.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (RoundId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RoundId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GetSignatureMapInput other) { - if (other == null) { - return; - } - if (other.Token.Length != 0) { - Token = other.Token; - } - if (other.RoundId != 0L) { - RoundId = other.RoundId; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Token = input.ReadString(); - break; - } - case 16: { - RoundId = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class SignatureMap : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SignatureMap()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[12]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SignatureMap() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SignatureMap(SignatureMap other) : this() { - value_ = other.value_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SignatureMap Clone() { - return new SignatureMap(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private static readonly pbc::MapField.Codec _map_value_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForString(18, ""), 10); - private readonly pbc::MapField value_ = new pbc::MapField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::MapField Value { - get { return value_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SignatureMap); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SignatureMap other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!Value.Equals(other.Value)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - value_.WriteTo(output, _map_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += value_.CalculateSize(_map_value_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SignatureMap other) { - if (other == null) { - return; - } - value_.Add(other.value_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - value_.AddEntriesFrom(input, _map_value_codec); - break; - } - } - } - } - - } - - public sealed partial class OffChainAggregationInfo : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OffChainAggregationInfo()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[13]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OffChainAggregationInfo() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OffChainAggregationInfo(OffChainAggregationInfo other) : this() { - token_ = other.token_; - offChainQueryInfoList_ = other.offChainQueryInfoList_ != null ? other.offChainQueryInfoList_.Clone() : null; - observerAssociationAddress_ = other.observerAssociationAddress_ != null ? other.observerAssociationAddress_.Clone() : null; - configDigest_ = other.configDigest_; - aggregateThreshold_ = other.aggregateThreshold_; - aggregatorContractAddress_ = other.aggregatorContractAddress_ != null ? other.aggregatorContractAddress_.Clone() : null; - roundIds_ = other.roundIds_.Clone(); - chainType_ = other.chainType_; - register_ = other.register_ != null ? other.register_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OffChainAggregationInfo Clone() { - return new OffChainAggregationInfo(this); - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 1; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "off_chain_query_info_list" field. - public const int OffChainQueryInfoListFieldNumber = 2; - private global::AElf.Contracts.Report.OffChainQueryInfoList offChainQueryInfoList_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Report.OffChainQueryInfoList OffChainQueryInfoList { - get { return offChainQueryInfoList_; } - set { - offChainQueryInfoList_ = value; - } - } - - /// Field number for the "observer_association_address" field. - public const int ObserverAssociationAddressFieldNumber = 3; - private global::AElf.Types.Address observerAssociationAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address ObserverAssociationAddress { - get { return observerAssociationAddress_; } - set { - observerAssociationAddress_ = value; - } - } - - /// Field number for the "config_digest" field. - public const int ConfigDigestFieldNumber = 4; - private pb::ByteString configDigest_ = pb::ByteString.Empty; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString ConfigDigest { - get { return configDigest_; } - set { - configDigest_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "aggregate_threshold" field. - public const int AggregateThresholdFieldNumber = 5; - private int aggregateThreshold_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int AggregateThreshold { - get { return aggregateThreshold_; } - set { - aggregateThreshold_ = value; - } - } - - /// Field number for the "aggregator_contract_address" field. - public const int AggregatorContractAddressFieldNumber = 6; - private global::AElf.Types.Address aggregatorContractAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address AggregatorContractAddress { - get { return aggregatorContractAddress_; } - set { - aggregatorContractAddress_ = value; - } - } - - /// Field number for the "round_ids" field. - public const int RoundIdsFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_roundIds_codec - = pb::FieldCodec.ForInt64(58); - private readonly pbc::RepeatedField roundIds_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField RoundIds { - get { return roundIds_; } - } - - /// Field number for the "chain_type" field. - public const int ChainTypeFieldNumber = 8; - private string chainType_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ChainType { - get { return chainType_; } - set { - chainType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "register" field. - public const int RegisterFieldNumber = 9; - private global::AElf.Types.Address register_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Register { - get { return register_; } - set { - register_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as OffChainAggregationInfo); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(OffChainAggregationInfo other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Token != other.Token) return false; - if (!object.Equals(OffChainQueryInfoList, other.OffChainQueryInfoList)) return false; - if (!object.Equals(ObserverAssociationAddress, other.ObserverAssociationAddress)) return false; - if (ConfigDigest != other.ConfigDigest) return false; - if (AggregateThreshold != other.AggregateThreshold) return false; - if (!object.Equals(AggregatorContractAddress, other.AggregatorContractAddress)) return false; - if(!roundIds_.Equals(other.roundIds_)) return false; - if (ChainType != other.ChainType) return false; - if (!object.Equals(Register, other.Register)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (offChainQueryInfoList_ != null) hash ^= OffChainQueryInfoList.GetHashCode(); - if (observerAssociationAddress_ != null) hash ^= ObserverAssociationAddress.GetHashCode(); - if (ConfigDigest.Length != 0) hash ^= ConfigDigest.GetHashCode(); - if (AggregateThreshold != 0) hash ^= AggregateThreshold.GetHashCode(); - if (aggregatorContractAddress_ != null) hash ^= AggregatorContractAddress.GetHashCode(); - hash ^= roundIds_.GetHashCode(); - if (ChainType.Length != 0) hash ^= ChainType.GetHashCode(); - if (register_ != null) hash ^= Register.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Token.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Token); - } - if (offChainQueryInfoList_ != null) { - output.WriteRawTag(18); - output.WriteMessage(OffChainQueryInfoList); - } - if (observerAssociationAddress_ != null) { - output.WriteRawTag(26); - output.WriteMessage(ObserverAssociationAddress); - } - if (ConfigDigest.Length != 0) { - output.WriteRawTag(34); - output.WriteBytes(ConfigDigest); - } - if (AggregateThreshold != 0) { - output.WriteRawTag(40); - output.WriteInt32(AggregateThreshold); - } - if (aggregatorContractAddress_ != null) { - output.WriteRawTag(50); - output.WriteMessage(AggregatorContractAddress); - } - roundIds_.WriteTo(output, _repeated_roundIds_codec); - if (ChainType.Length != 0) { - output.WriteRawTag(66); - output.WriteString(ChainType); - } - if (register_ != null) { - output.WriteRawTag(74); - output.WriteMessage(Register); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Token.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (offChainQueryInfoList_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OffChainQueryInfoList); - } - if (observerAssociationAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ObserverAssociationAddress); - } - if (ConfigDigest.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(ConfigDigest); - } - if (AggregateThreshold != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(AggregateThreshold); - } - if (aggregatorContractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(AggregatorContractAddress); - } - size += roundIds_.CalculateSize(_repeated_roundIds_codec); - if (ChainType.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ChainType); - } - if (register_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Register); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(OffChainAggregationInfo other) { - if (other == null) { - return; - } - if (other.Token.Length != 0) { - Token = other.Token; - } - if (other.offChainQueryInfoList_ != null) { - if (offChainQueryInfoList_ == null) { - OffChainQueryInfoList = new global::AElf.Contracts.Report.OffChainQueryInfoList(); - } - OffChainQueryInfoList.MergeFrom(other.OffChainQueryInfoList); - } - if (other.observerAssociationAddress_ != null) { - if (observerAssociationAddress_ == null) { - ObserverAssociationAddress = new global::AElf.Types.Address(); - } - ObserverAssociationAddress.MergeFrom(other.ObserverAssociationAddress); - } - if (other.ConfigDigest.Length != 0) { - ConfigDigest = other.ConfigDigest; - } - if (other.AggregateThreshold != 0) { - AggregateThreshold = other.AggregateThreshold; - } - if (other.aggregatorContractAddress_ != null) { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - AggregatorContractAddress.MergeFrom(other.AggregatorContractAddress); - } - roundIds_.Add(other.roundIds_); - if (other.ChainType.Length != 0) { - ChainType = other.ChainType; - } - if (other.register_ != null) { - if (register_ == null) { - Register = new global::AElf.Types.Address(); - } - Register.MergeFrom(other.Register); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Token = input.ReadString(); - break; - } - case 18: { - if (offChainQueryInfoList_ == null) { - OffChainQueryInfoList = new global::AElf.Contracts.Report.OffChainQueryInfoList(); - } - input.ReadMessage(OffChainQueryInfoList); - break; - } - case 26: { - if (observerAssociationAddress_ == null) { - ObserverAssociationAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(ObserverAssociationAddress); - break; - } - case 34: { - ConfigDigest = input.ReadBytes(); - break; - } - case 40: { - AggregateThreshold = input.ReadInt32(); - break; - } - case 50: { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(AggregatorContractAddress); - break; - } - case 58: - case 56: { - roundIds_.AddEntriesFrom(input, _repeated_roundIds_codec); - break; - } - case 66: { - ChainType = input.ReadString(); - break; - } - case 74: { - if (register_ == null) { - Register = new global::AElf.Types.Address(); - } - input.ReadMessage(Register); - break; - } - } - } - } - - } - - public sealed partial class RegisterOffChainAggregationInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RegisterOffChainAggregationInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[14]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RegisterOffChainAggregationInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RegisterOffChainAggregationInput(RegisterOffChainAggregationInput other) : this() { - observerList_ = other.observerList_ != null ? other.observerList_.Clone() : null; - offChainQueryInfoList_ = other.offChainQueryInfoList_ != null ? other.offChainQueryInfoList_.Clone() : null; - token_ = other.token_; - configDigest_ = other.configDigest_; - aggregateThreshold_ = other.aggregateThreshold_; - aggregatorContractAddress_ = other.aggregatorContractAddress_ != null ? other.aggregatorContractAddress_.Clone() : null; - chainType_ = other.chainType_; - register_ = other.register_ != null ? other.register_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RegisterOffChainAggregationInput Clone() { - return new RegisterOffChainAggregationInput(this); - } - - /// Field number for the "observer_list" field. - public const int ObserverListFieldNumber = 1; - private global::AElf.Contracts.Report.ObserverList observerList_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Report.ObserverList ObserverList { - get { return observerList_; } - set { - observerList_ = value; - } - } - - /// Field number for the "off_chain_query_info_list" field. - public const int OffChainQueryInfoListFieldNumber = 2; - private global::AElf.Contracts.Report.OffChainQueryInfoList offChainQueryInfoList_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Report.OffChainQueryInfoList OffChainQueryInfoList { - get { return offChainQueryInfoList_; } - set { - offChainQueryInfoList_ = value; - } - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 3; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "config_digest" field. - public const int ConfigDigestFieldNumber = 4; - private pb::ByteString configDigest_ = pb::ByteString.Empty; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString ConfigDigest { - get { return configDigest_; } - set { - configDigest_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "aggregate_threshold" field. - public const int AggregateThresholdFieldNumber = 5; - private int aggregateThreshold_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int AggregateThreshold { - get { return aggregateThreshold_; } - set { - aggregateThreshold_ = value; - } - } - - /// Field number for the "aggregator_contract_address" field. - public const int AggregatorContractAddressFieldNumber = 6; - private global::AElf.Types.Address aggregatorContractAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address AggregatorContractAddress { - get { return aggregatorContractAddress_; } - set { - aggregatorContractAddress_ = value; - } - } - - /// Field number for the "chain_type" field. - public const int ChainTypeFieldNumber = 7; - private string chainType_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ChainType { - get { return chainType_; } - set { - chainType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "register" field. - public const int RegisterFieldNumber = 8; - private global::AElf.Types.Address register_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Register { - get { return register_; } - set { - register_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as RegisterOffChainAggregationInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(RegisterOffChainAggregationInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(ObserverList, other.ObserverList)) return false; - if (!object.Equals(OffChainQueryInfoList, other.OffChainQueryInfoList)) return false; - if (Token != other.Token) return false; - if (ConfigDigest != other.ConfigDigest) return false; - if (AggregateThreshold != other.AggregateThreshold) return false; - if (!object.Equals(AggregatorContractAddress, other.AggregatorContractAddress)) return false; - if (ChainType != other.ChainType) return false; - if (!object.Equals(Register, other.Register)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (observerList_ != null) hash ^= ObserverList.GetHashCode(); - if (offChainQueryInfoList_ != null) hash ^= OffChainQueryInfoList.GetHashCode(); - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (ConfigDigest.Length != 0) hash ^= ConfigDigest.GetHashCode(); - if (AggregateThreshold != 0) hash ^= AggregateThreshold.GetHashCode(); - if (aggregatorContractAddress_ != null) hash ^= AggregatorContractAddress.GetHashCode(); - if (ChainType.Length != 0) hash ^= ChainType.GetHashCode(); - if (register_ != null) hash ^= Register.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (observerList_ != null) { - output.WriteRawTag(10); - output.WriteMessage(ObserverList); - } - if (offChainQueryInfoList_ != null) { - output.WriteRawTag(18); - output.WriteMessage(OffChainQueryInfoList); - } - if (Token.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Token); - } - if (ConfigDigest.Length != 0) { - output.WriteRawTag(34); - output.WriteBytes(ConfigDigest); - } - if (AggregateThreshold != 0) { - output.WriteRawTag(40); - output.WriteInt32(AggregateThreshold); - } - if (aggregatorContractAddress_ != null) { - output.WriteRawTag(50); - output.WriteMessage(AggregatorContractAddress); - } - if (ChainType.Length != 0) { - output.WriteRawTag(58); - output.WriteString(ChainType); - } - if (register_ != null) { - output.WriteRawTag(66); - output.WriteMessage(Register); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (observerList_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ObserverList); - } - if (offChainQueryInfoList_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OffChainQueryInfoList); - } - if (Token.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (ConfigDigest.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(ConfigDigest); - } - if (AggregateThreshold != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(AggregateThreshold); - } - if (aggregatorContractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(AggregatorContractAddress); - } - if (ChainType.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ChainType); - } - if (register_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Register); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(RegisterOffChainAggregationInput other) { - if (other == null) { - return; - } - if (other.observerList_ != null) { - if (observerList_ == null) { - ObserverList = new global::AElf.Contracts.Report.ObserverList(); - } - ObserverList.MergeFrom(other.ObserverList); - } - if (other.offChainQueryInfoList_ != null) { - if (offChainQueryInfoList_ == null) { - OffChainQueryInfoList = new global::AElf.Contracts.Report.OffChainQueryInfoList(); - } - OffChainQueryInfoList.MergeFrom(other.OffChainQueryInfoList); - } - if (other.Token.Length != 0) { - Token = other.Token; - } - if (other.ConfigDigest.Length != 0) { - ConfigDigest = other.ConfigDigest; - } - if (other.AggregateThreshold != 0) { - AggregateThreshold = other.AggregateThreshold; - } - if (other.aggregatorContractAddress_ != null) { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - AggregatorContractAddress.MergeFrom(other.AggregatorContractAddress); - } - if (other.ChainType.Length != 0) { - ChainType = other.ChainType; - } - if (other.register_ != null) { - if (register_ == null) { - Register = new global::AElf.Types.Address(); - } - Register.MergeFrom(other.Register); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (observerList_ == null) { - ObserverList = new global::AElf.Contracts.Report.ObserverList(); - } - input.ReadMessage(ObserverList); - break; - } - case 18: { - if (offChainQueryInfoList_ == null) { - OffChainQueryInfoList = new global::AElf.Contracts.Report.OffChainQueryInfoList(); - } - input.ReadMessage(OffChainQueryInfoList); - break; - } - case 26: { - Token = input.ReadString(); - break; - } - case 34: { - ConfigDigest = input.ReadBytes(); - break; - } - case 40: { - AggregateThreshold = input.ReadInt32(); - break; - } - case 50: { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(AggregatorContractAddress); - break; - } - case 58: { - ChainType = input.ReadString(); - break; - } - case 66: { - if (register_ == null) { - Register = new global::AElf.Types.Address(); - } - input.ReadMessage(Register); - break; - } - } - } - } - - } - - public sealed partial class OffChainQueryInfo : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OffChainQueryInfo()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[15]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OffChainQueryInfo() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OffChainQueryInfo(OffChainQueryInfo other) : this() { - Title_ = other.Title_; - Options_ = other.Options_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OffChainQueryInfo Clone() { - return new OffChainQueryInfo(this); - } - - /// Field number for the "url_to_query" field. - public const int TitleFieldNumber = 1; - private string Title_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Title { - get { return Title_; } - set { - Title_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "attributes_to_fetch" field. - public const int OptionsFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_Options_codec - = pb::FieldCodec.ForString(18); - private readonly pbc::RepeatedField Options_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Options { - get { return Options_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as OffChainQueryInfo); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(OffChainQueryInfo other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Title != other.Title) return false; - if(!Options_.Equals(other.Options_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Title.Length != 0) hash ^= Title.GetHashCode(); - hash ^= Options_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Title.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Title); - } - Options_.WriteTo(output, _repeated_Options_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Title.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Title); - } - size += Options_.CalculateSize(_repeated_Options_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(OffChainQueryInfo other) { - if (other == null) { - return; - } - if (other.Title.Length != 0) { - Title = other.Title; - } - Options_.Add(other.Options_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Title = input.ReadString(); - break; - } - case 18: { - Options_.AddEntriesFrom(input, _repeated_Options_codec); - break; - } - } - } - } - - } - - public sealed partial class GetReportInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetReportInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[16]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetReportInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetReportInput(GetReportInput other) : this() { - token_ = other.token_; - roundId_ = other.roundId_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetReportInput Clone() { - return new GetReportInput(this); - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 1; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "round_id" field. - public const int RoundIdFieldNumber = 2; - private long roundId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RoundId { - get { return roundId_; } - set { - roundId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GetReportInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GetReportInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Token != other.Token) return false; - if (RoundId != other.RoundId) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (RoundId != 0L) hash ^= RoundId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Token.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Token); - } - if (RoundId != 0L) { - output.WriteRawTag(16); - output.WriteInt64(RoundId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Token.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (RoundId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RoundId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GetReportInput other) { - if (other == null) { - return; - } - if (other.Token.Length != 0) { - Token = other.Token; - } - if (other.RoundId != 0L) { - RoundId = other.RoundId; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Token = input.ReadString(); - break; - } - case 16: { - RoundId = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class GetMerklePathInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetMerklePathInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[17]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetMerklePathInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetMerklePathInput(GetMerklePathInput other) : this() { - token_ = other.token_; - roundId_ = other.roundId_; - nodeIndex_ = other.nodeIndex_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetMerklePathInput Clone() { - return new GetMerklePathInput(this); - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 1; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "round_id" field. - public const int RoundIdFieldNumber = 2; - private long roundId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RoundId { - get { return roundId_; } - set { - roundId_ = value; - } - } - - /// Field number for the "node_index" field. - public const int NodeIndexFieldNumber = 3; - private int nodeIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int NodeIndex { - get { return nodeIndex_; } - set { - nodeIndex_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GetMerklePathInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GetMerklePathInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Token != other.Token) return false; - if (RoundId != other.RoundId) return false; - if (NodeIndex != other.NodeIndex) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (RoundId != 0L) hash ^= RoundId.GetHashCode(); - if (NodeIndex != 0) hash ^= NodeIndex.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Token.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Token); - } - if (RoundId != 0L) { - output.WriteRawTag(16); - output.WriteInt64(RoundId); - } - if (NodeIndex != 0) { - output.WriteRawTag(24); - output.WriteInt32(NodeIndex); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Token.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (RoundId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RoundId); - } - if (NodeIndex != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(NodeIndex); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GetMerklePathInput other) { - if (other == null) { - return; - } - if (other.Token.Length != 0) { - Token = other.Token; - } - if (other.RoundId != 0L) { - RoundId = other.RoundId; - } - if (other.NodeIndex != 0) { - NodeIndex = other.NodeIndex; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Token = input.ReadString(); - break; - } - case 16: { - RoundId = input.ReadInt64(); - break; - } - case 24: { - NodeIndex = input.ReadInt32(); - break; - } - } - } - } - - } - - public sealed partial class GetRawReportInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GetRawReportInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[18]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetRawReportInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetRawReportInput(GetRawReportInput other) : this() { - token_ = other.token_; - roundId_ = other.roundId_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GetRawReportInput Clone() { - return new GetRawReportInput(this); - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 1; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "round_id" field. - public const int RoundIdFieldNumber = 2; - private long roundId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RoundId { - get { return roundId_; } - set { - roundId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GetRawReportInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GetRawReportInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Token != other.Token) return false; - if (RoundId != other.RoundId) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (RoundId != 0L) hash ^= RoundId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Token.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Token); - } - if (RoundId != 0L) { - output.WriteRawTag(16); - output.WriteInt64(RoundId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Token.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (RoundId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RoundId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GetRawReportInput other) { - if (other == null) { - return; - } - if (other.Token.Length != 0) { - Token = other.Token; - } - if (other.RoundId != 0L) { - RoundId = other.RoundId; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Token = input.ReadString(); - break; - } - case 16: { - RoundId = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class GenerateRawReportInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GenerateRawReportInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[19]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GenerateRawReportInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GenerateRawReportInput(GenerateRawReportInput other) : this() { - report_ = other.report_ != null ? other.report_.Clone() : null; - configDigest_ = other.configDigest_; - organization_ = other.organization_ != null ? other.organization_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GenerateRawReportInput Clone() { - return new GenerateRawReportInput(this); - } - - /// Field number for the "report" field. - public const int ReportFieldNumber = 1; - private global::AElf.Contracts.Report.Report report_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Report.Report Report { - get { return report_; } - set { - report_ = value; - } - } - - /// Field number for the "config_digest" field. - public const int ConfigDigestFieldNumber = 2; - private pb::ByteString configDigest_ = pb::ByteString.Empty; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString ConfigDigest { - get { return configDigest_; } - set { - configDigest_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "organization" field. - public const int OrganizationFieldNumber = 3; - private global::AElf.Types.Address organization_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Organization { - get { return organization_; } - set { - organization_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GenerateRawReportInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GenerateRawReportInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Report, other.Report)) return false; - if (ConfigDigest != other.ConfigDigest) return false; - if (!object.Equals(Organization, other.Organization)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (report_ != null) hash ^= Report.GetHashCode(); - if (ConfigDigest.Length != 0) hash ^= ConfigDigest.GetHashCode(); - if (organization_ != null) hash ^= Organization.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (report_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Report); - } - if (ConfigDigest.Length != 0) { - output.WriteRawTag(18); - output.WriteBytes(ConfigDigest); - } - if (organization_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Organization); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (report_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Report); - } - if (ConfigDigest.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(ConfigDigest); - } - if (organization_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Organization); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GenerateRawReportInput other) { - if (other == null) { - return; - } - if (other.report_ != null) { - if (report_ == null) { - Report = new global::AElf.Contracts.Report.Report(); - } - Report.MergeFrom(other.Report); - } - if (other.ConfigDigest.Length != 0) { - ConfigDigest = other.ConfigDigest; - } - if (other.organization_ != null) { - if (organization_ == null) { - Organization = new global::AElf.Types.Address(); - } - Organization.MergeFrom(other.Organization); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (report_ == null) { - Report = new global::AElf.Contracts.Report.Report(); - } - input.ReadMessage(Report); - break; - } - case 18: { - ConfigDigest = input.ReadBytes(); - break; - } - case 26: { - if (organization_ == null) { - Organization = new global::AElf.Types.Address(); - } - input.ReadMessage(Organization); - break; - } - } - } - } - - } - - public sealed partial class OffChainQueryInfoList : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OffChainQueryInfoList()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[20]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OffChainQueryInfoList() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OffChainQueryInfoList(OffChainQueryInfoList other) : this() { - value_ = other.value_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OffChainQueryInfoList Clone() { - return new OffChainQueryInfoList(this); - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_value_codec - = pb::FieldCodec.ForMessage(10, global::AElf.Contracts.Report.OffChainQueryInfo.Parser); - private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Value { - get { return value_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as OffChainQueryInfoList); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(OffChainQueryInfoList other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!value_.Equals(other.value_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= value_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - value_.WriteTo(output, _repeated_value_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += value_.CalculateSize(_repeated_value_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(OffChainQueryInfoList other) { - if (other == null) { - return; - } - value_.Add(other.value_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - value_.AddEntriesFrom(input, _repeated_value_codec); - break; - } - } - } - } - - } - - public sealed partial class AddOffChainQueryInfoInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AddOffChainQueryInfoInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[21]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AddOffChainQueryInfoInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AddOffChainQueryInfoInput(AddOffChainQueryInfoInput other) : this() { - token_ = other.token_; - offChainQueryInfo_ = other.offChainQueryInfo_ != null ? other.offChainQueryInfo_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AddOffChainQueryInfoInput Clone() { - return new AddOffChainQueryInfoInput(this); - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 1; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "off_chain_query_info" field. - public const int OffChainQueryInfoFieldNumber = 2; - private global::AElf.Contracts.Report.OffChainQueryInfo offChainQueryInfo_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Report.OffChainQueryInfo OffChainQueryInfo { - get { return offChainQueryInfo_; } - set { - offChainQueryInfo_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as AddOffChainQueryInfoInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(AddOffChainQueryInfoInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Token != other.Token) return false; - if (!object.Equals(OffChainQueryInfo, other.OffChainQueryInfo)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (offChainQueryInfo_ != null) hash ^= OffChainQueryInfo.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Token.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Token); - } - if (offChainQueryInfo_ != null) { - output.WriteRawTag(18); - output.WriteMessage(OffChainQueryInfo); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Token.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (offChainQueryInfo_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OffChainQueryInfo); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(AddOffChainQueryInfoInput other) { - if (other == null) { - return; - } - if (other.Token.Length != 0) { - Token = other.Token; - } - if (other.offChainQueryInfo_ != null) { - if (offChainQueryInfo_ == null) { - OffChainQueryInfo = new global::AElf.Contracts.Report.OffChainQueryInfo(); - } - OffChainQueryInfo.MergeFrom(other.OffChainQueryInfo); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Token = input.ReadString(); - break; - } - case 18: { - if (offChainQueryInfo_ == null) { - OffChainQueryInfo = new global::AElf.Contracts.Report.OffChainQueryInfo(); - } - input.ReadMessage(OffChainQueryInfo); - break; - } - } - } - } - - } - - public sealed partial class RemoveOffChainQueryInfoInput : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RemoveOffChainQueryInfoInput()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[22]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RemoveOffChainQueryInfoInput() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RemoveOffChainQueryInfoInput(RemoveOffChainQueryInfoInput other) : this() { - token_ = other.token_; - removeNodeIndex_ = other.removeNodeIndex_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public RemoveOffChainQueryInfoInput Clone() { - return new RemoveOffChainQueryInfoInput(this); - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 1; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "remove_node_index" field. - public const int RemoveNodeIndexFieldNumber = 2; - private int removeNodeIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int RemoveNodeIndex { - get { return removeNodeIndex_; } - set { - removeNodeIndex_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as RemoveOffChainQueryInfoInput); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(RemoveOffChainQueryInfoInput other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Token != other.Token) return false; - if (RemoveNodeIndex != other.RemoveNodeIndex) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (RemoveNodeIndex != 0) hash ^= RemoveNodeIndex.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Token.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Token); - } - if (RemoveNodeIndex != 0) { - output.WriteRawTag(16); - output.WriteInt32(RemoveNodeIndex); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Token.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (RemoveNodeIndex != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(RemoveNodeIndex); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(RemoveOffChainQueryInfoInput other) { - if (other == null) { - return; - } - if (other.Token.Length != 0) { - Token = other.Token; - } - if (other.RemoveNodeIndex != 0) { - RemoveNodeIndex = other.RemoveNodeIndex; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Token = input.ReadString(); - break; - } - case 16: { - RemoveNodeIndex = input.ReadInt32(); - break; - } - } - } - } - - } - - public sealed partial class ReportProposed : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReportProposed()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[23]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReportProposed() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReportProposed(ReportProposed other) : this() { - rawReport_ = other.rawReport_; - observerAssociationAddress_ = other.observerAssociationAddress_ != null ? other.observerAssociationAddress_.Clone() : null; - token_ = other.token_; - roundId_ = other.roundId_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReportProposed Clone() { - return new ReportProposed(this); - } - - /// Field number for the "raw_report" field. - public const int RawReportFieldNumber = 1; - private string rawReport_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string RawReport { - get { return rawReport_; } - set { - rawReport_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "observer_association_address" field. - public const int ObserverAssociationAddressFieldNumber = 2; - private global::AElf.Types.Address observerAssociationAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address ObserverAssociationAddress { - get { return observerAssociationAddress_; } - set { - observerAssociationAddress_ = value; - } - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 3; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "round_id" field. - public const int RoundIdFieldNumber = 4; - private long roundId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RoundId { - get { return roundId_; } - set { - roundId_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ReportProposed); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ReportProposed other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (RawReport != other.RawReport) return false; - if (!object.Equals(ObserverAssociationAddress, other.ObserverAssociationAddress)) return false; - if (Token != other.Token) return false; - if (RoundId != other.RoundId) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (RawReport.Length != 0) hash ^= RawReport.GetHashCode(); - if (observerAssociationAddress_ != null) hash ^= ObserverAssociationAddress.GetHashCode(); - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (RoundId != 0L) hash ^= RoundId.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (RawReport.Length != 0) { - output.WriteRawTag(10); - output.WriteString(RawReport); - } - if (observerAssociationAddress_ != null) { - output.WriteRawTag(18); - output.WriteMessage(ObserverAssociationAddress); - } - if (Token.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Token); - } - if (RoundId != 0L) { - output.WriteRawTag(32); - output.WriteInt64(RoundId); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (RawReport.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(RawReport); - } - if (observerAssociationAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ObserverAssociationAddress); - } - if (Token.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (RoundId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RoundId); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ReportProposed other) { - if (other == null) { - return; - } - if (other.RawReport.Length != 0) { - RawReport = other.RawReport; - } - if (other.observerAssociationAddress_ != null) { - if (observerAssociationAddress_ == null) { - ObserverAssociationAddress = new global::AElf.Types.Address(); - } - ObserverAssociationAddress.MergeFrom(other.ObserverAssociationAddress); - } - if (other.Token.Length != 0) { - Token = other.Token; - } - if (other.RoundId != 0L) { - RoundId = other.RoundId; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - RawReport = input.ReadString(); - break; - } - case 18: { - if (observerAssociationAddress_ == null) { - ObserverAssociationAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(ObserverAssociationAddress); - break; - } - case 26: { - Token = input.ReadString(); - break; - } - case 32: { - RoundId = input.ReadInt64(); - break; - } - } - } - } - - } - - public sealed partial class ReportConfirmed : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReportConfirmed()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[24]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReportConfirmed() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReportConfirmed(ReportConfirmed other) : this() { - roundId_ = other.roundId_; - signature_ = other.signature_; - observerAssociationAddress_ = other.observerAssociationAddress_ != null ? other.observerAssociationAddress_.Clone() : null; - token_ = other.token_; - isAllNodeConfirmed_ = other.isAllNodeConfirmed_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ReportConfirmed Clone() { - return new ReportConfirmed(this); - } - - /// Field number for the "round_id" field. - public const int RoundIdFieldNumber = 1; - private long roundId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long RoundId { - get { return roundId_; } - set { - roundId_ = value; - } - } - - /// Field number for the "signature" field. - public const int SignatureFieldNumber = 2; - private string signature_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Signature { - get { return signature_; } - set { - signature_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "observer_association_address" field. - public const int ObserverAssociationAddressFieldNumber = 3; - private global::AElf.Types.Address observerAssociationAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address ObserverAssociationAddress { - get { return observerAssociationAddress_; } - set { - observerAssociationAddress_ = value; - } - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 4; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "is_all_node_confirmed" field. - public const int IsAllNodeConfirmedFieldNumber = 5; - private bool isAllNodeConfirmed_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool IsAllNodeConfirmed { - get { return isAllNodeConfirmed_; } - set { - isAllNodeConfirmed_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ReportConfirmed); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ReportConfirmed other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (RoundId != other.RoundId) return false; - if (Signature != other.Signature) return false; - if (!object.Equals(ObserverAssociationAddress, other.ObserverAssociationAddress)) return false; - if (Token != other.Token) return false; - if (IsAllNodeConfirmed != other.IsAllNodeConfirmed) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (RoundId != 0L) hash ^= RoundId.GetHashCode(); - if (Signature.Length != 0) hash ^= Signature.GetHashCode(); - if (observerAssociationAddress_ != null) hash ^= ObserverAssociationAddress.GetHashCode(); - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (IsAllNodeConfirmed != false) hash ^= IsAllNodeConfirmed.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (RoundId != 0L) { - output.WriteRawTag(8); - output.WriteInt64(RoundId); - } - if (Signature.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Signature); - } - if (observerAssociationAddress_ != null) { - output.WriteRawTag(26); - output.WriteMessage(ObserverAssociationAddress); - } - if (Token.Length != 0) { - output.WriteRawTag(34); - output.WriteString(Token); - } - if (IsAllNodeConfirmed != false) { - output.WriteRawTag(40); - output.WriteBool(IsAllNodeConfirmed); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (RoundId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(RoundId); - } - if (Signature.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Signature); - } - if (observerAssociationAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ObserverAssociationAddress); - } - if (Token.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (IsAllNodeConfirmed != false) { - size += 1 + 1; - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ReportConfirmed other) { - if (other == null) { - return; - } - if (other.RoundId != 0L) { - RoundId = other.RoundId; - } - if (other.Signature.Length != 0) { - Signature = other.Signature; - } - if (other.observerAssociationAddress_ != null) { - if (observerAssociationAddress_ == null) { - ObserverAssociationAddress = new global::AElf.Types.Address(); - } - ObserverAssociationAddress.MergeFrom(other.ObserverAssociationAddress); - } - if (other.Token.Length != 0) { - Token = other.Token; - } - if (other.IsAllNodeConfirmed != false) { - IsAllNodeConfirmed = other.IsAllNodeConfirmed; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - RoundId = input.ReadInt64(); - break; - } - case 18: { - Signature = input.ReadString(); - break; - } - case 26: { - if (observerAssociationAddress_ == null) { - ObserverAssociationAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(ObserverAssociationAddress); - break; - } - case 34: { - Token = input.ReadString(); - break; - } - case 40: { - IsAllNodeConfirmed = input.ReadBool(); - break; - } - } - } - } - - } - - public sealed partial class OffChainAggregationRegistered : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OffChainAggregationRegistered()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[25]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OffChainAggregationRegistered() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OffChainAggregationRegistered(OffChainAggregationRegistered other) : this() { - token_ = other.token_; - offChainQueryInfoList_ = other.offChainQueryInfoList_ != null ? other.offChainQueryInfoList_.Clone() : null; - observerAssociationAddress_ = other.observerAssociationAddress_ != null ? other.observerAssociationAddress_.Clone() : null; - configDigest_ = other.configDigest_; - aggregateThreshold_ = other.aggregateThreshold_; - aggregatorContractAddress_ = other.aggregatorContractAddress_ != null ? other.aggregatorContractAddress_.Clone() : null; - chainType_ = other.chainType_; - register_ = other.register_ != null ? other.register_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OffChainAggregationRegistered Clone() { - return new OffChainAggregationRegistered(this); - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 1; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "off_chain_query_info_list" field. - public const int OffChainQueryInfoListFieldNumber = 2; - private global::AElf.Contracts.Report.OffChainQueryInfoList offChainQueryInfoList_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Contracts.Report.OffChainQueryInfoList OffChainQueryInfoList { - get { return offChainQueryInfoList_; } - set { - offChainQueryInfoList_ = value; - } - } - - /// Field number for the "observer_association_address" field. - public const int ObserverAssociationAddressFieldNumber = 3; - private global::AElf.Types.Address observerAssociationAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address ObserverAssociationAddress { - get { return observerAssociationAddress_; } - set { - observerAssociationAddress_ = value; - } - } - - /// Field number for the "config_digest" field. - public const int ConfigDigestFieldNumber = 4; - private pb::ByteString configDigest_ = pb::ByteString.Empty; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString ConfigDigest { - get { return configDigest_; } - set { - configDigest_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "aggregate_threshold" field. - public const int AggregateThresholdFieldNumber = 5; - private int aggregateThreshold_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int AggregateThreshold { - get { return aggregateThreshold_; } - set { - aggregateThreshold_ = value; - } - } - - /// Field number for the "aggregator_contract_address" field. - public const int AggregatorContractAddressFieldNumber = 6; - private global::AElf.Types.Address aggregatorContractAddress_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address AggregatorContractAddress { - get { return aggregatorContractAddress_; } - set { - aggregatorContractAddress_ = value; - } - } - - /// Field number for the "chain_type" field. - public const int ChainTypeFieldNumber = 7; - private string chainType_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ChainType { - get { return chainType_; } - set { - chainType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "register" field. - public const int RegisterFieldNumber = 8; - private global::AElf.Types.Address register_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::AElf.Types.Address Register { - get { return register_; } - set { - register_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as OffChainAggregationRegistered); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(OffChainAggregationRegistered other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Token != other.Token) return false; - if (!object.Equals(OffChainQueryInfoList, other.OffChainQueryInfoList)) return false; - if (!object.Equals(ObserverAssociationAddress, other.ObserverAssociationAddress)) return false; - if (ConfigDigest != other.ConfigDigest) return false; - if (AggregateThreshold != other.AggregateThreshold) return false; - if (!object.Equals(AggregatorContractAddress, other.AggregatorContractAddress)) return false; - if (ChainType != other.ChainType) return false; - if (!object.Equals(Register, other.Register)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (offChainQueryInfoList_ != null) hash ^= OffChainQueryInfoList.GetHashCode(); - if (observerAssociationAddress_ != null) hash ^= ObserverAssociationAddress.GetHashCode(); - if (ConfigDigest.Length != 0) hash ^= ConfigDigest.GetHashCode(); - if (AggregateThreshold != 0) hash ^= AggregateThreshold.GetHashCode(); - if (aggregatorContractAddress_ != null) hash ^= AggregatorContractAddress.GetHashCode(); - if (ChainType.Length != 0) hash ^= ChainType.GetHashCode(); - if (register_ != null) hash ^= Register.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Token.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Token); - } - if (offChainQueryInfoList_ != null) { - output.WriteRawTag(18); - output.WriteMessage(OffChainQueryInfoList); - } - if (observerAssociationAddress_ != null) { - output.WriteRawTag(26); - output.WriteMessage(ObserverAssociationAddress); - } - if (ConfigDigest.Length != 0) { - output.WriteRawTag(34); - output.WriteBytes(ConfigDigest); - } - if (AggregateThreshold != 0) { - output.WriteRawTag(40); - output.WriteInt32(AggregateThreshold); - } - if (aggregatorContractAddress_ != null) { - output.WriteRawTag(50); - output.WriteMessage(AggregatorContractAddress); - } - if (ChainType.Length != 0) { - output.WriteRawTag(58); - output.WriteString(ChainType); - } - if (register_ != null) { - output.WriteRawTag(66); - output.WriteMessage(Register); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Token.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (offChainQueryInfoList_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OffChainQueryInfoList); - } - if (observerAssociationAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ObserverAssociationAddress); - } - if (ConfigDigest.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(ConfigDigest); - } - if (AggregateThreshold != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(AggregateThreshold); - } - if (aggregatorContractAddress_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(AggregatorContractAddress); - } - if (ChainType.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ChainType); - } - if (register_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Register); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(OffChainAggregationRegistered other) { - if (other == null) { - return; - } - if (other.Token.Length != 0) { - Token = other.Token; - } - if (other.offChainQueryInfoList_ != null) { - if (offChainQueryInfoList_ == null) { - OffChainQueryInfoList = new global::AElf.Contracts.Report.OffChainQueryInfoList(); - } - OffChainQueryInfoList.MergeFrom(other.OffChainQueryInfoList); - } - if (other.observerAssociationAddress_ != null) { - if (observerAssociationAddress_ == null) { - ObserverAssociationAddress = new global::AElf.Types.Address(); - } - ObserverAssociationAddress.MergeFrom(other.ObserverAssociationAddress); - } - if (other.ConfigDigest.Length != 0) { - ConfigDigest = other.ConfigDigest; - } - if (other.AggregateThreshold != 0) { - AggregateThreshold = other.AggregateThreshold; - } - if (other.aggregatorContractAddress_ != null) { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - AggregatorContractAddress.MergeFrom(other.AggregatorContractAddress); - } - if (other.ChainType.Length != 0) { - ChainType = other.ChainType; - } - if (other.register_ != null) { - if (register_ == null) { - Register = new global::AElf.Types.Address(); - } - Register.MergeFrom(other.Register); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Token = input.ReadString(); - break; - } - case 18: { - if (offChainQueryInfoList_ == null) { - OffChainQueryInfoList = new global::AElf.Contracts.Report.OffChainQueryInfoList(); - } - input.ReadMessage(OffChainQueryInfoList); - break; - } - case 26: { - if (observerAssociationAddress_ == null) { - ObserverAssociationAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(ObserverAssociationAddress); - break; - } - case 34: { - ConfigDigest = input.ReadBytes(); - break; - } - case 40: { - AggregateThreshold = input.ReadInt32(); - break; - } - case 50: { - if (aggregatorContractAddress_ == null) { - AggregatorContractAddress = new global::AElf.Types.Address(); - } - input.ReadMessage(AggregatorContractAddress); - break; - } - case 58: { - ChainType = input.ReadString(); - break; - } - case 66: { - if (register_ == null) { - Register = new global::AElf.Types.Address(); - } - input.ReadMessage(Register); - break; - } - } - } - } - - } - - public sealed partial class MerkleReportNodeAdded : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MerkleReportNodeAdded()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::AElf.Contracts.Report.ReportContractReflection.Descriptor.MessageTypes[26]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MerkleReportNodeAdded() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MerkleReportNodeAdded(MerkleReportNodeAdded other) : this() { - token_ = other.token_; - nodeIndex_ = other.nodeIndex_; - nodeRoundId_ = other.nodeRoundId_; - aggregatedData_ = other.aggregatedData_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public MerkleReportNodeAdded Clone() { - return new MerkleReportNodeAdded(this); - } - - /// Field number for the "token" field. - public const int TokenFieldNumber = 1; - private string token_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Token { - get { return token_; } - set { - token_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "node_index" field. - public const int NodeIndexFieldNumber = 2; - private int nodeIndex_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int NodeIndex { - get { return nodeIndex_; } - set { - nodeIndex_ = value; - } - } - - /// Field number for the "node_round_id" field. - public const int NodeRoundIdFieldNumber = 3; - private long nodeRoundId_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long NodeRoundId { - get { return nodeRoundId_; } - set { - nodeRoundId_ = value; - } - } - - /// Field number for the "aggregated_data" field. - public const int AggregatedDataFieldNumber = 4; - private string aggregatedData_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string AggregatedData { - get { return aggregatedData_; } - set { - aggregatedData_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as MerkleReportNodeAdded); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(MerkleReportNodeAdded other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Token != other.Token) return false; - if (NodeIndex != other.NodeIndex) return false; - if (NodeRoundId != other.NodeRoundId) return false; - if (AggregatedData != other.AggregatedData) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Token.Length != 0) hash ^= Token.GetHashCode(); - if (NodeIndex != 0) hash ^= NodeIndex.GetHashCode(); - if (NodeRoundId != 0L) hash ^= NodeRoundId.GetHashCode(); - if (AggregatedData.Length != 0) hash ^= AggregatedData.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Token.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Token); - } - if (NodeIndex != 0) { - output.WriteRawTag(16); - output.WriteInt32(NodeIndex); - } - if (NodeRoundId != 0L) { - output.WriteRawTag(24); - output.WriteInt64(NodeRoundId); - } - if (AggregatedData.Length != 0) { - output.WriteRawTag(34); - output.WriteString(AggregatedData); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Token.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Token); - } - if (NodeIndex != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(NodeIndex); - } - if (NodeRoundId != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(NodeRoundId); - } - if (AggregatedData.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(AggregatedData); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(MerkleReportNodeAdded other) { - if (other == null) { - return; - } - if (other.Token.Length != 0) { - Token = other.Token; - } - if (other.NodeIndex != 0) { - NodeIndex = other.NodeIndex; - } - if (other.NodeRoundId != 0L) { - NodeRoundId = other.NodeRoundId; - } - if (other.AggregatedData.Length != 0) { - AggregatedData = other.AggregatedData; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Token = input.ReadString(); - break; - } - case 16: { - NodeIndex = input.ReadInt32(); - break; - } - case 24: { - NodeRoundId = input.ReadInt64(); - break; - } - case 34: { - AggregatedData = input.ReadString(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/src/AElf.EventHandler/EventHandlerAppHostedService.cs b/src/AElf.EventHandler/EventHandlerAppHostedService.cs index c31ed058..638a399b 100644 --- a/src/AElf.EventHandler/EventHandlerAppHostedService.cs +++ b/src/AElf.EventHandler/EventHandlerAppHostedService.cs @@ -2,63 +2,54 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using AElf.Client.Core.Options; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Volo.Abp; -namespace AElf.EventHandler -{ - public class EventHandlerAppHostedService : IHostedService - { - private readonly IAbpApplicationWithExternalServiceProvider _application; - private readonly IServiceProvider _serviceProvider; - private readonly ILogger _logger; - - public EventHandlerAppHostedService( - IAbpApplicationWithExternalServiceProvider application, - IServiceProvider serviceProvider, ILogger logger) - { - _application = application; - _serviceProvider = serviceProvider; - _logger = logger; - } +namespace AElf.EventHandler; - public Task StartAsync(CancellationToken cancellationToken) - { - _application.Initialize(_serviceProvider); - - var configOptions = _serviceProvider.GetRequiredService>().Value; - var nodeManager = new NodeManager(configOptions.BlockChainEndpoint, configOptions.AccountAddress, - configOptions.AccountPassword); - if (!nodeManager.TransactionManager.IsKeyReady()) - { - _logger.LogError("Something wrong with key store."); - return Task.CompletedTask; - } - - var contractAddressOptions = - _serviceProvider.GetRequiredService>().Value; - _logger.LogInformation( - $"ContractAddressOptions contains: {contractAddressOptions.ContractAddressMap.Keys.Aggregate("", (t, n) => $"{t}\t{n}")}"); +public class EventHandlerAppHostedService : IHostedService +{ + private readonly IAbpApplicationWithExternalServiceProvider _application; + private readonly IServiceProvider _serviceProvider; + private readonly ILogger _logger; - var messageQueueOptions = - _serviceProvider.GetRequiredService>().Value; - _logger.LogInformation($"Message Queue Configs:\n" + - $"HostName: {messageQueueOptions.HostName}\n" + - $"Uri: {messageQueueOptions.Uri}\n" + - $"Port:{messageQueueOptions.Port}\n" + - $"ClientName: {messageQueueOptions.ClientName}\n" + - $"ExchangeName: {messageQueueOptions.ExchangeName}"); + public EventHandlerAppHostedService( + IAbpApplicationWithExternalServiceProvider application, + IServiceProvider serviceProvider, ILogger logger) + { + _application = application; + _serviceProvider = serviceProvider; + _logger = logger; + } - return Task.CompletedTask; - } + public Task StartAsync(CancellationToken cancellationToken) + { + _application.Initialize(_serviceProvider); + + var contractAddressOptions = + _serviceProvider.GetRequiredService>().Value; + _logger.LogInformation( + $"AElfContractOptions contains: {contractAddressOptions.ContractAddressList.Keys.Aggregate("", (t, n) => $"{t}\t{n}")}"); + + var messageQueueOptions = + _serviceProvider.GetRequiredService>().Value; + _logger.LogInformation($"Message Queue Configs:\n" + + $"HostName: {messageQueueOptions.HostName}\n" + + $"Uri: {messageQueueOptions.Uri}\n" + + $"Port:{messageQueueOptions.Port}\n" + + $"ClientName: {messageQueueOptions.ClientName}\n" + + $"ExchangeName: {messageQueueOptions.ExchangeName}"); + + return Task.CompletedTask; + } - public Task StopAsync(CancellationToken cancellationToken) - { - _application.Shutdown(); - return Task.CompletedTask; - } + public Task StopAsync(CancellationToken cancellationToken) + { + _application.Shutdown(); + return Task.CompletedTask; } } \ No newline at end of file diff --git a/src/AElf.EventHandler/EventHandlerAppModule.cs b/src/AElf.EventHandler/EventHandlerAppModule.cs index 09edbcdc..1676431e 100644 --- a/src/AElf.EventHandler/EventHandlerAppModule.cs +++ b/src/AElf.EventHandler/EventHandlerAppModule.cs @@ -1,8 +1,10 @@ using System; using System.Net.Security; using System.Security.Authentication; -using AElf.Contracts.Consensus.AEDPoS; -using Common.Logging; +using AElf.Client.Core; +using AElf.Client.Oracle; +using AElf.Client.Report; +using AElf.Nethereum.Core; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using RabbitMQ.Client; @@ -11,56 +13,56 @@ using Volo.Abp.Modularity; using Volo.Abp.RabbitMQ; -namespace AElf.EventHandler +namespace AElf.EventHandler; + +[DependsOn( + typeof(AbpAutofacModule), + typeof(AbpEventBusRabbitMqModule), + typeof(AElfClientModule), + typeof(AElfClientOracleModule), + typeof(AElfClientReportModule), + typeof(AElfNethereumClientModule) +)] +public class EventHandlerAppModule : AbpModule { - [DependsOn( - typeof(AbpAutofacModule), - typeof(AbpEventBusRabbitMqModule) - )] - public class EventHandlerAppModule : AbpModule + public override void ConfigureServices(ServiceConfigurationContext context) { - public override void ConfigureServices(ServiceConfigurationContext context) - { - var configuration = context.Services.GetConfiguration(); + var configuration = context.Services.GetConfiguration(); - // Just for logging. - Configure(options => { configuration.GetSection("MessageQueue").Bind(options); }); + // Just for logging. + Configure(options => { configuration.GetSection("MessageQueue").Bind(options); }); - Configure(options => - { - var messageQueueConfig = configuration.GetSection("MessageQueue"); - options.ClientName = messageQueueConfig.GetSection("ClientName").Value; - options.ExchangeName = messageQueueConfig.GetSection("ExchangeName").Value; - }); + Configure(options => + { + var messageQueueConfig = configuration.GetSection("MessageQueue"); + options.ClientName = messageQueueConfig.GetSection("ClientName").Value; + options.ExchangeName = messageQueueConfig.GetSection("ExchangeName").Value; + }); - Configure(options => - { - var messageQueueConfig = configuration.GetSection("MessageQueue"); - var hostName = messageQueueConfig.GetSection("HostName").Value; + Configure(options => + { + var messageQueueConfig = configuration.GetSection("MessageQueue"); + var hostName = messageQueueConfig.GetSection("HostName").Value; - options.Connections.Default.HostName = hostName; - options.Connections.Default.Port = int.Parse(messageQueueConfig.GetSection("Port").Value); - options.Connections.Default.UserName = messageQueueConfig.GetSection("UserName").Value; - options.Connections.Default.Password = messageQueueConfig.GetSection("Password").Value; - options.Connections.Default.Ssl = new SslOption - { - Enabled = true, - ServerName = hostName, - Version = SslProtocols.Tls12, - AcceptablePolicyErrors = SslPolicyErrors.RemoteCertificateNameMismatch | - SslPolicyErrors.RemoteCertificateChainErrors - }; - options.Connections.Default.VirtualHost = "/"; - options.Connections.Default.Uri = new Uri(messageQueueConfig.GetSection("Uri").Value); - }); + options.Connections.Default.HostName = hostName; + options.Connections.Default.Port = int.Parse(messageQueueConfig.GetSection("Port").Value); + options.Connections.Default.UserName = messageQueueConfig.GetSection("UserName").Value; + options.Connections.Default.Password = messageQueueConfig.GetSection("Password").Value; + options.Connections.Default.Ssl = new SslOption + { + Enabled = true, + ServerName = hostName, + Version = SslProtocols.Tls12, + AcceptablePolicyErrors = SslPolicyErrors.RemoteCertificateNameMismatch | + SslPolicyErrors.RemoteCertificateChainErrors + }; + options.Connections.Default.VirtualHost = "/"; + options.Connections.Default.Uri = new Uri(messageQueueConfig.GetSection("Uri").Value); + }); - Configure(configuration.GetSection("Contracts")); - Configure(configuration.GetSection("Config")); - Configure(configuration.GetSection("Ethereum")); - Configure(configuration.GetSection("ContractAbi")); - Configure(configuration.GetSection("Lottery")); - context.Services.AddHostedService(); - context.Services.AddTransient(typeof(ILogEventProcessor<>), typeof(LogEventProcessorBase<>)); - } + Configure(configuration.GetSection("Config")); + Configure(configuration.GetSection("Ethereum")); + context.Services.AddHostedService(); + context.Services.AddTransient(typeof(ILogEventProcessor<>), typeof(LogEventProcessorBase<>)); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Helpers/DrawHelper.cs b/src/AElf.EventHandler/Helpers/DrawHelper.cs deleted file mode 100644 index b6051cd1..00000000 --- a/src/AElf.EventHandler/Helpers/DrawHelper.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using AElf.Contracts.Lottery; -using AElf.Kernel; -using Google.Protobuf; -using Google.Protobuf.WellKnownTypes; - -namespace AElf.EventHandler -{ - public class DrawHelper - { - private static int _drewPeriod; - - public static bool TryToDrawLottery(string url, LotteryOptions lotteryOptions, out int period, out string txId) - { - _drewPeriod = lotteryOptions.LatestDrewPeriod == 0 ? _drewPeriod : lotteryOptions.LatestDrewPeriod; - txId = string.Empty; - var nodeManager = new NodeManager(url, lotteryOptions.AccountAddress, lotteryOptions.AccountPassword); - var duration = TimestampHelper.GetUtcNow() - - TimestampHelper.DurationFromSeconds(lotteryOptions.StartTimestamp); - CalculateDrawInfo(duration, - lotteryOptions.IntervalMinutes, out var isDraw, out period); - if (!isDraw || !lotteryOptions.IsDrawLottery) return false; - - txId = nodeManager.SendTransaction(lotteryOptions.AccountAddress, lotteryOptions.LotteryContractAddress, - "Draw", new DrawInput - { - PeriodId = period - }); - - return true; - } - - private static void CalculateDrawInfo(Timestamp duration, long intervalMinutes, out bool isDraw, out int period) - { - period = (int)(duration.Seconds / 60 / intervalMinutes); - if (_drewPeriod >= period) - { - period = 0; - isDraw = false; - return; - } - - _drewPeriod = period; - isDraw = true; - } - } -} \ No newline at end of file diff --git a/src/AElf.EventHandler/Managers/AccountManager.cs b/src/AElf.EventHandler/Managers/AccountManager.cs deleted file mode 100644 index a25e2325..00000000 --- a/src/AElf.EventHandler/Managers/AccountManager.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Net; -using System.Security; -using AElf; -using AElf.Cryptography.ECDSA; -using AElf.Types; -using Volo.Abp.Threading; - -namespace AElf.EventHandler -{ - public class AccountManager - { - private readonly AElfKeyStore _keyStore; - private List _accounts; - private const string DefaultPassword = "123456789"; - - public AccountManager(AElfKeyStore keyStore) - { - _keyStore = keyStore; - _accounts = AsyncHelper.RunSync(_keyStore.GetAccountsAsync); - } - - public string NewAccount(string password = "") - { - if (password == "") - password = DefaultPassword; - - if (password == "") - password = AskInvisible("password:"); - - var keyPair = AsyncHelper.RunSync(() => _keyStore.CreateAccountKeyPairAsync(password)); - var pubKey = keyPair.PublicKey; - var address = Address.FromPublicKey(pubKey); - - var accountInfo = address.ToBase58(); - _accounts.Add(accountInfo); - - return accountInfo; - } - - public List ListAccount() - { - _accounts = AsyncHelper.RunSync(_keyStore.GetAccountsAsync); - return _accounts; - } - - public bool UnlockAccount(string address, string password = "") - { - if (password == "") - password = DefaultPassword; - - if (_accounts == null || _accounts.Count == 0) - { - return false; - } - - if (!_accounts.Contains(address)) - { - return false; - } - - var tryOpen = AsyncHelper.RunSync(() => _keyStore.UnlockAccountAsync(false)); - - switch (tryOpen) - { - case KeyStoreErrors.WrongPassword: - break; - case KeyStoreErrors.AccountAlreadyUnlocked: - return true; - case KeyStoreErrors.None: - return true; - case KeyStoreErrors.WrongAccountFormat: - break; - case KeyStoreErrors.AccountFileNotFound: - break; - default: - throw new ArgumentOutOfRangeException(); - } - - return false; - } - - public string GetPublicKey(string address, string password = "") - { - if (password == "") - password = DefaultPassword; - - UnlockAccount(address, password); - var keyPair = GetKeyPair(address, password); - return keyPair.PublicKey.ToHex(); - } - - public bool AccountIsExist(string address) - { - if (_accounts == null) - ListAccount(); - - return _accounts.Contains(address); - } - - private ECKeyPair GetKeyPair(string addr, string password) - { - var kp = _keyStore.GetAccountKeyPair(); - return kp; - } - - private static string AskInvisible(string prefix) - { - Console.WriteLine(prefix); - - var pwd = new SecureString(); - while (true) - { - var i = Console.ReadKey(true); - if (i.Key == ConsoleKey.Enter) break; - - if (i.Key == ConsoleKey.Backspace) - { - if (pwd.Length > 0) pwd.RemoveAt(pwd.Length - 1); - } - else - { - pwd.AppendChar(i.KeyChar); - } - } - - Console.WriteLine(); - - return new NetworkCredential("", pwd).Password; - } - } -} \ No newline at end of file diff --git a/src/AElf.EventHandler/Managers/KeyAccount/AElfKeyStore.cs b/src/AElf.EventHandler/Managers/KeyAccount/AElfKeyStore.cs deleted file mode 100644 index fea683db..00000000 --- a/src/AElf.EventHandler/Managers/KeyAccount/AElfKeyStore.cs +++ /dev/null @@ -1,246 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using AElf.Cryptography; -using AElf.Cryptography.ECDSA; -using AElf.Cryptography.Exceptions; -using AElf.Types; -using Microsoft.Extensions.Options; -using Nethereum.KeyStore; -using Nethereum.KeyStore.Crypto; -using Volo.Abp.Threading; - -namespace AElf.EventHandler -{ - public enum KeyStoreErrors - { - None = 0, - AccountAlreadyUnlocked = 1, - WrongPassword = 2, - WrongAccountFormat = 3, - AccountFileNotFound = 4 - } - - public class AElfKeyStore : IKeyStore - { - private const string KeyFileExtension = ".json"; - private const string KeyFolderName = "keys"; - - private static AElfKeyStore _keyStore; - private readonly KeyStoreService _keyStoreService; - - private readonly List _unlockedAccounts; - - private readonly string _dataDirectory; - private readonly string _address; - private readonly string _password; - public readonly AccountInfoCache CacheAccount; - public TimeSpan DefaultTimeoutToClose = TimeSpan.FromMinutes(10); //in order to customize time setting. - - private AElfKeyStore(string address, string password, string dataDirectory) - { - _dataDirectory = dataDirectory; - _address = address; - _password = password; - CacheAccount = new AccountInfoCache(); - _unlockedAccounts = new List(); - _keyStoreService = new KeyStoreService(); - } - - public async Task UnlockAccountAsync(bool withTimeout = true) - { - try - { - if (_unlockedAccounts.Any(x => x.AccountName == _address)) - return KeyStoreErrors.AccountAlreadyUnlocked; - - if (withTimeout) - await UnlockAccountAsync(_address, _password, DefaultTimeoutToClose); - else - await UnlockAccountAsync(_address, _password, null); - } - catch (InvalidPasswordException) - { - return KeyStoreErrors.WrongPassword; - } - catch (KeyStoreNotFoundException) - { - return KeyStoreErrors.AccountFileNotFound; - } - - return KeyStoreErrors.None; - } - - public ECKeyPair GetAccountKeyPair() - { - var kp = _unlockedAccounts.FirstOrDefault(oa => oa.AccountName == _address)?.KeyPair; - if (kp == null) - { - AsyncHelper.RunSync(() => UnlockAccountAsync()); - kp = _unlockedAccounts.FirstOrDefault(oa => oa.AccountName == _address)?.KeyPair; - } - - return kp; - } - - public async Task CreateAccountKeyPairAsync(string password) - { - var keyPair = CryptoHelper.GenerateKeyPair(); - var res = await WriteKeyPairAsync(keyPair, password); - return !res ? null : keyPair; - } - - public async Task> GetAccountsAsync() - { - var dir = CreateKeystoreDirectory(); - var files = dir.GetFiles("*" + KeyFileExtension); - var accounts = new List(); - foreach (var file in files) - { - if (file.Length == 0) - { - File.Delete(file.FullName); //delete empty account files - continue; - } - - accounts.Add(Path.GetFileNameWithoutExtension(file.Name)); - } - - return await Task.FromResult(accounts); - } - - public static AElfKeyStore GetKeyStore(string address, string password, string dataDirectory = "") - { - if (dataDirectory == "") - dataDirectory = CommonHelper.GetCurrentDataDir(); - - if (_keyStore != null && _keyStore._dataDirectory == dataDirectory && _keyStore._address == address) - return _keyStore; - - _keyStore = new AElfKeyStore(address, password, dataDirectory); - - return _keyStore; - } - - private async Task UnlockAccountAsync(string address, string password, TimeSpan? timeoutToClose) - { - var keyPair = await ReadKeyPairAsync(address, password); - var unlockedAccount = new Account(address) {KeyPair = keyPair}; - - if (timeoutToClose.HasValue) - { - var t = new Timer(LockAccount, unlockedAccount, timeoutToClose.Value, timeoutToClose.Value); - unlockedAccount.LockTimer = t; - } - - _unlockedAccounts.Add(unlockedAccount); - } - - private void LockAccount(object accountObject) - { - if (!(accountObject is Account unlockedAccount)) - return; - unlockedAccount.Lock(); - _unlockedAccounts.Remove(unlockedAccount); - } - - public async Task ReadKeyPairAsync(string address, string password) - { - try - { - if (!CacheAccount.ReadCache(address, out var privateKey)) - { - var keyFilePath = GetKeyFileFullPath(address); - privateKey = await Task.Run(() => - { - using (var textReader = File.OpenText(keyFilePath)) - { - var json = textReader.ReadToEnd(); - return _keyStoreService.DecryptKeyStoreFromJson(password, json); - } - }); - //save cache info - await CacheAccount.WriteCache(address, privateKey); - } - - return CryptoHelper.FromPrivateKey(privateKey); - } - catch (FileNotFoundException ex) - { - throw new KeyStoreNotFoundException("Keystore file not found.", ex); - } - catch (DirectoryNotFoundException ex) - { - throw new KeyStoreNotFoundException("Invalid keystore path.", ex); - } - catch (DecryptionException ex) - { - throw new InvalidPasswordException("Invalid password.", ex); - } - } - - private async Task WriteKeyPairAsync(ECKeyPair keyPair, string password) - { - if (keyPair?.PrivateKey == null || keyPair.PublicKey == null) - throw new InvalidKeyPairException("Invalid keypair (null reference).", null); - - // Ensure path exists - CreateKeystoreDirectory(); - - var address = Address.FromPublicKey(keyPair.PublicKey); - var fullPath = GetKeyFileFullPath(address.ToBase58()); - //save cache - await CacheAccount.WriteCache(address.ToBase58(), keyPair.PrivateKey); - - await Task.Run(() => - { - using var writer = File.CreateText(fullPath); - string scryptResult; - while (true) - { - scryptResult = _keyStoreService.EncryptAndGenerateDefaultKeyStoreAsJson(password, - keyPair.PrivateKey, - address.ToBase58()); - if (!scryptResult.IsNullOrWhiteSpace()) - break; - } - - writer.Write(scryptResult); - writer.Flush(); - }); - - return true; - } - - /// - /// Return the full path of the files - /// - private string GetKeyFileFullPath(string address) - { - var path = GetKeyFileFullPathStrict(address); - return File.Exists(path) ? path : GetKeyFileFullPathStrict(address); - } - - private string GetKeyFileFullPathStrict(string address) - { - var dirPath = GetKeystoreDirectoryPath(); - var filePath = Path.Combine(dirPath, address); - var filePathWithExtension = Path.ChangeExtension(filePath, KeyFileExtension); - return filePathWithExtension; - } - - private DirectoryInfo CreateKeystoreDirectory() - { - var dirPath = GetKeystoreDirectoryPath(); - return Directory.CreateDirectory(dirPath); - } - - private string GetKeystoreDirectoryPath() - { - return Path.Combine(_dataDirectory, KeyFolderName); - } - } -} \ No newline at end of file diff --git a/src/AElf.EventHandler/Managers/KeyAccount/Account.cs b/src/AElf.EventHandler/Managers/KeyAccount/Account.cs deleted file mode 100644 index 2b01d27d..00000000 --- a/src/AElf.EventHandler/Managers/KeyAccount/Account.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Threading; -using AElf.Cryptography.ECDSA; - -namespace AElf.EventHandler -{ - public class Account - { - public Account(string address) - { - AccountName = address; - } - - // Close account when time out - public Timer LockTimer { private get; set; } - public ECKeyPair KeyPair { get; set; } - public string AccountName { get; } - - public void Lock() - { - LockTimer.Dispose(); - } - } -} \ No newline at end of file diff --git a/src/AElf.EventHandler/Managers/KeyAccount/AccountCache.cs b/src/AElf.EventHandler/Managers/KeyAccount/AccountCache.cs deleted file mode 100644 index b28a9a2e..00000000 --- a/src/AElf.EventHandler/Managers/KeyAccount/AccountCache.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.IO; -using System.Threading.Tasks; -using AElf; -using AElf.Cryptography; - -namespace AElf.EventHandler -{ - public class AccountInfo - { - public AccountInfo(string account, string privateKey, string publicKey) - { - Account = account; - PrivateKey = privateKey; - PublicKey = publicKey; - } - - public string Account { get; set; } - public string PrivateKey { get; set; } - public string PublicKey { get; set; } - } - - public class AccountInfoCache - { - private const string KeyCacheExtension = ".cache"; - private const string KeyFolderName = "keys"; - - public AccountInfoCache() - { - KeyPath = Path.Combine(CommonHelper.GetCurrentDataDir(), KeyFolderName); - } - - public string KeyPath { get; set; } - - public async Task WriteCache(string account, byte[] privateKeyBytes) - { - var privateKey = privateKeyBytes.ToHex(); - var keyPair = CryptoHelper.FromPrivateKey(privateKeyBytes); - var publicKeyBytes = keyPair.PublicKey; - var publicKey = publicKeyBytes.ToHex(); - - var accountInfo = new AccountInfo(account, privateKey, publicKey); - await WriteCache(accountInfo); - } - - public bool ReadCache(string account, out byte[] privateKeyBytes) - { - privateKeyBytes = null; - var result = TryGetCache(account, out var info); - if (result) - { - privateKeyBytes = ByteArrayHelper.HexStringToByteArray(info.PrivateKey); - return true; - } - - return false; - } - - private async Task WriteCache(AccountInfo info) - { - var fullName = Path.Combine(KeyPath, $"{info.Account}{KeyCacheExtension}"); - await Task.Run(() => - { - using (var writer = File.CreateText(fullName)) - { - var content = $"{info.PrivateKey} {info.PublicKey}"; - writer.Write(content); - writer.Flush(); - } - }); - } - - private bool TryGetCache(string account, out AccountInfo info) - { - info = null; - var fullName = Path.Combine(KeyPath, $"{account}{KeyCacheExtension}"); - if (File.Exists(fullName)) - { - var content = File.ReadAllText(fullName); - var infoArray = content.Split(" "); - info = new AccountInfo(account, infoArray[0], infoArray[1]); - - return true; - } - - return false; - } - } -} \ No newline at end of file diff --git a/src/AElf.EventHandler/Managers/KeyAccount/IKeyStore.cs b/src/AElf.EventHandler/Managers/KeyAccount/IKeyStore.cs deleted file mode 100644 index d1a99a9c..00000000 --- a/src/AElf.EventHandler/Managers/KeyAccount/IKeyStore.cs +++ /dev/null @@ -1,9 +0,0 @@ -using AElf.Cryptography.ECDSA; - -namespace AElf.EventHandler -{ - public interface IKeyStore - { - ECKeyPair GetAccountKeyPair(); - } -} \ No newline at end of file diff --git a/src/AElf.EventHandler/Managers/KeyAccount/Password.cs b/src/AElf.EventHandler/Managers/KeyAccount/Password.cs deleted file mode 100644 index 6911b49a..00000000 --- a/src/AElf.EventHandler/Managers/KeyAccount/Password.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Org.BouncyCastle.OpenSsl; - -namespace AElf.EventHandler -{ - public class Password : IPasswordFinder - { - private readonly char[] _password; - - public Password(char[] word) - { - _password = (char[]) word.Clone(); - } - - public char[] GetPassword() - { - return (char[]) _password.Clone(); - } - } -} \ No newline at end of file diff --git a/src/AElf.EventHandler/Managers/NodeManager.cs b/src/AElf.EventHandler/Managers/NodeManager.cs deleted file mode 100644 index f9b6a640..00000000 --- a/src/AElf.EventHandler/Managers/NodeManager.cs +++ /dev/null @@ -1,383 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Threading; -using AElf.Client.Dto; -using AElf.Client.Service; -using AElf.Types; -using Google.Protobuf; -using Volo.Abp.Threading; - -namespace AElf.EventHandler -{ - public class NodeManager - { - public NodeManager(string baseUrl, string address, string password, string keyPath = "") - { - _baseUrl = baseUrl; - _keyStore = AElfKeyStore.GetKeyStore(address, password, keyPath); - ApiClient = AElfClientExtension.GetClient(baseUrl); - var check = AsyncHelper.RunSync(() => ApiClient.IsConnectedAsync()); - _chainId = GetChainId(); - } - - public string GetApiUrl() - { - return _baseUrl; - } - - public bool UpdateApiUrl(string url) - { - _baseUrl = url; - ApiClient = AElfClientExtension.GetClient(url); - var check = AsyncHelper.RunSync(() => ApiClient.IsConnectedAsync()); - if (!check) - { - return false; - } - - _chainId = GetChainId(); - - return true; - } - - public string GetChainId() - { - if (_chainId != null) - return _chainId; - - var chainStatus = AsyncHelper.RunSync(ApiClient.GetChainStatusAsync); - _chainId = chainStatus.ChainId; - - return _chainId; - } - - public string GetGenesisContractAddress() - { - if (_genesisAddress != null) return _genesisAddress; - - var statusDto = AsyncHelper.RunSync(ApiClient.GetChainStatusAsync); - _genesisAddress = statusDto.GenesisContractAddress; - - return _genesisAddress; - } - - private string CallTransaction(Transaction tx) - { - var rawTransaction = TransactionManager.ConvertTransactionRawTxString(tx); - return AsyncHelper.RunSync(() => ApiClient.ExecuteTransactionAsync(new ExecuteTransactionDto - { - RawTransaction = rawTransaction - })); - } - - private TransactionManager GetTransactionManager() - { - if (_transactionManager != null) return _transactionManager; - - _transactionManager = new TransactionManager(_keyStore); - return _transactionManager; - } - - private AccountManager GetAccountManager() - { - if (_accountManager != null) return _accountManager; - - _accountManager = new AccountManager(_keyStore); - return _accountManager; - } - - #region Properties - - private string _baseUrl; - private string _chainId; - private readonly AElfKeyStore _keyStore; - - private string _genesisAddress; - public string GenesisAddress => GetGenesisContractAddress(); - - private AccountManager _accountManager; - public AccountManager AccountManager => GetAccountManager(); - - private TransactionManager _transactionManager; - public TransactionManager TransactionManager => GetTransactionManager(); - public AElfClient ApiClient { get; set; } - - #endregion - - #region Account methods - - public string NewAccount(string password = "") - { - return AccountManager.NewAccount(password); - } - - public string GetRandomAccount() - { - var accounts = AccountManager.ListAccount(); - var retry = 0; - while (retry < 5) - { - retry++; - var randomId = CommonHelper.GenerateRandomNumber(0, accounts.Count); - var result = AccountManager.UnlockAccount(accounts[randomId]); - if (!result) continue; - - return accounts[randomId]; - } - - throw new Exception("Cannot got account with default password."); - } - - public string GetAccountPublicKey(string account, string password = "") - { - return AccountManager.GetPublicKey(account, password); - } - - public List ListAccounts() - { - return AccountManager.ListAccount(); - } - - public bool UnlockAccount(string account, string password = "") - { - return AccountManager.UnlockAccount(account, password); - } - - #endregion - - #region Web request methods - - public string SendTransaction(string from, string to, string methodName, IMessage inputParameter) - { - var rawTransaction = GenerateRawTransaction(from, to, methodName, inputParameter); - var transactionOutput = AsyncHelper.RunSync(() => ApiClient.SendTransactionAsync(new SendTransactionInput - { - RawTransaction = rawTransaction - })); - - return transactionOutput.TransactionId; - } - - public string SendTransaction(string rawTransaction) - { - return AsyncHelper.RunSync(() => ApiClient.SendTransactionAsync(new SendTransactionInput - { - RawTransaction = rawTransaction - })).TransactionId; - } - - public List SendTransactions(string rawTransactions) - { - var transactions = AsyncHelper.RunSync(() => ApiClient.SendTransactionsAsync(new SendTransactionsInput - { - RawTransactions = rawTransactions - })); - - return transactions.ToList(); - } - - private string GenerateRawTransaction(string from, string to, string methodName, IMessage inputParameter) - { - var tr = new Transaction - { - From = from.ConvertAddress(), - To = to.ConvertAddress(), - MethodName = methodName - }; - - if (tr.MethodName == null) - { - return string.Empty; - } - - tr.Params = inputParameter == null ? ByteString.Empty : inputParameter.ToByteString(); - tr = tr.AddBlockReference(_baseUrl, _chainId); - - TransactionManager.SignTransaction(tr); - - return tr.ToByteArray().ToHex(); - } - - public TransactionResultDto CheckTransactionResult(string txId, int maxSeconds = -1) - { - if (maxSeconds == -1) maxSeconds = 600; //check transaction result 10 minutes. - Thread.Sleep(1000); //wait 1 second ignore NotExisted result - var stopwatch = Stopwatch.StartNew(); - var pendingSource = new CancellationTokenSource(maxSeconds * 1000); - var notExistSource = new CancellationTokenSource(); - var compositeCancel = - CancellationTokenSource.CreateLinkedTokenSource(pendingSource.Token, notExistSource.Token); - var notExist = 0; - while (!compositeCancel.IsCancellationRequested) - { - TransactionResultDto transactionResult; - try - { - transactionResult = AsyncHelper.RunSync(() => ApiClient.GetTransactionResultAsync(txId)); - } - catch (Exception e) - { - Console.WriteLine(e); - Thread.Sleep(10000); - transactionResult = AsyncHelper.RunSync(() => ApiClient.GetTransactionResultAsync(txId)); - } - - var status = transactionResult.Status.ConvertTransactionResultStatus(); - string message; - string errorMsg; - switch (status) - { - case TransactionResultStatus.NodeValidationFailed: - message = $"Transaction {txId} status: {status}-[{transactionResult.GetTransactionFeeInfo()}]"; - errorMsg = transactionResult.Error.Contains("\n") - ? transactionResult.Error.Split("\n")[0] - : transactionResult.Error; - message += $"\r\nError Message: {errorMsg}"; - return transactionResult; - case TransactionResultStatus.NotExisted: - notExist++; - if (notExist >= 20) - notExistSource.Cancel(); //Continue check and if status 'NotExisted' and cancel check - break; - case TransactionResultStatus.PendingValidation: - case TransactionResultStatus.Pending: - if (notExist > 0) notExist = 0; - break; - case TransactionResultStatus.Mined: - Thread.Sleep(1000); //wait 1 second to wait set best chain - return transactionResult; - case TransactionResultStatus.Failed: - return transactionResult; - } - - Console.Write( - $"\rTransaction {txId} status: {status}, time using: {CommonHelper.ConvertMileSeconds(stopwatch.ElapsedMilliseconds)}"); - Thread.Sleep(1000); - } - - Console.WriteLine(); - throw new TimeoutException($"Transaction {txId} cannot be 'Mined' after long time."); - } - - public void CheckTransactionListResult(List transactionIds) - { - var transactionQueue = new ConcurrentQueue(); - transactionIds.ForEach(transactionQueue.Enqueue); - var stopwatch = Stopwatch.StartNew(); - while (transactionQueue.TryDequeue(out var transactionId)) - { - var id = transactionId; - TransactionResultDto transactionResult; - try - { - transactionResult = AsyncHelper.RunSync(() => ApiClient.GetTransactionResultAsync(id)); - } - catch (Exception e) - { - Console.WriteLine(e); - Thread.Sleep(5000); - transactionResult = AsyncHelper.RunSync(() => ApiClient.GetTransactionResultAsync(id)); - } - - var status = transactionResult.Status.ConvertTransactionResultStatus(); - switch (status) - { - case TransactionResultStatus.Pending: - case TransactionResultStatus.PendingValidation: - case TransactionResultStatus.NotExisted: - Console.Write( - $"\r[Processing]: TransactionId={id}, Status: {status}, using time:{CommonHelper.ConvertMileSeconds(stopwatch.ElapsedMilliseconds)}"); - transactionQueue.Enqueue(id); - Thread.Sleep(500); - break; - case TransactionResultStatus.NodeValidationFailed: - break; - case TransactionResultStatus.Mined: - Thread.Sleep(500); - break; - case TransactionResultStatus.Failed: - case TransactionResultStatus.Conflict: - break; - } - } - - stopwatch.Stop(); - } - - public T QueryView(string from, string to, string methodName, IMessage inputParameter) - where T : IMessage, new() - { - var transaction = new Transaction - { - From = from.ConvertAddress(), - To = to.ConvertAddress(), - MethodName = methodName, - Params = inputParameter == null ? ByteString.Empty : inputParameter.ToByteString() - }; - transaction = TransactionManager.SignTransaction(transaction); - - var resp = CallTransaction(transaction); - - //deserialize response - if (resp == null) - { - return default; - } - - var byteArray = ByteArrayHelper.HexStringToByteArray(resp); - var messageParser = new MessageParser(() => new T()); - - return messageParser.ParseFrom(byteArray); - } - - public ByteString QueryView(string from, string to, string methodName, IMessage inputParameter) - { - var transaction = new Transaction - { - From = from.ConvertAddress(), - To = to.ConvertAddress(), - MethodName = methodName, - Params = inputParameter == null ? ByteString.Empty : inputParameter.ToByteString() - }; - transaction = TransactionManager.SignTransaction(transaction); - - var resp = CallTransaction(transaction); - - //deserialize response - if (resp == null) - { - return default; - } - - var byteArray = ByteArrayHelper.HexStringToByteArray(resp); - - return ByteString.CopyFrom(byteArray); - } - - //Net Api - public List NetGetPeers() - { - return AsyncHelper.RunSync(() => ApiClient.GetPeersAsync(true)); - } - - public bool NetAddPeer(string address) - { - return AsyncHelper.RunSync(() => ApiClient.AddPeerAsync(address, string.Empty, string.Empty)); - } - - public bool NetRemovePeer(string address) - { - return AsyncHelper.RunSync(() => ApiClient.RemovePeerAsync(address, string.Empty, string.Empty)); - } - - public NetworkInfoOutput NetworkInfo() - { - return AsyncHelper.RunSync(ApiClient.GetNetworkInfoAsync); - } - - #endregion - } -} \ No newline at end of file diff --git a/src/AElf.EventHandler/Managers/TransactionManager.cs b/src/AElf.EventHandler/Managers/TransactionManager.cs deleted file mode 100644 index d88a908c..00000000 --- a/src/AElf.EventHandler/Managers/TransactionManager.cs +++ /dev/null @@ -1,125 +0,0 @@ -using System; -using System.Linq; -using System.Threading; -using AElf.Cryptography; -using AElf.Types; -using Google.Protobuf; -using Volo.Abp.Threading; - -namespace AElf.EventHandler -{ - public class TransactionManager - { - private readonly AElfKeyStore _keyStore; - - public TransactionManager(AElfKeyStore keyStore) - { - _keyStore = keyStore; - } - - public Transaction CreateTransaction(string from, string to, - string methodName, ByteString input) - { - try - { - var transaction = new Transaction - { - From = from.ConvertAddress(), - To = to.ConvertAddress(), - MethodName = methodName, - Params = input ?? ByteString.Empty - }; - - return transaction; - } - catch (Exception) - { - return null; - } - } - - public Transaction SignTransaction(Transaction tx) - { - if (!IsKeyReady()) - { - throw new InvalidOperationException("Key not ready."); - } - var txData = tx.GetHash().ToByteArray(); - tx.Signature = GetSignature(txData); - return tx; - } - - private ByteString GetSignature(byte[] txData) - { - var kp = _keyStore.GetAccountKeyPair(); - - if (kp == null) - { - return null; - } - - // Sign the hash - var signature = CryptoHelper.SignWithPrivateKey(kp.PrivateKey, txData); - return ByteString.CopyFrom(signature); - } - - public bool IsKeyReady() - { - return _keyStore.GetAccountKeyPair() != null; - } - - public string ConvertTransactionRawTxString(Transaction tx) - { - return tx.ToByteArray().ToHex(); - } - } - - public static class BlockMarkingHelper - { - private static DateTime _refBlockTime = DateTime.Now; - private static long _cachedHeight; - private static string _cachedHash; - private static string _chainId = string.Empty; - private static string _baseUrl = string.Empty; - - public static Transaction AddBlockReference(this Transaction transaction, string rpcAddress, - string chainId = "AELF") - {if (_cachedHeight == default || (DateTime.Now - _refBlockTime).TotalSeconds > 60 || - !_chainId.Equals(chainId)||_baseUrl !=rpcAddress) - { - _chainId = chainId; - (_cachedHeight, _cachedHash) = GetBlockReference(rpcAddress); - _refBlockTime = DateTime.Now; - _baseUrl = rpcAddress; - } - - transaction.RefBlockNumber = _cachedHeight; - transaction.RefBlockPrefix = - ByteString.CopyFrom(ByteArrayHelper.HexStringToByteArray(_cachedHash).Where((b, i) => i < 4).ToArray()); - return transaction; - } - - private static (long, string) GetBlockReference(string baseUrl, int requestTimes = 4) - { - while (true) - try - { - var client = AElfClientExtension.GetClient(baseUrl); - var chainStatus = AsyncHelper.RunSync(client.GetChainStatusAsync); - if (chainStatus.LongestChainHeight - chainStatus.LastIrreversibleBlockHeight > 400) - { - continue; - } - - //return (chainStatus.LastIrreversibleBlockHeight, chainStatus.LastIrreversibleBlockHash); - return (chainStatus.BestChainHeight, chainStatus.BestChainHash); - } - catch (Exception) - { - requestTimes--; - if (requestTimes < 0) throw new Exception("Get chain status got failed exception."); - Thread.Sleep(500); - } - } - } -} \ No newline at end of file diff --git a/src/AElf.EventHandler/Managers/Web3Manager.cs b/src/AElf.EventHandler/Managers/Web3Manager.cs index f97a0118..427eb3a5 100644 --- a/src/AElf.EventHandler/Managers/Web3Manager.cs +++ b/src/AElf.EventHandler/Managers/Web3Manager.cs @@ -2,56 +2,56 @@ using Nethereum.Contracts; using Nethereum.RPC.Eth.DTOs; using Nethereum.Web3; +using Nethereum.Web3.Accounts; -namespace AElf.EventHandler +namespace AElf.EventHandler; + +public class Web3Manager { - public class Web3Manager - { - private const string MethodName = "transmit"; - private readonly string _senderAddress; - private readonly string _abiCode; - private readonly Web3 _web3; - public string BaseUrl { get; set; } + private const string MethodName = "transmit"; + private readonly string _senderAddress; + private readonly string _abiCode; + private readonly Web3 _web3; + public string BaseUrl { get; set; } - public Web3Manager(string url, string senderAddress, string privateKey, string abiCode) - { - _senderAddress = senderAddress; - _abiCode = abiCode; - var account = new Nethereum.Web3.Accounts.Account(privateKey); - _web3 = new Web3(account, url); - BaseUrl = url; - } + public Web3Manager(string url, string senderAddress, string privateKey, string abiCode) + { + _senderAddress = senderAddress; + _abiCode = abiCode; + var account = new Account(privateKey); + _web3 = new Web3(account, url); + BaseUrl = url; + } - public async Task TransmitDataOnEthereum(string contractAddress, byte[] report, byte[][] rs, byte[][] ss, - byte[] rawVs) - { - var contract = _web3.Eth.GetContract(_abiCode, contractAddress); - var setValueFunction = contract.GetFunction(MethodName); - var gas = await setValueFunction.EstimateGasAsync(_senderAddress, null, null, report, rs, ss, rawVs); - await setValueFunction.SendTransactionAsync(_senderAddress, gas, null, null, report, rs, ss, rawVs); - } + public async Task TransmitDataOnEthereum(string contractAddress, byte[] report, byte[][] rs, byte[][] ss, + byte[] rawVs) + { + var contract = _web3.Eth.GetContract(_abiCode, contractAddress); + var setValueFunction = contract.GetFunction(MethodName); + var gas = await setValueFunction.EstimateGasAsync(_senderAddress, null, null, report, rs, ss, rawVs); + await setValueFunction.SendTransactionAsync(_senderAddress, gas, null, null, report, rs, ss, rawVs); + } - public async Task TransmitDataOnEthereumWithReceipt(string contractAddress, byte[] report, - byte[][] rs, byte[][] ss, byte[] rawVs) - { - var contract = _web3.Eth.GetContract(_abiCode, contractAddress); - var setValueFunction = contract.GetFunction(MethodName); - var gas = await setValueFunction.EstimateGasAsync(_senderAddress, null, null, report, rs, ss, rawVs); - var transactionResult = - await setValueFunction.SendTransactionAndWaitForReceiptAsync(_senderAddress, gas, null, null, report, - rs, ss, rawVs); - return transactionResult; - } + public async Task TransmitDataOnEthereumWithReceipt(string contractAddress, byte[] report, + byte[][] rs, byte[][] ss, byte[] rawVs) + { + var contract = _web3.Eth.GetContract(_abiCode, contractAddress); + var setValueFunction = contract.GetFunction(MethodName); + var gas = await setValueFunction.EstimateGasAsync(_senderAddress, null, null, report, rs, ss, rawVs); + var transactionResult = + await setValueFunction.SendTransactionAndWaitForReceiptAsync(_senderAddress, gas, null, null, report, + rs, ss, rawVs); + return transactionResult; + } - public Function GetFunction(string contractAddress, string methodName) - { - var contract = _web3.Eth.GetContract(_abiCode, contractAddress); - return contract.GetFunction(methodName); - } + public Function GetFunction(string contractAddress, string methodName) + { + var contract = _web3.Eth.GetContract(_abiCode, contractAddress); + return contract.GetFunction(methodName); + } - public async Task GetTransactionReceipt(string transactionHash) - { - return await _web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(transactionHash); - } + public async Task GetTransactionReceipt(string transactionHash) + { + return await _web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(transactionHash); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Options/ConfigOptions.cs b/src/AElf.EventHandler/Options/ConfigOptions.cs index ddf33c12..b3c34105 100644 --- a/src/AElf.EventHandler/Options/ConfigOptions.cs +++ b/src/AElf.EventHandler/Options/ConfigOptions.cs @@ -4,13 +4,8 @@ namespace AElf.EventHandler { public class ConfigOptions { - public string BlockChainEndpoint { get; set; } - public string AccountAddress { get; set; } - public string AccountPassword { get; set; } public string Token { get; set; } public List ObserverAssociationAddressList { get; set; } - public string TransmitContractAddress { get; set; } - public string MerkleGeneratorContractAddress { get; set; } public List SwapConfigs { get; set; } public int MaximumLeafCount { get; set; } public bool SendQueryTransaction { get; set; } @@ -21,7 +16,7 @@ public class ConfigOptions public class SwapConfig { public string TokenSymbol { get; set; } - public long RecorderId { get; set; } + public string SpaceId { get; set; } public string LockMappingContractAddress { get; set; } public string NodeUrl { get; set; } public bool CanTakeToken { get; set; } diff --git a/src/AElf.EventHandler/Options/ContractAbiOptions.cs b/src/AElf.EventHandler/Options/ContractAbiOptions.cs deleted file mode 100644 index 44e2a1f0..00000000 --- a/src/AElf.EventHandler/Options/ContractAbiOptions.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace AElf.EventHandler -{ - public class ContractAbiOptions - { - public string TransmitAbiFilePath { get; set; } - public string LockAbiFilePath { get; set; } = "./ContractBuild/LockAbi.json"; - public string LockWithTakeTokenAbiFilePath { get; set; } = "./ContractBuild/LockWithTakeTokenAbi.json"; - } -} \ No newline at end of file diff --git a/src/AElf.EventHandler/Options/ContractAddressOptions.cs b/src/AElf.EventHandler/Options/ContractAddressOptions.cs deleted file mode 100644 index 313b1ce1..00000000 --- a/src/AElf.EventHandler/Options/ContractAddressOptions.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Collections.Generic; -using AElf.Types; - -namespace AElf.EventHandler -{ - public class ContractAddressOptions - { - public Dictionary ContractAddressMap { get; set; } = new Dictionary - { - { - "BasicZero", "pykr77ft9UUKJZLVq15wCH8PinBSjVRQ12sD1Ayq92mKFsJ1i" - } - }; - } -} \ No newline at end of file diff --git a/src/AElf.EventHandler/Options/EthereumConfigOptions.cs b/src/AElf.EventHandler/Options/EthereumConfigOptions.cs index 442fb2a3..00982a45 100644 --- a/src/AElf.EventHandler/Options/EthereumConfigOptions.cs +++ b/src/AElf.EventHandler/Options/EthereumConfigOptions.cs @@ -2,10 +2,6 @@ namespace AElf.EventHandler { public class EthereumConfigOptions { - public string Url { get; set; } - public string Address { get; set; } - public string PrivateKey { get; set; } public bool IsEnable { get; set; } - } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Options/LotteryOptions.cs b/src/AElf.EventHandler/Options/LotteryOptions.cs deleted file mode 100644 index 7d3972ff..00000000 --- a/src/AElf.EventHandler/Options/LotteryOptions.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace AElf.EventHandler -{ - public class LotteryOptions - { - public bool IsDrawLottery { get; set; } - public string AccountAddress { get; set; } - public string AccountPassword { get; set; } - public string LotteryContractAddress { get; set; } - public long StartTimestamp { get; set; } - public long IntervalMinutes { get; set; } - public int LatestDrewPeriod { get; set; } - } -} \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/AggregateDataReceivedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/AggregateDataReceivedLogEventProcessor.cs index e0a54ddd..b54a0c44 100644 --- a/src/AElf.EventHandler/Processors/AggregateDataReceivedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/AggregateDataReceivedLogEventProcessor.cs @@ -1,4 +1,5 @@ using System.Threading.Tasks; +using AElf.Client.Core.Options; using AElf.Contracts.IntegerAggregator; using AElf.Types; using Common.Logging; @@ -12,7 +13,7 @@ internal class AggregateDataReceivedLogEventProcessor : LogEventProcessorBase _logger; - public AggregateDataReceivedLogEventProcessor(IOptionsSnapshot contractAddressOptions, + public AggregateDataReceivedLogEventProcessor(IOptionsSnapshot contractAddressOptions, ILogger logger) : base(contractAddressOptions) { _logger = logger; diff --git a/src/AElf.EventHandler/Processors/ContractDeployedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ContractDeployedLogEventProcessor.cs index 55614954..18f992ed 100644 --- a/src/AElf.EventHandler/Processors/ContractDeployedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ContractDeployedLogEventProcessor.cs @@ -1,30 +1,31 @@ using System.Threading.Tasks; +using AElf.Client.Core.Extensions; +using AElf.Client.Core.Options; using AElf.Standards.ACS0; using AElf.Types; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Volo.Abp.DependencyInjection; -namespace AElf.EventHandler +namespace AElf.EventHandler; + +internal class ContractDeployedLogEventProcessor : LogEventProcessorBase { - internal class ContractDeployedLogEventProcessor : LogEventProcessorBase, ITransientDependency + public override string ContractName => "BasicZero"; + private readonly ILogger _logger; + + public ContractDeployedLogEventProcessor(ILogger logger, + IOptionsSnapshot contractAddressOptions) : base(contractAddressOptions) { - public override string ContractName => "BasicZero"; - private readonly ILogger _logger; + _logger = logger; + } - public ContractDeployedLogEventProcessor(ILogger logger, - IOptionsSnapshot contractAddressOptions) : base(contractAddressOptions) - { - _logger = logger; - } + public override Task ProcessAsync(LogEvent logEvent) + { + var contractDeployed = new ContractDeployed(); + contractDeployed.MergeFrom(logEvent); - public override Task ProcessAsync(LogEvent logEvent) - { - var contractDeployed = new ContractDeployed(); - contractDeployed.MergeFrom(logEvent); - _logger.LogInformation($"New contract deployed: {contractDeployed}"); + _logger.LogInformation($"New contract deployed: {contractDeployed}"); - return Task.CompletedTask; - } + return Task.CompletedTask; } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/ILogEventProcessor.cs b/src/AElf.EventHandler/Processors/ILogEventProcessor.cs index a1a93be0..f0640987 100644 --- a/src/AElf.EventHandler/Processors/ILogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ILogEventProcessor.cs @@ -6,7 +6,7 @@ namespace AElf.EventHandler { - public interface ILogEventProcessor : ITransientDependency, ILogEventProcessor where T : IEvent + public interface ILogEventProcessor : ITransientDependency, ILogEventProcessor { } diff --git a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs index bde58c1a..7efee072 100644 --- a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs @@ -1,177 +1,163 @@ -using System; using System.IO; using System.Linq; using System.Threading.Tasks; +using AElf.Client.Core.Extensions; +using AElf.Client.Core.Options; +using AElf.Client.MerkleTreeContract; +using AElf.Client.Oracle; using AElf.Contracts.Consensus.AEDPoS; +using AElf.Contracts.MerkleTreeContract; using AElf.Contracts.Oracle; -using AElf.Kernel; +using AElf.Nethereum.Core.Options; using AElf.Types; -using Google.Protobuf.WellKnownTypes; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using MTRecorder; -using Volo.Abp.DependencyInjection; -namespace AElf.EventHandler +namespace AElf.EventHandler; + +public class IrreversibleBlockFoundLogEventProcessor : LogEventProcessorBase { - public class IrreversibleBlockFoundLogEventProcessor : LogEventProcessorBase, - ITransientDependency + private readonly ConfigOptions _configOptions; + private readonly EthereumConfigOptions _ethereumConfigOptions; + private readonly AElfContractOptions _contractAddressOptions; + private readonly EthereumContractOptions _ethereumContractOptions; + private readonly ILatestQueriedReceiptCountProvider _latestQueriedReceiptCountProvider; + private readonly IOracleService _oracleService; + private readonly IMerkleTreeContractService _merkleTreeContractService; + private readonly ILogger _logger; + private readonly string _lockAbi; + + public IrreversibleBlockFoundLogEventProcessor( + IOptionsSnapshot contractAddressOptions, + IOptionsSnapshot configOptions, + IOptionsSnapshot ethereumConfigOptions, + IOptionsSnapshot ethereumContractOptions, + ILatestQueriedReceiptCountProvider latestQueriedReceiptCountProvider, + IOracleService oracleService, + IMerkleTreeContractService merkleTreeContractService, + ILogger logger) : base(contractAddressOptions) { - private readonly ConfigOptions _configOptions; - private readonly EthereumConfigOptions _ethereumConfigOptions; - private readonly ContractAddressOptions _contractAddressOptions; - private readonly LotteryOptions _lotteryOptions; - private readonly ILatestQueriedReceiptCountProvider _latestQueriedReceiptCountProvider; - private readonly ILogger _logger; - private readonly string _lockAbi; - - public IrreversibleBlockFoundLogEventProcessor( - IOptionsSnapshot contractAddressOptions, - IOptionsSnapshot configOptions, - IOptionsSnapshot ethereumConfigOptions, - IOptionsSnapshot contractAbiOptions, - IOptionsSnapshot lotteryOptions, - ILatestQueriedReceiptCountProvider latestQueriedReceiptCountProvider, - ILogger logger) : base(contractAddressOptions) - { - _latestQueriedReceiptCountProvider = latestQueriedReceiptCountProvider; - _logger = logger; + _ethereumContractOptions = ethereumContractOptions.Value; + _latestQueriedReceiptCountProvider = latestQueriedReceiptCountProvider; + _oracleService = oracleService; + _merkleTreeContractService = merkleTreeContractService; + _logger = logger; - var contractAbiOptions1 = contractAbiOptions.Value; - _configOptions = configOptions.Value; - _ethereumConfigOptions = ethereumConfigOptions.Value; - _contractAddressOptions = contractAddressOptions.Value; - _lotteryOptions = lotteryOptions.Value; + _configOptions = configOptions.Value; + _ethereumConfigOptions = ethereumConfigOptions.Value; + _contractAddressOptions = contractAddressOptions.Value; + { + var file = Path.Combine(_ethereumContractOptions.AbiFileDirectory, + _ethereumContractOptions.ContractInfoList["Bridge"].AbiFileName); + if (!string.IsNullOrEmpty(file)) { - var file = contractAbiOptions1.LockAbiFilePath; - if (!string.IsNullOrEmpty(file)) + if (!File.Exists(file)) { - if (!File.Exists(file)) - { - _logger.LogError($"Cannot found file {file}"); - } - - _lockAbi = JsonHelper.ReadJson(file, "abi"); + _logger.LogError($"Cannot found file {file}"); } + + _lockAbi = JsonHelper.ReadJson(file, "abi"); } } + } + + public override string ContractName => "Consensus"; - public override string ContractName => "Consensus"; + public override async Task ProcessAsync(LogEvent logEvent) + { + var libFound = new IrreversibleBlockFound(); + libFound.MergeFrom(logEvent); + _logger.LogInformation($"IrreversibleBlockFound: {libFound}"); - public override async Task ProcessAsync(LogEvent logEvent) + if (!_configOptions.SendQueryTransaction) return; + + foreach (var swapConfig in _configOptions.SwapConfigs) { - var libFound = new IrreversibleBlockFound(); - libFound.MergeFrom(logEvent); - _logger.LogInformation($"IrreversibleBlockFound: {libFound}"); + await SendQueryAsync(swapConfig.LockMappingContractAddress, Hash.LoadFromBase64(swapConfig.SpaceId), + swapConfig.TokenSymbol); + } + } - if (_lotteryOptions.IsDrawLottery) - { - // Just for logging. - var startTimestamp = TimestampHelper.DurationFromSeconds(_lotteryOptions.StartTimestamp); - var duration = TimestampHelper.GetUtcNow() - startTimestamp; - _logger.LogInformation( - $"Trying to draw lottery of supposed period {(int) (duration.Seconds / 60 / _lotteryOptions.IntervalMinutes)}. StartTimestamp: {startTimestamp}. Duration: {duration.Seconds} seconds."); - - _logger.LogInformation( - DrawHelper.TryToDrawLottery(_configOptions.BlockChainEndpoint, _lotteryOptions, out var period, - out var txId) - ? $"Drew period {period}, Tx id: {txId}" - : $"Not draw."); - } + private async Task SendQueryAsync(string lockMappingContractAddress, Hash spaceId, string symbol) + { + _logger.LogInformation($"Querying {lockMappingContractAddress}, Space Id {spaceId}, Symbol {symbol}"); + var nodeUrl = _configOptions.SwapConfigs.Single(c => Hash.LoadFromBase64(c.SpaceId) == spaceId).NodeUrl; + var web3ManagerForLock = new Web3Manager(nodeUrl, lockMappingContractAddress, + "", _lockAbi); - if (!_configOptions.SendQueryTransaction) return; + // TODO: Travel Bridge.Bridges config. - foreach (var swapConfig in _configOptions.SwapConfigs) - { - await SendQueryAsync(swapConfig.LockMappingContractAddress, swapConfig.RecorderId, - swapConfig.TokenSymbol); - } - } + var lockTimes = await web3ManagerForLock.GetFunction(lockMappingContractAddress, "receiptCount") + .CallAsync();// TODO: Bridges.OriginToken - private async Task SendQueryAsync(string lockMappingContractAddress, long recorderId, string symbol) - { - _logger.LogInformation($"Querying {lockMappingContractAddress}, Recorder Id {recorderId}, Symbol {symbol}"); - var nodeUrl = _configOptions.SwapConfigs.Single(c => c.RecorderId == recorderId).NodeUrl; - var web3ManagerForLock = new Web3Manager(nodeUrl, lockMappingContractAddress, - _ethereumConfigOptions.PrivateKey, _lockAbi); - var node = new NodeManager(_configOptions.BlockChainEndpoint, _configOptions.AccountAddress, - _configOptions.AccountPassword); - var merkleTreeRecorderContractAddress = _contractAddressOptions.ContractAddressMap["MTRecorder"]; - - var lockTimes = await web3ManagerForLock.GetFunction(lockMappingContractAddress, "receiptCount") - .CallAsync(); - - _logger.LogInformation($"{symbol} lock times: {lockTimes}"); - - var lastRecordedLeafIndex = node.QueryView(_configOptions.AccountAddress, - merkleTreeRecorderContractAddress, "GetLastRecordedLeafIndex", - new RecorderIdInput - { - RecorderId = recorderId - }).Value; + _logger.LogInformation($"{symbol} lock times: {lockTimes}"); - var maxAvailableIndex = lockTimes - 1; - if (_latestQueriedReceiptCountProvider.Get(symbol) == 0) + var lastRecordedLeafIndex = (await _merkleTreeContractService.GetLastLeafIndexAsync( + new GetLastLeafIndexInput { - _latestQueriedReceiptCountProvider.Set(symbol, lastRecordedLeafIndex + 1); - } + SpaceId = spaceId + })).Value; - var latestTreeIndex = _latestQueriedReceiptCountProvider.Get(symbol) / _configOptions.MaximumLeafCount; - _logger.LogInformation($"{symbol} latest tree index: {latestTreeIndex}"); + var maxAvailableIndex = lockTimes - 1; + if (_latestQueriedReceiptCountProvider.Get(symbol) == 0) + { + _latestQueriedReceiptCountProvider.Set(symbol, lastRecordedLeafIndex + 1); + } - var almostTreeIndex = lockTimes / _configOptions.MaximumLeafCount; - if (latestTreeIndex < almostTreeIndex) - { - maxAvailableIndex = (latestTreeIndex + 1) * _configOptions.MaximumLeafCount - 1; - } + var latestTreeIndex = _latestQueriedReceiptCountProvider.Get(symbol) / _configOptions.MaximumLeafCount; + _logger.LogInformation($"{symbol} latest tree index: {latestTreeIndex}"); - _logger.LogInformation( - $"Lock times: {lockTimes}; Latest tree index: {latestTreeIndex}; Almost tree index: {almostTreeIndex}; Max available index: {maxAvailableIndex};"); + var almostTreeIndex = lockTimes / _configOptions.MaximumLeafCount; + if (latestTreeIndex < almostTreeIndex) + { + maxAvailableIndex = (latestTreeIndex + 1) * _configOptions.MaximumLeafCount - 1; + } - if (maxAvailableIndex + 1 <= _latestQueriedReceiptCountProvider.Get(symbol)) - { - return; - } + _logger.LogInformation( + $"Lock times: {lockTimes}; Latest tree index: {latestTreeIndex}; Almost tree index: {almostTreeIndex}; Max available index: {maxAvailableIndex};"); - if (lastRecordedLeafIndex == -2) - { - _logger.LogError($"Recorder of id {recorderId} didn't created."); - return; - } + if (maxAvailableIndex + 1 <= _latestQueriedReceiptCountProvider.Get(symbol)) + { + return; + } - _logger.LogInformation($"Last recorded leaf index: {lastRecordedLeafIndex}"); - var notRecordedReceiptsCount = maxAvailableIndex - lastRecordedLeafIndex; - if (notRecordedReceiptsCount > 0) + if (lastRecordedLeafIndex == -2) + { + _logger.LogError($"Space {spaceId.ToHex()} didn't created."); + return; + } + + _logger.LogInformation($"Last recorded leaf index: {lastRecordedLeafIndex}"); + var notRecordedReceiptsCount = maxAvailableIndex - lastRecordedLeafIndex; + if (notRecordedReceiptsCount > 0) + { + var queryInput = new QueryInput { - var queryInput = new QueryInput + Payment = _configOptions.QueryPayment, + QueryInfo = new QueryInfo { - Payment = _configOptions.QueryPayment, - QueryInfo = new QueryInfo - { - Title = $"record_receipts_{symbol}", - Options = {(lastRecordedLeafIndex + 1).ToString(), maxAvailableIndex.ToString()} - }, - AggregatorContractAddress = _contractAddressOptions.ContractAddressMap["StringAggregator"] - .ConvertAddress(), - CallbackInfo = new CallbackInfo - { - ContractAddress = _contractAddressOptions.ContractAddressMap["Bridge"].ConvertAddress(), - MethodName = "RecordReceiptHash" - }, - DesignatedNodeList = new AddressList - {Value = {_configOptions.TokenSwapOracleOrganizationAddress.ConvertAddress()}} - }; - - _logger.LogInformation($"About to send Query transaction for token swapping, QueryInput: {queryInput}"); - - var txId = node.SendTransaction(_configOptions.AccountAddress, - _contractAddressOptions.ContractAddressMap["Oracle"], "Query", queryInput); - _logger.LogInformation($"Query tx id: {txId}"); - _latestQueriedReceiptCountProvider.Set(symbol, maxAvailableIndex + 1); - _logger.LogInformation( - $"Latest queried receipt count: {_latestQueriedReceiptCountProvider.Get(symbol)}"); - } + Title = $"record_receipts_{symbol}",// TODO: Change this to SwapId. + Options = { (lastRecordedLeafIndex + 1).ToString(), maxAvailableIndex.ToString() } + }, + AggregatorContractAddress = _contractAddressOptions.ContractAddressList["StringAggregator"] + .ConvertAddress(), + CallbackInfo = new CallbackInfo + { + ContractAddress = _contractAddressOptions.ContractAddressList["Bridge"].ConvertAddress(), + MethodName = "RecordReceiptHash" + }, + DesignatedNodeList = new AddressList + { Value = { _configOptions.TokenSwapOracleOrganizationAddress.ConvertAddress() } } + }; + + _logger.LogInformation($"About to send Query transaction for token swapping, QueryInput: {queryInput}"); + + var sendTxResult = await _oracleService.QueryAsync(queryInput); + _logger.LogInformation($"Query tx id: {sendTxResult.Transaction.GetHash()}"); + _latestQueriedReceiptCountProvider.Set(symbol, maxAvailableIndex + 1); + _logger.LogInformation( + $"Latest queried receipt count: {_latestQueriedReceiptCountProvider.Get(symbol)}"); } } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs b/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs index 1dcaf4d6..b6777078 100644 --- a/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs +++ b/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs @@ -1,4 +1,5 @@ using System.Threading.Tasks; +using AElf.Client.Core.Options; using AElf.CSharp.Core; using AElf.Types; using Microsoft.Extensions.Options; @@ -6,13 +7,13 @@ namespace AElf.EventHandler { - public abstract class LogEventProcessorBase : ILogEventProcessor where T : IEvent + public abstract class LogEventProcessorBase : ILogEventProcessor { - private readonly ContractAddressOptions _contractAddressOptions; + private readonly AElfContractOptions _contractOptions; - public LogEventProcessorBase(IOptionsSnapshot contractAddressOptions) + public LogEventProcessorBase(IOptionsSnapshot contractAddressOptions) { - _contractAddressOptions = contractAddressOptions.Value; + _contractOptions = contractAddressOptions.Value; } public abstract string ContractName { get; } @@ -21,7 +22,7 @@ public LogEventProcessorBase(IOptionsSnapshot contractAd public string GetContractAddress() { - return _contractAddressOptions.ContractAddressMap.TryGetValue(ContractName, out var contractAddress) + return _contractOptions.ContractAddressList.TryGetValue(ContractName, out var contractAddress) ? contractAddress : string.Empty; } diff --git a/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs index 685b2db7..01df86e1 100644 --- a/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs @@ -1,31 +1,31 @@ using System.Threading.Tasks; +using AElf.Client.Core.Extensions; +using AElf.Client.Core.Options; using AElf.Contracts.Oracle; using AElf.Types; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Volo.Abp.DependencyInjection; -namespace AElf.EventHandler +namespace AElf.EventHandler; + +internal class QueryCompletedLogEventProcessor : LogEventProcessorBase { - internal class QueryCompletedLogEventProcessor : LogEventProcessorBase, - ITransientDependency - { - public override string ContractName => "Oracle"; - private readonly ILogger _logger; + public override string ContractName => "Oracle"; + private readonly ILogger _logger; - public QueryCompletedLogEventProcessor(ILogger logger, - IOptionsSnapshot contractAddressOptions) : base(contractAddressOptions) - { - _logger = logger; - } + public QueryCompletedLogEventProcessor(ILogger logger, + IOptionsSnapshot contractAddressOptions) : base(contractAddressOptions) + { + _logger = logger; + } - public override Task ProcessAsync(LogEvent logEvent) - { - var completed = new QueryCompletedWithAggregation(); - completed.MergeFrom(logEvent); - _logger.LogInformation(logEvent.ToString()); + public override Task ProcessAsync(LogEvent logEvent) + { + var completed = new QueryCompletedWithAggregation(); + completed.MergeFrom(logEvent); + _logger.LogInformation(logEvent.ToString()); - return Task.CompletedTask; - } + return Task.CompletedTask; } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs index f5f4a816..971118d8 100644 --- a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs @@ -1,75 +1,72 @@ -using System.Linq; using System.Threading.Tasks; +using AElf.Client.Core.Extensions; +using AElf.Client.Core.Options; using AElf.Contracts.Oracle; using AElf.Types; -using Google.Protobuf.WellKnownTypes; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Volo.Abp.DependencyInjection; -namespace AElf.EventHandler -{ - internal class QueryCreatedLogEventProcessor : LogEventProcessorBase, ISingletonDependency - { - private readonly ISaltProvider _saltProvider; - private readonly IDataProvider _dataProvider; - private readonly ConfigOptions _configOptions; - public override string ContractName => "Oracle"; - private readonly ILogger _logger; - - public QueryCreatedLogEventProcessor(IOptionsSnapshot configOptions, - IOptionsSnapshot contractAddressOptions, - ISaltProvider saltProvider, IDataProvider dataProvider, ILogger logger) : - base(contractAddressOptions) - { - _saltProvider = saltProvider; - _dataProvider = dataProvider; - _logger = logger; - _configOptions = configOptions.Value; - } - - public override async Task ProcessAsync(LogEvent logEvent) - { - var queryCreated = new QueryCreated(); - queryCreated.MergeFrom(logEvent); - _logger.LogInformation(queryCreated.ToString()); +namespace AElf.EventHandler; - var nodeAddress = Address.FromBase58(_configOptions.AccountAddress); - var firstDesignatedNodeAddress = queryCreated.DesignatedNodeList.Value.First(); - var queryToken = queryCreated - .Token; // Query token means the ethereum contract address oracle node should cares in report case. - if (queryCreated.DesignatedNodeList.Value.Contains(nodeAddress) || - _configOptions.ObserverAssociationAddressList.Contains(firstDesignatedNodeAddress.ToBase58()) || - _configOptions.TransmitContractAddress == queryToken || - _configOptions.Token == queryToken) - { - var data = await _dataProvider.GetDataAsync(queryCreated.QueryId, queryCreated.QueryInfo.Title, - queryCreated.QueryInfo.Options.ToList()); - if (string.IsNullOrEmpty(data)) - { - _logger.LogError(queryCreated.QueryInfo.Title == "record_receipts" - ? "Failed to record receipts from eth to aelf." - : $"Failed to response to query {queryCreated.QueryId}."); +internal class QueryCreatedLogEventProcessor : LogEventProcessorBase, ISingletonDependency +{ + private readonly ISaltProvider _saltProvider; + private readonly IDataProvider _dataProvider; + private readonly ConfigOptions _configOptions; + public override string ContractName => "Oracle"; + private readonly ILogger _logger; - return; - } + public QueryCreatedLogEventProcessor(IOptionsSnapshot configOptions, + IOptionsSnapshot contractAddressOptions, + ISaltProvider saltProvider, IDataProvider dataProvider, ILogger logger) : + base(contractAddressOptions) + { + _saltProvider = saltProvider; + _dataProvider = dataProvider; + _logger = logger; + _configOptions = configOptions.Value; + } - var salt = _saltProvider.GetSalt(queryCreated.QueryId); - _logger.LogInformation($"Queried data: {data}, salt: {salt}"); - var node = new NodeManager(_configOptions.BlockChainEndpoint, _configOptions.AccountAddress, - _configOptions.AccountPassword); - var commitInput = new CommitInput - { - QueryId = queryCreated.QueryId, - Commitment = HashHelper.ConcatAndCompute( - HashHelper.ComputeFrom(data), - HashHelper.ConcatAndCompute(salt, HashHelper.ComputeFrom(_configOptions.AccountAddress))) - }; - _logger.LogInformation($"Sending Commit tx with input: {commitInput}"); - var txId = node.SendTransaction(_configOptions.AccountAddress, GetContractAddress(), "Commit", - commitInput); - _logger.LogInformation($"[Commit] Tx id {txId}"); - } - } + public override async Task ProcessAsync(LogEvent logEvent) + { + var queryCreated = new QueryCreated(); + queryCreated.MergeFrom(logEvent); + _logger.LogInformation(queryCreated.ToString()); + // + // var nodeAddress = Address.FromBase58(_configOptions.AccountAddress); + // var firstDesignatedNodeAddress = queryCreated.DesignatedNodeList.Value.First(); + // var queryToken = queryCreated + // .Token; // Query token means the ethereum contract address oracle node should cares in report case. + // if (queryCreated.DesignatedNodeList.Value.Contains(nodeAddress) || + // _configOptions.ObserverAssociationAddressList.Contains(firstDesignatedNodeAddress.ToBase58()) || + // _configOptions.TransmitContractAddress == queryToken || + // _configOptions.Token == queryToken) + // { + // var data = await _dataProvider.GetDataAsync(queryCreated.QueryId, queryCreated.QueryInfo.Title, + // queryCreated.QueryInfo.Options.ToList()); + // if (string.IsNullOrEmpty(data)) + // { + // _logger.LogError(queryCreated.QueryInfo.Title == "record_receipts" + // ? "Failed to record receipts from eth to aelf." + // : $"Failed to response to query {queryCreated.QueryId}."); + // + // return; + // } + // + // var salt = _saltProvider.GetSalt(queryCreated.QueryId); + // _logger.LogInformation($"Queried data: {data}, salt: {salt}"); + // var commitInput = new CommitInput + // { + // QueryId = queryCreated.QueryId, + // Commitment = HashHelper.ConcatAndCompute( + // HashHelper.ComputeFrom(data), + // HashHelper.ConcatAndCompute(salt, HashHelper.ComputeFrom(_configOptions.AccountAddress))) + // }; + // _logger.LogInformation($"Sending Commit tx with input: {commitInput}"); + // var txId = node.SendTransaction(_configOptions.AccountAddress, GetContractAddress(), "Commit", + // commitInput); + // _logger.LogInformation($"[Commit] Tx id {txId}"); + // } } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/QueryDataRecordedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/QueryDataRecordedLogEventProcessor.cs index 3955a056..122eaf47 100644 --- a/src/AElf.EventHandler/Processors/QueryDataRecordedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/QueryDataRecordedLogEventProcessor.cs @@ -1,31 +1,31 @@ using System.Threading.Tasks; +using AElf.Client.Core.Options; using AElf.Contracts.OracleUser; using AElf.Types; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Volo.Abp.DependencyInjection; -namespace AElf.EventHandler +namespace AElf.EventHandler; + +internal class QueryDataRecordedLogEventProcessor : LogEventProcessorBase, ITransientDependency { - internal class QueryDataRecordedLogEventProcessor : LogEventProcessorBase, ITransientDependency - { - private readonly ILogger _logger; + private readonly ILogger _logger; - public QueryDataRecordedLogEventProcessor(IOptionsSnapshot contractAddressOptions, - ILogger logger) : base(contractAddressOptions) - { - _logger = logger; - } + public QueryDataRecordedLogEventProcessor(IOptionsSnapshot contractAddressOptions, + ILogger logger) : base(contractAddressOptions) + { + _logger = logger; + } - public override string ContractName => "OracleUser"; + public override string ContractName => "OracleUser"; - public override Task ProcessAsync(LogEvent logEvent) - { - var queryDataRecorded = new QueryDataRecorded(); - queryDataRecorded.MergeFrom(logEvent); - _logger.LogInformation($"[Callback] Query data recorded: {queryDataRecorded}"); + public override Task ProcessAsync(LogEvent logEvent) + { + var queryDataRecorded = new QueryDataRecorded(); + queryDataRecorded.MergeFrom(logEvent); + _logger.LogInformation($"[Callback] Query data recorded: {queryDataRecorded}"); - return Task.CompletedTask; - } + return Task.CompletedTask; } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs index ecb2c844..12f2d991 100644 --- a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs @@ -1,106 +1,107 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Threading.Tasks; +using AElf.Client.Core.Options; using AElf.Contracts.Report; +using AElf.Nethereum.Core.Options; using AElf.Types; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using Volo.Abp.DependencyInjection; -namespace AElf.EventHandler +namespace AElf.EventHandler; + +internal class ReportConfirmedLogEventProcessor : LogEventProcessorBase { - internal class ReportConfirmedLogEventProcessor : LogEventProcessorBase, ITransientDependency + public override string ContractName => "Report"; + private readonly ILogger _logger; + private readonly ISignatureRecoverableInfoProvider _signaturesRecoverableInfoProvider; + private readonly EthereumContractOptions _ethereumContractOptions; + private readonly IReportProvider _reportProvider; + private readonly EthereumConfigOptions _ethereumConfigOptions; + private readonly string _abi; + + public ReportConfirmedLogEventProcessor(ILogger logger, + IOptionsSnapshot contractAddressOptions, + IReportProvider reportProvider, + ISignatureRecoverableInfoProvider signaturesRecoverableInfoProvider, + IOptionsSnapshot ethereumConfigOptions, + IOptionsSnapshot ethereumContractOptions) : base(contractAddressOptions) { - public override string ContractName => "Report"; - private readonly ILogger _logger; - private readonly ISignatureRecoverableInfoProvider _signaturesRecoverableInfoProvider; - private readonly ContractAbiOptions _contractAbiOptions; - private readonly IReportProvider _reportProvider; - private readonly EthereumConfigOptions _ethereumConfigOptions; - private readonly string _abi; + _logger = logger; + _signaturesRecoverableInfoProvider = signaturesRecoverableInfoProvider; + _ethereumContractOptions = ethereumContractOptions.Value; + _reportProvider = reportProvider; + _ethereumConfigOptions = ethereumConfigOptions.Value; + var file = Path.Combine(_ethereumContractOptions.AbiFileDirectory, + _ethereumContractOptions.ContractInfoList["Bridge"].AbiFileName); + if (!string.IsNullOrEmpty(file)) + _abi = JsonHelper.ReadJson(file, "abi"); + } - public ReportConfirmedLogEventProcessor(ILogger logger, - IOptionsSnapshot contractAddressOptions, - IReportProvider reportProvider, - ISignatureRecoverableInfoProvider signaturesRecoverableInfoProvider, - IOptionsSnapshot ethereumConfigOptions, - IOptionsSnapshot contractAbiOptions) : base(contractAddressOptions) - { - _logger = logger; - _signaturesRecoverableInfoProvider = signaturesRecoverableInfoProvider; - _contractAbiOptions = contractAbiOptions.Value; - _reportProvider = reportProvider; - _ethereumConfigOptions = ethereumConfigOptions.Value; - var file = _contractAbiOptions.TransmitAbiFilePath; - if (!string.IsNullOrEmpty(file)) - _abi = JsonHelper.ReadJson(file, "abi"); - } + public override async Task ProcessAsync(LogEvent logEvent) + { + // var reportConfirmed = new ReportConfirmed(); + // reportConfirmed.MergeFrom(logEvent); + // _logger.LogInformation(reportConfirmed.ToString()); + // var ethereumContractAddress = reportConfirmed.Token; + // var roundId = reportConfirmed.RoundId; + // _signaturesRecoverableInfoProvider.SetSignature(ethereumContractAddress, roundId, + // reportConfirmed.Signature); + // if (reportConfirmed.IsAllNodeConfirmed) + // { + // if (_ethereumConfigOptions.IsEnable) + // { + // var report = + // _reportProvider.GetReport(ethereumContractAddress, roundId); + // var signatureRecoverableInfos = + // _signaturesRecoverableInfoProvider.GetSignature(ethereumContractAddress, roundId); + // var (reportBytes, rs, ss, vs) = TransferToEthereumParameter(report, signatureRecoverableInfos); + // var web3Manager = new Web3Manager(_ethereumConfigOptions.Url, _ethereumConfigOptions.Address, + // _ethereumConfigOptions.PrivateKey, _abi); + // try + // { + // _logger.LogInformation( + // $"Try to transmit data to Ethereum, Address: {ethereumContractAddress} RoundId: {reportConfirmed.RoundId}"); + // var transactionReceipt = + // await web3Manager.TransmitDataOnEthereumWithReceipt(ethereumContractAddress, reportBytes, + // rs, ss, vs); + // if (transactionReceipt.HasErrors().Value) + // { + // _logger.LogInformation("Failed to transmit data."); + // } + // } + // catch (Exception ex) + // { + // _logger.LogInformation("Failed to transmit data:"); + // _logger.LogInformation(ex.Message); + // } + // } + // + // _signaturesRecoverableInfoProvider.RemoveSignature(ethereumContractAddress, roundId); + // _reportProvider.RemoveReport(ethereumContractAddress, roundId); + // } + } - public override async Task ProcessAsync(LogEvent logEvent) + public (byte[], byte[][], byte[][], byte[]) TransferToEthereumParameter(string report, + HashSet recoverableInfos) + { + var signaturesCount = recoverableInfos.Count; + var r = new byte[signaturesCount][]; + var s = new byte[signaturesCount][]; + var v = new byte[32]; + var index = 0; + foreach (var recoverableInfoBytes in recoverableInfos.Select(recoverableInfo => + ByteStringHelper.FromHexString(recoverableInfo).ToByteArray())) { - var reportConfirmed = new ReportConfirmed(); - reportConfirmed.MergeFrom(logEvent); - _logger.LogInformation(reportConfirmed.ToString()); - var ethereumContractAddress = reportConfirmed.Token; - var roundId = reportConfirmed.RoundId; - _signaturesRecoverableInfoProvider.SetSignature(ethereumContractAddress, roundId, - reportConfirmed.Signature); - if (reportConfirmed.IsAllNodeConfirmed) - { - if (_ethereumConfigOptions.IsEnable) - { - var report = - _reportProvider.GetReport(ethereumContractAddress, roundId); - var signatureRecoverableInfos = - _signaturesRecoverableInfoProvider.GetSignature(ethereumContractAddress, roundId); - var (reportBytes, rs, ss, vs) = TransferToEthereumParameter(report, signatureRecoverableInfos); - var web3Manager = new Web3Manager(_ethereumConfigOptions.Url, _ethereumConfigOptions.Address, - _ethereumConfigOptions.PrivateKey, _abi); - try - { - _logger.LogInformation( - $"Try to transmit data to Ethereum, Address: {ethereumContractAddress} RoundId: {reportConfirmed.RoundId}"); - var transactionReceipt = - await web3Manager.TransmitDataOnEthereumWithReceipt(ethereumContractAddress, reportBytes, - rs, ss, vs); - if (transactionReceipt.HasErrors().Value) - { - _logger.LogInformation("Failed to transmit data."); - } - } - catch (Exception ex) - { - _logger.LogInformation("Failed to transmit data:"); - _logger.LogInformation(ex.Message); - } - } - - _signaturesRecoverableInfoProvider.RemoveSignature(ethereumContractAddress, roundId); - _reportProvider.RemoveReport(ethereumContractAddress, roundId); - } + r[index] = recoverableInfoBytes.Take(32).ToArray(); + s[index] = recoverableInfoBytes.Skip(32).Take(32).ToArray(); + v[index] = recoverableInfoBytes.Last(); + index++; } - public (byte[], byte[][], byte[][], byte[]) TransferToEthereumParameter(string report, - HashSet recoverableInfos) - { - var signaturesCount = recoverableInfos.Count; - var r = new byte[signaturesCount][]; - var s = new byte[signaturesCount][]; - var v = new byte[32]; - var index = 0; - foreach (var recoverableInfoBytes in recoverableInfos.Select(recoverableInfo => - ByteStringHelper.FromHexString(recoverableInfo).ToByteArray())) - { - r[index] = recoverableInfoBytes.Take(32).ToArray(); - s[index] = recoverableInfoBytes.Skip(32).Take(32).ToArray(); - v[index] = recoverableInfoBytes.Last(); - index++; - } - - return (ByteStringHelper.FromHexString(report).ToByteArray(), r, s, v); - } + return (ByteStringHelper.FromHexString(report).ToByteArray(), r, s, v); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs index 35cf7193..b7008a5c 100644 --- a/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs @@ -1,56 +1,57 @@ using System.Threading.Tasks; +using AElf.Client.Core; +using AElf.Client.Core.Options; +using AElf.Client.Report; using AElf.Contracts.Report; using AElf.Types; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Volo.Abp.DependencyInjection; -namespace AElf.EventHandler -{ - internal class ReportProposedLogEventProcessor : LogEventProcessorBase, ITransientDependency - { - private readonly ContractAddressOptions _contractAddressOptions; - private readonly ConfigOptions _configOptions; - private readonly IKeyStore _keyStore; - private readonly IReportProvider _reportProvider; - - public override string ContractName => "Report"; - private readonly ILogger _logger; - - public ReportProposedLogEventProcessor(IOptionsSnapshot configOptions, - IOptionsSnapshot contractAddressOptions, - IReportProvider reportProvider, - ILogger logger) : base(contractAddressOptions) - { - _logger = logger; - _configOptions = configOptions.Value; - _contractAddressOptions = contractAddressOptions.Value; - _keyStore = AElfKeyStore.GetKeyStore(configOptions.Value.AccountAddress, - configOptions.Value.AccountPassword); - _reportProvider = reportProvider; - } +namespace AElf.EventHandler; - public override Task ProcessAsync(LogEvent logEvent) - { - var reportProposed = new ReportProposed(); - reportProposed.MergeFrom(logEvent); +internal class ReportProposedLogEventProcessor : LogEventProcessorBase +{ + private readonly AElfContractOptions _contractAddressOptions; + private readonly ConfigOptions _configOptions; + private readonly IReportProvider _reportProvider; + private readonly IReportService _reportService; + private readonly IAElfAccountProvider _accountProvider; - _logger.LogInformation($"New report: {reportProposed}"); + public override string ContractName => "Report"; + private readonly ILogger _logger; - var node = new NodeManager(_configOptions.BlockChainEndpoint, _configOptions.AccountAddress, - _configOptions.AccountPassword); - var txId = node.SendTransaction(_configOptions.AccountAddress, - _contractAddressOptions.ContractAddressMap[ContractName], "ConfirmReport", new ConfirmReportInput - { - Token = _configOptions.TransmitContractAddress, - RoundId = reportProposed.RoundId, - Signature = SignHelper - .GetSignature(reportProposed.RawReport, _keyStore.GetAccountKeyPair().PrivateKey).RecoverInfo - }); - _reportProvider.SetReport(_configOptions.TransmitContractAddress, reportProposed.RoundId, reportProposed.RawReport); - _logger.LogInformation($"[ConfirmReport] Tx id {txId}"); + public ReportProposedLogEventProcessor(IOptionsSnapshot configOptions, + IOptionsSnapshot contractAddressOptions, + IReportProvider reportProvider, + IReportService reportService, + IAElfAccountProvider accountProvider, + ILogger logger) : base(contractAddressOptions) + { + _logger = logger; + _configOptions = configOptions.Value; + _contractAddressOptions = contractAddressOptions.Value; + _reportProvider = reportProvider; + _reportService = reportService; + _accountProvider = accountProvider; + } - return Task.CompletedTask; - } + public override async Task ProcessAsync(LogEvent logEvent) + { + // var reportProposed = new ReportProposed(); + // reportProposed.MergeFrom(logEvent); + // + // _logger.LogInformation($"New report: {reportProposed}"); + // + // var sendTxResult = await _reportService.ConfirmReportAsync(new ConfirmReportInput + // { + // Token = _configOptions.TransmitContractAddress, + // RoundId = reportProposed.RoundId, + // Signature = SignHelper + // .GetSignature(reportProposed.RawReport, _keyStore.GetAccountKeyPair().PrivateKey).RecoverInfo + // }); + // _reportProvider.SetReport(_configOptions.TransmitContractAddress, reportProposed.RoundId, + // reportProposed.RawReport); + // _logger.LogInformation($"[ConfirmReport] Tx id {txId}"); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs index 2a279780..c68f2f47 100644 --- a/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs @@ -1,61 +1,58 @@ using System.Threading.Tasks; +using AElf.Client.Core.Options; using AElf.Contracts.Oracle; using AElf.Types; -using Google.Protobuf; -using Google.Protobuf.WellKnownTypes; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Volo.Abp.DependencyInjection; -namespace AElf.EventHandler -{ - internal class SufficientCommitmentsCollectedLogEventProcessor : - LogEventProcessorBase, ITransientDependency - { - private readonly ISaltProvider _saltProvider; - private readonly IDataProvider _dataProvider; - private readonly ContractAddressOptions _contractAddressOptions; - private readonly ConfigOptions _configOptions; - private readonly ILogger _logger; +namespace AElf.EventHandler; - public SufficientCommitmentsCollectedLogEventProcessor(IOptionsSnapshot configOptions, - IOptionsSnapshot contractAddressOptions, - ISaltProvider saltProvider, IDataProvider dataProvider, - ILogger logger) : base(contractAddressOptions) - { - _saltProvider = saltProvider; - _dataProvider = dataProvider; - _logger = logger; - _configOptions = configOptions.Value; - _contractAddressOptions = contractAddressOptions.Value; - } +internal class SufficientCommitmentsCollectedLogEventProcessor : + LogEventProcessorBase +{ + private readonly ISaltProvider _saltProvider; + private readonly IDataProvider _dataProvider; + private readonly AElfContractOptions _contractAddressOptions; + private readonly ConfigOptions _configOptions; + private readonly ILogger _logger; - public override string ContractName => "Oracle"; + public SufficientCommitmentsCollectedLogEventProcessor(IOptionsSnapshot configOptions, + IOptionsSnapshot contractAddressOptions, + ISaltProvider saltProvider, IDataProvider dataProvider, + ILogger logger) : base(contractAddressOptions) + { + _saltProvider = saltProvider; + _dataProvider = dataProvider; + _logger = logger; + _configOptions = configOptions.Value; + _contractAddressOptions = contractAddressOptions.Value; + } - public override async Task ProcessAsync(LogEvent logEvent) - { - var collected = new SufficientCommitmentsCollected(); - collected.MergeFrom(logEvent); - var data = await _dataProvider.GetDataAsync(collected.QueryId); - if (string.IsNullOrEmpty(data)) - { - _logger.LogError($"Failed to reveal data for query {collected.QueryId}."); - return; - } + public override string ContractName => "Oracle"; - _logger.LogInformation($"Get data for revealing: {data}"); - var node = new NodeManager(_configOptions.BlockChainEndpoint, _configOptions.AccountAddress, - _configOptions.AccountPassword); - var revealInput = new RevealInput - { - QueryId = collected.QueryId, - Data = data, - Salt = _saltProvider.GetSalt(collected.QueryId) - }; - _logger.LogInformation($"Sending Reveal tx with input: {revealInput}"); - var txId = node.SendTransaction(_configOptions.AccountAddress, - _contractAddressOptions.ContractAddressMap[ContractName], "Reveal", revealInput); - _logger.LogInformation($"[Reveal] Tx id {txId}"); - } + public override async Task ProcessAsync(LogEvent logEvent) + { + // var collected = new SufficientCommitmentsCollected(); + // collected.MergeFrom(logEvent); + // var data = await _dataProvider.GetDataAsync(collected.QueryId); + // if (string.IsNullOrEmpty(data)) + // { + // _logger.LogError($"Failed to reveal data for query {collected.QueryId}."); + // return; + // } + // + // _logger.LogInformation($"Get data for revealing: {data}"); + // var node = new NodeManager(_configOptions.BlockChainEndpoint, _configOptions.AccountAddress, + // _configOptions.AccountPassword); + // var revealInput = new RevealInput + // { + // QueryId = collected.QueryId, + // Data = data, + // Salt = _saltProvider.GetSalt(collected.QueryId) + // }; + // _logger.LogInformation($"Sending Reveal tx with input: {revealInput}"); + // var txId = node.SendTransaction(_configOptions.AccountAddress, + // _contractAddressOptions.ContractAddressList[ContractName], "Reveal", revealInput); + // _logger.LogInformation($"[Reveal] Tx id {txId}"); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Program.cs b/src/AElf.EventHandler/Program.cs index b7679d57..07b193e1 100644 --- a/src/AElf.EventHandler/Program.cs +++ b/src/AElf.EventHandler/Program.cs @@ -5,50 +5,49 @@ using Serilog; using Serilog.Events; -namespace AElf.EventHandler +namespace AElf.EventHandler; + +public class Program { - public class Program + public static async Task Main(string[] args) { - public static async Task Main(string[] args) - { - Log.Logger = new LoggerConfiguration() + Log.Logger = new LoggerConfiguration() #if DEBUG - .MinimumLevel.Debug() + .MinimumLevel.Debug() #else .MinimumLevel.Information() #endif - .MinimumLevel.Override("Microsoft", LogEventLevel.Information) - .Enrich.FromLogContext() - .WriteTo.File("Logs/EventHandler-.logs", rollingInterval: RollingInterval.Day) - .WriteTo.Async(c => c.Console()) - .CreateLogger(); - - try - { - Log.Information("Starting console host."); - await CreateHostBuilder(args).RunConsoleAsync(); - return 0; - } - catch (Exception ex) - { - Log.Fatal(ex, "Host terminated unexpectedly!"); - return 1; - } - finally - { - Log.CloseAndFlush(); - } + .MinimumLevel.Override("Microsoft", LogEventLevel.Information) + .Enrich.FromLogContext() + .WriteTo.File("Logs/EventHandler-.logs", rollingInterval: RollingInterval.Day) + .WriteTo.Async(c => c.Console()) + .CreateLogger(); + try + { + Log.Information("Starting console host."); + await CreateHostBuilder(args).RunConsoleAsync(); + return 0; + } + catch (Exception ex) + { + Log.Fatal(ex, "Host terminated unexpectedly!"); + return 1; + } + finally + { + Log.CloseAndFlush(); } - internal static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .UseAutofac() - .UseSerilog() - .ConfigureAppConfiguration((context, config) => - { - //setup your additional configuration sources - }) - .ConfigureServices((hostContext, services) => { services.AddApplication(); }); } + + internal static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .UseAutofac() + .UseSerilog() + .ConfigureAppConfiguration((context, config) => + { + //setup your additional configuration sources + }) + .ConfigureServices((hostContext, services) => { services.AddApplication(); }); } \ No newline at end of file diff --git a/src/AElf.EventHandler/Providers/IDataProvider.cs b/src/AElf.EventHandler/Providers/IDataProvider.cs index 39751256..53bb0675 100644 --- a/src/AElf.EventHandler/Providers/IDataProvider.cs +++ b/src/AElf.EventHandler/Providers/IDataProvider.cs @@ -6,338 +6,324 @@ using System.Net.Http; using System.Text.Json; using System.Threading.Tasks; +using AElf.Client.Core.Options; using AElf.Contracts.Bridge; +using AElf.Nethereum.Core.Options; using AElf.Types; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Volo.Abp.DependencyInjection; -namespace AElf.EventHandler +namespace AElf.EventHandler; + +public interface IDataProvider { - public interface IDataProvider - { - Task GetDataAsync(Hash queryId, string title = null, List options = null); - } + Task GetDataAsync(Hash queryId, string title = null, List options = null); +} - public class DataProvider : IDataProvider, ISingletonDependency +public class DataProvider : IDataProvider, ISingletonDependency +{ + private readonly Dictionary _dictionary; + private readonly ILogger _logger; + private readonly AElfContractOptions _contractAddressOptions; + private readonly EthereumConfigOptions _ethereumConfigOptions; + private readonly ConfigOptions _configOptions; + private readonly string _bridgeAbi; + + private Web3Manager _web3ManagerForLock; + + public DataProvider(ILogger logger, IOptionsSnapshot ethereumConfigOptions, + IOptionsSnapshot configOptions, IOptionsSnapshot ethereumContractOptions, + IOptionsSnapshot contractAddressOptions) { - private readonly Dictionary _dictionary; - private readonly ILogger _logger; - private readonly ContractAddressOptions _contractAddressOptions; - private readonly EthereumConfigOptions _ethereumConfigOptions; - private readonly ConfigOptions _configOptions; - private readonly string _lockAbi; - private readonly string _lockWithTakeTokenAbi; - - private Web3Manager _web3ManagerForLock; - - public DataProvider(ILogger logger, IOptionsSnapshot ethereumConfigOptions, - IOptionsSnapshot configOptions, IOptionsSnapshot contractAbiOptions, - IOptionsSnapshot contractAddressOptions) + _logger = logger; + _contractAddressOptions = contractAddressOptions.Value; + _configOptions = configOptions.Value; + _ethereumConfigOptions = ethereumConfigOptions.Value; + _dictionary = new Dictionary(); { - _logger = logger; - _contractAddressOptions = contractAddressOptions.Value; - var contractAbiOption = contractAbiOptions.Value; - _configOptions = configOptions.Value; - _ethereumConfigOptions = ethereumConfigOptions.Value; - _dictionary = new Dictionary(); + var file = Path.Combine(ethereumContractOptions.Value.AbiFileDirectory, + ethereumContractOptions.Value.ContractInfoList["Bridge"].AbiFileName); + if (!string.IsNullOrEmpty(file)) { - var file = contractAbiOption.LockAbiFilePath; - if (!string.IsNullOrEmpty(file)) + if (!File.Exists(file)) { - if (!File.Exists(file)) - { - _logger.LogError($"Cannot found file {file}"); - } - - _lockAbi = JsonHelper.ReadJson(file, "abi"); + _logger.LogError($"Cannot found file {file}"); } - } - - { - { - var file = contractAbiOption.LockWithTakeTokenAbiFilePath; - if (!string.IsNullOrEmpty(file)) - { - if (!File.Exists(file)) - { - _logger.LogError($"Cannot found file {file}"); - } - _lockWithTakeTokenAbi = JsonHelper.ReadJson(file, "abi"); - } - } + _bridgeAbi = JsonHelper.ReadJson(file, "abi"); } } + } - public async Task GetDataAsync(Hash queryId, string title = null, List options = null) + public async Task GetDataAsync(Hash queryId, string title = null, List options = null) + { + if (title == "invalid") { - if (title == "invalid") - { - return "0"; - } + return "0"; + } - if (_dictionary.TryGetValue(queryId, out var data)) - { - return data; - } + if (_dictionary.TryGetValue(queryId, out var data)) + { + return data; + } - if (title == null || options == null) - { - _logger.LogError($"No data of {queryId} for revealing."); - return string.Empty; - } + if (title == null || options == null) + { + _logger.LogError($"No data of {queryId} for revealing."); + return string.Empty; + } - if (title.StartsWith("record_receipts") && options.Count == 2) - { - var symbol = title.Split('_').Last(); - _logger.LogInformation($"Trying to query record receipt data of {symbol}"); - var swapConfig = _configOptions.SwapConfigs.Single(c => c.TokenSymbol == symbol); - var recorderId = swapConfig.RecorderId; - var lockMappingAddress = swapConfig.LockMappingContractAddress; - _logger.LogInformation("About to handle record receipt hashes for swapping tokens."); - var recordReceiptHashInput = - await GetReceiptHashMap(recorderId, lockMappingAddress, long.Parse(options[0]), - long.Parse(options[1])); - _logger.LogInformation($"RecordReceiptHashInput: {recordReceiptHashInput}"); - _dictionary[queryId] = recordReceiptHashInput; - return recordReceiptHashInput; - } + if (title.StartsWith("record_receipts") && options.Count == 2) + { + var symbol = title.Split('_').Last(); + _logger.LogInformation($"Trying to query record receipt data of {symbol}"); + var swapConfig = _configOptions.SwapConfigs.Single(c => c.TokenSymbol == symbol); + var spaceId = swapConfig.SpaceId; + var lockMappingAddress = swapConfig.LockMappingContractAddress; + _logger.LogInformation("About to handle record receipt hashes for swapping tokens."); + var recordReceiptHashInput = + await GetReceiptHashMap(Hash.LoadFromBase64(spaceId), lockMappingAddress, long.Parse(options[0]), + long.Parse(options[1])); + _logger.LogInformation($"RecordReceiptHashInput: {recordReceiptHashInput}"); + _dictionary[queryId] = recordReceiptHashInput; + return recordReceiptHashInput; + } - string result; + string result; - if (!title.Contains('|')) - { - result = await GetSingleUrlDataAsync(title, options); - } - else + if (!title.Contains('|')) + { + result = await GetSingleUrlDataAsync(title, options); + } + else + { + var urls = title.Split('|'); + var urlAttributes = options.Select(a => a.Split('|')).ToList(); + var dataList = new List(); + for (var i = 0; i < urls.Length; i++) { - var urls = title.Split('|'); - var urlAttributes = options.Select(a => a.Split('|')).ToList(); - var dataList = new List(); - for (var i = 0; i < urls.Length; i++) + var singleData = + await GetSingleUrlDataAsync(urls[i], urlAttributes.Select(a => a[i]).ToList()); + if (singleData.Contains("\"")) { - var singleData = - await GetSingleUrlDataAsync(urls[i], urlAttributes.Select(a => a[i]).ToList()); - if (singleData.Contains("\"")) - { - singleData = singleData.Replace("\"", ""); - } - - if (decimal.TryParse(singleData, out var decimalData)) - { - _logger.LogInformation($"Add {singleData} to data list."); - dataList.Add(decimalData); - } - else - { - throw new Exception($"Error during paring {singleData} to decimal"); - } + singleData = singleData.Replace("\"", ""); } - result = Aggregate(dataList); + if (decimal.TryParse(singleData, out var decimalData)) + { + _logger.LogInformation($"Add {singleData} to data list."); + dataList.Add(decimalData); + } + else + { + throw new Exception($"Error during paring {singleData} to decimal"); + } } - _dictionary[queryId] = result; - return result; + result = Aggregate(dataList); } - private async Task GetReceiptHashMap(long recorderId, string lockMappingAddress, long start, long end) - { - var nodeUrl = _configOptions.SwapConfigs.Single(c => c.RecorderId == recorderId).NodeUrl; - if (_web3ManagerForLock == null || _web3ManagerForLock.BaseUrl != nodeUrl) - { - _web3ManagerForLock = new Web3Manager(nodeUrl, - lockMappingAddress, _ethereumConfigOptions.PrivateKey, _lockAbi); - } - - var canTakeToken = _configOptions.SwapConfigs.Single(c => c.RecorderId == recorderId).CanTakeToken; - var receiptInfos = await GetReceiptInfosAsync(lockMappingAddress, start, end, nodeUrl, canTakeToken); - var receiptHashes = new List(); - for (var i = 0; i <= end - start; i++) - { - var amountHash = GetHashTokenAmountData(receiptInfos[i].Amount.ToString(), 32, true); - var targetAddressHash = HashHelper.ComputeFrom(receiptInfos[i].TargetAddress); - var receiptIdHash = HashHelper.ComputeFrom(i + start); - var hash = HashHelper.ConcatAndCompute(amountHash, targetAddressHash, receiptIdHash); - receiptHashes.Add(hash); - } + _dictionary[queryId] = result; + return result; + } - var input = new ReceiptHashMap - { - RecorderId = recorderId - }; - for (var i = 0; i <= end - start; i++) - { - var index = (int) (i + start); - input.Value.Add(index, receiptHashes[i].ToHex()); - } + private async Task GetReceiptHashMap(Hash spaceId, string lockMappingAddress, long start, long end) + { + // var nodeUrl = _configOptions.SwapConfigs.Single(c => c.SpaceId == spaceId.ToHex()).NodeUrl; + // if (_web3ManagerForLock == null || _web3ManagerForLock.BaseUrl != nodeUrl) + // { + // _web3ManagerForLock = new Web3Manager(nodeUrl, + // lockMappingAddress, _ethereumConfigOptions.PrivateKey, _bridgeAbi); + // } + // + // var canTakeToken = _configOptions.SwapConfigs.Single(c => c.SpaceId == spaceId.ToHex()).CanTakeToken; + // var receiptInfos = await GetReceiptInfosAsync(lockMappingAddress, start, end, nodeUrl, canTakeToken); + // var receiptHashes = new List(); + // for (var i = 0; i <= end - start; i++) + // { + // var amountHash = GetHashTokenAmountData(receiptInfos[i].Amount.ToString(), 32, true); + // var targetAddressHash = HashHelper.ComputeFrom(receiptInfos[i].TargetAddress); + // var receiptIdHash = HashHelper.ComputeFrom(i + start); + // var hash = HashHelper.ConcatAndCompute(amountHash, targetAddressHash, receiptIdHash); + // receiptHashes.Add(hash); + // } + // + // var input = new ReceiptHashMap + // { + // RecorderId = recorderId + // }; + // for (var i = 0; i <= end - start; i++) + // { + // var index = (int)(i + start); + // input.Value.Add(index, receiptHashes[i].ToHex()); + // } + // + // return input.ToString(); + return ""; + } - return input.ToString(); + private Hash GetHashTokenAmountData(string stringAmount, int originTokenSizeInByte, bool isBigEndian) + { + var amount = decimal.Parse(stringAmount); + var preHolderSize = originTokenSizeInByte - 16; + int[] amountInIntegers; + if (isBigEndian) + { + amountInIntegers = decimal.GetBits(amount).Reverse().ToArray(); + if (preHolderSize < 0) + amountInIntegers = amountInIntegers.TakeLast(originTokenSizeInByte / 4).ToArray(); + } + else + { + amountInIntegers = decimal.GetBits(amount).ToArray(); + if (preHolderSize < 0) + amountInIntegers = amountInIntegers.Take(originTokenSizeInByte / 4).ToArray(); } - private Hash GetHashTokenAmountData(string stringAmount, int originTokenSizeInByte, bool isBigEndian) + var amountBytes = new List(); + + amountInIntegers.Aggregate(amountBytes, (cur, i) => { - var amount = decimal.Parse(stringAmount); - var preHolderSize = originTokenSizeInByte - 16; - int[] amountInIntegers; - if (isBigEndian) - { - amountInIntegers = decimal.GetBits(amount).Reverse().ToArray(); - if (preHolderSize < 0) - amountInIntegers = amountInIntegers.TakeLast(originTokenSizeInByte / 4).ToArray(); - } - else - { - amountInIntegers = decimal.GetBits(amount).ToArray(); - if (preHolderSize < 0) - amountInIntegers = amountInIntegers.Take(originTokenSizeInByte / 4).ToArray(); - } + cur.AddRange(i.ToBytes(isBigEndian)); + return cur; + }); - var amountBytes = new List(); + if (preHolderSize > 0) + { + var placeHolder = Enumerable.Repeat(new byte(), preHolderSize).ToArray(); + amountBytes = isBigEndian + ? placeHolder.Concat(amountBytes).ToList() + : amountBytes.Concat(placeHolder).ToList(); + } - amountInIntegers.Aggregate(amountBytes, (cur, i) => - { - cur.AddRange(i.ToBytes(isBigEndian)); - return cur; - }); + return HashHelper.ComputeFrom(amountBytes.ToArray()); + } - if (preHolderSize > 0) - { - var placeHolder = Enumerable.Repeat(new byte(), preHolderSize).ToArray(); - amountBytes = isBigEndian - ? placeHolder.Concat(amountBytes).ToList() - : amountBytes.Concat(placeHolder).ToList(); - } + private string Aggregate(List dataList) + { + var finalPrice = dataList.OrderBy(p => p).ToList()[dataList.Count / 2] + .ToString(CultureInfo.InvariantCulture); - return HashHelper.ComputeFrom(amountBytes.ToArray()); - } + _logger.LogInformation($"Final price: {finalPrice}"); - private string Aggregate(List dataList) - { - var finalPrice = dataList.OrderBy(p => p).ToList()[dataList.Count / 2] - .ToString(CultureInfo.InvariantCulture); + return finalPrice; + } - _logger.LogInformation($"Final price: {finalPrice}"); + public async Task GetSingleUrlDataAsync(string url, List attributes) + { + _logger.LogInformation($"Querying {url} for attributes {attributes.First()} etc.."); - return finalPrice; + var data = string.Empty; + var response = string.Empty; + try + { + var client = new HttpClient { Timeout = TimeSpan.FromMinutes(2) }; + using var responseMessage = await client.GetHttpResponseMessageWithRetryAsync(url, _logger); + response = await responseMessage.Content.ReadAsStringAsync(); + } + catch (Exception e) + { + _logger.LogError($"Error during querying: {e.Message}"); } - public async Task GetSingleUrlDataAsync(string url, List attributes) + try { - _logger.LogInformation($"Querying {url} for attributes {attributes.First()} etc.."); + _logger.LogInformation($"Trying to parse response to json: {response}"); - var data = string.Empty; - var response = string.Empty; - try + if (response != string.Empty) { - var client = new HttpClient {Timeout = TimeSpan.FromMinutes(2)}; - using var responseMessage = await client.GetHttpResponseMessageWithRetryAsync(url, _logger); - response = await responseMessage.Content.ReadAsStringAsync(); + data = ParseJson(response, attributes); } - catch (Exception e) - { - _logger.LogError($"Error during querying: {e.Message}"); - } - - try - { - _logger.LogInformation($"Trying to parse response to json: {response}"); + } + catch (Exception e) + { + _logger.LogError($"Error during parsing json: {response}\n{e.Message}"); + throw; + } - if (response != string.Empty) - { - data = ParseJson(response, attributes); - } - } - catch (Exception e) - { - _logger.LogError($"Error during parsing json: {response}\n{e.Message}"); - throw; - } + if (string.IsNullOrEmpty(data)) + { + data = "0"; + _logger.LogError($"Failed to get {attributes.First()} from {response}, will just return 0."); - if (string.IsNullOrEmpty(data)) - { - data = "0"; - _logger.LogError($"Failed to get {attributes.First()} from {response}, will just return 0."); + } - } + return data; + } - return data; - } + private string ParseJson(string response, List attributes) + { + var jsonDoc = JsonDocument.Parse(response); + var data = string.Empty; - private string ParseJson(string response, List attributes) + foreach (var attribute in attributes) { - var jsonDoc = JsonDocument.Parse(response); - var data = string.Empty; - - foreach (var attribute in attributes) + if (!attribute.Contains('/')) { - if (!attribute.Contains('/')) + if (jsonDoc.RootElement.TryGetProperty(attribute, out var targetElement)) { - if (jsonDoc.RootElement.TryGetProperty(attribute, out var targetElement)) + if (data == string.Empty) { - if (data == string.Empty) - { - data = targetElement.GetRawText(); - } - else - { - data += $";{targetElement.GetRawText()}"; - } + data = targetElement.GetRawText(); } else { - return data; + data += $";{targetElement.GetRawText()}"; } } else { - var attrs = attribute.Split('/'); - var targetElement = jsonDoc.RootElement.GetProperty(attrs[0]); - foreach (var attr in attrs.Skip(1)) + return data; + } + } + else + { + var attrs = attribute.Split('/'); + var targetElement = jsonDoc.RootElement.GetProperty(attrs[0]); + foreach (var attr in attrs.Skip(1)) + { + if (!targetElement.TryGetProperty(attr, out targetElement)) { - if (!targetElement.TryGetProperty(attr, out targetElement)) - { - return attr; - } + return attr; } + } - if (data == string.Empty) - { - data = targetElement.GetRawText(); - } - else - { - data += $";{targetElement.GetRawText()}"; - } + if (data == string.Empty) + { + data = targetElement.GetRawText(); + } + else + { + data += $";{targetElement.GetRawText()}"; } } - - return data; } - private async Task> GetReceiptInfosAsync(string lockMappingContractAddress, long start, - long end, string nodeUrl, bool canTakeToken) - { - var receiptInfoList = new List(); - var usingAbi = canTakeToken ? _lockWithTakeTokenAbi : _lockAbi; - if (_web3ManagerForLock == null) - { - _web3ManagerForLock = new Web3Manager(nodeUrl, - _ethereumConfigOptions.Address, - _ethereumConfigOptions.PrivateKey, usingAbi); - } - - var receiptInfoFunction = - _web3ManagerForLock.GetFunction(lockMappingContractAddress, "getReceiptInfo"); - for (var i = start; i <= end; i++) - { - var receiptInfo = await receiptInfoFunction.CallDeserializingToObjectAsync(i); - _logger.LogInformation($"Got receipt info of id {i}: {receiptInfo}"); - receiptInfoList.Add(receiptInfo); - } + return data; + } - return receiptInfoList; - } + private async Task> GetReceiptInfosAsync(string lockMappingContractAddress, long start, + long end, string nodeUrl, bool canTakeToken) + { + var receiptInfoList = new List(); + // var usingAbi = canTakeToken ? _lockWithTakeTokenAbi : _bridgeAbi; + // if (_web3ManagerForLock == null) + // { + // _web3ManagerForLock = new Web3Manager(nodeUrl, + // _ethereumConfigOptions.Address, + // _ethereumConfigOptions.PrivateKey, usingAbi); + // } + // + // var receiptInfoFunction = + // _web3ManagerForLock.GetFunction(lockMappingContractAddress, "getReceiptInfo"); + // for (var i = start; i <= end; i++) + // { + // var receiptInfo = await receiptInfoFunction.CallDeserializingToObjectAsync(i); + // _logger.LogInformation($"Got receipt info of id {i}: {receiptInfo}"); + // receiptInfoList.Add(receiptInfo); + // } + + return receiptInfoList; } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Providers/ILatestQueriedReceiptCountProvider.cs b/src/AElf.EventHandler/Providers/ILatestQueriedReceiptCountProvider.cs index 0fdbf51d..db1e1e65 100644 --- a/src/AElf.EventHandler/Providers/ILatestQueriedReceiptCountProvider.cs +++ b/src/AElf.EventHandler/Providers/ILatestQueriedReceiptCountProvider.cs @@ -1,8 +1,7 @@ -namespace AElf.EventHandler +namespace AElf.EventHandler; + +public interface ILatestQueriedReceiptCountProvider { - public interface ILatestQueriedReceiptCountProvider - { - long Get(string symbol); - void Set(string symbol, long count); - } + long Get(string symbol); + void Set(string symbol, long count); } \ No newline at end of file diff --git a/src/AElf.EventHandler/Providers/ISignatureRecoverableInfoProvider.cs b/src/AElf.EventHandler/Providers/ISignatureRecoverableInfoProvider.cs index 132fd6c5..7e0a2522 100644 --- a/src/AElf.EventHandler/Providers/ISignatureRecoverableInfoProvider.cs +++ b/src/AElf.EventHandler/Providers/ISignatureRecoverableInfoProvider.cs @@ -2,60 +2,60 @@ using Microsoft.Extensions.Logging; using Volo.Abp.DependencyInjection; -namespace AElf.EventHandler +namespace AElf.EventHandler; + +public interface ISignatureRecoverableInfoProvider +{ + void SetSignature(string ethereumContractAddress, long roundId, string recoverableInfo); + HashSet GetSignature(string ethereumContractAddress, long roundId); + void RemoveSignature(string ethereumContractAddress, long roundId); +} + +public class SignatureRecoverableInfoProvider : ISignatureRecoverableInfoProvider, ISingletonDependency { - public interface ISignatureRecoverableInfoProvider + private readonly Dictionary>> _signatureRecoverableInfoDictionary; + private ILogger _logger; + + public SignatureRecoverableInfoProvider(ILogger logger) { - void SetSignature(string ethereumContractAddress, long roundId, string recoverableInfo); - HashSet GetSignature(string ethereumContractAddress, long roundId); - void RemoveSignature(string ethereumContractAddress, long roundId); + _signatureRecoverableInfoDictionary = new Dictionary>>(); + _logger = logger; } - public class SignatureRecoverableInfoProvider : ISignatureRecoverableInfoProvider, ISingletonDependency + public void SetSignature(string ethereumContractAddress, long roundId, string recoverableInfo) { - private readonly Dictionary>> _signatureRecoverableInfoDictionary; - private ILogger _logger; - - public SignatureRecoverableInfoProvider(ILogger logger) + if (!_signatureRecoverableInfoDictionary.TryGetValue(ethereumContractAddress, out var roundSignature)) { - _signatureRecoverableInfoDictionary = new Dictionary>>(); - _logger = logger; + roundSignature = new Dictionary>(); + _signatureRecoverableInfoDictionary[ethereumContractAddress] = roundSignature; } - public void SetSignature(string ethereumContractAddress, long roundId, string recoverableInfo) - { - if (!_signatureRecoverableInfoDictionary.TryGetValue(ethereumContractAddress, out var roundSignature)) - { - roundSignature = new Dictionary>(); - _signatureRecoverableInfoDictionary[ethereumContractAddress] = roundSignature; - } - if (!roundSignature.ContainsKey(roundId)) - roundSignature[roundId] = new HashSet(); - roundSignature[roundId].Add(recoverableInfo); - } + if (!roundSignature.ContainsKey(roundId)) + roundSignature[roundId] = new HashSet(); + roundSignature[roundId].Add(recoverableInfo); + } - public HashSet GetSignature(string ethereumContractAddress, long roundId) - { - if (!_signatureRecoverableInfoDictionary.TryGetValue(ethereumContractAddress, out var roundSignature)) - { - _logger.LogInformation($"Address: {ethereumContractAddress} report dose not exist"); - return new HashSet(); - } - - if (roundSignature.TryGetValue(roundId, out var recoverableInfo)) return recoverableInfo; - _logger.LogInformation($"Address: {ethereumContractAddress} RoundId: {roundId} report dose not exist"); - return new HashSet(); - } - - public void RemoveSignature(string ethereumContractAddress, long roundId) + public HashSet GetSignature(string ethereumContractAddress, long roundId) + { + if (!_signatureRecoverableInfoDictionary.TryGetValue(ethereumContractAddress, out var roundSignature)) { - if (!_signatureRecoverableInfoDictionary.TryGetValue(ethereumContractAddress, out var roundSignature)) - return; - if (!roundSignature.TryGetValue(roundId, out _)) - return; - roundSignature.Remove(roundId); - if (roundSignature.Count == 0) - _signatureRecoverableInfoDictionary.Remove(ethereumContractAddress); + _logger.LogInformation($"Address: {ethereumContractAddress} report dose not exist"); + return new HashSet(); } + + if (roundSignature.TryGetValue(roundId, out var recoverableInfo)) return recoverableInfo; + _logger.LogInformation($"Address: {ethereumContractAddress} RoundId: {roundId} report dose not exist"); + return new HashSet(); + } + + public void RemoveSignature(string ethereumContractAddress, long roundId) + { + if (!_signatureRecoverableInfoDictionary.TryGetValue(ethereumContractAddress, out var roundSignature)) + return; + if (!roundSignature.TryGetValue(roundId, out _)) + return; + roundSignature.Remove(roundId); + if (roundSignature.Count == 0) + _signatureRecoverableInfoDictionary.Remove(ethereumContractAddress); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Providers/LatestQueriedReceiptCountProvider.cs b/src/AElf.EventHandler/Providers/LatestQueriedReceiptCountProvider.cs index b1d66248..ff38747c 100644 --- a/src/AElf.EventHandler/Providers/LatestQueriedReceiptCountProvider.cs +++ b/src/AElf.EventHandler/Providers/LatestQueriedReceiptCountProvider.cs @@ -1,22 +1,21 @@ using System.Collections.Generic; using Volo.Abp.DependencyInjection; -namespace AElf.EventHandler +namespace AElf.EventHandler; + +public class LatestQueriedReceiptCountProvider : ILatestQueriedReceiptCountProvider, ISingletonDependency { - public class LatestQueriedReceiptCountProvider : ILatestQueriedReceiptCountProvider, ISingletonDependency - { - private readonly Dictionary _count = new Dictionary(); + private readonly Dictionary _count = new Dictionary(); - public long Get(string symbol) - { - if (_count.ContainsKey(symbol)) return _count[symbol]; - _count.Add(symbol, 0); - return 0; - } + public long Get(string symbol) + { + if (_count.ContainsKey(symbol)) return _count[symbol]; + _count.Add(symbol, 0); + return 0; + } - public void Set(string symbol, long count) - { - _count[symbol] = count; - } + public void Set(string symbol, long count) + { + _count[symbol] = count; } } \ No newline at end of file diff --git a/src/AElf.EventHandler/TransactionResultListEventHandler.cs b/src/AElf.EventHandler/TransactionResultListEventHandler.cs index 266d82d2..8690b50d 100644 --- a/src/AElf.EventHandler/TransactionResultListEventHandler.cs +++ b/src/AElf.EventHandler/TransactionResultListEventHandler.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using AElf.Client.Core.Options; using AElf.Types; using AElf.WebApp.MessageQueue; using Google.Protobuf; @@ -15,11 +16,11 @@ public class TransactionResultListEventHandler : IDistributedEventHandler _logEventProcessors; - private readonly ContractAddressOptions _contractAddressOptions; + private readonly AElfContractOptions _contractAddressOptions; private readonly ILogger _logger; public TransactionResultListEventHandler(IEnumerable logEventProcessors, - IOptionsSnapshot contractAddressOptions, + IOptionsSnapshot contractAddressOptions, ILogger logger) { _logEventProcessors = logEventProcessors; @@ -30,7 +31,7 @@ public TransactionResultListEventHandler(IEnumerable logEven public async Task HandleEventAsync(TransactionResultListEto eventData) { var usefulLogEventProcessors = _logEventProcessors.Where(p => - _contractAddressOptions.ContractAddressMap.ContainsKey(p.ContractName)).ToList(); + _contractAddressOptions.ContractAddressList.ContainsKey(p.ContractName)).ToList(); foreach (var txResultEto in eventData.TransactionResults.Values.SelectMany(result => result)) { diff --git a/src/AElf.EventHandler/appsettings.json b/src/AElf.EventHandler/appsettings.json index 0d57da1d..9881e9e4 100644 --- a/src/AElf.EventHandler/appsettings.json +++ b/src/AElf.EventHandler/appsettings.json @@ -16,69 +16,121 @@ "UserName": "", "Password": "" }, - "Contracts": { - "ContractAddressMap": { - "BasicZero": "pykr77ft9UUKJZLVq15wCH8PinBSjVRQ12sD1Ayq92mKFsJ1i", - "Oracle": "2LUmicHyH4RXrMjG4beDwuDsiWJESyLkgkwPdGTR8kahRzq5XS", - "Report": "2WHXRoLRjbUTDQsuqR5CntygVfnDb125qdJkudev4kVNbLhTdG", - "Consensus": "pGa4e5hNGsgkfjEGm72TEvbF7aRDqKBd4LuXtab4ucMbXLcgJ", - "IntegerAggregator": "2RHf2fxsnEaM3wb6N1yGqPupNZbcCY98LgWbGSFWmWzgEs5Sjo", - "NumericAggregator": "2RHf2fxsnEaM3wb6N1yGqPupNZbcCY98LgWbGSFWmWzgEs5Sjo", - "StringAggregator": "", - "Bridge": "", - "MTRecorder": "", - "Regiment": "" - } + "AElfClient": { + "ClientConfigList": [ + { + "Alias": "Example", + "Endpoint": "http://192.168.0.31:6800", + "UserName": "", + "Password": "", + "Timeout": 100 + } + ] }, - "Config": { - "BlockChainEndpoint": "http://localhost:8001/", - "AccountAddress": "4zT74bCjganXgwFhcnW8DNLVt3Lebq2speF362oQoAqR4S7WX", - "AccountPassword": "123456789", - "Token": "", - "ObserverAssociationAddressList": [], - "TransmitContractAddress": "", - "LockMappingContractAddress": "", - "MerkleGeneratorContractAddress": "", - "RecorderId": 0, - "MaximumLeafCount": 1024, - "SendQueryTransaction": true, - "QueryPayment": 100000000, - "TokenSwapOracleOrganizationAddress": "", - "SwapConfigs" :[ + "AElfAccount": { + "KeyDirectory": "", + "AccountConfigList": [ + { + "Alias": "Ean", + "PrivateKey": "8cc296e44d9e8881942e75a21ebc116ed3f29e39e0eaace1c92dc21e86d215c3", + "Address": "2AiXjNszZwUMdonm2RYb3GsB3aLUU3hkD1fxoazMwqPAamerLQ", + "Password": "aelftest" + }, + { + "Alias": "Test1", + "Address": "215tht8WyakoxNK4SvsR132jChydxE27RtJN8HSk1UXxuDQnmM", + "Password": "aelftest" + }, + { + "Alias": "Test2", + "PrivateKey": "5e2f12d13e4527ad1128e07db00f1614ec6b8b51662e68d4fdb42125ab384195" + }, + { + "Alias": "eanz", + "Address": "2HeW7S9HZrbRJZeivMppUuUY3djhWdfVnP5zrDsz8wqq6hKMfT", + "Password": "zhaoyiqi" + } + ] + }, + "AElfClientConfig": { + "ClientAlias": "TestNetSideChain2", + "MainChainClientAlias": "TestNetMainChain", + "SideChainClientAlias": "TestNetSideChain2", + "AccountAlias": "eanz" + }, + "EthereumClient": { + "ClientConfigList": [ { - "TokenSymbol": "ELF", - "LockMappingContractAddress": "", - "RecorderId" : 0, - "NodeUrl": "https://kovan.infura.io/v3/4c41b8476e874c178c633ff442a27a1b", - "CanTakeToken": false + "Alias": "Example", + "Url": "https://kovan.infura.io/v3/4c41b8476e874c178c633ff442a27a1b" + } + ] + }, + "EthereumAccount": { + "KeyDirectory": "", + "AccountConfigList": [ + { + "Alias": "Ean", + "PrivateKey": "99e3b0664a3d38d89937c8549ddd1d9e725426c5cdfad05ce55d15464c49b5c0" }, { - "TokenSymbol": "USDT", - "LockMappingContractAddress": "", - "RecorderId" : 1, - "NodeUrl": "", - "CanTakeToken": false + "Alias": "Test1", + "Address": "0xB72ca421Ad2f462db0b91aB9428EE1947Cf3d59e", + "Password": "test" } ] }, - "Ethereum": { - "Url": "https://kovan.infura.io/v3/4c41b8476e874c178c633ff442a27a1b", - "Address": "0xB240915a9D4505503a28B8c23f6ea4aAcE4d34E7", - "PrivateKey": "0x2abfd8a6bd92d4e17a8fb2621a07fd723487e8690f2a575d5b321be1481ceae2", - "IsEnable": false + "EthereumClientConfig": { + "AccountAlias": "Test1" + }, + "AElfContract": { + "ContractDirectory": "", + "ContractAddressList": { + "MerkleTreeContractAddress": "2RHf2fxsnEaM3wb6N1yGqPupNZbcCY98LgWbGSFWmWzgEs5Sjo", + "BridgeContractAddress": "pykr77ft9UUKJZLVq15wCH8PinBSjVRQ12sD1Ayq92mKFsJ1i", + "OracleContractAddress": "2ZpYFeE4yWjrcKLBoj1iwbfYnbo9hK7exvfGTdqcq77QSxpzNH" + } + }, + "EthereumContract": { + "AbiFileDirectory": "", + "ContractInfoList": { + "Regiment": { + "ContractAddress": "", + "AbiFileName": "RegimentAbi.json" + }, + "Bridge": { + "ContractAddress": "", + "AbiFileName": "BridgeAbi.json" + } + } }, - "ContractAbi": { - "TransmitAbiFilePath": "./ContractBuild/TransmitAbi.json", - "LockAbiFilePath": "./ContractBuild/LockAbi.json", - "LockWithTakeTokenAbiFilePath":"./ContractBuild/LockWithTakeTokenAbi.json" + "Oracle": { + "ObserverAssociationAddressList": [] }, - "Lottery": { - "IsDrawLottery": false, - "AccountAddress": "", - "AccountPassword": "123456789", - "LotteryContractAddress" : "", - "StartTimestamp": 0, - "IntervalMinutes": 1440, - "LatestDrewPeriod": 0 + "Bridge": { + "IsSendQuery": false, + "QueryPayment": 100000000, + "Bridges": [ + { + "EthereumClientAlias": "Example", + "OriginToken": "", + "BridgeContractAddress": "", + "SpaceId": "", + "SwapId": "", + "MaximumLeafCount": 1024, + "QueryToAddress": "", + "IsTransmitter": false + }, + { + "EthereumClientAlias": "Example2", + "OriginToken": "", + "BridgeContractAddress": "", + "SpaceId": "", + "SwapId": "", + "MaximumLeafCount": 1024, + "QueryToAddress": "", + "IsTransmitter": false + } + ] } } \ No newline at end of file From 712a86917481dfdbae3729df5080b4c9f1af6aea Mon Sep 17 00:00:00 2001 From: zhxymh Date: Wed, 17 Aug 2022 10:07:43 +0800 Subject: [PATCH 02/66] feat: add config --- .gitignore | 4 +- .../MerkleTreeContract.cs | 55 +++++++++++++ modules/AElf.Client.Oracle/OracleService.cs | 78 +++++++++++++++++++ modules/AElf.Client.Report/ReportService.cs | 65 ++++++++++++++++ .../Options/EthereumClientConfigOptions.cs | 10 ++- .../EventHandlerAppModule.cs | 6 +- .../Options/BridgeOptions.cs | 22 ++++++ .../Options/ConfigOptions.cs | 38 ++++----- .../Options/EthereumConfigOptions.cs | 8 +- .../Options/OracleOptions.cs | 8 ++ ...IrreversibleBlockFoundLogEventProcessor.cs | 6 -- .../QueryCreatedLogEventProcessor.cs | 4 +- .../ReportConfirmedLogEventProcessor.cs | 3 - .../ReportProposedLogEventProcessor.cs | 4 +- ...ntCommitmentsCollectedLogEventProcessor.cs | 4 +- .../Providers/IDataProvider.cs | 9 +-- src/AElf.EventHandler/appsettings.json | 7 +- 17 files changed, 273 insertions(+), 58 deletions(-) create mode 100644 modules/AElf.Client.MerkleTree/MerkleTreeContract.cs create mode 100644 modules/AElf.Client.Oracle/OracleService.cs create mode 100644 modules/AElf.Client.Report/ReportService.cs create mode 100644 src/AElf.EventHandler/Options/BridgeOptions.cs create mode 100644 src/AElf.EventHandler/Options/OracleOptions.cs diff --git a/.gitignore b/.gitignore index 86181d1c..cee95826 100644 --- a/.gitignore +++ b/.gitignore @@ -296,4 +296,6 @@ aelf.js Contracts.manifest # Contract patcher dlls -chain/scripts/patcher/* +scripts/patcher/* +src/AElf.Boilerplate.Launcher/contracts/* +test/patched/* \ No newline at end of file diff --git a/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs b/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs new file mode 100644 index 00000000..1b1ee8d2 --- /dev/null +++ b/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs @@ -0,0 +1,55 @@ +using AElf.Client.Core; +using AElf.Client.Core.Options; +using AElf.Contracts.MerkleTreeContract; +using AElf.Types; +using Microsoft.Extensions.Options; +using Volo.Abp.DependencyInjection; +using Google.Protobuf.WellKnownTypes; +using Google.Protobuf; + +namespace AElf.Client.MerkleTreeContract; + +public interface IMerkleTreeContractService +{ + Task CreateSpaceAsync(CreateSpaceInput createSpaceInput); + + Task GetLastLeafIndexAsync(GetLastLeafIndexInput getLastLeafIndexInput); +} + +public class MerkleTreeContractService : ContractServiceBase, IMerkleTreeContractService, ITransientDependency +{ + private readonly IAElfClientService _clientService; + private readonly AElfClientConfigOptions _clientConfigOptions; + private readonly AElfContractOptions _contractOptions; + + protected MerkleTreeContractService(IAElfClientService clientService, + IOptionsSnapshot clientConfigOptions, + IOptionsSnapshot contractOptions) : base(clientService, + Address.FromBase58(contractOptions.Value.ContractAddressList[""])) + { + _clientService = clientService; + _clientConfigOptions = clientConfigOptions.Value; + _contractOptions = contractOptions.Value; + } + + public async Task CreateSpaceAsync(CreateSpaceInput createSpaceInput) + { + var useClientAlias = _clientConfigOptions.ClientAlias; + var tx = await PerformSendTransactionAsync("CreateSpace", createSpaceInput, useClientAlias); + return new SendTransactionResult + { + Transaction = tx, + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), useClientAlias) + }; + } + + public async Task GetLastLeafIndexAsync(GetLastLeafIndexInput getLastLeafIndexInput) + { + var useClientAlias = _clientConfigOptions.ClientAlias; + var result = await _clientService.ViewAsync(_contractOptions.ContractAddressList[""], "GetLastLeafIndex", + getLastLeafIndexInput, useClientAlias); + var actualResult = new Int64Value(); + actualResult.MergeFrom(result); + return actualResult; + } +} \ No newline at end of file diff --git a/modules/AElf.Client.Oracle/OracleService.cs b/modules/AElf.Client.Oracle/OracleService.cs new file mode 100644 index 00000000..d5469218 --- /dev/null +++ b/modules/AElf.Client.Oracle/OracleService.cs @@ -0,0 +1,78 @@ +using AElf.Client.Core; +using AElf.Client.Core.Options; +using AElf.Contracts.Oracle; +using AElf.Types; +using Microsoft.Extensions.Options; +using Volo.Abp.DependencyInjection; + +namespace AElf.Client.Oracle; + +public interface IOracleService +{ + Task QueryAsync(QueryInput queryInput); + + Task CommitAsync(CommitInput commitInput); + + Task RevealAsync(RevealInput revealInput); + + Task CancelQueryAsync(Hash cancelQueryInput); +} + +public class OracleService : ContractServiceBase, IOracleService, ITransientDependency +{ + private readonly IAElfClientService _clientService; + private readonly AElfClientConfigOptions _clientConfigOptions; + + protected OracleService(IAElfClientService clientService, + IOptionsSnapshot clientConfigOptions, + IOptionsSnapshot contractOptions) : base(clientService, + Address.FromBase58(contractOptions.Value.ContractAddressList["OracleContractAddress"])) + { + _clientService = clientService; + _clientConfigOptions = clientConfigOptions.Value; + } + + public async Task QueryAsync(QueryInput queryInput) + { + var useClientAlias = _clientConfigOptions.ClientAlias; + var tx = await PerformSendTransactionAsync("Query", queryInput, useClientAlias); + return new SendTransactionResult + { + Transaction = tx, + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), useClientAlias) + }; + } + + public async Task CommitAsync(CommitInput commitInput) + { + var useClientAlias = _clientConfigOptions.ClientAlias; + var tx = await PerformSendTransactionAsync("Commit", commitInput, useClientAlias); + return new SendTransactionResult + { + Transaction = tx, + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), useClientAlias) + }; + } + + public async Task RevealAsync(RevealInput revealInput) + { + var useClientAlias = _clientConfigOptions.ClientAlias; + var tx = await PerformSendTransactionAsync("Reveal", revealInput, useClientAlias); + return new SendTransactionResult + { + Transaction = tx, + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), useClientAlias) + }; + } + + public async Task CancelQueryAsync(Hash cancelQueryInput) + { + var useClientAlias = _clientConfigOptions.ClientAlias; + var tx = await PerformSendTransactionAsync("CancelQuery", cancelQueryInput, useClientAlias); + return new SendTransactionResult + { + Transaction = tx, + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), useClientAlias) + }; + } +} \ No newline at end of file diff --git a/modules/AElf.Client.Report/ReportService.cs b/modules/AElf.Client.Report/ReportService.cs new file mode 100644 index 00000000..ad6f5fda --- /dev/null +++ b/modules/AElf.Client.Report/ReportService.cs @@ -0,0 +1,65 @@ +using AElf.Client.Core; +using AElf.Client.Core.Options; +using AElf.Contracts.Report; +using AElf.Types; +using Microsoft.Extensions.Options; +using Volo.Abp.DependencyInjection; + +namespace AElf.Client.Report; + +public interface IReportService +{ + Task ProposeReportAsync(CallbackInput proposeReportInput); + + Task ConfirmReportAsync(ConfirmReportInput confirmReportInput); + + Task RejectReportAsync(RejectReportInput rejectReportInput); +} + +public class ReportService : ContractServiceBase, IReportService, ITransientDependency +{ + private readonly IAElfClientService _clientService; + private readonly AElfClientConfigOptions _clientConfigOptions; + + protected ReportService(IAElfClientService clientService, + IOptionsSnapshot clientConfigOptions, + IOptionsSnapshot contractOptions) : base(clientService, + Address.FromBase58(contractOptions.Value.ContractAddressList["ReportContractAddress"])) + { + _clientService = clientService; + _clientConfigOptions = clientConfigOptions.Value; + } + + public async Task ProposeReportAsync(CallbackInput proposeReportInput) + { + var useClientAlias = _clientConfigOptions.ClientAlias; + var tx = await PerformSendTransactionAsync("ProposeReport", proposeReportInput, useClientAlias); + return new SendTransactionResult + { + Transaction = tx, + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), useClientAlias) + }; + } + + public async Task ConfirmReportAsync(ConfirmReportInput confirmReportInput) + { + var useClientAlias = _clientConfigOptions.ClientAlias; + var tx = await PerformSendTransactionAsync("ConfirmReport", confirmReportInput, useClientAlias); + return new SendTransactionResult + { + Transaction = tx, + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), useClientAlias) + }; + } + + public async Task RejectReportAsync(RejectReportInput rejectReportInput) + { + var useClientAlias = _clientConfigOptions.ClientAlias; + var tx = await PerformSendTransactionAsync("RejectReport", rejectReportInput, useClientAlias); + return new SendTransactionResult + { + Transaction = tx, + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), useClientAlias) + }; + } +} \ No newline at end of file diff --git a/modules/AElf.Nethereum.Core/Options/EthereumClientConfigOptions.cs b/modules/AElf.Nethereum.Core/Options/EthereumClientConfigOptions.cs index ca4d70eb..bbd1ec73 100644 --- a/modules/AElf.Nethereum.Core/Options/EthereumClientConfigOptions.cs +++ b/modules/AElf.Nethereum.Core/Options/EthereumClientConfigOptions.cs @@ -2,6 +2,12 @@ namespace AElf.Nethereum.Core.Options; public class EthereumClientConfigOptions { - public string Url { get; set; } = "https://kovan.infura.io/v3/4c41b8476e874c178c633ff442a27a1b"; - public string AccountAlias { get; set; } = "Default"; + public List ClientConfigList { get; set; } = new(); +} + +public class EthereumClient +{ + public string Alias { get; set; } + + public string Url { get; set; } } \ No newline at end of file diff --git a/src/AElf.EventHandler/EventHandlerAppModule.cs b/src/AElf.EventHandler/EventHandlerAppModule.cs index 1676431e..812d23d1 100644 --- a/src/AElf.EventHandler/EventHandlerAppModule.cs +++ b/src/AElf.EventHandler/EventHandlerAppModule.cs @@ -60,8 +60,10 @@ public override void ConfigureServices(ServiceConfigurationContext context) options.Connections.Default.Uri = new Uri(messageQueueConfig.GetSection("Uri").Value); }); - Configure(configuration.GetSection("Config")); - Configure(configuration.GetSection("Ethereum")); + // Configure(configuration.GetSection("Config")); + // Configure(configuration.GetSection("Ethereum")); + Configure(configuration.GetSection("Oracle")); + Configure(configuration.GetSection("Bridge")); context.Services.AddHostedService(); context.Services.AddTransient(typeof(ILogEventProcessor<>), typeof(LogEventProcessorBase<>)); } diff --git a/src/AElf.EventHandler/Options/BridgeOptions.cs b/src/AElf.EventHandler/Options/BridgeOptions.cs new file mode 100644 index 00000000..94814d27 --- /dev/null +++ b/src/AElf.EventHandler/Options/BridgeOptions.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace AElf.EventHandler; + +public class BridgeOptions +{ + public bool IsSendQuery { get; set; } + public bool IsTransmitter { get; set; } + public long QueryPayment { get; set; } + public List Bridges { get; set; } +} + +public class BridgeItem +{ + public string EthereumClientAlias { get; set; } + public string OriginToken { get; set; } + public string BridgeContractAddress { get; set; } + public string SpaceId { get; set; } + public string SwapId { get; set; } + public string MaximumLeafCount { get; set; } + public string QueryToAddress { get; set; } +} \ No newline at end of file diff --git a/src/AElf.EventHandler/Options/ConfigOptions.cs b/src/AElf.EventHandler/Options/ConfigOptions.cs index b3c34105..cefc91b6 100644 --- a/src/AElf.EventHandler/Options/ConfigOptions.cs +++ b/src/AElf.EventHandler/Options/ConfigOptions.cs @@ -2,23 +2,23 @@ namespace AElf.EventHandler { - public class ConfigOptions - { - public string Token { get; set; } - public List ObserverAssociationAddressList { get; set; } - public List SwapConfigs { get; set; } - public int MaximumLeafCount { get; set; } - public bool SendQueryTransaction { get; set; } - public long QueryPayment { get; set; } = 1_0000_0000; - public string TokenSwapOracleOrganizationAddress { get; set; } - } - - public class SwapConfig - { - public string TokenSymbol { get; set; } - public string SpaceId { get; set; } - public string LockMappingContractAddress { get; set; } - public string NodeUrl { get; set; } - public bool CanTakeToken { get; set; } - } + // public class ConfigOptions + // { + // public string Token { get; set; } + // public List ObserverAssociationAddressList { get; set; } + // public List SwapConfigs { get; set; } + // public int MaximumLeafCount { get; set; } + // public bool SendQueryTransaction { get; set; } + // public long QueryPayment { get; set; } = 1_0000_0000; + // public string TokenSwapOracleOrganizationAddress { get; set; } + // } + // + // public class SwapConfig + // { + // public string TokenSymbol { get; set; } + // public string SpaceId { get; set; } + // public string LockMappingContractAddress { get; set; } + // public string NodeUrl { get; set; } + // public bool CanTakeToken { get; set; } + // } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Options/EthereumConfigOptions.cs b/src/AElf.EventHandler/Options/EthereumConfigOptions.cs index 00982a45..124081dc 100644 --- a/src/AElf.EventHandler/Options/EthereumConfigOptions.cs +++ b/src/AElf.EventHandler/Options/EthereumConfigOptions.cs @@ -1,7 +1,7 @@ namespace AElf.EventHandler { - public class EthereumConfigOptions - { - public bool IsEnable { get; set; } - } + // public class EthereumConfigOptions + // { + // public bool IsEnable { get; set; } + // } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Options/OracleOptions.cs b/src/AElf.EventHandler/Options/OracleOptions.cs new file mode 100644 index 00000000..fa4570b8 --- /dev/null +++ b/src/AElf.EventHandler/Options/OracleOptions.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic; + +namespace AElf.EventHandler; + +public class OracleOptions +{ + public List ObserverAssociationAddressList { get; set; } +} \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs index 7efee072..e2f1be11 100644 --- a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs @@ -17,8 +17,6 @@ namespace AElf.EventHandler; public class IrreversibleBlockFoundLogEventProcessor : LogEventProcessorBase { - private readonly ConfigOptions _configOptions; - private readonly EthereumConfigOptions _ethereumConfigOptions; private readonly AElfContractOptions _contractAddressOptions; private readonly EthereumContractOptions _ethereumContractOptions; private readonly ILatestQueriedReceiptCountProvider _latestQueriedReceiptCountProvider; @@ -29,8 +27,6 @@ public class IrreversibleBlockFoundLogEventProcessor : LogEventProcessorBase contractAddressOptions, - IOptionsSnapshot configOptions, - IOptionsSnapshot ethereumConfigOptions, IOptionsSnapshot ethereumContractOptions, ILatestQueriedReceiptCountProvider latestQueriedReceiptCountProvider, IOracleService oracleService, @@ -43,8 +39,6 @@ public IrreversibleBlockFoundLogEventProcessor( _merkleTreeContractService = merkleTreeContractService; _logger = logger; - _configOptions = configOptions.Value; - _ethereumConfigOptions = ethereumConfigOptions.Value; _contractAddressOptions = contractAddressOptions.Value; { diff --git a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs index 971118d8..002c2886 100644 --- a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs @@ -13,11 +13,10 @@ internal class QueryCreatedLogEventProcessor : LogEventProcessorBase "Oracle"; private readonly ILogger _logger; - public QueryCreatedLogEventProcessor(IOptionsSnapshot configOptions, + public QueryCreatedLogEventProcessor( IOptionsSnapshot contractAddressOptions, ISaltProvider saltProvider, IDataProvider dataProvider, ILogger logger) : base(contractAddressOptions) @@ -25,7 +24,6 @@ public QueryCreatedLogEventProcessor(IOptionsSnapshot configOptio _saltProvider = saltProvider; _dataProvider = dataProvider; _logger = logger; - _configOptions = configOptions.Value; } public override async Task ProcessAsync(LogEvent logEvent) diff --git a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs index 12f2d991..608dc0bc 100644 --- a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs @@ -20,21 +20,18 @@ internal class ReportConfirmedLogEventProcessor : LogEventProcessorBase logger, IOptionsSnapshot contractAddressOptions, IReportProvider reportProvider, ISignatureRecoverableInfoProvider signaturesRecoverableInfoProvider, - IOptionsSnapshot ethereumConfigOptions, IOptionsSnapshot ethereumContractOptions) : base(contractAddressOptions) { _logger = logger; _signaturesRecoverableInfoProvider = signaturesRecoverableInfoProvider; _ethereumContractOptions = ethereumContractOptions.Value; _reportProvider = reportProvider; - _ethereumConfigOptions = ethereumConfigOptions.Value; var file = Path.Combine(_ethereumContractOptions.AbiFileDirectory, _ethereumContractOptions.ContractInfoList["Bridge"].AbiFileName); if (!string.IsNullOrEmpty(file)) diff --git a/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs index b7008a5c..f42a27f0 100644 --- a/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs @@ -13,7 +13,6 @@ namespace AElf.EventHandler; internal class ReportProposedLogEventProcessor : LogEventProcessorBase { private readonly AElfContractOptions _contractAddressOptions; - private readonly ConfigOptions _configOptions; private readonly IReportProvider _reportProvider; private readonly IReportService _reportService; private readonly IAElfAccountProvider _accountProvider; @@ -21,7 +20,7 @@ internal class ReportProposedLogEventProcessor : LogEventProcessorBase "Report"; private readonly ILogger _logger; - public ReportProposedLogEventProcessor(IOptionsSnapshot configOptions, + public ReportProposedLogEventProcessor( IOptionsSnapshot contractAddressOptions, IReportProvider reportProvider, IReportService reportService, @@ -29,7 +28,6 @@ public ReportProposedLogEventProcessor(IOptionsSnapshot configOpt ILogger logger) : base(contractAddressOptions) { _logger = logger; - _configOptions = configOptions.Value; _contractAddressOptions = contractAddressOptions.Value; _reportProvider = reportProvider; _reportService = reportService; diff --git a/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs index c68f2f47..1dc92058 100644 --- a/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs @@ -13,10 +13,9 @@ internal class SufficientCommitmentsCollectedLogEventProcessor : private readonly ISaltProvider _saltProvider; private readonly IDataProvider _dataProvider; private readonly AElfContractOptions _contractAddressOptions; - private readonly ConfigOptions _configOptions; private readonly ILogger _logger; - public SufficientCommitmentsCollectedLogEventProcessor(IOptionsSnapshot configOptions, + public SufficientCommitmentsCollectedLogEventProcessor( IOptionsSnapshot contractAddressOptions, ISaltProvider saltProvider, IDataProvider dataProvider, ILogger logger) : base(contractAddressOptions) @@ -24,7 +23,6 @@ public SufficientCommitmentsCollectedLogEventProcessor(IOptionsSnapshot _dictionary; private readonly ILogger _logger; - private readonly AElfContractOptions _contractAddressOptions; - private readonly EthereumConfigOptions _ethereumConfigOptions; - private readonly ConfigOptions _configOptions; private readonly string _bridgeAbi; private Web3Manager _web3ManagerForLock; - public DataProvider(ILogger logger, IOptionsSnapshot ethereumConfigOptions, - IOptionsSnapshot configOptions, IOptionsSnapshot ethereumContractOptions, + public DataProvider(ILogger logger, IOptionsSnapshot ethereumContractOptions, IOptionsSnapshot contractAddressOptions) { _logger = logger; - _contractAddressOptions = contractAddressOptions.Value; - _configOptions = configOptions.Value; - _ethereumConfigOptions = ethereumConfigOptions.Value; _dictionary = new Dictionary(); { var file = Path.Combine(ethereumContractOptions.Value.AbiFileDirectory, diff --git a/src/AElf.EventHandler/appsettings.json b/src/AElf.EventHandler/appsettings.json index 9881e9e4..c861e13b 100644 --- a/src/AElf.EventHandler/appsettings.json +++ b/src/AElf.EventHandler/appsettings.json @@ -109,6 +109,7 @@ }, "Bridge": { "IsSendQuery": false, + "IsTransmitter": false, "QueryPayment": 100000000, "Bridges": [ { @@ -118,8 +119,7 @@ "SpaceId": "", "SwapId": "", "MaximumLeafCount": 1024, - "QueryToAddress": "", - "IsTransmitter": false + "QueryToAddress": "" }, { "EthereumClientAlias": "Example2", @@ -128,8 +128,7 @@ "SpaceId": "", "SwapId": "", "MaximumLeafCount": 1024, - "QueryToAddress": "", - "IsTransmitter": false + "QueryToAddress": "" } ] } From 4433c8a787610d9811ebb965be8e186fd6bdcb8b Mon Sep 17 00:00:00 2001 From: zhxymh Date: Wed, 17 Aug 2022 14:57:16 +0800 Subject: [PATCH 03/66] feat: add bridge contract service --- AElf.Contracts.PortAll.sln | 7 +++ .../AElf.Nethereum.Bridge.csproj | 13 +++++ .../AElfNethereumBridgeModule.cs | 19 +++++++ .../GetReceiptInfosDTO.cs | 39 ++++++++++++++ .../GetSendReceiptIndexDTO.cs | 13 +++++ .../AElf.Nethereum.Bridge/IBridgeInService.cs | 28 ++++++++++ .../IBridgeOutService.cs | 34 ++++++++++++ .../AElfNethereumClientModule.cs | 1 + .../ContractServiceBase.cs | 49 +++++++++++++++++ .../INethereumAccountProvider.cs | 32 ++++++++++++ .../INethereumClientProvider.cs | 52 +++++++++++++++++++ .../EthereumClientAccountMappingOptions.cs | 6 +++ ...IrreversibleBlockFoundLogEventProcessor.cs | 2 +- src/AElf.EventHandler/appsettings.json | 5 ++ 14 files changed, 299 insertions(+), 1 deletion(-) create mode 100644 modules/AElf.Nethereum.Bridge/AElf.Nethereum.Bridge.csproj create mode 100644 modules/AElf.Nethereum.Bridge/AElfNethereumBridgeModule.cs create mode 100644 modules/AElf.Nethereum.Bridge/GetReceiptInfosDTO.cs create mode 100644 modules/AElf.Nethereum.Bridge/GetSendReceiptIndexDTO.cs create mode 100644 modules/AElf.Nethereum.Bridge/IBridgeInService.cs create mode 100644 modules/AElf.Nethereum.Bridge/IBridgeOutService.cs create mode 100644 modules/AElf.Nethereum.Core/ContractServiceBase.cs create mode 100644 modules/AElf.Nethereum.Core/INethereumAccountProvider.cs create mode 100644 modules/AElf.Nethereum.Core/INethereumClientProvider.cs create mode 100644 modules/AElf.Nethereum.Core/Options/EthereumClientAccountMappingOptions.cs diff --git a/AElf.Contracts.PortAll.sln b/AElf.Contracts.PortAll.sln index 2554916b..65ce73cf 100644 --- a/AElf.Contracts.PortAll.sln +++ b/AElf.Contracts.PortAll.sln @@ -67,6 +67,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Nethereum.Core", "modu EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Client.Bridge", "modules\AElf.Client.Bridge\AElf.Client.Bridge.csproj", "{ADD0EBAC-F957-4D59-AF43-C10D31DFB2DA}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Nethereum.Bridge", "modules\AElf.Nethereum.Bridge\AElf.Nethereum.Bridge.csproj", "{1AC48421-CF85-44B9-B79A-6D41F8C09FF8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -173,6 +175,10 @@ Global {ADD0EBAC-F957-4D59-AF43-C10D31DFB2DA}.Debug|Any CPU.Build.0 = Debug|Any CPU {ADD0EBAC-F957-4D59-AF43-C10D31DFB2DA}.Release|Any CPU.ActiveCfg = Release|Any CPU {ADD0EBAC-F957-4D59-AF43-C10D31DFB2DA}.Release|Any CPU.Build.0 = Release|Any CPU + {1AC48421-CF85-44B9-B79A-6D41F8C09FF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1AC48421-CF85-44B9-B79A-6D41F8C09FF8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1AC48421-CF85-44B9-B79A-6D41F8C09FF8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1AC48421-CF85-44B9-B79A-6D41F8C09FF8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -203,6 +209,7 @@ Global {538194EF-9329-4C90-8BD9-0E6EFDFEF691} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039} {4175F31E-5ED6-4B67-973C-51B0C44BE74B} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039} {ADD0EBAC-F957-4D59-AF43-C10D31DFB2DA} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039} + {1AC48421-CF85-44B9-B79A-6D41F8C09FF8} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {D7426B41-E959-40E4-9ED8-ED8D9C50F133} diff --git a/modules/AElf.Nethereum.Bridge/AElf.Nethereum.Bridge.csproj b/modules/AElf.Nethereum.Bridge/AElf.Nethereum.Bridge.csproj new file mode 100644 index 00000000..ae9295a7 --- /dev/null +++ b/modules/AElf.Nethereum.Bridge/AElf.Nethereum.Bridge.csproj @@ -0,0 +1,13 @@ + + + + net6.0 + enable + enable + + + + + + + diff --git a/modules/AElf.Nethereum.Bridge/AElfNethereumBridgeModule.cs b/modules/AElf.Nethereum.Bridge/AElfNethereumBridgeModule.cs new file mode 100644 index 00000000..a87c6ad8 --- /dev/null +++ b/modules/AElf.Nethereum.Bridge/AElfNethereumBridgeModule.cs @@ -0,0 +1,19 @@ +using AElf.Nethereum.Core; +using AElf.Nethereum.Core.Options; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Autofac; +using Volo.Abp.AutoMapper; +using Volo.Abp.Modularity; + +namespace AElf.Nethereum.Bridge; + +[DependsOn( + typeof(AElfNethereumClientModule) +)] +public class AElfNethereumBridgeModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + var configuration = context.Services.GetConfiguration(); + } +} \ No newline at end of file diff --git a/modules/AElf.Nethereum.Bridge/GetReceiptInfosDTO.cs b/modules/AElf.Nethereum.Bridge/GetReceiptInfosDTO.cs new file mode 100644 index 00000000..418ce1f8 --- /dev/null +++ b/modules/AElf.Nethereum.Bridge/GetReceiptInfosDTO.cs @@ -0,0 +1,39 @@ +using System.Numerics; +using Nethereum.ABI.FunctionEncoding.Attributes; + +namespace AElf.Nethereum.Bridge; + +[FunctionOutput] +public class GetReceiptInfosDTO: IFunctionOutputDTO +{ + [Parameter("tuple[]", "_receipts", 1)] + public List Receipts { get; set; } +} + +[FunctionOutput] +public class ReceiptDTO : IFunctionOutputDTO +{ + [Parameter("uint256", "receiptId", 1)] + public BigInteger ReceiptId { get; set; } + + [Parameter("address", "asset", 2)] + public string Asset { get; set; } + + [Parameter("address", "owner", 3)] + public string Owner { get; set; } + + [Parameter("string", "targetChainId", 4)] + public string TargetChainId { get; set; } + + [Parameter("string", "targetAddress", 5)] + public string TargetAddress { get; set; } + + [Parameter("uint256", "amount", 6)] + public BigInteger Amount { get; set; } + + [Parameter("uint256", "blockHeight", 7)] + public BigInteger BlockHeight { get; set; } + + [Parameter("uint256", "blockTime", 8)] + public BigInteger BlockTime { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Nethereum.Bridge/GetSendReceiptIndexDTO.cs b/modules/AElf.Nethereum.Bridge/GetSendReceiptIndexDTO.cs new file mode 100644 index 00000000..2cfa7988 --- /dev/null +++ b/modules/AElf.Nethereum.Bridge/GetSendReceiptIndexDTO.cs @@ -0,0 +1,13 @@ +using System.Numerics; +using Nethereum.ABI.FunctionEncoding.Attributes; + +namespace AElf.Nethereum.Bridge; + +[FunctionOutput] +public class GetSendReceiptIndexDTO : IFunctionOutputDTO +{ + [Parameter("tuple[]", "indexs", 1)] public List Indexes { get; set; } + + [Parameter("tuple[]", "blocktimes", 2)] + public List BlockTimes { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Nethereum.Bridge/IBridgeInService.cs b/modules/AElf.Nethereum.Bridge/IBridgeInService.cs new file mode 100644 index 00000000..415970e5 --- /dev/null +++ b/modules/AElf.Nethereum.Bridge/IBridgeInService.cs @@ -0,0 +1,28 @@ +using AElf.Nethereum.Core; +using Nethereum.RPC.Eth.DTOs; +using Volo.Abp.DependencyInjection; + +namespace AElf.Nethereum.Bridge; + +public interface IBridgeInService +{ + Task TransmitAsync(string clientAlias, byte[] report, byte[][] rs, byte[][] ss, byte[] rawVs); +} + +public class BridgeInService : ContractServiceBase,IBridgeInService,ITransientDependency +{ + protected override string SmartContractName { get; } = "BridgeIn"; + + public async Task TransmitAsync(string clientAlias, byte[] report, byte[][] rs, byte[][] ss, byte[] rawVs) + { + var setValueFunction = GetFunction(clientAlias, "transmit"); + var sender = GetAccount(clientAlias).Address; + var gas = await setValueFunction.EstimateGasAsync(sender, null, null, report, rs, ss, rawVs); + var transactionResult = + await setValueFunction.SendTransactionAndWaitForReceiptAsync(sender, gas, null, null, report, + rs, ss, rawVs); + return transactionResult; + } + + +} \ No newline at end of file diff --git a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs new file mode 100644 index 00000000..97abdabf --- /dev/null +++ b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs @@ -0,0 +1,34 @@ +using AElf.Nethereum.Core; +using Nethereum.RPC.Eth.DTOs; +using Volo.Abp.DependencyInjection; + +namespace AElf.Nethereum.Bridge; + +public interface IBridgeOutService +{ + Task GetSendReceiptInfosAsync(string clientAlias, string token, long fromIndex); + + Task GetTransferReceiptIndexAsync(string clientAlias, List tokens, + List targetChainIds); +} + +public class BridgeOutService : ContractServiceBase,IBridgeOutService,ITransientDependency +{ + protected override string SmartContractName { get; } = "BridgeOut"; + + public async Task GetSendReceiptInfosAsync(string clientAlias, string token, long fromIndex) + { + var function = GetFunction(clientAlias, "getSendReceiptInfos"); + + var evmGetReceiptInfos = await function.CallDeserializingToObjectAsync(token, fromIndex); + return evmGetReceiptInfos; + } + + public async Task GetTransferReceiptIndexAsync(string clientAlias, List tokens, List targetChainIds) + { + var function = GetFunction(clientAlias, "getSendReceiptIndex"); + + var evmGetReceiptInfos = await function.CallDeserializingToObjectAsync(tokens, targetChainIds); + return evmGetReceiptInfos; + } +} \ No newline at end of file diff --git a/modules/AElf.Nethereum.Core/AElfNethereumClientModule.cs b/modules/AElf.Nethereum.Core/AElfNethereumClientModule.cs index 801e05ef..48eeed95 100644 --- a/modules/AElf.Nethereum.Core/AElfNethereumClientModule.cs +++ b/modules/AElf.Nethereum.Core/AElfNethereumClientModule.cs @@ -19,5 +19,6 @@ public override void ConfigureServices(ServiceConfigurationContext context) Configure(configuration.GetSection("EthereumAccount")); Configure(configuration.GetSection("EthereumClientConfig")); Configure(configuration.GetSection("EthereumContract")); + Configure(configuration.GetSection("EthereumClientAccountMapping")); } } \ No newline at end of file diff --git a/modules/AElf.Nethereum.Core/ContractServiceBase.cs b/modules/AElf.Nethereum.Core/ContractServiceBase.cs new file mode 100644 index 00000000..7bbfeeaf --- /dev/null +++ b/modules/AElf.Nethereum.Core/ContractServiceBase.cs @@ -0,0 +1,49 @@ +using AElf.Nethereum.Core.Options; +using Microsoft.Extensions.Options; +using Nethereum.Contracts; +using Nethereum.Web3; +using Nethereum.Web3.Accounts; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace AElf.Nethereum.Core; + +public abstract class ContractServiceBase +{ + public INethereumClientProvider NethereumClientProvider { get; set; } + public INethereumAccountProvider NethereumAccountProvider { get; set; } + public EthereumClientAccountMappingOptions EthereumClientAccountMappingOptions { get; set; } + public EthereumContractOptions EthereumContractOptions { get; set; } + protected abstract string SmartContractName { get; } + + protected ContractServiceBase() + { + } + + protected Function GetFunction(string clientAlias, string methodName) + { + var accountAlias = EthereumClientAccountMappingOptions.Mapping[clientAlias]; + var client = NethereumClientProvider.GetClient(clientAlias, accountAlias); + var contractAddress = EthereumContractOptions.ContractInfoList[SmartContractName].ContractAddress; + var contract = client.Eth.GetContract(GetAbi(), contractAddress); + return contract.GetFunction(methodName); + } + + protected Account GetAccount(string clientAlias) + { + var accountAlias = EthereumClientAccountMappingOptions.Mapping[clientAlias]; + return NethereumAccountProvider.GetAccount(accountAlias); + } + + private string GetAbi() + { + var path = Path.Combine(EthereumContractOptions.AbiFileDirectory, + EthereumContractOptions.ContractInfoList[SmartContractName].AbiFileName); + + using var file = System.IO.File.OpenText(path); + using var reader = new JsonTextReader(file); + var o = (JObject) JToken.ReadFrom(reader); + var value = o["abi"]?.ToString(); + return value; + } +} \ No newline at end of file diff --git a/modules/AElf.Nethereum.Core/INethereumAccountProvider.cs b/modules/AElf.Nethereum.Core/INethereumAccountProvider.cs new file mode 100644 index 00000000..02a5a476 --- /dev/null +++ b/modules/AElf.Nethereum.Core/INethereumAccountProvider.cs @@ -0,0 +1,32 @@ +using System.Collections.Concurrent; +using AElf.Nethereum.Core.Options; +using Microsoft.Extensions.Options; +using Nethereum.Web3.Accounts; +using Volo.Abp.DependencyInjection; + +namespace AElf.Nethereum.Core; + +public interface INethereumAccountProvider +{ + Account GetAccount(string alias); +} + +public class NethereumAccountProvider : ConcurrentDictionary, INethereumAccountProvider, ISingletonDependency +{ + private readonly EthereumAccountOptions _ethereumAccountOptions; + + public NethereumAccountProvider(IOptionsSnapshot optionsSnapshot) + { + _ethereumAccountOptions = optionsSnapshot.Value; + + foreach (var item in _ethereumAccountOptions.AccountConfigList) + { + TryAdd(item.Alias, new Account(item.PrivateKey)); + } + } + + public Account GetAccount(string alias) + { + return this[alias]; + } +} \ No newline at end of file diff --git a/modules/AElf.Nethereum.Core/INethereumClientProvider.cs b/modules/AElf.Nethereum.Core/INethereumClientProvider.cs new file mode 100644 index 00000000..9c591013 --- /dev/null +++ b/modules/AElf.Nethereum.Core/INethereumClientProvider.cs @@ -0,0 +1,52 @@ +using System.Collections.Concurrent; +using AElf.Nethereum.Core.Options; +using Microsoft.Extensions.Options; +using Nethereum.Web3; +using Volo.Abp.DependencyInjection; + +namespace AElf.Nethereum.Core; + +public interface INethereumClientProvider +{ + Web3 GetClient(string clientAlias, string accountAlias); +} + +public class NethereumClientProvider : ConcurrentDictionary, INethereumClientProvider, ISingletonDependency +{ + private readonly EthereumClientConfigOptions _ethereumClientConfigOptions; + private readonly INethereumAccountProvider _nethereumAccountProvider; + + public NethereumClientProvider(IOptionsSnapshot ethereumClientConfigOptions, + INethereumAccountProvider nethereumAccountProvider) + { + _nethereumAccountProvider = nethereumAccountProvider; + _ethereumClientConfigOptions = ethereumClientConfigOptions.Value; + } + + public Web3 GetClient(string clientAlias, string accountAlias) + { + var keys = Keys.Where(o => o.ClientAlias == clientAlias && o.AccountAlias == accountAlias).ToList(); + if (keys.Count == 0) + { + var account = _nethereumAccountProvider.GetAccount(accountAlias); + var clientConfig = _ethereumClientConfigOptions.ClientConfigList + .FirstOrDefault(o => o.Alias == clientAlias); + var client = new Web3(account, clientConfig.Url); + TryAdd(new NethereumClientInfo + { + ClientAlias = clientAlias, + AccountAlias = accountAlias + }, client); + + return client; + } + + return this[keys.Single()]; + } +} + +public class NethereumClientInfo +{ + public string ClientAlias { get; set; } + public string AccountAlias { get; set; } +} diff --git a/modules/AElf.Nethereum.Core/Options/EthereumClientAccountMappingOptions.cs b/modules/AElf.Nethereum.Core/Options/EthereumClientAccountMappingOptions.cs new file mode 100644 index 00000000..7330e487 --- /dev/null +++ b/modules/AElf.Nethereum.Core/Options/EthereumClientAccountMappingOptions.cs @@ -0,0 +1,6 @@ +namespace AElf.Nethereum.Core.Options; + +public class EthereumClientAccountMappingOptions +{ + public Dictionary Mapping { get; set; } +} \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs index e2f1be11..5f45fff3 100644 --- a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs @@ -79,7 +79,7 @@ private async Task SendQueryAsync(string lockMappingContractAddress, Hash spaceI var nodeUrl = _configOptions.SwapConfigs.Single(c => Hash.LoadFromBase64(c.SpaceId) == spaceId).NodeUrl; var web3ManagerForLock = new Web3Manager(nodeUrl, lockMappingContractAddress, "", _lockAbi); - + // TODO: Travel Bridge.Bridges config. var lockTimes = await web3ManagerForLock.GetFunction(lockMappingContractAddress, "receiptCount") diff --git a/src/AElf.EventHandler/appsettings.json b/src/AElf.EventHandler/appsettings.json index c861e13b..af0c4ee8 100644 --- a/src/AElf.EventHandler/appsettings.json +++ b/src/AElf.EventHandler/appsettings.json @@ -83,6 +83,11 @@ "EthereumClientConfig": { "AccountAlias": "Test1" }, + "EthereumClientAccountMapping": { + "Mapping": { + "ClientAlias": "AccountAlias" + } + }, "AElfContract": { "ContractDirectory": "", "ContractAddressList": { From 67a760af0dd0f5d20b61ea8a82224749b9e9d2bb Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Wed, 17 Aug 2022 15:10:08 +0800 Subject: [PATCH 04/66] refactor: Update .proto file --- .../Protobuf/bridge_contract.proto | 255 ++++++++--- .../Protobuf/regiment_contract.proto | 10 +- .../Protobuf/report_contract.proto | 407 +++++++++--------- 3 files changed, 404 insertions(+), 268 deletions(-) diff --git a/modules/AElf.Client.Protobuf/Protobuf/bridge_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/bridge_contract.proto index 47e8672b..b241e29e 100644 --- a/modules/AElf.Client.Protobuf/Protobuf/bridge_contract.proto +++ b/modules/AElf.Client.Protobuf/Protobuf/bridge_contract.proto @@ -15,9 +15,10 @@ service BridgeContract { option (aelf.csharp_state) = "AElf.Contracts.Bridge.BridgeContractState"; option (aelf.base) = "acs13.proto"; option (aelf.base) = "receipt_maker.proto"; - + rpc Initialize (InitializeInput) returns (google.protobuf.Empty) {} + //To AElf. rpc CreateSwap (CreateSwapInput) returns (aelf.Hash) { } rpc SwapToken (SwapTokenInput) returns (google.protobuf.Empty) { @@ -28,12 +29,43 @@ service BridgeContract { } rpc Withdraw (WithdrawInput) returns (google.protobuf.Empty) { } - rpc UpdateMerkleTree (UpdateMerkleTreeInput) returns (google.protobuf.Empty) { - } rpc RecordReceiptHash (CallbackInput) returns (google.protobuf.Empty) { } - - rpc ChangeMaximalLeafCount (google.protobuf.Int32Value) returns (google.protobuf.Empty) { + + //AElf to others. + rpc AddToken(AddTokenInput) returns(google.protobuf.Empty){ + } + rpc RemoveToken(RemoveTokenInput) returns (google.protobuf.Empty){ + } + rpc CreateReceipt(CreateReceiptInput) returns (google.protobuf.Empty){ + } + + //Gas Fee + rpc SetGasFeeAndPrice(SetGasFeeAndPriceInput) returns(google.protobuf.Empty){ + } + rpc SetPriceRatio(SetPriceRatioInput) returns (google.protobuf.Empty){ + } + rpc GetGasFeeAndPrice(google.protobuf.Empty) returns(GetGasFeeAndPriceOutput){ + option (aelf.is_view) = true; + } + rpc GetPriceRatio(GetPriceRatioInput) returns (google.protobuf.Int64Value){ + option (aelf.is_view) = true; + } + + rpc SetController(aelf.Address) returns(google.protobuf.Empty){ + } + + rpc GetReceiptIdInfo(aelf.Hash) returns (ReceiptIdInfo){ + option (aelf.is_view) = true; + } + rpc GetOwnerLockReceipt(GetOwnerLockReceiptInput) returns (ReceiptIdList){ + option (aelf.is_view) = true; + } + rpc GetLockTokens(GetLockTokensInput) returns(google.protobuf.Int64Value){ + option (aelf.is_view) = true; + } + rpc GetReceiptInfo(GetReceiptInfoInput) returns (Receipt){ + option (aelf.is_view) = true; } // view methods @@ -41,13 +73,10 @@ service BridgeContract { rpc GetSwapInfo (aelf.Hash) returns (SwapInfo) { option (aelf.is_view) = true; } - rpc GetSwapPair (GetSwapPairInput) returns (SwapPair) { - option (aelf.is_view) = true; - } rpc GetSwapAmounts (GetSwapAmountsInput) returns (SwapAmounts) { option (aelf.is_view) = true; } - rpc GetRegimentAddressByRecorderId (google.protobuf.Int64Value) returns (aelf.Address) { + rpc GetRegimentIdBySpaceId (aelf.Hash) returns (aelf.Hash) { option (aelf.is_view) = true; } rpc GetSwappedReceiptIdList (GetSwappedReceiptIdListInput) returns (ReceiptIdList) { @@ -56,47 +85,43 @@ service BridgeContract { rpc GetSwappedReceiptInfoList (GetSwappedReceiptInfoListInput) returns (ReceiptInfoList) { option (aelf.is_view) = true; } + rpc GetSpaceIdBySwapId (aelf.Hash) returns (aelf.Hash){ + option (aelf.is_view) = true; + } } message InitializeInput { aelf.Address oracle_contract_address = 1; - aelf.Address merkle_tree_recorder_contract_address = 2; - aelf.Address regiment_contract_address = 3; - aelf.Address merkle_tree_generator_contract_address = 4; - int32 merkle_tree_leaf_limit = 5; + aelf.Address merkle_tree_contract_address = 2; + aelf.Address regiment_contract_address = 3; + aelf.Address report_contract_address = 4; + aelf.Address admin = 5; } - +//To AElf message. message CreateSwapInput { - int32 origin_token_size_in_byte = 1; - bool origin_token_numeric_big_endian = 2; - repeated SwapTargetToken swap_target_token_list = 3; - aelf.Address regiment_address = 4; + repeated SwapTargetToken swap_target_token_list = 1; + aelf.Hash regiment_id = 2; + int32 merkle_tree_leaf_limit = 3; } message SwapTargetToken { - string target_token_symbol = 1; + string symbol = 1; SwapRatio swap_ratio = 2; - int64 deposit_amount = 3; + string from_chain_id = 3; } message SwapInfo { aelf.Hash swap_id = 1; - int32 origin_token_size_in_byte = 2; - bool origin_token_numeric_big_endian = 3; - map swap_target_token_map = 4; - aelf.Address regiment_address = 5; - int64 recorder_id = 6; + repeated SwapTargetToken swap_target_token_list = 2; + aelf.Hash regiment_id = 3; + aelf.Hash space_id = 4; } -message SwapPair { - aelf.Hash swap_id = 1; - int32 origin_token_size_in_byte = 2; - bool origin_token_numeric_big_endian = 3; - string target_token_symbol = 4; - SwapRatio swap_ratio = 5; - int64 swapped_amount = 6; - int64 swapped_times = 7; - int64 deposit_amount = 8; + +message SwapPairInfo { + int64 swapped_amount = 1; + int64 swapped_times = 2; + int64 deposit_amount = 3; } message SwapRatio { @@ -104,6 +129,43 @@ message SwapRatio { int64 target_share = 2; } +message SwapAmounts { + aelf.Address receiver = 1; + map received_amounts = 2; +} + +message ReceiptInfo { + string receipt_id = 1; + aelf.Hash receiving_tx_id = 2; + google.protobuf.Timestamp receiving_time = 3; + map amount_map = 4; +} + +message ReceiptInfoList { + repeated ReceiptInfo value = 1; +} + +message ReceiptHashMap { + map value = 1; + string swap_id = 2; +} + +message ReceiptIdList { + repeated string value = 1; +} + + +message ReceiptIdInfo{ + string chain_id = 1; + string symbol = 2; +} + +message SendingInfo { + int64 receipt_id = 1; + string sending_tx_id = 2; + string sending_time = 3; +} + message ChangeSwapRatioInput { aelf.Hash swap_id = 1; SwapRatio swap_ratio = 2; @@ -112,8 +174,9 @@ message ChangeSwapRatioInput { message SwapTokenInput { aelf.Hash swap_id = 1; - int64 receipt_id = 2; + string receipt_id = 2; string origin_amount = 3; + aelf.Address receiver_address = 4; } message DepositInput { @@ -124,17 +187,12 @@ message DepositInput { message GetSwapPairInput { aelf.Hash swap_id = 1; - string target_token_symbol = 2; + string symbol = 2; } message GetSwapAmountsInput { aelf.Hash swap_id = 1; - int64 receipt_id = 2; -} - -message SwapAmounts { - aelf.Address receiver = 1; - map received_amounts = 2; + string receipt_id = 2; } message WithdrawInput { @@ -143,48 +201,85 @@ message WithdrawInput { int64 amount = 3; } -message ReceiptHashMap { - map value = 1; - int64 recorder_id = 2; +message GetSwappedReceiptIdListInput { + aelf.Hash swap_id = 1; + aelf.Address receiver_address = 2; } -message UpdateMerkleTreeInput { - int64 recorder_id = 1; - aelf.Address regiment_address = 2; +message GetSwappedReceiptInfoListInput { + aelf.Hash swap_id = 1; + aelf.Address receiver_address = 2; } -message ReceiptIdList { - repeated int64 value = 1; +//AElf to others message. +message Receipt{ + string symbol = 1; + aelf.Address owner = 2; + string targetAddress = 3; + int64 amount = 4; +} +message ReceiptList{ + repeated Receipt value = 1; } -message GetSwappedReceiptIdListInput { - aelf.Hash swap_id = 1; - aelf.Address receiver_address = 2; +message AddTokenInput{ + StringList symbol = 1; } -message GetSwappedReceiptInfoListInput { - aelf.Hash swap_id = 1; - aelf.Address receiving_address = 2; +message TokenSymbolList { + StringList symbol = 1; } -message ReceiptInfo { - int64 receipt_id = 1; - aelf.Hash receiving_tx_id = 2; - google.protobuf.Timestamp receiving_time = 3; +message RemoveTokenInput{ + StringList symbol = 1; +} + +message CreateReceiptInput{ + string symbol = 1; + aelf.Address owner = 2; + string targetAddress = 3; int64 amount = 4; - map amount_map = 5; + string target_chain_id = 5; } -message ReceiptInfoList { - repeated ReceiptInfo value = 1; +message SetGasFeeAndPriceInput{ + int64 gas_fee = 1; + int64 gas_price = 2; } -message SendingInfo { - int64 receipt_id = 1; - string sending_tx_id = 2; - string sending_time = 3; +message SetPriceRatioInput{ + string symbol_pair = 1; + int64 price_ratio = 2; +} + +message GetGasFeeAndPriceOutput{ + int64 gas_fee = 1; + int64 gas_price = 2; +} + +message GetPriceRatioInput{ + string symbol_pair = 1; +} + +message GetReceiptInfoInput{ + string receipt_id = 1; +} + +message GetOwnerLockReceiptInput{ + aelf.Address owner = 1; +} + +message GetLockTokensInput{ + aelf.Address owner = 1; +} + +message StringList{ + repeated string value = 1; } + + + // Events message SwapRatioChanged { @@ -199,9 +294,33 @@ message TokenSwapped { aelf.Address address = 1; int64 amount = 2; string symbol = 3; + string receipt_id = 4; + string from_chain_id = 5; } -message SwapPairAdded { +message SwapInfoAdded { option (aelf.is_event) = true; aelf.Hash swap_id = 1; + string from_chain_id = 2; + string symbol = 3; +} + +message TokenWhitelistAdded{ + option (aelf.is_event) = true; + StringList token_list = 1; +} + +message TokenWhitelistRemoved{ + option (aelf.is_event) = true; + StringList token_list = 1; +} + +message ReceiptCreated{ + option (aelf.is_event) = true; + string receipt_id = 1; + string symbol = 2; + aelf.Address owner = 3; + string targetAddress = 4; + int64 amount = 5; + string target_chain_id = 6; } \ No newline at end of file diff --git a/modules/AElf.Client.Protobuf/Protobuf/regiment_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/regiment_contract.proto index d320d9fc..3a8380c2 100644 --- a/modules/AElf.Client.Protobuf/Protobuf/regiment_contract.proto +++ b/modules/AElf.Client.Protobuf/Protobuf/regiment_contract.proto @@ -33,7 +33,12 @@ service RegimentContract { rpc GetConfig (google.protobuf.Empty) returns (RegimentContractConfig) { option (aelf.is_view) = true; } - + rpc GetRegimentId(aelf.Address) returns(aelf.Hash){ + option(aelf.is_view) = true; + } + rpc GetRegimentAddress(aelf.Hash) returns (aelf.Address){ + option (aelf.is_view) = true; + } rpc GetRegimentInfo (aelf.Address) returns (RegimentInfo) { option (aelf.is_view) = true; } @@ -129,6 +134,7 @@ message RegimentCreated { aelf.Address manager = 2; RegimentMemberList initial_member_list = 3; aelf.Address regiment_address = 4; + aelf.Hash regiment_id = 5; } message NewMemberApplied { @@ -149,4 +155,4 @@ message RegimentMemberLeft { aelf.Address regiment_address = 1; aelf.Address left_member_address = 2; aelf.Address operator_address = 3; -} \ No newline at end of file +} diff --git a/modules/AElf.Client.Protobuf/Protobuf/report_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/report_contract.proto index 865dbd4e..004ed831 100644 --- a/modules/AElf.Client.Protobuf/Protobuf/report_contract.proto +++ b/modules/AElf.Client.Protobuf/Protobuf/report_contract.proto @@ -11,303 +11,314 @@ option csharp_namespace = "AElf.Contracts.Report"; // the contract definition: a gRPC service definition. service ReportContract { - option (aelf.csharp_state) = "AElf.Contracts.Report.ReportContractState"; + option (aelf.csharp_state) = "AElf.Contracts.Report.ReportContractState"; - rpc Initialize (InitializeInput) returns (google.protobuf.Empty) {} - - rpc QueryOracle (QueryOracleInput) returns (aelf.Hash) {} + rpc Initialize (InitializeInput) returns (google.protobuf.Empty) {} + + rpc QueryOracle (QueryOracleInput) returns (aelf.Hash) {} + + rpc CancelQueryOracle (aelf.Hash) returns (google.protobuf.Empty) {} + + rpc ConfirmReport (ConfirmReportInput) returns (google.protobuf.Empty) {} + + rpc RejectReport (RejectReportInput) returns (google.protobuf.Empty) {} + + rpc ProposeReport (CallbackInput) returns (Report) {} + + rpc MortgageTokens (google.protobuf.Int64Value) returns (google.protobuf.Empty) {} + + rpc WithdrawTokens (google.protobuf.Int64Value) returns (google.protobuf.Empty) {} - rpc CancelQueryOracle (aelf.Hash) returns (google.protobuf.Empty) {} + rpc SetSkipMemberList (SetSkipMemberListInput) returns (google.protobuf.Empty){} - rpc ConfirmReport (ConfirmReportInput) returns (google.protobuf.Empty) {} - rpc RejectReport (RejectReportInput) returns (google.protobuf.Empty) {} + // Observer management. + rpc ApplyObserver (ApplyObserverInput) returns (google.protobuf.Empty) {} - rpc AdjustAmercementAmount (google.protobuf.Int64Value) returns (google.protobuf.Empty) {} + rpc QuitObserver (QuitObserverInput) returns (google.protobuf.Empty) {} + + rpc AdjustApplyObserverFee (google.protobuf.Int64Value) returns (google.protobuf.Empty) {} - rpc ProposeReport (CallbackInput) returns (Report) {} - - rpc MortgageTokens (google.protobuf.Int64Value) returns (google.protobuf.Empty) {} - - rpc WithdrawTokens (google.protobuf.Int64Value) returns (google.protobuf.Empty) {} - - // Observer management. - - rpc ApplyObserver (ApplyObserverInput) returns (google.protobuf.Empty) {} - - rpc QuitObserver (QuitObserverInput) returns (google.protobuf.Empty) {} - - rpc AdjustApplyObserverFee (google.protobuf.Int64Value) returns (google.protobuf.Empty) {} - - rpc AdjustReportFee (google.protobuf.Int64Value) returns (google.protobuf.Empty) {} - - // Offchain Aggregator Contract management. - - rpc RegisterOffChainAggregation (RegisterOffChainAggregationInput) returns (OffChainAggregationInfo) {} - - rpc BindOffChainAggregation (BindOffChainAggregationInput) returns (OffChainAggregationInfo) {} - - rpc AddOffChainQueryInfo (AddOffChainQueryInfoInput) returns (google.protobuf.Empty) {} - - rpc RemoveOffChainQueryInfo (RemoveOffChainQueryInfoInput) returns (google.protobuf.Empty) {} - - rpc ChangeOffChainQueryInfo (ChangeOffChainQueryInfoInput) returns (google.protobuf.Empty) {} - - rpc AddRegisterWhiteList (aelf.Address) returns (google.protobuf.Empty) {} - - rpc RemoveFromRegisterWhiteList (aelf.Address) returns (google.protobuf.Empty) {} - - rpc ChangeOracleContractAddress (aelf.Address) returns (google.protobuf.Empty) {} - - // Merkle tree style aggregator. - - rpc GetMerklePath (GetMerklePathInput) returns (aelf.MerklePath) { - option (aelf.is_view) = true; - } - - // View methods. - - rpc GetReport (GetReportInput) returns (Report) { - option (aelf.is_view) = true; - } - rpc GetSignature (GetSignatureInput) returns (google.protobuf.StringValue) { - option (aelf.is_view) = true; - } - rpc GetOffChainAggregationInfo (google.protobuf.StringValue) returns (OffChainAggregationInfo) { - option (aelf.is_view) = true; - } - rpc GetReportQueryRecord (aelf.Hash) returns (ReportQueryRecord) { - option (aelf.is_view) = true; - } - rpc GetCurrentRoundId (google.protobuf.StringValue) returns (google.protobuf.Int64Value) { - option (aelf.is_view) = true; - } - rpc GetRawReport (GetRawReportInput) returns (google.protobuf.StringValue) { - option (aelf.is_view) = true; - } - rpc GenerateRawReport (GenerateRawReportInput) returns (google.protobuf.StringValue) { - option (aelf.is_view) = true; - } - rpc GetSignatureMap (GetSignatureMapInput) returns (SignatureMap) { - option (aelf.is_view) = true; - } - rpc IsInRegisterWhiteList (aelf.Address) returns (google.protobuf.BoolValue) { - option (aelf.is_view) = true; - } - rpc IsObserver (IsObserverInput) returns (google.protobuf.BoolValue) { - option (aelf.is_view) = true; - } - rpc GetMortgagedTokenAmount (aelf.Address) returns (google.protobuf.Int64Value) { - option (aelf.is_view) = true; - } - rpc GetObserverList (aelf.Address) returns (ObserverList) { - option (aelf.is_view) = true; - } + rpc AdjustReportFee (google.protobuf.Int64Value) returns (google.protobuf.Empty) {} + + // Offchain Aggregator Contract management. + + rpc RegisterOffChainAggregation (RegisterOffChainAggregationInput) returns (OffChainAggregationInfo) {} + + rpc BindOffChainAggregation (BindOffChainAggregationInput) returns (OffChainAggregationInfo) {} + + rpc AddOffChainQueryInfo (AddOffChainQueryInfoInput) returns (google.protobuf.Empty) {} + + rpc RemoveOffChainQueryInfo (RemoveOffChainQueryInfoInput) returns (google.protobuf.Empty) {} + + rpc ChangeOffChainQueryInfo (ChangeOffChainQueryInfoInput) returns (google.protobuf.Empty) {} + + rpc AddRegisterWhiteList (aelf.Address) returns (google.protobuf.Empty) {} + + rpc RemoveFromRegisterWhiteList (aelf.Address) returns (google.protobuf.Empty) {} + + rpc ChangeOracleContractAddress (aelf.Address) returns (google.protobuf.Empty) {} + + // Merkle tree style aggregator. + + rpc GetMerklePath (GetMerklePathInput) returns (aelf.MerklePath) { + option (aelf.is_view) = true; + } + + // View methods. + + rpc GetReport (GetReportInput) returns (Report) { + option (aelf.is_view) = true; + } + rpc GetSignature (GetSignatureInput) returns (google.protobuf.StringValue) { + option (aelf.is_view) = true; + } + rpc GetOffChainAggregationInfo (google.protobuf.StringValue) returns (OffChainAggregationInfo) { + option (aelf.is_view) = true; + } + rpc GetReportQueryRecord (aelf.Hash) returns (ReportQueryRecord) { + option (aelf.is_view) = true; + } + rpc GetCurrentRoundId (google.protobuf.StringValue) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + rpc GetRawReport (GetRawReportInput) returns (google.protobuf.StringValue) { + option (aelf.is_view) = true; + } + rpc GenerateRawReport (GenerateRawReportInput) returns (google.protobuf.StringValue) { + option (aelf.is_view) = true; + } + rpc GetSignatureMap (GetSignatureMapInput) returns (SignatureMap) { + option (aelf.is_view) = true; + } + rpc IsInRegisterWhiteList (aelf.Address) returns (google.protobuf.BoolValue) { + option (aelf.is_view) = true; + } + rpc IsObserver (IsObserverInput) returns (google.protobuf.BoolValue) { + option (aelf.is_view) = true; + } + rpc GetMortgagedTokenAmount (aelf.Address) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + rpc GetObserverList (aelf.Address) returns (ObserverList) { + option (aelf.is_view) = true; + } + rpc GetSkipMemberList(google.protobuf.StringValue) returns (MemberList){ + option (aelf.is_view) = true; + } } message InitializeInput { - aelf.Address oracle_contract_address = 1; - int64 report_fee = 2; - int64 apply_observer_fee = 3; - repeated aelf.Address initial_register_white_list = 4; - aelf.Address regiment_contract_address = 5; + aelf.Address oracle_contract_address = 1; + int64 report_fee = 2; + int64 apply_observer_fee = 3; + repeated aelf.Address initial_register_white_list = 4; + aelf.Address regiment_contract_address = 5; } message QueryOracleInput { - int64 payment = 1; - string token = 2; - int32 aggregate_threshold = 3; - int32 node_index = 4; + int64 payment = 1; + string token = 2; + int32 aggregate_threshold = 3; + int32 node_index = 4; + OffChainQueryInfo query_info = 5; + string chain_id = 6; } message ConfirmReportInput { - string token = 1; - int64 round_id = 2; - string signature = 3; + string token = 1; + int64 round_id = 2; + string signature = 3; } message RejectReportInput { - string token = 1; - int64 round_id = 2; - repeated aelf.Address accusing_nodes = 3; + string token = 1; + int64 round_id = 2; + repeated aelf.Address accusing_nodes = 3; } message Report { - aelf.Hash query_id = 1; - int64 round_id = 2; - Observations observations = 3; - bytes aggregated_data = 4; - repeated ObserverList observers = 5; + aelf.Hash query_id = 1; + int64 round_id = 2; + Observations observations = 3; + bytes aggregated_data = 4; } message ReportQueryRecord { - aelf.Address origin_query_sender = 1; - int64 paid_report_fee = 2; - bool is_rejected = 3; - bool is_all_node_confirmed = 4; - repeated aelf.Address confirmed_node_list = 5; - int64 payment = 6; + aelf.Address origin_query_sender = 1; + int64 paid_report_fee = 2; + bool is_rejected = 3; + bool is_all_node_confirmed = 4; + repeated aelf.Address confirmed_node_list = 5; + int64 payment = 6; } message ObserverList { - repeated aelf.Address value = 1; -} - -message ProposeReportInput { - repeated aelf.Hash query_id_list = 1; + repeated aelf.Address value = 1; } message Observations { - repeated Observation value = 1; + repeated Observation value = 1; } message Observation { - string key = 1; - string data = 2; + string key = 1; + string data = 2; } message GetSignatureInput { - string token = 1; - int64 round_id = 2; - aelf.Address address = 3; + string token = 1; + int64 round_id = 2; + aelf.Address address = 3; } message GetSignatureMapInput { - string token = 1; - int64 round_id = 2; + string token = 1; + int64 round_id = 2; } message SignatureMap { - map value = 1; + map value = 1; +} + +message MemberList{ + repeated aelf.Address value = 1; } message OffChainAggregationInfo { - string token = 1; - OffChainQueryInfoList off_chain_query_info_list = 2; - aelf.Address regiment_address = 3; - bytes config_digest = 4; - int32 aggregate_threshold = 5; - aelf.Address aggregator_contract_address = 6; - repeated int64 round_ids = 7; - string chain_name = 8; - aelf.Address register = 9; - int32 aggregate_option = 10; + string token = 1; + OffChainQueryInfoList off_chain_query_info_list = 2; + aelf.Hash regiment_id = 3; + bytes config_digest = 4; + int32 aggregate_threshold = 5; + aelf.Address aggregator_contract_address = 6; + repeated int64 round_ids = 7; + string chain_id = 8; + aelf.Address register = 9; + int32 aggregate_option = 10; } message RegisterOffChainAggregationInput { - aelf.Address regiment_address = 1; - OffChainQueryInfoList off_chain_query_info_list = 2; - string token = 3; - bytes config_digest = 4; - int32 aggregate_threshold = 5; - aelf.Address aggregator_contract_address = 6; - string chain_name = 7; - aelf.Address register = 8; - int32 aggregate_option = 9; + aelf.Hash regiment_id = 1; + OffChainQueryInfoList off_chain_query_info_list = 2; + string token = 3; + bytes config_digest = 4; + int32 aggregate_threshold = 5; + aelf.Address aggregator_contract_address = 6; + string chain_id = 7; + int32 aggregate_option = 8; } message BindOffChainAggregationInput { - repeated aelf.Hash task_id_list = 1; - string chain_name = 2; - string token = 3; - bytes config_digest = 4; + repeated aelf.Hash task_id_list = 1; + string chain_name = 2; + string token = 3; + bytes config_digest = 4; } message OffChainQueryInfo { - string title = 1; - repeated string options = 2; + string title = 1; + repeated string options = 2; } message GetReportInput { - string token = 1; - int64 round_id = 2; + string token = 1; + int64 round_id = 2; } message GetMerklePathInput { - string token = 1; - int64 round_id = 2; - int32 node_index = 3; + string token = 1; + int64 round_id = 2; + int32 node_index = 3; } message GetRawReportInput{ - string token = 1; - int64 round_id = 2; + string token = 1; + int64 round_id = 2; } message GenerateRawReportInput{ - Report report = 1; - bytes config_digest = 2; - aelf.Address organization = 3; + Report report = 1; + bytes config_digest = 2; + aelf.Address organization = 3; } message OffChainQueryInfoList { - repeated OffChainQueryInfo value = 1; + repeated OffChainQueryInfo value = 1; } message AddOffChainQueryInfoInput { - string token = 1; - OffChainQueryInfo off_chain_query_info = 2; + string token = 1; + OffChainQueryInfo off_chain_query_info = 2; } message RemoveOffChainQueryInfoInput { - string token = 1; - int32 remove_node_index = 2; + string token = 1; + int32 remove_node_index = 2; } message ChangeOffChainQueryInfoInput { - string token = 1; - OffChainQueryInfo new_off_chain_query_info = 2; + string token = 1; + OffChainQueryInfo new_off_chain_query_info = 2; } message ApplyObserverInput { - repeated aelf.Address regiment_address_list = 1; + repeated aelf.Address regiment_address_list = 1; } message QuitObserverInput { - repeated aelf.Address regiment_address_list = 1; + repeated aelf.Address regiment_address_list = 1; } message IsObserverInput { - aelf.Address regiment_address = 1; - aelf.Address oracle_node_address = 2; + aelf.Address regiment_address = 1; + aelf.Address oracle_node_address = 2; +} + +message SetSkipMemberListInput{ + string token = 1; + MemberList value = 2; } // Events message ReportProposed { - option (aelf.is_event) = true; - string raw_report = 1; - aelf.Address regiment_address = 2; - string token = 3; - int64 round_id = 4; + option (aelf.is_event) = true; + string raw_report = 1; + aelf.Hash regiment_id = 2; + string token = 3; + int64 round_id = 4; + OffChainQueryInfo query_info = 5; + string target_chain_id = 6; } message ReportConfirmed { - option (aelf.is_event) = true; - int64 round_id = 1; - string signature = 2; - aelf.Address regiment_address = 3; - string token = 4; - bool is_all_node_confirmed = 5; + option (aelf.is_event) = true; + int64 round_id = 1; + string signature = 2; + aelf.Hash regiment_id = 3; + string token = 4; + bool is_all_node_confirmed = 5; + string target_chain_id = 6; } message OffChainAggregationRegistered { - option (aelf.is_event) = true; - string token = 1; - OffChainQueryInfoList off_chain_query_info_list = 2; - aelf.Address regiment_address = 3; - bytes config_digest = 4; - int32 aggregate_threshold = 5; - aelf.Address aggregator_contract_address = 6; - string chain_name = 7; - aelf.Address register = 8; - int32 aggregate_option = 9; + option (aelf.is_event) = true; + string token = 1; + OffChainQueryInfoList off_chain_query_info_list = 2; + aelf.Hash regiment_id = 3; + bytes config_digest = 4; + int32 aggregate_threshold = 5; + aelf.Address aggregator_contract_address = 6; + string chain_id = 7; + aelf.Address register = 8; + int32 aggregate_option = 9; } message MerkleReportNodeAdded { - option (aelf.is_event) = true; - string token = 1; - int32 node_index = 2; - int64 node_round_id = 3; - string aggregated_data = 4; + option (aelf.is_event) = true; + string token = 1; + int32 node_index = 2; + int64 node_round_id = 3; + string aggregated_data = 4; } \ No newline at end of file From 0a978e6c6a29025591c3df627f30b9aa489af02a Mon Sep 17 00:00:00 2001 From: zhxymh Date: Wed, 17 Aug 2022 15:32:45 +0800 Subject: [PATCH 05/66] feat: add bridge service --- modules/AElf.Client.Bridge/BridgeService.cs | 42 +++++++++++++++++++ .../ContractServiceBase.cs | 6 +-- .../INethereumClientProvider.cs | 20 ++++++--- .../AElf.Nethereum.Core/INethereumService.cs | 26 ++++++++++++ .../AElf.EventHandler.csproj | 2 + .../EventHandlerAppModule.cs | 7 +++- 6 files changed, 91 insertions(+), 12 deletions(-) create mode 100644 modules/AElf.Client.Bridge/BridgeService.cs create mode 100644 modules/AElf.Nethereum.Core/INethereumService.cs diff --git a/modules/AElf.Client.Bridge/BridgeService.cs b/modules/AElf.Client.Bridge/BridgeService.cs new file mode 100644 index 00000000..c05e1abb --- /dev/null +++ b/modules/AElf.Client.Bridge/BridgeService.cs @@ -0,0 +1,42 @@ +using AElf.Client.Core; +using AElf.Client.Core.Options; +using AElf.Contracts.Report; +using AElf.Types; +using Microsoft.Extensions.Options; +using Volo.Abp.DependencyInjection; + +namespace AElf.Client.Bridge; + +public interface IBridgeService +{ + Task GetSpaceIdBySwapIdAsync(Hash swapId); +} + +public class BridgeService : ContractServiceBase, IBridgeService, ITransientDependency +{ + private readonly IAElfClientService _clientService; + private readonly AElfClientConfigOptions _clientConfigOptions; + private readonly AElfContractOptions _contractOptions; + + private const string ContractName = "BridgeContractAddress"; + + protected BridgeService(IAElfClientService clientService, + IOptionsSnapshot clientConfigOptions, + IOptionsSnapshot contractOptions) : base(clientService, + Address.FromBase58(contractOptions.Value.ContractAddressList[ContractName])) + { + _clientService = clientService; + _clientConfigOptions = clientConfigOptions.Value; + _contractOptions = contractOptions.Value; + } + + public async Task GetSpaceIdBySwapIdAsync(Hash swapId) + { + var useClientAlias = _clientConfigOptions.ClientAlias; + + var result = await _clientService.ViewAsync(_contractOptions.ContractAddressList["ContractName"], "GetSpaceIdBySwapId", + swapId, useClientAlias); + + return Hash.LoadFromByteArray(result); + } +} \ No newline at end of file diff --git a/modules/AElf.Nethereum.Core/ContractServiceBase.cs b/modules/AElf.Nethereum.Core/ContractServiceBase.cs index 7bbfeeaf..0e4d281f 100644 --- a/modules/AElf.Nethereum.Core/ContractServiceBase.cs +++ b/modules/AElf.Nethereum.Core/ContractServiceBase.cs @@ -15,11 +15,7 @@ public abstract class ContractServiceBase public EthereumClientAccountMappingOptions EthereumClientAccountMappingOptions { get; set; } public EthereumContractOptions EthereumContractOptions { get; set; } protected abstract string SmartContractName { get; } - - protected ContractServiceBase() - { - } - + protected Function GetFunction(string clientAlias, string methodName) { var accountAlias = EthereumClientAccountMappingOptions.Mapping[clientAlias]; diff --git a/modules/AElf.Nethereum.Core/INethereumClientProvider.cs b/modules/AElf.Nethereum.Core/INethereumClientProvider.cs index 9c591013..086a2c5e 100644 --- a/modules/AElf.Nethereum.Core/INethereumClientProvider.cs +++ b/modules/AElf.Nethereum.Core/INethereumClientProvider.cs @@ -8,7 +8,7 @@ namespace AElf.Nethereum.Core; public interface INethereumClientProvider { - Web3 GetClient(string clientAlias, string accountAlias); + Web3 GetClient(string clientAlias, string accountAlias = null); } public class NethereumClientProvider : ConcurrentDictionary, INethereumClientProvider, ISingletonDependency @@ -23,15 +23,23 @@ public NethereumClientProvider(IOptionsSnapshot eth _ethereumClientConfigOptions = ethereumClientConfigOptions.Value; } - public Web3 GetClient(string clientAlias, string accountAlias) + public Web3 GetClient(string clientAlias, string accountAlias = null) { var keys = Keys.Where(o => o.ClientAlias == clientAlias && o.AccountAlias == accountAlias).ToList(); if (keys.Count == 0) - { - var account = _nethereumAccountProvider.GetAccount(accountAlias); - var clientConfig = _ethereumClientConfigOptions.ClientConfigList + {var clientConfig = _ethereumClientConfigOptions.ClientConfigList .FirstOrDefault(o => o.Alias == clientAlias); - var client = new Web3(account, clientConfig.Url); + Web3 client; + if (string.IsNullOrWhiteSpace(accountAlias)) + { + client = new Web3(clientConfig.Url); + } + else + { + var account = _nethereumAccountProvider.GetAccount(accountAlias); + client = new Web3(account, clientConfig.Url); + } + TryAdd(new NethereumClientInfo { ClientAlias = clientAlias, diff --git a/modules/AElf.Nethereum.Core/INethereumService.cs b/modules/AElf.Nethereum.Core/INethereumService.cs new file mode 100644 index 00000000..c6e73c0c --- /dev/null +++ b/modules/AElf.Nethereum.Core/INethereumService.cs @@ -0,0 +1,26 @@ +using Nethereum.BlockchainProcessing.BlockStorage.Entities.Mapping; +using Volo.Abp.DependencyInjection; + +namespace AElf.Nethereum.Core; + +public interface INethereumService +{ + Task GetBlockNumberAsync(string clientAlias); +} + +public class NethereumService : INethereumService, ITransientDependency +{ + private readonly INethereumClientProvider _nethereumClientProvider; + + public NethereumService(INethereumClientProvider nethereumClientProvider) + { + _nethereumClientProvider = nethereumClientProvider; + } + + public async Task GetBlockNumberAsync(string clientAlias) + { + var web3 = _nethereumClientProvider.GetClient(clientAlias); + var latestBlockNumber = await web3.Eth.Blocks.GetBlockNumber.SendRequestAsync(); + return latestBlockNumber.ToLong(); + } +} \ No newline at end of file diff --git a/src/AElf.EventHandler/AElf.EventHandler.csproj b/src/AElf.EventHandler/AElf.EventHandler.csproj index 634e385d..78563658 100644 --- a/src/AElf.EventHandler/AElf.EventHandler.csproj +++ b/src/AElf.EventHandler/AElf.EventHandler.csproj @@ -63,10 +63,12 @@ + + diff --git a/src/AElf.EventHandler/EventHandlerAppModule.cs b/src/AElf.EventHandler/EventHandlerAppModule.cs index 812d23d1..620b4450 100644 --- a/src/AElf.EventHandler/EventHandlerAppModule.cs +++ b/src/AElf.EventHandler/EventHandlerAppModule.cs @@ -1,9 +1,12 @@ using System; using System.Net.Security; using System.Security.Authentication; +using AElf.Client.Bridge; using AElf.Client.Core; +using AElf.Client.MerkleTree; using AElf.Client.Oracle; using AElf.Client.Report; +using AElf.Nethereum.Bridge; using AElf.Nethereum.Core; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -21,7 +24,9 @@ namespace AElf.EventHandler; typeof(AElfClientModule), typeof(AElfClientOracleModule), typeof(AElfClientReportModule), - typeof(AElfNethereumClientModule) + typeof(AElfClientBridgeModule), + typeof(AElfClientMerkleTreeModule), + typeof(AElfNethereumBridgeModule) )] public class EventHandlerAppModule : AbpModule { From edef79f7c705b301cb7686ce875a7b70be901993 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Thu, 18 Aug 2022 11:15:33 +0800 Subject: [PATCH 06/66] feat: store signatures in Redis --- modules/AElf.Client.Bridge/BridgeService.cs | 2 +- .../Options/AElfContractOptions.cs | 2 +- .../MerkleTreeContract.cs | 2 +- modules/AElf.Client.Oracle/OracleService.cs | 2 +- modules/AElf.Client.Report/ReportService.cs | 2 +- .../AElf.EventHandler.csproj | 1 + .../EventHandlerAppModule.cs | 10 ++- .../ISignatureRecoverableInfoProvider.cs | 88 ++++++++++++------- src/AElf.EventHandler/appsettings.json | 13 +-- 9 files changed, 80 insertions(+), 42 deletions(-) diff --git a/modules/AElf.Client.Bridge/BridgeService.cs b/modules/AElf.Client.Bridge/BridgeService.cs index c05e1abb..a8a1d46a 100644 --- a/modules/AElf.Client.Bridge/BridgeService.cs +++ b/modules/AElf.Client.Bridge/BridgeService.cs @@ -20,7 +20,7 @@ public class BridgeService : ContractServiceBase, IBridgeService, ITransientDepe private const string ContractName = "BridgeContractAddress"; - protected BridgeService(IAElfClientService clientService, + public BridgeService(IAElfClientService clientService, IOptionsSnapshot clientConfigOptions, IOptionsSnapshot contractOptions) : base(clientService, Address.FromBase58(contractOptions.Value.ContractAddressList[ContractName])) diff --git a/modules/AElf.Client.Core/Options/AElfContractOptions.cs b/modules/AElf.Client.Core/Options/AElfContractOptions.cs index 1e2428fe..1a4d3e4e 100644 --- a/modules/AElf.Client.Core/Options/AElfContractOptions.cs +++ b/modules/AElf.Client.Core/Options/AElfContractOptions.cs @@ -3,5 +3,5 @@ namespace AElf.Client.Core.Options; public class AElfContractOptions { public string ContractDirectory { get; set; } - public Dictionary ContractAddressList { get; set; } + public Dictionary ContractAddressList { get; set; } = new(); } \ No newline at end of file diff --git a/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs b/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs index 1b1ee8d2..2166a9cd 100644 --- a/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs +++ b/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs @@ -22,7 +22,7 @@ public class MerkleTreeContractService : ContractServiceBase, IMerkleTreeContrac private readonly AElfClientConfigOptions _clientConfigOptions; private readonly AElfContractOptions _contractOptions; - protected MerkleTreeContractService(IAElfClientService clientService, + public MerkleTreeContractService(IAElfClientService clientService, IOptionsSnapshot clientConfigOptions, IOptionsSnapshot contractOptions) : base(clientService, Address.FromBase58(contractOptions.Value.ContractAddressList[""])) diff --git a/modules/AElf.Client.Oracle/OracleService.cs b/modules/AElf.Client.Oracle/OracleService.cs index d5469218..08b400ba 100644 --- a/modules/AElf.Client.Oracle/OracleService.cs +++ b/modules/AElf.Client.Oracle/OracleService.cs @@ -23,7 +23,7 @@ public class OracleService : ContractServiceBase, IOracleService, ITransientDepe private readonly IAElfClientService _clientService; private readonly AElfClientConfigOptions _clientConfigOptions; - protected OracleService(IAElfClientService clientService, + public OracleService(IAElfClientService clientService, IOptionsSnapshot clientConfigOptions, IOptionsSnapshot contractOptions) : base(clientService, Address.FromBase58(contractOptions.Value.ContractAddressList["OracleContractAddress"])) diff --git a/modules/AElf.Client.Report/ReportService.cs b/modules/AElf.Client.Report/ReportService.cs index ad6f5fda..c407eaab 100644 --- a/modules/AElf.Client.Report/ReportService.cs +++ b/modules/AElf.Client.Report/ReportService.cs @@ -21,7 +21,7 @@ public class ReportService : ContractServiceBase, IReportService, ITransientDepe private readonly IAElfClientService _clientService; private readonly AElfClientConfigOptions _clientConfigOptions; - protected ReportService(IAElfClientService clientService, + public ReportService(IAElfClientService clientService, IOptionsSnapshot clientConfigOptions, IOptionsSnapshot contractOptions) : base(clientService, Address.FromBase58(contractOptions.Value.ContractAddressList["ReportContractAddress"])) diff --git a/src/AElf.EventHandler/AElf.EventHandler.csproj b/src/AElf.EventHandler/AElf.EventHandler.csproj index 78563658..d73c2253 100644 --- a/src/AElf.EventHandler/AElf.EventHandler.csproj +++ b/src/AElf.EventHandler/AElf.EventHandler.csproj @@ -26,6 +26,7 @@ + diff --git a/src/AElf.EventHandler/EventHandlerAppModule.cs b/src/AElf.EventHandler/EventHandlerAppModule.cs index 620b4450..48f24c04 100644 --- a/src/AElf.EventHandler/EventHandlerAppModule.cs +++ b/src/AElf.EventHandler/EventHandlerAppModule.cs @@ -11,10 +11,13 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using RabbitMQ.Client; +using Volo.Abp; using Volo.Abp.Autofac; +using Volo.Abp.Caching.StackExchangeRedis; using Volo.Abp.EventBus.RabbitMq; using Volo.Abp.Modularity; using Volo.Abp.RabbitMQ; +using Volo.Abp.Threading; namespace AElf.EventHandler; @@ -26,7 +29,8 @@ namespace AElf.EventHandler; typeof(AElfClientReportModule), typeof(AElfClientBridgeModule), typeof(AElfClientMerkleTreeModule), - typeof(AElfNethereumBridgeModule) + typeof(AElfNethereumBridgeModule), + typeof(AbpCachingStackExchangeRedisModule) )] public class EventHandlerAppModule : AbpModule { @@ -72,4 +76,8 @@ public override void ConfigureServices(ServiceConfigurationContext context) context.Services.AddHostedService(); context.Services.AddTransient(typeof(ILogEventProcessor<>), typeof(LogEventProcessorBase<>)); } + + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Providers/ISignatureRecoverableInfoProvider.cs b/src/AElf.EventHandler/Providers/ISignatureRecoverableInfoProvider.cs index 7e0a2522..fd4e57a8 100644 --- a/src/AElf.EventHandler/Providers/ISignatureRecoverableInfoProvider.cs +++ b/src/AElf.EventHandler/Providers/ISignatureRecoverableInfoProvider.cs @@ -1,61 +1,87 @@ +using System; using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.Extensions.Caching.Distributed; +using Microsoft.Extensions.Caching.StackExchangeRedis; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Volo.Abp.Caching; +using Volo.Abp.Caching.StackExchangeRedis; using Volo.Abp.DependencyInjection; namespace AElf.EventHandler; public interface ISignatureRecoverableInfoProvider { - void SetSignature(string ethereumContractAddress, long roundId, string recoverableInfo); - HashSet GetSignature(string ethereumContractAddress, long roundId); - void RemoveSignature(string ethereumContractAddress, long roundId); + Task SetSignatureAsync(string ethereumContractAddress, long roundId, string recoverableInfo); + Task> GetSignatureAsync(string ethereumContractAddress, long roundId); + Task RemoveSignatureAsync(string ethereumContractAddress, long roundId); } -public class SignatureRecoverableInfoProvider : ISignatureRecoverableInfoProvider, ISingletonDependency +public class SignatureRecoverableInfoProvider : AbpRedisCache, ISignatureRecoverableInfoProvider, ITransientDependency { - private readonly Dictionary>> _signatureRecoverableInfoDictionary; private ILogger _logger; + private readonly IDistributedCacheSerializer _serializer; + + private const string KeyPrefix = "ReportSignature"; - public SignatureRecoverableInfoProvider(ILogger logger) + public SignatureRecoverableInfoProvider(ILogger logger, + IOptions optionsAccessor, IDistributedCacheSerializer serializer) : base(optionsAccessor) { - _signatureRecoverableInfoDictionary = new Dictionary>>(); + _serializer = serializer; _logger = logger; } - public void SetSignature(string ethereumContractAddress, long roundId, string recoverableInfo) + public async Task SetSignatureAsync(string ethereumContractAddress, long roundId, string recoverableInfo) { - if (!_signatureRecoverableInfoDictionary.TryGetValue(ethereumContractAddress, out var roundSignature)) + var key = GetStoreKey(ethereumContractAddress, roundId); + var signatureBytes = await GetAsync(key); + ReportSignature signature; + if (signatureBytes == null) { - roundSignature = new Dictionary>(); - _signatureRecoverableInfoDictionary[ethereumContractAddress] = roundSignature; + signature = new ReportSignature + { + Address = ethereumContractAddress, + RoundId = roundId, + Signatures = new HashSet() + }; } + else + { + signature = _serializer.Deserialize(signatureBytes); + } + + signature.Signatures.Add(recoverableInfo); - if (!roundSignature.ContainsKey(roundId)) - roundSignature[roundId] = new HashSet(); - roundSignature[roundId].Add(recoverableInfo); + await SetAsync(key, _serializer.Serialize(signature), new DistributedCacheEntryOptions + { + AbsoluteExpiration = DateTimeOffset.MaxValue + }); } - public HashSet GetSignature(string ethereumContractAddress, long roundId) + public async Task> GetSignatureAsync(string ethereumContractAddress, long roundId) { - if (!_signatureRecoverableInfoDictionary.TryGetValue(ethereumContractAddress, out var roundSignature)) - { - _logger.LogInformation($"Address: {ethereumContractAddress} report dose not exist"); - return new HashSet(); - } + var key = GetStoreKey(ethereumContractAddress, roundId); + var signatureBytes = await GetAsync(key); + var signature = _serializer.Deserialize(signatureBytes); + return signature.Signatures; + } - if (roundSignature.TryGetValue(roundId, out var recoverableInfo)) return recoverableInfo; - _logger.LogInformation($"Address: {ethereumContractAddress} RoundId: {roundId} report dose not exist"); - return new HashSet(); + public async Task RemoveSignatureAsync(string ethereumContractAddress, long roundId) + { + var key = GetStoreKey(ethereumContractAddress, roundId); + await RemoveAsync(key); } - public void RemoveSignature(string ethereumContractAddress, long roundId) + private string GetStoreKey(string ethereumContractAddress, long roundId) { - if (!_signatureRecoverableInfoDictionary.TryGetValue(ethereumContractAddress, out var roundSignature)) - return; - if (!roundSignature.TryGetValue(roundId, out _)) - return; - roundSignature.Remove(roundId); - if (roundSignature.Count == 0) - _signatureRecoverableInfoDictionary.Remove(ethereumContractAddress); + return $"{KeyPrefix}-{ethereumContractAddress}-{roundId}"; } +} + +public class ReportSignature +{ + public string Address { get; set; } + public long RoundId { get; set; } + public HashSet Signatures { get; set; } = new(); } \ No newline at end of file diff --git a/src/AElf.EventHandler/appsettings.json b/src/AElf.EventHandler/appsettings.json index af0c4ee8..9643e639 100644 --- a/src/AElf.EventHandler/appsettings.json +++ b/src/AElf.EventHandler/appsettings.json @@ -6,15 +6,18 @@ "Microsoft.Hosting.Lifetime": "Information" } }, + "Redis": { + "Configuration": "127.0.0.1" + }, "MessageQueue": { "Enable": true, - "HostName": "", - "Uri": "", - "Port": "5671", + "HostName": "127.0.0.1", + "Uri": "amqp://127.0.0.1:5672", + "Port": "5672", "ClientName": "AElfBoilerplate-Local-11", "ExchangeName": "AElfExchange-Local", - "UserName": "", - "Password": "" + "UserName": "guest", + "Password": "guest" }, "AElfClient": { "ClientConfigList": [ From 8bb771069b7678432f6c4920204b747e1e353d0d Mon Sep 17 00:00:00 2001 From: zhxymh Date: Thu, 18 Aug 2022 19:58:51 +0800 Subject: [PATCH 07/66] feat: add transmit queue --- .../AElfClientService.Blockchain.cs | 6 + .../AElf.Client.Core/IAElfClientService.cs | 2 + .../AElf.Nethereum.Bridge/IBridgeInService.cs | 13 +- .../IBridgeOutService.cs | 19 +-- .../ContractServiceBase.cs | 3 +- .../Options/EthereumContractOptions.cs | 1 - .../EventHandlerAppModule.cs | 1 + .../ISignatureRecoverableInfoProvider.cs | 2 +- .../Providers/ITransmitTransactionProvider.cs | 115 ++++++++++++++++++ src/AElf.EventHandler/appsettings.json | 7 +- 10 files changed, 147 insertions(+), 22 deletions(-) create mode 100644 src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs diff --git a/modules/AElf.Client.Core/AElfClientService.Blockchain.cs b/modules/AElf.Client.Core/AElfClientService.Blockchain.cs index 7aa6d244..19730c6c 100644 --- a/modules/AElf.Client.Core/AElfClientService.Blockchain.cs +++ b/modules/AElf.Client.Core/AElfClientService.Blockchain.cs @@ -36,6 +36,12 @@ public async Task GetChainStatusAsync(string clientAlias) var aelfClient = _aelfClientProvider.GetClient(alias: clientAlias); return await aelfClient.GetChainStatusAsync(); } + + public async Task GetBlockByHeightAsync(string clientAlias, long height) + { + var aelfClient = _aelfClientProvider.GetClient(alias: clientAlias); + return await aelfClient.GetBlockByHeightAsync(height); + } public async Task GetMerklePathByTransactionIdAsync(string transactionId, string clientAlias) { diff --git a/modules/AElf.Client.Core/IAElfClientService.cs b/modules/AElf.Client.Core/IAElfClientService.cs index 2c1c7703..63b847cb 100644 --- a/modules/AElf.Client.Core/IAElfClientService.cs +++ b/modules/AElf.Client.Core/IAElfClientService.cs @@ -21,5 +21,7 @@ Task SendSystemAsync(string systemContractName, string methodName, Task GetChainStatusAsync(string clientAlias); + Task GetBlockByHeightAsync(string clientAlias, long height); + Task GetMerklePathByTransactionIdAsync(string transactionId, string clientAlias); } \ No newline at end of file diff --git a/modules/AElf.Nethereum.Bridge/IBridgeInService.cs b/modules/AElf.Nethereum.Bridge/IBridgeInService.cs index 415970e5..641eef9c 100644 --- a/modules/AElf.Nethereum.Bridge/IBridgeInService.cs +++ b/modules/AElf.Nethereum.Bridge/IBridgeInService.cs @@ -6,23 +6,22 @@ namespace AElf.Nethereum.Bridge; public interface IBridgeInService { - Task TransmitAsync(string clientAlias, byte[] report, byte[][] rs, byte[][] ss, byte[] rawVs); + Task TransmitAsync(string clientAlias, string contractAddress, byte[] report, byte[][] rs, byte[][] ss, byte[] rawVs); } -public class BridgeInService : ContractServiceBase,IBridgeInService,ITransientDependency +public class BridgeInService : ContractServiceBase, IBridgeInService, ITransientDependency { protected override string SmartContractName { get; } = "BridgeIn"; - public async Task TransmitAsync(string clientAlias, byte[] report, byte[][] rs, byte[][] ss, byte[] rawVs) + public async Task TransmitAsync(string clientAlias, string contractAddress, byte[] report, + byte[][] rs, byte[][] ss, byte[] rawVs) { - var setValueFunction = GetFunction(clientAlias, "transmit"); + var setValueFunction = GetFunction(clientAlias, contractAddress, "transmit"); var sender = GetAccount(clientAlias).Address; var gas = await setValueFunction.EstimateGasAsync(sender, null, null, report, rs, ss, rawVs); var transactionResult = - await setValueFunction.SendTransactionAndWaitForReceiptAsync(sender, gas, null, null, report, + await setValueFunction.SendTransactionAsync(sender, gas, null, null, report, rs, ss, rawVs); return transactionResult; } - - } \ No newline at end of file diff --git a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs index 97abdabf..c1d422c5 100644 --- a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs +++ b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs @@ -6,29 +6,32 @@ namespace AElf.Nethereum.Bridge; public interface IBridgeOutService { - Task GetSendReceiptInfosAsync(string clientAlias, string token, long fromIndex); + Task GetSendReceiptInfosAsync(string clientAlias, string contractAddress, string token, long fromIndex); - Task GetTransferReceiptIndexAsync(string clientAlias, List tokens, + Task GetTransferReceiptIndexAsync(string clientAlias, string contractAddress, List tokens, List targetChainIds); } -public class BridgeOutService : ContractServiceBase,IBridgeOutService,ITransientDependency +public class BridgeOutService : ContractServiceBase, IBridgeOutService, ITransientDependency { protected override string SmartContractName { get; } = "BridgeOut"; - public async Task GetSendReceiptInfosAsync(string clientAlias, string token, long fromIndex) + public async Task GetSendReceiptInfosAsync(string clientAlias, string contractAddress, + string token, long fromIndex) { - var function = GetFunction(clientAlias, "getSendReceiptInfos"); + var function = GetFunction(clientAlias, contractAddress, "getSendReceiptInfos"); var evmGetReceiptInfos = await function.CallDeserializingToObjectAsync(token, fromIndex); return evmGetReceiptInfos; } - public async Task GetTransferReceiptIndexAsync(string clientAlias, List tokens, List targetChainIds) + public async Task GetTransferReceiptIndexAsync(string clientAlias, string contractAddress, + List tokens, List targetChainIds) { - var function = GetFunction(clientAlias, "getSendReceiptIndex"); + var function = GetFunction(clientAlias, contractAddress, "getSendReceiptIndex"); - var evmGetReceiptInfos = await function.CallDeserializingToObjectAsync(tokens, targetChainIds); + var evmGetReceiptInfos = + await function.CallDeserializingToObjectAsync(tokens, targetChainIds); return evmGetReceiptInfos; } } \ No newline at end of file diff --git a/modules/AElf.Nethereum.Core/ContractServiceBase.cs b/modules/AElf.Nethereum.Core/ContractServiceBase.cs index 0e4d281f..1b86e10c 100644 --- a/modules/AElf.Nethereum.Core/ContractServiceBase.cs +++ b/modules/AElf.Nethereum.Core/ContractServiceBase.cs @@ -16,11 +16,10 @@ public abstract class ContractServiceBase public EthereumContractOptions EthereumContractOptions { get; set; } protected abstract string SmartContractName { get; } - protected Function GetFunction(string clientAlias, string methodName) + protected Function GetFunction(string clientAlias, string contractAddress, string methodName) { var accountAlias = EthereumClientAccountMappingOptions.Mapping[clientAlias]; var client = NethereumClientProvider.GetClient(clientAlias, accountAlias); - var contractAddress = EthereumContractOptions.ContractInfoList[SmartContractName].ContractAddress; var contract = client.Eth.GetContract(GetAbi(), contractAddress); return contract.GetFunction(methodName); } diff --git a/modules/AElf.Nethereum.Core/Options/EthereumContractOptions.cs b/modules/AElf.Nethereum.Core/Options/EthereumContractOptions.cs index 21f733a1..97888c7f 100644 --- a/modules/AElf.Nethereum.Core/Options/EthereumContractOptions.cs +++ b/modules/AElf.Nethereum.Core/Options/EthereumContractOptions.cs @@ -8,6 +8,5 @@ public class EthereumContractOptions public class EthereumContractInfo { - public string ContractAddress { get; set; } public string AbiFileName { get; set; } } \ No newline at end of file diff --git a/src/AElf.EventHandler/EventHandlerAppModule.cs b/src/AElf.EventHandler/EventHandlerAppModule.cs index 48f24c04..5256e732 100644 --- a/src/AElf.EventHandler/EventHandlerAppModule.cs +++ b/src/AElf.EventHandler/EventHandlerAppModule.cs @@ -75,6 +75,7 @@ public override void ConfigureServices(ServiceConfigurationContext context) Configure(configuration.GetSection("Bridge")); context.Services.AddHostedService(); context.Services.AddTransient(typeof(ILogEventProcessor<>), typeof(LogEventProcessorBase<>)); + context.Services.AddSingleton(); } public override void OnApplicationInitialization(ApplicationInitializationContext context) diff --git a/src/AElf.EventHandler/Providers/ISignatureRecoverableInfoProvider.cs b/src/AElf.EventHandler/Providers/ISignatureRecoverableInfoProvider.cs index fd4e57a8..2fc59ad3 100644 --- a/src/AElf.EventHandler/Providers/ISignatureRecoverableInfoProvider.cs +++ b/src/AElf.EventHandler/Providers/ISignatureRecoverableInfoProvider.cs @@ -18,7 +18,7 @@ public interface ISignatureRecoverableInfoProvider Task RemoveSignatureAsync(string ethereumContractAddress, long roundId); } -public class SignatureRecoverableInfoProvider : AbpRedisCache, ISignatureRecoverableInfoProvider, ITransientDependency +public class SignatureRecoverableInfoProvider : AbpRedisCache, ISignatureRecoverableInfoProvider, ISingletonDependency { private ILogger _logger; private readonly IDistributedCacheSerializer _serializer; diff --git a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs new file mode 100644 index 00000000..d14cd6e4 --- /dev/null +++ b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs @@ -0,0 +1,115 @@ +using System.Threading.Tasks; +using AElf.Client.Core; +using AElf.Client.Core.Options; +using AElf.Nethereum.Bridge; +using Microsoft.Extensions.Caching.StackExchangeRedis; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using StackExchange.Redis; +using Volo.Abp.Caching; +using Volo.Abp.Caching.StackExchangeRedis; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Threading; + +namespace AElf.EventHandler; + +public interface ITransmitTransactionProvider +{ +} + +public class TransmitTransactionProvider : AbpRedisCache, ITransmitTransactionProvider, ISingletonDependency +{ + private readonly IDistributedCacheSerializer _serializer; + private readonly IAElfClientService _aelfClientService; + private readonly AElfClientConfigOptions _aelfClientConfigOptions; + private readonly IBridgeInService _bridgeInService; + + public ILogger Logger { get; set; } + + private const string TransmitSendingQueue = "TransmitSendingQueue"; + private const string TransmitCheckingQueue = "TransmitCheckingQueue"; + private const string TransmitArchivingQueue = "TransmitCheckingQueue"; + + public TransmitTransactionProvider(IOptions optionsAccessor, + IOptions aelfClientConfigOptions, + IDistributedCacheSerializer serializer, IAElfClientService aelfClientService, IBridgeInService bridgeInService) + : base(optionsAccessor) + { + _serializer = serializer; + _aelfClientService = aelfClientService; + _bridgeInService = bridgeInService; + _aelfClientConfigOptions = aelfClientConfigOptions.Value; + } + + public async Task EnqueueAsync(SendTransmitArgs args) + { + await EnqueueAsync(TransmitSendingQueue, args); + } + + public async Task SendByLibAsync(string libHash, long libHeight) + { + var item = await GetFirstItemAsync(TransmitSendingQueue); + while (item != null) + { + if (item.BlockHeight > libHeight) + { + break; + } + + var block = await _aelfClientService.GetBlockByHeightAsync(_aelfClientConfigOptions.ClientAlias, item.BlockHeight); + if (block.BlockHash == item.BlockHash) + { + var sendResult = await _bridgeInService.TransmitAsync(item.TargetChainId, item.TargetContractAddress, + item.Report, item.Rs, item.Ss, item.RawVs); + if (string.IsNullOrWhiteSpace(sendResult)) + { + Logger.LogError("Failed to transmit."); + break; + } + + item.TransactionId = sendResult; + await EnqueueAsync(TransmitCheckingQueue, item); + } + + await DequeueAsync(TransmitSendingQueue); + item = await GetFirstItemAsync(TransmitSendingQueue); + } + } + + private async Task EnqueueAsync(string queueName, SendTransmitArgs item) + { + await ConnectAsync(); + + await RedisDatabase.ListRightPushAsync((RedisKey)queueName, _serializer.Serialize(item)); + } + + private async Task DequeueAsync(string queueName) + { + await ConnectAsync(); + + var value = await RedisDatabase.ListLeftPopAsync((RedisKey)queueName); + return value.IsNullOrEmpty ? null : _serializer.Deserialize(value); + } + + private async Task GetFirstItemAsync(string queueName) + { + await ConnectAsync(); + + var value = await RedisDatabase.ListGetByIndexAsync((RedisKey)queueName,0); + return !value.HasValue ? null : _serializer.Deserialize(value); + } +} + +public class SendTransmitArgs +{ + public string BlockHash { get; set; } + public long BlockHeight { get; set; } + public string TargetChainId { get; set; } + public string TargetContractAddress { get; set; } + public string TransactionId { get; set; } + public byte[] Report { get; set; } + public byte[][] Rs { get; set; } + public byte[][] Ss{ get; set; } + public byte[] RawVs { get; set; } + public int RetryTimes { get; set; } +} diff --git a/src/AElf.EventHandler/appsettings.json b/src/AElf.EventHandler/appsettings.json index 9643e639..152e9d23 100644 --- a/src/AElf.EventHandler/appsettings.json +++ b/src/AElf.EventHandler/appsettings.json @@ -103,11 +103,12 @@ "AbiFileDirectory": "", "ContractInfoList": { "Regiment": { - "ContractAddress": "", "AbiFileName": "RegimentAbi.json" }, - "Bridge": { - "ContractAddress": "", + "BridgeIn": { + "AbiFileName": "BridgeAbi.json" + }, + "BridgeOut": { "AbiFileName": "BridgeAbi.json" } } From 9868f07ed5b98fa52d59a5831e6a0578506e5446 Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Fri, 19 Aug 2022 10:43:51 +0800 Subject: [PATCH 08/66] feat: update processor. --- .../GetReceiptInfosDTO.cs | 4 +- .../Options/BridgeOptions.cs | 13 +- ...IrreversibleBlockFoundLogEventProcessor.cs | 168 +++++++++++++----- .../QueryCreatedLogEventProcessor.cs | 81 +++++---- .../ReportProposedLogEventProcessor.cs | 41 +++-- ...ntCommitmentsCollectedLogEventProcessor.cs | 49 ++--- .../Providers/IDataProvider.cs | 150 ++++++++-------- .../ILatestQueriedReceiptCountProvider.cs | 4 +- 8 files changed, 307 insertions(+), 203 deletions(-) diff --git a/modules/AElf.Nethereum.Bridge/GetReceiptInfosDTO.cs b/modules/AElf.Nethereum.Bridge/GetReceiptInfosDTO.cs index 418ce1f8..5d917f0e 100644 --- a/modules/AElf.Nethereum.Bridge/GetReceiptInfosDTO.cs +++ b/modules/AElf.Nethereum.Bridge/GetReceiptInfosDTO.cs @@ -13,8 +13,8 @@ public class GetReceiptInfosDTO: IFunctionOutputDTO [FunctionOutput] public class ReceiptDTO : IFunctionOutputDTO { - [Parameter("uint256", "receiptId", 1)] - public BigInteger ReceiptId { get; set; } + [Parameter("string", "receiptId", 1)] + public string ReceiptId { get; set; } [Parameter("address", "asset", 2)] public string Asset { get; set; } diff --git a/src/AElf.EventHandler/Options/BridgeOptions.cs b/src/AElf.EventHandler/Options/BridgeOptions.cs index 94814d27..c799e6d3 100644 --- a/src/AElf.EventHandler/Options/BridgeOptions.cs +++ b/src/AElf.EventHandler/Options/BridgeOptions.cs @@ -8,15 +8,22 @@ public class BridgeOptions public bool IsTransmitter { get; set; } public long QueryPayment { get; set; } public List Bridges { get; set; } + public string AccountAddress { get; set; } } public class BridgeItem { + public string FromChainId { get; set; } public string EthereumClientAlias { get; set; } + public string EthereumBridgeInContractAddress { get; set; } public string OriginToken { get; set; } - public string BridgeContractAddress { get; set; } - public string SpaceId { get; set; } + public string QueryToAddress { get; set; } + public string EthereumBridgeOutContractAddress { get; set; } public string SwapId { get; set; } public string MaximumLeafCount { get; set; } - public string QueryToAddress { get; set; } + public string EthereumSwapId { get; set; } + public string TargetChainId { get; set; } + + + } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs index 5f45fff3..0b2ebbdd 100644 --- a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs @@ -1,6 +1,8 @@ +using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; +using AElf.Client.Bridge; using AElf.Client.Core.Extensions; using AElf.Client.Core.Options; using AElf.Client.MerkleTreeContract; @@ -8,29 +10,44 @@ using AElf.Contracts.Consensus.AEDPoS; using AElf.Contracts.MerkleTreeContract; using AElf.Contracts.Oracle; +using AElf.Nethereum.Bridge; +using AElf.Nethereum.Core; using AElf.Nethereum.Core.Options; using AElf.Types; +using AutoMapper.Mappers; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +using Org.BouncyCastle.Math; +using BigInteger = System.Numerics.BigInteger; namespace AElf.EventHandler; public class IrreversibleBlockFoundLogEventProcessor : LogEventProcessorBase { private readonly AElfContractOptions _contractAddressOptions; + private readonly BridgeOptions _bridgeOptions; private readonly EthereumContractOptions _ethereumContractOptions; + private readonly OracleOptions _oracleOptions; private readonly ILatestQueriedReceiptCountProvider _latestQueriedReceiptCountProvider; + private readonly BridgeService _bridgeContractService; private readonly IOracleService _oracleService; + private readonly IBridgeOutService _bridgeOutService; + private readonly INethereumService _nethereumService; private readonly IMerkleTreeContractService _merkleTreeContractService; private readonly ILogger _logger; private readonly string _lockAbi; public IrreversibleBlockFoundLogEventProcessor( IOptionsSnapshot contractAddressOptions, + IOptionsSnapshot bridgeOptions, IOptionsSnapshot ethereumContractOptions, + IOptionsSnapshot oracleOptions, ILatestQueriedReceiptCountProvider latestQueriedReceiptCountProvider, IOracleService oracleService, + IBridgeOutService bridgeOutService, + BridgeService bridgeService, IMerkleTreeContractService merkleTreeContractService, + INethereumService nethereumService, ILogger logger) : base(contractAddressOptions) { _ethereumContractOptions = ethereumContractOptions.Value; @@ -38,8 +55,12 @@ public IrreversibleBlockFoundLogEventProcessor( _oracleService = oracleService; _merkleTreeContractService = merkleTreeContractService; _logger = logger; - + _bridgeOptions = bridgeOptions.Value; + _bridgeOutService = bridgeOutService; + _oracleOptions = oracleOptions.Value; _contractAddressOptions = contractAddressOptions.Value; + _bridgeContractService = bridgeService; + _nethereumService = nethereumService; { var file = Path.Combine(_ethereumContractOptions.AbiFileDirectory, @@ -64,94 +85,143 @@ public override async Task ProcessAsync(LogEvent logEvent) libFound.MergeFrom(logEvent); _logger.LogInformation($"IrreversibleBlockFound: {libFound}"); - if (!_configOptions.SendQueryTransaction) return; + if (!_bridgeOptions.IsSendQuery) return; + var bridgeItemsMap = new Dictionary<(string, string), List>(); + var sendQueryList = new Dictionary(); + var tokenIndex = new Dictionary(); + foreach (var bridgeItem in _bridgeOptions.Bridges) + { + bridgeItemsMap[(bridgeItem.EthereumClientAlias, bridgeItem.EthereumBridgeOutContractAddress)].Add(bridgeItem); + } - foreach (var swapConfig in _configOptions.SwapConfigs) + foreach (var (aliasAddress,item) in bridgeItemsMap) { - await SendQueryAsync(swapConfig.LockMappingContractAddress, Hash.LoadFromBase64(swapConfig.SpaceId), - swapConfig.TokenSymbol); + var tokenList = item.Select(i => i.OriginToken).ToList(); + var targetChainIdList = item.Select(i => i.TargetChainId).ToList(); + var sendReceiptIndexDto = await _bridgeOutService.GetTransferReceiptIndexAsync(aliasAddress.Item1,aliasAddress.Item2,tokenList,targetChainIdList); + for (var i = 0; i < tokenList.Count; i++) + { + var ethereumBlockNumber = await _nethereumService.GetBlockNumberAsync(aliasAddress.Item1); + if (ethereumBlockNumber - sendReceiptIndexDto.BlockTimes[i] <= 12) continue; + tokenIndex[tokenList[i]] = sendReceiptIndexDto.Indexes[i]; + sendQueryList[item[i].SwapId] = item[i]; + } } - } - private async Task SendQueryAsync(string lockMappingContractAddress, Hash spaceId, string symbol) - { - _logger.LogInformation($"Querying {lockMappingContractAddress}, Space Id {spaceId}, Symbol {symbol}"); - var nodeUrl = _configOptions.SwapConfigs.Single(c => Hash.LoadFromBase64(c.SpaceId) == spaceId).NodeUrl; - var web3ManagerForLock = new Web3Manager(nodeUrl, lockMappingContractAddress, - "", _lockAbi); - - // TODO: Travel Bridge.Bridges config. + foreach (var (swapId,item) in sendQueryList) + { + await SendQueryAsync(item,tokenIndex[item.OriginToken]); + } - var lockTimes = await web3ManagerForLock.GetFunction(lockMappingContractAddress, "receiptCount") - .CallAsync();// TODO: Bridges.OriginToken - _logger.LogInformation($"{symbol} lock times: {lockTimes}"); + } + private async Task QueryEthereumReceiptIndex(IGrouping item) + { + } + private async Task SendQueryAsync(BridgeItem bridgeItem, BigInteger tokenIndex) + { + var swapId = bridgeItem.SwapId; + var spaceId = await _bridgeContractService.GetSpaceIdBySwapIdAsync(Hash.LoadFromBase64(swapId)); var lastRecordedLeafIndex = (await _merkleTreeContractService.GetLastLeafIndexAsync( new GetLastLeafIndexInput { SpaceId = spaceId })).Value; - - var maxAvailableIndex = lockTimes - 1; - if (_latestQueriedReceiptCountProvider.Get(symbol) == 0) - { - _latestQueriedReceiptCountProvider.Set(symbol, lastRecordedLeafIndex + 1); - } - - var latestTreeIndex = _latestQueriedReceiptCountProvider.Get(symbol) / _configOptions.MaximumLeafCount; - _logger.LogInformation($"{symbol} latest tree index: {latestTreeIndex}"); - - var almostTreeIndex = lockTimes / _configOptions.MaximumLeafCount; - if (latestTreeIndex < almostTreeIndex) + if (lastRecordedLeafIndex == -2) { - maxAvailableIndex = (latestTreeIndex + 1) * _configOptions.MaximumLeafCount - 1; + _logger.LogInformation($"Space of id {spaceId} is not created. "); + return; } - - _logger.LogInformation( - $"Lock times: {lockTimes}; Latest tree index: {latestTreeIndex}; Almost tree index: {almostTreeIndex}; Max available index: {maxAvailableIndex};"); - - if (maxAvailableIndex + 1 <= _latestQueriedReceiptCountProvider.Get(symbol)) + if (_latestQueriedReceiptCountProvider.Get(swapId) == 0) { - return; + _latestQueriedReceiptCountProvider.Set(swapId,lastRecordedLeafIndex); } - - if (lastRecordedLeafIndex == -2) + _logger.LogInformation($"Last recorded leaf index : {lastRecordedLeafIndex}."); + if (tokenIndex <= _latestQueriedReceiptCountProvider.Get(swapId)) { - _logger.LogError($"Space {spaceId.ToHex()} didn't created."); return; } - _logger.LogInformation($"Last recorded leaf index: {lastRecordedLeafIndex}"); - var notRecordedReceiptsCount = maxAvailableIndex - lastRecordedLeafIndex; - if (notRecordedReceiptsCount > 0) + var notRecordLeafCount = tokenIndex - lastRecordedLeafIndex; + if (notRecordLeafCount > 0) { var queryInput = new QueryInput { - Payment = _configOptions.QueryPayment, + Payment = _bridgeOptions.QueryPayment, QueryInfo = new QueryInfo { - Title = $"record_receipts_{symbol}",// TODO: Change this to SwapId. - Options = { (lastRecordedLeafIndex + 1).ToString(), maxAvailableIndex.ToString() } + Title = $"record_receipt_{swapId}", + Options = {(lastRecordedLeafIndex + 1).ToString(), notRecordLeafCount.ToString()} }, AggregatorContractAddress = _contractAddressOptions.ContractAddressList["StringAggregator"] .ConvertAddress(), CallbackInfo = new CallbackInfo { - ContractAddress = _contractAddressOptions.ContractAddressList["Bridge"].ConvertAddress(), + ContractAddress = + _contractAddressOptions.ContractAddressList["Bridge"].ConvertAddress(), MethodName = "RecordReceiptHash" }, DesignatedNodeList = new AddressList - { Value = { _configOptions.TokenSwapOracleOrganizationAddress.ConvertAddress() } } + { + Value = {bridgeItem.QueryToAddress.ConvertAddress()} + } }; _logger.LogInformation($"About to send Query transaction for token swapping, QueryInput: {queryInput}"); var sendTxResult = await _oracleService.QueryAsync(queryInput); _logger.LogInformation($"Query tx id: {sendTxResult.Transaction.GetHash()}"); - _latestQueriedReceiptCountProvider.Set(symbol, maxAvailableIndex + 1); + _latestQueriedReceiptCountProvider.Set(swapId, (int) tokenIndex + 1); _logger.LogInformation( - $"Latest queried receipt count: {_latestQueriedReceiptCountProvider.Get(symbol)}"); + $"Latest queried receipt count: {_latestQueriedReceiptCountProvider.Get(swapId)}"); } + + //Format Bridge Config => {ethereum contract address -> alias -> {token[],targetChainId[]}} + // var bridgeGroup = _bridgeOptions.Bridges.GroupBy(e => e.EthereumBridgeInContractAddress).ToList(); + // foreach (var bridge in bridgeGroup) + // { + // _logger.LogInformation($"Querying ethereum contract address : {bridge.Key}."); + // var bridgeGroupByAlias = bridge.GroupBy(e => e.EthereumClientAlias); + // foreach (var item in bridgeGroupByAlias) + // { + // var ethereumClientAlias = item.Key; + // var tokenList = item.Select(e => e.OriginToken).ToList(); + // var targetChainIdList = item.Select(e => e.TargetChainId).ToList(); + // var sendReceiptIndexDto = await _bridgeOutService.GetTransferReceiptIndexAsync(ethereumClientAlias,tokenList,targetChainIdList); + // + // var swapTokenMap = new Dictionary(); + // foreach (var bridgeItem in item) + // { + // swapTokenMap[bridgeItem.SwapId] = bridgeItem; + // } + // var tokenIndex = new Dictionary(); + // var blockNumber = new Dictionary(); + // for (var i = 0; i < tokenList.Count; i++) + // { + // tokenIndex[tokenList[i]] = sendReceiptIndexDto.Indexes[i]; + // blockNumber[tokenList[i]] = sendReceiptIndexDto.BlockTimes[i]; + // } + // + // for (var i = 0; i < tokenList.Count; i++) + // { + // var ethereumBlockNumber = await _nethereumService.GetBlockNumberAsync(ethereumClientAlias); + // if (ethereumBlockNumber - blockNumber[tokenList[i]] < 12) + // { + // tokenList.Remove(tokenList[i]); + // } + // } + // var swapTokenMapSend = swapTokenMap.Select(pair => tokenList.Contains(pair.Value.OriginToken) ? pair : default).ToList(); + // foreach (var (swapId, value) in swapTokenMapSend) + // { + // var index = tokenIndex[value.OriginToken]; + // + // + // + // + // } + // + // } + // } } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs index 002c2886..44c19ddd 100644 --- a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs @@ -1,6 +1,8 @@ +using System.Linq; using System.Threading.Tasks; using AElf.Client.Core.Extensions; using AElf.Client.Core.Options; +using AElf.Client.Oracle; using AElf.Contracts.Oracle; using AElf.Types; using Microsoft.Extensions.Logging; @@ -13,17 +15,28 @@ internal class QueryCreatedLogEventProcessor : LogEventProcessorBase "Oracle"; private readonly ILogger _logger; public QueryCreatedLogEventProcessor( IOptionsSnapshot contractAddressOptions, - ISaltProvider saltProvider, IDataProvider dataProvider, ILogger logger) : + ISaltProvider saltProvider, + IDataProvider dataProvider, + ILogger logger, + IOptionsSnapshot bridgeOptions, + IOptionsSnapshot oracleOptions, + IOracleService oracleService) : base(contractAddressOptions) { _saltProvider = saltProvider; _dataProvider = dataProvider; _logger = logger; + _bridgeOptions = bridgeOptions.Value; + _oracleOptions = oracleOptions.Value; + _oracleService = oracleService; } public override async Task ProcessAsync(LogEvent logEvent) @@ -31,40 +44,36 @@ public override async Task ProcessAsync(LogEvent logEvent) var queryCreated = new QueryCreated(); queryCreated.MergeFrom(logEvent); _logger.LogInformation(queryCreated.ToString()); - // - // var nodeAddress = Address.FromBase58(_configOptions.AccountAddress); - // var firstDesignatedNodeAddress = queryCreated.DesignatedNodeList.Value.First(); - // var queryToken = queryCreated - // .Token; // Query token means the ethereum contract address oracle node should cares in report case. - // if (queryCreated.DesignatedNodeList.Value.Contains(nodeAddress) || - // _configOptions.ObserverAssociationAddressList.Contains(firstDesignatedNodeAddress.ToBase58()) || - // _configOptions.TransmitContractAddress == queryToken || - // _configOptions.Token == queryToken) - // { - // var data = await _dataProvider.GetDataAsync(queryCreated.QueryId, queryCreated.QueryInfo.Title, - // queryCreated.QueryInfo.Options.ToList()); - // if (string.IsNullOrEmpty(data)) - // { - // _logger.LogError(queryCreated.QueryInfo.Title == "record_receipts" - // ? "Failed to record receipts from eth to aelf." - // : $"Failed to response to query {queryCreated.QueryId}."); - // - // return; - // } - // - // var salt = _saltProvider.GetSalt(queryCreated.QueryId); - // _logger.LogInformation($"Queried data: {data}, salt: {salt}"); - // var commitInput = new CommitInput - // { - // QueryId = queryCreated.QueryId, - // Commitment = HashHelper.ConcatAndCompute( - // HashHelper.ComputeFrom(data), - // HashHelper.ConcatAndCompute(salt, HashHelper.ComputeFrom(_configOptions.AccountAddress))) - // }; - // _logger.LogInformation($"Sending Commit tx with input: {commitInput}"); - // var txId = node.SendTransaction(_configOptions.AccountAddress, GetContractAddress(), "Commit", - // commitInput); - // _logger.LogInformation($"[Commit] Tx id {txId}"); - // } + + var nodeAddress = Address.FromBase58(_bridgeOptions.AccountAddress); + var firstDesignatedNodeAddress = queryCreated.DesignatedNodeList.Value.First(); + //var queryToken = queryCreated.Token; // Query token means the ethereum contract address oracle node should cares in report case. + if (queryCreated.DesignatedNodeList.Value.Contains(nodeAddress) || + _oracleOptions.ObserverAssociationAddressList.Contains(firstDesignatedNodeAddress.ToBase58())) + { + var data = await _dataProvider.GetDataAsync(queryCreated.QueryId, queryCreated.QueryInfo.Title, + queryCreated.QueryInfo.Options.ToList()); + if (string.IsNullOrEmpty(data)) + { + _logger.LogError(queryCreated.QueryInfo.Title == "record_receipts" + ? "Failed to record receipts from eth to aelf." + : $"Failed to response to query {queryCreated.QueryId}."); + + return; + } + + var salt = _saltProvider.GetSalt(queryCreated.QueryId); + _logger.LogInformation($"Queried data: {data}, salt: {salt}"); + var commitInput = new CommitInput + { + QueryId = queryCreated.QueryId, + Commitment = HashHelper.ConcatAndCompute( + HashHelper.ComputeFrom(data), + HashHelper.ConcatAndCompute(salt, HashHelper.ComputeFrom(_bridgeOptions.AccountAddress))) + }; + _logger.LogInformation($"Sending Commit tx with input: {commitInput}"); + var transactionResult = await _oracleService.CommitAsync(commitInput); + _logger.LogInformation($"[Commit] Tx id {transactionResult.TransactionResult}"); + } } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs index f42a27f0..f8d9cc1a 100644 --- a/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs @@ -1,5 +1,6 @@ using System.Threading.Tasks; using AElf.Client.Core; +using AElf.Client.Core.Extensions; using AElf.Client.Core.Options; using AElf.Client.Report; using AElf.Contracts.Report; @@ -16,6 +17,8 @@ internal class ReportProposedLogEventProcessor : LogEventProcessorBase "Report"; private readonly ILogger _logger; @@ -25,31 +28,37 @@ public ReportProposedLogEventProcessor( IReportProvider reportProvider, IReportService reportService, IAElfAccountProvider accountProvider, - ILogger logger) : base(contractAddressOptions) + ILogger logger, + IOptionsSnapshot bridgeOptions, + IOptionsSnapshot AElfConfigOptions) : base(contractAddressOptions) { _logger = logger; _contractAddressOptions = contractAddressOptions.Value; _reportProvider = reportProvider; _reportService = reportService; _accountProvider = accountProvider; + _bridgeOptions = bridgeOptions.Value; + _aelfClientConfigOptions = AElfConfigOptions.Value; } public override async Task ProcessAsync(LogEvent logEvent) { - // var reportProposed = new ReportProposed(); - // reportProposed.MergeFrom(logEvent); - // - // _logger.LogInformation($"New report: {reportProposed}"); - // - // var sendTxResult = await _reportService.ConfirmReportAsync(new ConfirmReportInput - // { - // Token = _configOptions.TransmitContractAddress, - // RoundId = reportProposed.RoundId, - // Signature = SignHelper - // .GetSignature(reportProposed.RawReport, _keyStore.GetAccountKeyPair().PrivateKey).RecoverInfo - // }); - // _reportProvider.SetReport(_configOptions.TransmitContractAddress, reportProposed.RoundId, - // reportProposed.RawReport); - // _logger.LogInformation($"[ConfirmReport] Tx id {txId}"); + var reportProposed = new ReportProposed(); + reportProposed.MergeFrom(logEvent); + + _logger.LogInformation($"New report: {reportProposed}"); + + var privateKey = _accountProvider.GetPrivateKey(_aelfClientConfigOptions.AccountAlias); + + var sendTxResult = await _reportService.ConfirmReportAsync(new ConfirmReportInput + { + Token = reportProposed.Token, + RoundId = reportProposed.RoundId, + Signature = SignHelper + .GetSignature(reportProposed.RawReport, privateKey).RecoverInfo + }); + _reportProvider.SetReport(reportProposed.Token, reportProposed.RoundId, + reportProposed.RawReport); + _logger.LogInformation($"[ConfirmReport] Tx : {sendTxResult}"); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs index 1dc92058..910a3ef2 100644 --- a/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs @@ -1,5 +1,7 @@ using System.Threading.Tasks; +using AElf.Client.Core.Extensions; using AElf.Client.Core.Options; +using AElf.Client.Oracle; using AElf.Contracts.Oracle; using AElf.Types; using Microsoft.Extensions.Logging; @@ -14,43 +16,48 @@ internal class SufficientCommitmentsCollectedLogEventProcessor : private readonly IDataProvider _dataProvider; private readonly AElfContractOptions _contractAddressOptions; private readonly ILogger _logger; + private readonly OracleOptions _oracleOptions; + private readonly IOracleService _oracleService; public SufficientCommitmentsCollectedLogEventProcessor( IOptionsSnapshot contractAddressOptions, ISaltProvider saltProvider, IDataProvider dataProvider, - ILogger logger) : base(contractAddressOptions) + ILogger logger, + IOptionsSnapshot oracleOptions, + IOracleService oracleService) : base(contractAddressOptions) { _saltProvider = saltProvider; _dataProvider = dataProvider; _logger = logger; _contractAddressOptions = contractAddressOptions.Value; + _oracleOptions = oracleOptions.Value; + _oracleService = oracleService; } public override string ContractName => "Oracle"; public override async Task ProcessAsync(LogEvent logEvent) { - // var collected = new SufficientCommitmentsCollected(); - // collected.MergeFrom(logEvent); - // var data = await _dataProvider.GetDataAsync(collected.QueryId); - // if (string.IsNullOrEmpty(data)) - // { - // _logger.LogError($"Failed to reveal data for query {collected.QueryId}."); - // return; - // } - // - // _logger.LogInformation($"Get data for revealing: {data}"); + var collected = new SufficientCommitmentsCollected(); + collected.MergeFrom(logEvent); + var data = await _dataProvider.GetDataAsync(collected.QueryId); + if (string.IsNullOrEmpty(data)) + { + _logger.LogError($"Failed to reveal data for query {collected.QueryId}."); + return; + } + + _logger.LogInformation($"Get data for revealing: {data}"); // var node = new NodeManager(_configOptions.BlockChainEndpoint, _configOptions.AccountAddress, // _configOptions.AccountPassword); - // var revealInput = new RevealInput - // { - // QueryId = collected.QueryId, - // Data = data, - // Salt = _saltProvider.GetSalt(collected.QueryId) - // }; - // _logger.LogInformation($"Sending Reveal tx with input: {revealInput}"); - // var txId = node.SendTransaction(_configOptions.AccountAddress, - // _contractAddressOptions.ContractAddressList[ContractName], "Reveal", revealInput); - // _logger.LogInformation($"[Reveal] Tx id {txId}"); + var revealInput = new RevealInput + { + QueryId = collected.QueryId, + Data = data, + Salt = _saltProvider.GetSalt(collected.QueryId) + }; + _logger.LogInformation($"Sending Reveal tx with input: {revealInput}"); + var transaction = await _oracleService.RevealAsync(revealInput); + _logger.LogInformation($"[Reveal] Transaction : {transaction}"); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Providers/IDataProvider.cs b/src/AElf.EventHandler/Providers/IDataProvider.cs index 40cc6bda..73234342 100644 --- a/src/AElf.EventHandler/Providers/IDataProvider.cs +++ b/src/AElf.EventHandler/Providers/IDataProvider.cs @@ -6,8 +6,11 @@ using System.Net.Http; using System.Text.Json; using System.Threading.Tasks; +using AElf.Client.Bridge; using AElf.Client.Core.Options; using AElf.Contracts.Bridge; +using AElf.Nethereum.Bridge; +using AElf.Nethereum.Core; using AElf.Nethereum.Core.Options; using AElf.Types; using Microsoft.Extensions.Logging; @@ -26,13 +29,23 @@ public class DataProvider : IDataProvider, ISingletonDependency private readonly Dictionary _dictionary; private readonly ILogger _logger; private readonly string _bridgeAbi; - private Web3Manager _web3ManagerForLock; - - public DataProvider(ILogger logger, IOptionsSnapshot ethereumContractOptions, - IOptionsSnapshot contractAddressOptions) + private BridgeOptions _bridgeOptions; + private BridgeService _bridgeService; + private IBridgeOutService _bridgeOutService; + + public DataProvider( + ILogger logger, + IOptionsSnapshot ethereumContractOptions, + IOptionsSnapshot contractAddressOptions, + IOptionsSnapshot bridgeOptions, + BridgeService bridgeService, + BridgeOutService bridgeOutService) { _logger = logger; + _bridgeOptions = bridgeOptions.Value; + _bridgeService = bridgeService; + _bridgeOutService = bridgeOutService; _dictionary = new Dictionary(); { var file = Path.Combine(ethereumContractOptions.Value.AbiFileDirectory, @@ -69,14 +82,12 @@ public async Task GetDataAsync(Hash queryId, string title = null, List c.TokenSymbol == symbol); - var spaceId = swapConfig.SpaceId; - var lockMappingAddress = swapConfig.LockMappingContractAddress; + var swapId = title.Split('_').Last(); + _logger.LogInformation($"Trying to query record receipt data of {swapId}"); + var swapConfig = _bridgeOptions.Bridges.Single(c => c.SwapId == swapId); _logger.LogInformation("About to handle record receipt hashes for swapping tokens."); var recordReceiptHashInput = - await GetReceiptHashMap(Hash.LoadFromBase64(spaceId), lockMappingAddress, long.Parse(options[0]), + await GetReceiptHashMap(Hash.LoadFromBase64(swapId), swapConfig, long.Parse(options[0]), long.Parse(options[1])); _logger.LogInformation($"RecordReceiptHashInput: {recordReceiptHashInput}"); _dictionary[queryId] = recordReceiptHashInput; @@ -121,78 +132,69 @@ await GetReceiptHashMap(Hash.LoadFromBase64(spaceId), lockMappingAddress, long.P return result; } - private async Task GetReceiptHashMap(Hash spaceId, string lockMappingAddress, long start, long end) - { - // var nodeUrl = _configOptions.SwapConfigs.Single(c => c.SpaceId == spaceId.ToHex()).NodeUrl; - // if (_web3ManagerForLock == null || _web3ManagerForLock.BaseUrl != nodeUrl) - // { - // _web3ManagerForLock = new Web3Manager(nodeUrl, - // lockMappingAddress, _ethereumConfigOptions.PrivateKey, _bridgeAbi); - // } - // - // var canTakeToken = _configOptions.SwapConfigs.Single(c => c.SpaceId == spaceId.ToHex()).CanTakeToken; - // var receiptInfos = await GetReceiptInfosAsync(lockMappingAddress, start, end, nodeUrl, canTakeToken); - // var receiptHashes = new List(); - // for (var i = 0; i <= end - start; i++) - // { - // var amountHash = GetHashTokenAmountData(receiptInfos[i].Amount.ToString(), 32, true); - // var targetAddressHash = HashHelper.ComputeFrom(receiptInfos[i].TargetAddress); - // var receiptIdHash = HashHelper.ComputeFrom(i + start); - // var hash = HashHelper.ConcatAndCompute(amountHash, targetAddressHash, receiptIdHash); - // receiptHashes.Add(hash); - // } - // - // var input = new ReceiptHashMap - // { - // RecorderId = recorderId - // }; - // for (var i = 0; i <= end - start; i++) - // { - // var index = (int)(i + start); - // input.Value.Add(index, receiptHashes[i].ToHex()); - // } - // - // return input.ToString(); - return ""; - } - - private Hash GetHashTokenAmountData(string stringAmount, int originTokenSizeInByte, bool isBigEndian) + private async Task GetReceiptHashMap(Hash swapId, BridgeItem bridgeItem, long start, long end) { - var amount = decimal.Parse(stringAmount); - var preHolderSize = originTokenSizeInByte - 16; - int[] amountInIntegers; - if (isBigEndian) - { - amountInIntegers = decimal.GetBits(amount).Reverse().ToArray(); - if (preHolderSize < 0) - amountInIntegers = amountInIntegers.TakeLast(originTokenSizeInByte / 4).ToArray(); - } - else + var token = _bridgeOptions.Bridges.Single(c => c.SwapId == swapId.ToHex()).OriginToken; + var receiptInfos = await _bridgeOutService.GetSendReceiptInfosAsync(bridgeItem.EthereumClientAlias,bridgeItem.EthereumBridgeOutContractAddress, token, start); + var receiptHashes = new List(); + for (var i = 0; i <= end - start; i++) { - amountInIntegers = decimal.GetBits(amount).ToArray(); - if (preHolderSize < 0) - amountInIntegers = amountInIntegers.Take(originTokenSizeInByte / 4).ToArray(); + var amountHash = HashHelper.ComputeFrom(receiptInfos.Receipts[i].Amount.ToString()); + var targetAddressHash = HashHelper.ComputeFrom(receiptInfos.Receipts[i].TargetAddress); + var receiptIdHash = HashHelper.ComputeFrom(receiptInfos.Receipts[i].ReceiptId); + var hash = HashHelper.ConcatAndCompute(amountHash, targetAddressHash, receiptIdHash); + receiptHashes.Add(hash); } - - var amountBytes = new List(); - - amountInIntegers.Aggregate(amountBytes, (cur, i) => + + var input = new ReceiptHashMap { - cur.AddRange(i.ToBytes(isBigEndian)); - return cur; - }); - - if (preHolderSize > 0) + SwapId = swapId.ToHex() + }; + for (var i = 0; i <= end - start; i++) { - var placeHolder = Enumerable.Repeat(new byte(), preHolderSize).ToArray(); - amountBytes = isBigEndian - ? placeHolder.Concat(amountBytes).ToList() - : amountBytes.Concat(placeHolder).ToList(); + input.Value.Add(receiptInfos.Receipts[(int)(i + start)].ReceiptId, receiptHashes[i].ToHex()); } - - return HashHelper.ComputeFrom(amountBytes.ToArray()); + + return input.ToString(); } + // private Hash GetHashTokenAmountData(string stringAmount, int originTokenSizeInByte, bool isBigEndian) + // { + // var amount = decimal.Parse(stringAmount); + // var preHolderSize = originTokenSizeInByte - 16; + // int[] amountInIntegers; + // if (isBigEndian) + // { + // amountInIntegers = decimal.GetBits(amount).Reverse().ToArray(); + // if (preHolderSize < 0) + // amountInIntegers = amountInIntegers.TakeLast(originTokenSizeInByte / 4).ToArray(); + // } + // else + // { + // amountInIntegers = decimal.GetBits(amount).ToArray(); + // if (preHolderSize < 0) + // amountInIntegers = amountInIntegers.Take(originTokenSizeInByte / 4).ToArray(); + // } + // + // var amountBytes = new List(); + // + // amountInIntegers.Aggregate(amountBytes, (cur, i) => + // { + // cur.AddRange(i.ToBytes(isBigEndian)); + // return cur; + // }); + // + // if (preHolderSize > 0) + // { + // var placeHolder = Enumerable.Repeat(new byte(), preHolderSize).ToArray(); + // amountBytes = isBigEndian + // ? placeHolder.Concat(amountBytes).ToList() + // : amountBytes.Concat(placeHolder).ToList(); + // } + // + // return HashHelper.ComputeFrom(amountBytes.ToArray()); + // } + private string Aggregate(List dataList) { var finalPrice = dataList.OrderBy(p => p).ToList()[dataList.Count / 2] diff --git a/src/AElf.EventHandler/Providers/ILatestQueriedReceiptCountProvider.cs b/src/AElf.EventHandler/Providers/ILatestQueriedReceiptCountProvider.cs index db1e1e65..9222062e 100644 --- a/src/AElf.EventHandler/Providers/ILatestQueriedReceiptCountProvider.cs +++ b/src/AElf.EventHandler/Providers/ILatestQueriedReceiptCountProvider.cs @@ -2,6 +2,6 @@ namespace AElf.EventHandler; public interface ILatestQueriedReceiptCountProvider { - long Get(string symbol); - void Set(string symbol, long count); + long Get(string swapId); + void Set(string swapId, long count); } \ No newline at end of file From e7165ba3351c9f3f33408657720e1ff390c449a2 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Fri, 19 Aug 2022 11:01:07 +0800 Subject: [PATCH 09/66] feat: add event context --- .../AElf.Nethereum.Core/INethereumService.cs | 16 +++++ .../EventHandlerAppModule.cs | 8 ++- .../Options/AElfChainAliasOptions.cs | 8 +++ .../AggregateDataReceivedLogEventProcessor.cs | 2 +- .../ContractDeployedLogEventProcessor.cs | 2 +- .../Processors/ILogEventProcessor.cs | 2 +- ...IrreversibleBlockFoundLogEventProcessor.cs | 2 +- .../Processors/LogEventProcessorBase.cs | 7 +- .../QueryCompletedLogEventProcessor.cs | 2 +- .../QueryCreatedLogEventProcessor.cs | 2 +- .../QueryDataRecordedLogEventProcessor.cs | 2 +- .../ReportConfirmedLogEventProcessor.cs | 2 +- .../ReportProposedLogEventProcessor.cs | 2 +- ...ntCommitmentsCollectedLogEventProcessor.cs | 2 +- .../Providers/ITransmitTransactionProvider.cs | 70 ++++++++++++++++--- .../TransactionResultListEventHandler.cs | 3 + .../Workers/ReceiptSyncWorker.cs | 20 ++++++ .../Workers/TransmitTransactionWorker.cs | 24 +++++++ src/AElf.EventHandler/appsettings.json | 5 ++ 19 files changed, 159 insertions(+), 22 deletions(-) create mode 100644 src/AElf.EventHandler/Options/AElfChainAliasOptions.cs create mode 100644 src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs create mode 100644 src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs diff --git a/modules/AElf.Nethereum.Core/INethereumService.cs b/modules/AElf.Nethereum.Core/INethereumService.cs index c6e73c0c..1cd26509 100644 --- a/modules/AElf.Nethereum.Core/INethereumService.cs +++ b/modules/AElf.Nethereum.Core/INethereumService.cs @@ -1,4 +1,6 @@ using Nethereum.BlockchainProcessing.BlockStorage.Entities.Mapping; +using Nethereum.Hex.HexTypes; +using Nethereum.RPC.Eth.DTOs; using Volo.Abp.DependencyInjection; namespace AElf.Nethereum.Core; @@ -6,6 +8,8 @@ namespace AElf.Nethereum.Core; public interface INethereumService { Task GetBlockNumberAsync(string clientAlias); + Task GetTransactionReceiptAsync(string clientAlias, string transactionHash); + Task GetBlockByNumberAsync(string clientAlias, HexBigInteger number); } public class NethereumService : INethereumService, ITransientDependency @@ -23,4 +27,16 @@ public async Task GetBlockNumberAsync(string clientAlias) var latestBlockNumber = await web3.Eth.Blocks.GetBlockNumber.SendRequestAsync(); return latestBlockNumber.ToLong(); } + + public async Task GetTransactionReceiptAsync(string clientAlias, string transactionHash) + { + var web3 = _nethereumClientProvider.GetClient(clientAlias); + return await web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(transactionHash); + } + + public async Task GetBlockByNumberAsync(string clientAlias, HexBigInteger number) + { + var web3 = _nethereumClientProvider.GetClient(clientAlias); + return await web3.Eth.Blocks.GetBlockWithTransactionsHashesByNumber.SendRequestAsync(number); + } } \ No newline at end of file diff --git a/src/AElf.EventHandler/EventHandlerAppModule.cs b/src/AElf.EventHandler/EventHandlerAppModule.cs index 5256e732..dbff0b10 100644 --- a/src/AElf.EventHandler/EventHandlerAppModule.cs +++ b/src/AElf.EventHandler/EventHandlerAppModule.cs @@ -6,6 +6,7 @@ using AElf.Client.MerkleTree; using AElf.Client.Oracle; using AElf.Client.Report; +using AElf.EventHandler.Workers; using AElf.Nethereum.Bridge; using AElf.Nethereum.Core; using Microsoft.Extensions.Configuration; @@ -13,6 +14,7 @@ using RabbitMQ.Client; using Volo.Abp; using Volo.Abp.Autofac; +using Volo.Abp.BackgroundWorkers; using Volo.Abp.Caching.StackExchangeRedis; using Volo.Abp.EventBus.RabbitMq; using Volo.Abp.Modularity; @@ -30,7 +32,8 @@ namespace AElf.EventHandler; typeof(AElfClientBridgeModule), typeof(AElfClientMerkleTreeModule), typeof(AElfNethereumBridgeModule), - typeof(AbpCachingStackExchangeRedisModule) + typeof(AbpCachingStackExchangeRedisModule), + typeof(AbpBackgroundWorkersModule) )] public class EventHandlerAppModule : AbpModule { @@ -73,6 +76,7 @@ public override void ConfigureServices(ServiceConfigurationContext context) // Configure(configuration.GetSection("Ethereum")); Configure(configuration.GetSection("Oracle")); Configure(configuration.GetSection("Bridge")); + Configure(configuration.GetSection("AElfChainAlias")); context.Services.AddHostedService(); context.Services.AddTransient(typeof(ILogEventProcessor<>), typeof(LogEventProcessorBase<>)); context.Services.AddSingleton(); @@ -80,5 +84,7 @@ public override void ConfigureServices(ServiceConfigurationContext context) public override void OnApplicationInitialization(ApplicationInitializationContext context) { + //context.AddBackgroundWorkerAsync(); + //context.AddBackgroundWorkerAsync(); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Options/AElfChainAliasOptions.cs b/src/AElf.EventHandler/Options/AElfChainAliasOptions.cs new file mode 100644 index 00000000..20dd588d --- /dev/null +++ b/src/AElf.EventHandler/Options/AElfChainAliasOptions.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic; + +namespace AElf.EventHandler; + +public class AElfChainAliasOptions +{ + public Dictionary Mapping { get; set; } = new(); +} \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/AggregateDataReceivedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/AggregateDataReceivedLogEventProcessor.cs index b54a0c44..8e887272 100644 --- a/src/AElf.EventHandler/Processors/AggregateDataReceivedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/AggregateDataReceivedLogEventProcessor.cs @@ -21,7 +21,7 @@ public AggregateDataReceivedLogEventProcessor(IOptionsSnapshot "IntegerAggregator"; - public override Task ProcessAsync(LogEvent logEvent) + public override Task ProcessAsync(LogEvent logEvent, EventContext context) { var aggregateDataReceived = new AggregateDataReceived(); aggregateDataReceived.MergeFrom(logEvent); diff --git a/src/AElf.EventHandler/Processors/ContractDeployedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ContractDeployedLogEventProcessor.cs index 18f992ed..dd633be0 100644 --- a/src/AElf.EventHandler/Processors/ContractDeployedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ContractDeployedLogEventProcessor.cs @@ -19,7 +19,7 @@ public ContractDeployedLogEventProcessor(ILogger _logger = logger; } - public override Task ProcessAsync(LogEvent logEvent) + public override Task ProcessAsync(LogEvent logEvent, EventContext context) { var contractDeployed = new ContractDeployed(); contractDeployed.MergeFrom(logEvent); diff --git a/src/AElf.EventHandler/Processors/ILogEventProcessor.cs b/src/AElf.EventHandler/Processors/ILogEventProcessor.cs index f0640987..faafc6e0 100644 --- a/src/AElf.EventHandler/Processors/ILogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ILogEventProcessor.cs @@ -14,7 +14,7 @@ public interface ILogEventProcessor : ITransientDependency, ILogEventProcesso public interface ILogEventProcessor { string ContractName { get; } - Task ProcessAsync(LogEvent logEvent); + Task ProcessAsync(LogEvent logEvent, EventContext context); bool IsMatch(string contractAddress, string logEventName); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs index 0b2ebbdd..45e04bc7 100644 --- a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs @@ -79,7 +79,7 @@ public IrreversibleBlockFoundLogEventProcessor( public override string ContractName => "Consensus"; - public override async Task ProcessAsync(LogEvent logEvent) + public override async Task ProcessAsync(LogEvent logEvent, EventContext context) { var libFound = new IrreversibleBlockFound(); libFound.MergeFrom(logEvent); diff --git a/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs b/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs index b6777078..918591e2 100644 --- a/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs +++ b/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs @@ -18,7 +18,7 @@ public LogEventProcessorBase(IOptionsSnapshot contractAddre public abstract string ContractName { get; } - public abstract Task ProcessAsync(LogEvent logEvent); + public abstract Task ProcessAsync(LogEvent logEvent, EventContext context); public string GetContractAddress() { @@ -38,4 +38,9 @@ public bool IsMatch(string contractAddress, string logEventName) return actualContractAddress == contractAddress && logEventName == typeof(T).Name; } } + + public class EventContext + { + public int ChainId { get; set; } + } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs index 01df86e1..44a9bedf 100644 --- a/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs @@ -20,7 +20,7 @@ public QueryCompletedLogEventProcessor(ILogger _logger = logger; } - public override Task ProcessAsync(LogEvent logEvent) + public override Task ProcessAsync(LogEvent logEvent, EventContext context) { var completed = new QueryCompletedWithAggregation(); completed.MergeFrom(logEvent); diff --git a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs index 44c19ddd..0e0eb74b 100644 --- a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs @@ -39,7 +39,7 @@ public QueryCreatedLogEventProcessor( _oracleService = oracleService; } - public override async Task ProcessAsync(LogEvent logEvent) + public override async Task ProcessAsync(LogEvent logEvent, EventContext context) { var queryCreated = new QueryCreated(); queryCreated.MergeFrom(logEvent); diff --git a/src/AElf.EventHandler/Processors/QueryDataRecordedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/QueryDataRecordedLogEventProcessor.cs index 122eaf47..d82efb82 100644 --- a/src/AElf.EventHandler/Processors/QueryDataRecordedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/QueryDataRecordedLogEventProcessor.cs @@ -20,7 +20,7 @@ public QueryDataRecordedLogEventProcessor(IOptionsSnapshot public override string ContractName => "OracleUser"; - public override Task ProcessAsync(LogEvent logEvent) + public override Task ProcessAsync(LogEvent logEvent, EventContext context) { var queryDataRecorded = new QueryDataRecorded(); queryDataRecorded.MergeFrom(logEvent); diff --git a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs index 608dc0bc..a966203d 100644 --- a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs @@ -38,7 +38,7 @@ public ReportConfirmedLogEventProcessor(ILogger "Oracle"; - public override async Task ProcessAsync(LogEvent logEvent) + public override async Task ProcessAsync(LogEvent logEvent, EventContext context) { var collected = new SufficientCommitmentsCollected(); collected.MergeFrom(logEvent); diff --git a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs index d14cd6e4..f3d4f840 100644 --- a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs +++ b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs @@ -2,9 +2,11 @@ using AElf.Client.Core; using AElf.Client.Core.Options; using AElf.Nethereum.Bridge; +using AElf.Nethereum.Core; using Microsoft.Extensions.Caching.StackExchangeRedis; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +using Nethereum.BlockchainProcessing.BlockStorage.Entities.Mapping; using StackExchange.Redis; using Volo.Abp.Caching; using Volo.Abp.Caching.StackExchangeRedis; @@ -15,6 +17,8 @@ namespace AElf.EventHandler; public interface ITransmitTransactionProvider { + Task SendByLibAsync(string libHash, long libHeight); + Task UpdateStatusAsync(); } public class TransmitTransactionProvider : AbpRedisCache, ITransmitTransactionProvider, ISingletonDependency @@ -23,21 +27,24 @@ public class TransmitTransactionProvider : AbpRedisCache, ITransmitTransactionPr private readonly IAElfClientService _aelfClientService; private readonly AElfClientConfigOptions _aelfClientConfigOptions; private readonly IBridgeInService _bridgeInService; + private readonly INethereumService _nethereumService; public ILogger Logger { get; set; } private const string TransmitSendingQueue = "TransmitSendingQueue"; private const string TransmitCheckingQueue = "TransmitCheckingQueue"; - private const string TransmitArchivingQueue = "TransmitCheckingQueue"; + private const string TransmitFailedQueue = "TransmitFailedQueue"; public TransmitTransactionProvider(IOptions optionsAccessor, IOptions aelfClientConfigOptions, - IDistributedCacheSerializer serializer, IAElfClientService aelfClientService, IBridgeInService bridgeInService) + IDistributedCacheSerializer serializer, IAElfClientService aelfClientService, IBridgeInService bridgeInService, + INethereumService nethereumService) : base(optionsAccessor) { _serializer = serializer; _aelfClientService = aelfClientService; _bridgeInService = bridgeInService; + _nethereumService = nethereumService; _aelfClientConfigOptions = aelfClientConfigOptions.Value; } @@ -59,16 +66,25 @@ public async Task SendByLibAsync(string libHash, long libHeight) var block = await _aelfClientService.GetBlockByHeightAsync(_aelfClientConfigOptions.ClientAlias, item.BlockHeight); if (block.BlockHash == item.BlockHash) { - var sendResult = await _bridgeInService.TransmitAsync(item.TargetChainId, item.TargetContractAddress, - item.Report, item.Rs, item.Ss, item.RawVs); - if (string.IsNullOrWhiteSpace(sendResult)) + if (item.RetryTimes > 3) { - Logger.LogError("Failed to transmit."); - break; + Logger.LogError($"Transmit transaction failed after retry {item.RetryTimes-1} times. Chain: {item.TargetChainId}, TxId: {item.TransactionId}"); + await EnqueueAsync(TransmitFailedQueue, item); + } + else + { + var sendResult = await _bridgeInService.TransmitAsync(item.TargetChainId, + item.TargetContractAddress, + item.Report, item.Rs, item.Ss, item.RawVs); + if (string.IsNullOrWhiteSpace(sendResult)) + { + Logger.LogError("Failed to transmit."); + break; + } + + item.TransactionId = sendResult; + await EnqueueAsync(TransmitCheckingQueue, item); } - - item.TransactionId = sendResult; - await EnqueueAsync(TransmitCheckingQueue, item); } await DequeueAsync(TransmitSendingQueue); @@ -76,6 +92,39 @@ public async Task SendByLibAsync(string libHash, long libHeight) } } + public async Task UpdateStatusAsync() + { + var item = await GetFirstItemAsync(TransmitCheckingQueue); + while (item != null) + { + var receipt = await _nethereumService.GetTransactionReceiptAsync(item.TargetChainId, item.TransactionId); + + if (receipt.Status.Value != 1) + { + Logger.LogError($"Transmit transaction failed. Chain: {item.TargetChainId}, TxId: {item.TransactionId}"); + item.RetryTimes += 1; + await EnqueueAsync(TransmitSendingQueue, item); + } + + var currentHeight = await _nethereumService.GetBlockNumberAsync(item.TargetChainId); + if (receipt.BlockNumber.ToLong() >= currentHeight - 12) + { + break; + } + + var block = await _nethereumService.GetBlockByNumberAsync(item.TargetChainId, receipt.BlockNumber); + if (block.BlockHash != receipt.BlockHash) + { + Logger.LogError($"Transmit transaction forked. Chain: {item.TargetChainId}, TxId: {item.TransactionId}"); + item.RetryTimes += 1; + await EnqueueAsync(TransmitSendingQueue, item); + } + + await DequeueAsync(TransmitCheckingQueue); + item = await GetFirstItemAsync(TransmitCheckingQueue); + } + } + private async Task EnqueueAsync(string queueName, SendTransmitArgs item) { await ConnectAsync(); @@ -102,6 +151,7 @@ private async Task GetFirstItemAsync(string queueName) public class SendTransmitArgs { + public string ChainId { get; set; } public string BlockHash { get; set; } public long BlockHeight { get; set; } public string TargetChainId { get; set; } diff --git a/src/AElf.EventHandler/TransactionResultListEventHandler.cs b/src/AElf.EventHandler/TransactionResultListEventHandler.cs index 8690b50d..bc9c8599 100644 --- a/src/AElf.EventHandler/TransactionResultListEventHandler.cs +++ b/src/AElf.EventHandler/TransactionResultListEventHandler.cs @@ -47,6 +47,9 @@ await logEventProcessor.ProcessAsync(new LogEvent { Indexed = { eventLog.Indexed.Select(ByteString.FromBase64) }, NonIndexed = ByteString.FromBase64(eventLog.NonIndexed) + }, new EventContext + { + ChainId = eventData.ChainId }); } } diff --git a/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs new file mode 100644 index 00000000..10ed41e2 --- /dev/null +++ b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs @@ -0,0 +1,20 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.BackgroundWorkers; +using Volo.Abp.Threading; + +namespace AElf.EventHandler.Workers; + +public class ReceiptSyncWorker : AsyncPeriodicBackgroundWorkerBase +{ + public ReceiptSyncWorker(AbpAsyncTimer timer, IServiceScopeFactory serviceScopeFactory + ) : base(timer, + serviceScopeFactory) + { + Timer.Period = 1000 * 60; + } + + protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) + { + } +} \ No newline at end of file diff --git a/src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs b/src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs new file mode 100644 index 00000000..d4639f30 --- /dev/null +++ b/src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs @@ -0,0 +1,24 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.BackgroundWorkers; +using Volo.Abp.Threading; + +namespace AElf.EventHandler.Workers; + +public class TransmitTransactionWorker : AsyncPeriodicBackgroundWorkerBase +{ + private readonly ITransmitTransactionProvider _transmitTransactionProvider; + + public TransmitTransactionWorker(AbpAsyncTimer timer, IServiceScopeFactory serviceScopeFactory, + ITransmitTransactionProvider transmitTransactionProvider) : base(timer, + serviceScopeFactory) + { + _transmitTransactionProvider = transmitTransactionProvider; + Timer.Period = 1000 * 60; + } + + protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) + { + await _transmitTransactionProvider.UpdateStatusAsync(); + } +} \ No newline at end of file diff --git a/src/AElf.EventHandler/appsettings.json b/src/AElf.EventHandler/appsettings.json index 152e9d23..58d7ab29 100644 --- a/src/AElf.EventHandler/appsettings.json +++ b/src/AElf.EventHandler/appsettings.json @@ -61,6 +61,11 @@ "SideChainClientAlias": "TestNetSideChain2", "AccountAlias": "eanz" }, + "AElfChainAlias": { + "Mapping": { + "9992731": "Test1" + } + }, "EthereumClient": { "ClientConfigList": [ { From 825138a7093ee29160e01de50c48b86d7ff5261c Mon Sep 17 00:00:00 2001 From: zhxymh Date: Fri, 19 Aug 2022 11:14:46 +0800 Subject: [PATCH 10/66] feat: add client alias for contract service --- modules/AElf.Client.Bridge/BridgeService.cs | 11 ++---- .../MerkleTreeContract.cs | 25 ++++++------- modules/AElf.Client.Oracle/OracleService.cs | 36 +++++++++---------- modules/AElf.Client.Report/ReportService.cs | 12 +++---- 4 files changed, 36 insertions(+), 48 deletions(-) diff --git a/modules/AElf.Client.Bridge/BridgeService.cs b/modules/AElf.Client.Bridge/BridgeService.cs index a8a1d46a..9954a319 100644 --- a/modules/AElf.Client.Bridge/BridgeService.cs +++ b/modules/AElf.Client.Bridge/BridgeService.cs @@ -9,33 +9,28 @@ namespace AElf.Client.Bridge; public interface IBridgeService { - Task GetSpaceIdBySwapIdAsync(Hash swapId); + Task GetSpaceIdBySwapIdAsync(string clientAlias, Hash swapId); } public class BridgeService : ContractServiceBase, IBridgeService, ITransientDependency { private readonly IAElfClientService _clientService; - private readonly AElfClientConfigOptions _clientConfigOptions; private readonly AElfContractOptions _contractOptions; private const string ContractName = "BridgeContractAddress"; public BridgeService(IAElfClientService clientService, - IOptionsSnapshot clientConfigOptions, IOptionsSnapshot contractOptions) : base(clientService, Address.FromBase58(contractOptions.Value.ContractAddressList[ContractName])) { _clientService = clientService; - _clientConfigOptions = clientConfigOptions.Value; _contractOptions = contractOptions.Value; } - public async Task GetSpaceIdBySwapIdAsync(Hash swapId) + public async Task GetSpaceIdBySwapIdAsync(string clientAlias, Hash swapId) { - var useClientAlias = _clientConfigOptions.ClientAlias; - var result = await _clientService.ViewAsync(_contractOptions.ContractAddressList["ContractName"], "GetSpaceIdBySwapId", - swapId, useClientAlias); + swapId, clientAlias); return Hash.LoadFromByteArray(result); } diff --git a/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs b/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs index 2166a9cd..9720b737 100644 --- a/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs +++ b/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs @@ -11,43 +11,40 @@ namespace AElf.Client.MerkleTreeContract; public interface IMerkleTreeContractService { - Task CreateSpaceAsync(CreateSpaceInput createSpaceInput); + Task CreateSpaceAsync(string clientAlias, CreateSpaceInput createSpaceInput); - Task GetLastLeafIndexAsync(GetLastLeafIndexInput getLastLeafIndexInput); + Task GetLastLeafIndexAsync(string clientAlias, GetLastLeafIndexInput getLastLeafIndexInput); } public class MerkleTreeContractService : ContractServiceBase, IMerkleTreeContractService, ITransientDependency { private readonly IAElfClientService _clientService; - private readonly AElfClientConfigOptions _clientConfigOptions; private readonly AElfContractOptions _contractOptions; + + private const string ContractName = "MerkleTreeContractAddress"; public MerkleTreeContractService(IAElfClientService clientService, - IOptionsSnapshot clientConfigOptions, IOptionsSnapshot contractOptions) : base(clientService, - Address.FromBase58(contractOptions.Value.ContractAddressList[""])) + Address.FromBase58(contractOptions.Value.ContractAddressList[ContractName])) { _clientService = clientService; - _clientConfigOptions = clientConfigOptions.Value; _contractOptions = contractOptions.Value; } - public async Task CreateSpaceAsync(CreateSpaceInput createSpaceInput) + public async Task CreateSpaceAsync(string clientAlias, CreateSpaceInput createSpaceInput) { - var useClientAlias = _clientConfigOptions.ClientAlias; - var tx = await PerformSendTransactionAsync("CreateSpace", createSpaceInput, useClientAlias); + var tx = await PerformSendTransactionAsync("CreateSpace", createSpaceInput, clientAlias); return new SendTransactionResult { Transaction = tx, - TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), useClientAlias) + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) }; } - public async Task GetLastLeafIndexAsync(GetLastLeafIndexInput getLastLeafIndexInput) + public async Task GetLastLeafIndexAsync(string clientAlias, GetLastLeafIndexInput getLastLeafIndexInput) { - var useClientAlias = _clientConfigOptions.ClientAlias; - var result = await _clientService.ViewAsync(_contractOptions.ContractAddressList[""], "GetLastLeafIndex", - getLastLeafIndexInput, useClientAlias); + var result = await _clientService.ViewAsync(_contractOptions.ContractAddressList[ContractName], "GetLastLeafIndex", + getLastLeafIndexInput, clientAlias); var actualResult = new Int64Value(); actualResult.MergeFrom(result); return actualResult; diff --git a/modules/AElf.Client.Oracle/OracleService.cs b/modules/AElf.Client.Oracle/OracleService.cs index 08b400ba..23698c44 100644 --- a/modules/AElf.Client.Oracle/OracleService.cs +++ b/modules/AElf.Client.Oracle/OracleService.cs @@ -9,13 +9,13 @@ namespace AElf.Client.Oracle; public interface IOracleService { - Task QueryAsync(QueryInput queryInput); + Task QueryAsync(string clientAlias, QueryInput queryInput); - Task CommitAsync(CommitInput commitInput); + Task CommitAsync(string clientAlias, CommitInput commitInput); - Task RevealAsync(RevealInput revealInput); + Task RevealAsync(string clientAlias, RevealInput revealInput); - Task CancelQueryAsync(Hash cancelQueryInput); + Task CancelQueryAsync(string clientAlias, Hash cancelQueryInput); } public class OracleService : ContractServiceBase, IOracleService, ITransientDependency @@ -32,47 +32,43 @@ public OracleService(IAElfClientService clientService, _clientConfigOptions = clientConfigOptions.Value; } - public async Task QueryAsync(QueryInput queryInput) + public async Task QueryAsync(string clientAlias, QueryInput queryInput) { - var useClientAlias = _clientConfigOptions.ClientAlias; - var tx = await PerformSendTransactionAsync("Query", queryInput, useClientAlias); + var tx = await PerformSendTransactionAsync("Query", queryInput, clientAlias); return new SendTransactionResult { Transaction = tx, - TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), useClientAlias) + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) }; } - public async Task CommitAsync(CommitInput commitInput) + public async Task CommitAsync(string clientAlias, CommitInput commitInput) { - var useClientAlias = _clientConfigOptions.ClientAlias; - var tx = await PerformSendTransactionAsync("Commit", commitInput, useClientAlias); + var tx = await PerformSendTransactionAsync("Commit", commitInput, clientAlias); return new SendTransactionResult { Transaction = tx, - TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), useClientAlias) + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) }; } - public async Task RevealAsync(RevealInput revealInput) + public async Task RevealAsync(string clientAlias, RevealInput revealInput) { - var useClientAlias = _clientConfigOptions.ClientAlias; - var tx = await PerformSendTransactionAsync("Reveal", revealInput, useClientAlias); + var tx = await PerformSendTransactionAsync("Reveal", revealInput, clientAlias); return new SendTransactionResult { Transaction = tx, - TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), useClientAlias) + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) }; } - public async Task CancelQueryAsync(Hash cancelQueryInput) + public async Task CancelQueryAsync(string clientAlias, Hash cancelQueryInput) { - var useClientAlias = _clientConfigOptions.ClientAlias; - var tx = await PerformSendTransactionAsync("CancelQuery", cancelQueryInput, useClientAlias); + var tx = await PerformSendTransactionAsync("CancelQuery", cancelQueryInput, clientAlias); return new SendTransactionResult { Transaction = tx, - TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), useClientAlias) + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) }; } } \ No newline at end of file diff --git a/modules/AElf.Client.Report/ReportService.cs b/modules/AElf.Client.Report/ReportService.cs index c407eaab..c4a8074d 100644 --- a/modules/AElf.Client.Report/ReportService.cs +++ b/modules/AElf.Client.Report/ReportService.cs @@ -9,11 +9,11 @@ namespace AElf.Client.Report; public interface IReportService { - Task ProposeReportAsync(CallbackInput proposeReportInput); + Task ProposeReportAsync(string clientAlias, CallbackInput proposeReportInput); - Task ConfirmReportAsync(ConfirmReportInput confirmReportInput); + Task ConfirmReportAsync(string clientAlias, ConfirmReportInput confirmReportInput); - Task RejectReportAsync(RejectReportInput rejectReportInput); + Task RejectReportAsync(string clientAlias, RejectReportInput rejectReportInput); } public class ReportService : ContractServiceBase, IReportService, ITransientDependency @@ -30,7 +30,7 @@ public ReportService(IAElfClientService clientService, _clientConfigOptions = clientConfigOptions.Value; } - public async Task ProposeReportAsync(CallbackInput proposeReportInput) + public async Task ProposeReportAsync(string clientAlias, CallbackInput proposeReportInput) { var useClientAlias = _clientConfigOptions.ClientAlias; var tx = await PerformSendTransactionAsync("ProposeReport", proposeReportInput, useClientAlias); @@ -41,7 +41,7 @@ public async Task ProposeReportAsync(CallbackInput propos }; } - public async Task ConfirmReportAsync(ConfirmReportInput confirmReportInput) + public async Task ConfirmReportAsync(string clientAlias, ConfirmReportInput confirmReportInput) { var useClientAlias = _clientConfigOptions.ClientAlias; var tx = await PerformSendTransactionAsync("ConfirmReport", confirmReportInput, useClientAlias); @@ -52,7 +52,7 @@ public async Task ConfirmReportAsync(ConfirmReportInput c }; } - public async Task RejectReportAsync(RejectReportInput rejectReportInput) + public async Task RejectReportAsync(string clientAlias, RejectReportInput rejectReportInput) { var useClientAlias = _clientConfigOptions.ClientAlias; var tx = await PerformSendTransactionAsync("RejectReport", rejectReportInput, useClientAlias); From 8e051e16183870dbbdcb4fa475c21edd2d282f72 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Fri, 19 Aug 2022 11:34:04 +0800 Subject: [PATCH 11/66] feat: add chainId for queue --- .../Processors/LogEventProcessorBase.cs | 5 +++++ .../Providers/ITransmitTransactionProvider.cs | 9 +++++---- .../TransactionResultListEventHandler.cs | 6 +++++- .../Workers/TransmitTransactionWorker.cs | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs b/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs index 918591e2..0162e94c 100644 --- a/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs +++ b/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs @@ -1,3 +1,4 @@ +using System; using System.Threading.Tasks; using AElf.Client.Core.Options; using AElf.CSharp.Core; @@ -42,5 +43,9 @@ public bool IsMatch(string contractAddress, string logEventName) public class EventContext { public int ChainId { get; set; } + public long BlockNumber { get; set; } + public string BlockHash { get; set; } + public DateTime BlockTime { get; set; } + public string TransactionId { get; set; } } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs index f3d4f840..6a48399d 100644 --- a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs +++ b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs @@ -17,8 +17,9 @@ namespace AElf.EventHandler; public interface ITransmitTransactionProvider { - Task SendByLibAsync(string libHash, long libHeight); - Task UpdateStatusAsync(); + Task EnqueueAsync(SendTransmitArgs args); + Task SendByLibAsync(string chainId, string libHash, long libHeight); + Task UpdateQueueAsync(); } public class TransmitTransactionProvider : AbpRedisCache, ITransmitTransactionProvider, ISingletonDependency @@ -53,7 +54,7 @@ public async Task EnqueueAsync(SendTransmitArgs args) await EnqueueAsync(TransmitSendingQueue, args); } - public async Task SendByLibAsync(string libHash, long libHeight) + public async Task SendByLibAsync(string chainId, string libHash, long libHeight) { var item = await GetFirstItemAsync(TransmitSendingQueue); while (item != null) @@ -92,7 +93,7 @@ public async Task SendByLibAsync(string libHash, long libHeight) } } - public async Task UpdateStatusAsync() + public async Task UpdateQueueAsync() { var item = await GetFirstItemAsync(TransmitCheckingQueue); while (item != null) diff --git a/src/AElf.EventHandler/TransactionResultListEventHandler.cs b/src/AElf.EventHandler/TransactionResultListEventHandler.cs index bc9c8599..61baa8d1 100644 --- a/src/AElf.EventHandler/TransactionResultListEventHandler.cs +++ b/src/AElf.EventHandler/TransactionResultListEventHandler.cs @@ -49,7 +49,11 @@ await logEventProcessor.ProcessAsync(new LogEvent NonIndexed = ByteString.FromBase64(eventLog.NonIndexed) }, new EventContext { - ChainId = eventData.ChainId + ChainId = eventData.ChainId, + BlockNumber = txResultEto.BlockNumber, + BlockHash = txResultEto.BlockHash, + BlockTime = txResultEto.BlockTime, + TransactionId = txResultEto.TransactionId }); } } diff --git a/src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs b/src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs index d4639f30..aac18620 100644 --- a/src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs +++ b/src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs @@ -19,6 +19,6 @@ public TransmitTransactionWorker(AbpAsyncTimer timer, IServiceScopeFactory servi protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) { - await _transmitTransactionProvider.UpdateStatusAsync(); + await _transmitTransactionProvider.UpdateQueueAsync(); } } \ No newline at end of file From 72c4d835e1e502da43dc751f55222051bb9601b4 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Fri, 19 Aug 2022 11:54:14 +0800 Subject: [PATCH 12/66] feat: add target chain id for birdge contract --- .../IBridgeOutService.cs | 7 +++-- .../Providers/ITransmitTransactionProvider.cs | 31 +++++++++++-------- .../Workers/TransmitTransactionWorker.cs | 11 +++++-- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs index c1d422c5..7f0d5993 100644 --- a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs +++ b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs @@ -6,7 +6,7 @@ namespace AElf.Nethereum.Bridge; public interface IBridgeOutService { - Task GetSendReceiptInfosAsync(string clientAlias, string contractAddress, string token, long fromIndex); + Task GetSendReceiptInfosAsync(string clientAlias, string contractAddress, string token, string targetChainId, long fromIndex); Task GetTransferReceiptIndexAsync(string clientAlias, string contractAddress, List tokens, List targetChainIds); @@ -17,11 +17,12 @@ public class BridgeOutService : ContractServiceBase, IBridgeOutService, ITransie protected override string SmartContractName { get; } = "BridgeOut"; public async Task GetSendReceiptInfosAsync(string clientAlias, string contractAddress, - string token, long fromIndex) + string token, string targetChainId, long fromIndex) { var function = GetFunction(clientAlias, contractAddress, "getSendReceiptInfos"); - var evmGetReceiptInfos = await function.CallDeserializingToObjectAsync(token, fromIndex); + var evmGetReceiptInfos = + await function.CallDeserializingToObjectAsync(token, targetChainId, fromIndex); return evmGetReceiptInfos; } diff --git a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs index 6a48399d..22c02789 100644 --- a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs +++ b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs @@ -19,7 +19,7 @@ public interface ITransmitTransactionProvider { Task EnqueueAsync(SendTransmitArgs args); Task SendByLibAsync(string chainId, string libHash, long libHeight); - Task UpdateQueueAsync(); + Task UpdateQueueAsync(string chainId); } public class TransmitTransactionProvider : AbpRedisCache, ITransmitTransactionProvider, ISingletonDependency @@ -51,12 +51,12 @@ public TransmitTransactionProvider(IOptions optionsAccessor, public async Task EnqueueAsync(SendTransmitArgs args) { - await EnqueueAsync(TransmitSendingQueue, args); + await EnqueueAsync(GetQueueName(TransmitSendingQueue,args.ChainId), args); } public async Task SendByLibAsync(string chainId, string libHash, long libHeight) { - var item = await GetFirstItemAsync(TransmitSendingQueue); + var item = await GetFirstItemAsync(GetQueueName(TransmitSendingQueue, chainId)); while (item != null) { if (item.BlockHeight > libHeight) @@ -70,7 +70,7 @@ public async Task SendByLibAsync(string chainId, string libHash, long libHeight) if (item.RetryTimes > 3) { Logger.LogError($"Transmit transaction failed after retry {item.RetryTimes-1} times. Chain: {item.TargetChainId}, TxId: {item.TransactionId}"); - await EnqueueAsync(TransmitFailedQueue, item); + await EnqueueAsync(GetQueueName(TransmitFailedQueue, item.ChainId), item); } else { @@ -84,18 +84,18 @@ public async Task SendByLibAsync(string chainId, string libHash, long libHeight) } item.TransactionId = sendResult; - await EnqueueAsync(TransmitCheckingQueue, item); + await EnqueueAsync(GetQueueName(TransmitCheckingQueue,item.ChainId), item); } } - await DequeueAsync(TransmitSendingQueue); - item = await GetFirstItemAsync(TransmitSendingQueue); + await DequeueAsync(GetQueueName(TransmitSendingQueue, chainId)); + item = await GetFirstItemAsync(GetQueueName(TransmitSendingQueue, chainId)); } } - public async Task UpdateQueueAsync() + public async Task UpdateQueueAsync(string chainId) { - var item = await GetFirstItemAsync(TransmitCheckingQueue); + var item = await GetFirstItemAsync(GetQueueName(TransmitCheckingQueue,chainId)); while (item != null) { var receipt = await _nethereumService.GetTransactionReceiptAsync(item.TargetChainId, item.TransactionId); @@ -104,7 +104,7 @@ public async Task UpdateQueueAsync() { Logger.LogError($"Transmit transaction failed. Chain: {item.TargetChainId}, TxId: {item.TransactionId}"); item.RetryTimes += 1; - await EnqueueAsync(TransmitSendingQueue, item); + await EnqueueAsync(GetQueueName(TransmitSendingQueue, item.ChainId), item); } var currentHeight = await _nethereumService.GetBlockNumberAsync(item.TargetChainId); @@ -118,14 +118,19 @@ public async Task UpdateQueueAsync() { Logger.LogError($"Transmit transaction forked. Chain: {item.TargetChainId}, TxId: {item.TransactionId}"); item.RetryTimes += 1; - await EnqueueAsync(TransmitSendingQueue, item); + await EnqueueAsync(GetQueueName(TransmitSendingQueue, item.ChainId), item); } - await DequeueAsync(TransmitCheckingQueue); - item = await GetFirstItemAsync(TransmitCheckingQueue); + await DequeueAsync(GetQueueName(TransmitCheckingQueue,chainId)); + item = await GetFirstItemAsync(GetQueueName(TransmitCheckingQueue,chainId)); } } + private string GetQueueName(string queue, string chainId) + { + return $"{queue}-{chainId}"; + } + private async Task EnqueueAsync(string queueName, SendTransmitArgs item) { await ConnectAsync(); diff --git a/src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs b/src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs index aac18620..542ee9a1 100644 --- a/src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs +++ b/src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs @@ -1,5 +1,6 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; using Volo.Abp.BackgroundWorkers; using Volo.Abp.Threading; @@ -8,17 +9,23 @@ namespace AElf.EventHandler.Workers; public class TransmitTransactionWorker : AsyncPeriodicBackgroundWorkerBase { private readonly ITransmitTransactionProvider _transmitTransactionProvider; + private readonly AElfChainAliasOptions _chainAliasOptions; public TransmitTransactionWorker(AbpAsyncTimer timer, IServiceScopeFactory serviceScopeFactory, - ITransmitTransactionProvider transmitTransactionProvider) : base(timer, + ITransmitTransactionProvider transmitTransactionProvider, + IOptionsSnapshot chainAliasOptions) : base(timer, serviceScopeFactory) { _transmitTransactionProvider = transmitTransactionProvider; + _chainAliasOptions = chainAliasOptions.Value; Timer.Period = 1000 * 60; } protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) { - await _transmitTransactionProvider.UpdateQueueAsync(); + foreach (var item in _chainAliasOptions.Mapping) + { + await _transmitTransactionProvider.UpdateQueueAsync(item.Value); + } } } \ No newline at end of file From 4a21110db0750f031aeb34b0910d913f64e42baa Mon Sep 17 00:00:00 2001 From: zhxymh Date: Fri, 19 Aug 2022 15:49:51 +0800 Subject: [PATCH 13/66] feat: add chain id for provider --- .../GetSendReceiptIndexDTO.cs | 3 --- .../EventHandlerAppModule.cs | 3 +-- .../Options/BlockConfirmationOptions.cs | 8 ++++++ .../Providers/ISaltProvider.cs | 13 +++++----- .../ISignatureRecoverableInfoProvider.cs | 25 ++++++++++--------- .../Providers/ITransmitTransactionProvider.cs | 6 +++-- src/AElf.EventHandler/appsettings.json | 6 +++++ 7 files changed, 39 insertions(+), 25 deletions(-) create mode 100644 src/AElf.EventHandler/Options/BlockConfirmationOptions.cs diff --git a/modules/AElf.Nethereum.Bridge/GetSendReceiptIndexDTO.cs b/modules/AElf.Nethereum.Bridge/GetSendReceiptIndexDTO.cs index 2cfa7988..cdde5fea 100644 --- a/modules/AElf.Nethereum.Bridge/GetSendReceiptIndexDTO.cs +++ b/modules/AElf.Nethereum.Bridge/GetSendReceiptIndexDTO.cs @@ -7,7 +7,4 @@ namespace AElf.Nethereum.Bridge; public class GetSendReceiptIndexDTO : IFunctionOutputDTO { [Parameter("tuple[]", "indexs", 1)] public List Indexes { get; set; } - - [Parameter("tuple[]", "blocktimes", 2)] - public List BlockTimes { get; set; } } \ No newline at end of file diff --git a/src/AElf.EventHandler/EventHandlerAppModule.cs b/src/AElf.EventHandler/EventHandlerAppModule.cs index dbff0b10..385488d0 100644 --- a/src/AElf.EventHandler/EventHandlerAppModule.cs +++ b/src/AElf.EventHandler/EventHandlerAppModule.cs @@ -72,11 +72,10 @@ public override void ConfigureServices(ServiceConfigurationContext context) options.Connections.Default.Uri = new Uri(messageQueueConfig.GetSection("Uri").Value); }); - // Configure(configuration.GetSection("Config")); - // Configure(configuration.GetSection("Ethereum")); Configure(configuration.GetSection("Oracle")); Configure(configuration.GetSection("Bridge")); Configure(configuration.GetSection("AElfChainAlias")); + Configure(configuration.GetSection("BlockConfirmation")); context.Services.AddHostedService(); context.Services.AddTransient(typeof(ILogEventProcessor<>), typeof(LogEventProcessorBase<>)); context.Services.AddSingleton(); diff --git a/src/AElf.EventHandler/Options/BlockConfirmationOptions.cs b/src/AElf.EventHandler/Options/BlockConfirmationOptions.cs new file mode 100644 index 00000000..3395f1f1 --- /dev/null +++ b/src/AElf.EventHandler/Options/BlockConfirmationOptions.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic; + +namespace AElf.EventHandler; + +public class BlockConfirmationOptions +{ + public Dictionary ConfirmationCount { get; set; } = new(); +} \ No newline at end of file diff --git a/src/AElf.EventHandler/Providers/ISaltProvider.cs b/src/AElf.EventHandler/Providers/ISaltProvider.cs index e1846e9c..867de8d1 100644 --- a/src/AElf.EventHandler/Providers/ISaltProvider.cs +++ b/src/AElf.EventHandler/Providers/ISaltProvider.cs @@ -9,31 +9,32 @@ namespace AElf.EventHandler { public interface ISaltProvider { - Hash GetSalt(Hash queryId); + Hash GetSalt(string chainId, Hash queryId); } public class SaltProvider : ISaltProvider, ISingletonDependency { - private readonly Dictionary _dictionary; + private readonly Dictionary _dictionary; private readonly ILogger _logger; public SaltProvider(ILogger logger) { _logger = logger; - _dictionary = new Dictionary(); + _dictionary = new Dictionary(); } - public Hash GetSalt(Hash queryId) + public Hash GetSalt(string chainId, Hash queryId) { // Look up dictionary. - if (_dictionary.TryGetValue(queryId, out var salt)) + var key = chainId + queryId.ToHex(); + if (_dictionary.TryGetValue(key, out var salt)) { return salt; } var randomStr = DateTime.UtcNow.Millisecond.ToString(CultureInfo.InvariantCulture) + Guid.NewGuid(); salt = HashHelper.ConcatAndCompute(queryId, HashHelper.ComputeFrom(randomStr)); - _dictionary[queryId] = salt; + _dictionary[key] = salt; _logger.LogInformation($"New salt for queryId {queryId}: {salt}. Using random string: {randomStr}"); return salt; } diff --git a/src/AElf.EventHandler/Providers/ISignatureRecoverableInfoProvider.cs b/src/AElf.EventHandler/Providers/ISignatureRecoverableInfoProvider.cs index 2fc59ad3..dd788c8c 100644 --- a/src/AElf.EventHandler/Providers/ISignatureRecoverableInfoProvider.cs +++ b/src/AElf.EventHandler/Providers/ISignatureRecoverableInfoProvider.cs @@ -13,16 +13,16 @@ namespace AElf.EventHandler; public interface ISignatureRecoverableInfoProvider { - Task SetSignatureAsync(string ethereumContractAddress, long roundId, string recoverableInfo); - Task> GetSignatureAsync(string ethereumContractAddress, long roundId); - Task RemoveSignatureAsync(string ethereumContractAddress, long roundId); + Task SetSignatureAsync(string chainId, string ethereumContractAddress, long roundId, string recoverableInfo); + Task> GetSignatureAsync(string chainId, string ethereumContractAddress, long roundId); + Task RemoveSignatureAsync(string chainId, string ethereumContractAddress, long roundId); } public class SignatureRecoverableInfoProvider : AbpRedisCache, ISignatureRecoverableInfoProvider, ISingletonDependency { private ILogger _logger; private readonly IDistributedCacheSerializer _serializer; - + private const string KeyPrefix = "ReportSignature"; public SignatureRecoverableInfoProvider(ILogger logger, @@ -32,9 +32,10 @@ public SignatureRecoverableInfoProvider(ILogger> GetSignatureAsync(string ethereumContractAddress, long roundId) + public async Task> GetSignatureAsync(string chainId, string ethereumContractAddress, long roundId) { - var key = GetStoreKey(ethereumContractAddress, roundId); + var key = GetStoreKey(chainId, ethereumContractAddress, roundId); var signatureBytes = await GetAsync(key); var signature = _serializer.Deserialize(signatureBytes); return signature.Signatures; } - public async Task RemoveSignatureAsync(string ethereumContractAddress, long roundId) + public async Task RemoveSignatureAsync(string chainId, string ethereumContractAddress, long roundId) { - var key = GetStoreKey(ethereumContractAddress, roundId); + var key = GetStoreKey(chainId, ethereumContractAddress, roundId); await RemoveAsync(key); } - private string GetStoreKey(string ethereumContractAddress, long roundId) + private string GetStoreKey(string chainId, string ethereumContractAddress, long roundId) { - return $"{KeyPrefix}-{ethereumContractAddress}-{roundId}"; + return $"{KeyPrefix}-{chainId}-{ethereumContractAddress}-{roundId}"; } } diff --git a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs index 22c02789..84f50409 100644 --- a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs +++ b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs @@ -29,6 +29,7 @@ public class TransmitTransactionProvider : AbpRedisCache, ITransmitTransactionPr private readonly AElfClientConfigOptions _aelfClientConfigOptions; private readonly IBridgeInService _bridgeInService; private readonly INethereumService _nethereumService; + private readonly BlockConfirmationOptions _blockConfirmationOptions; public ILogger Logger { get; set; } @@ -39,7 +40,7 @@ public class TransmitTransactionProvider : AbpRedisCache, ITransmitTransactionPr public TransmitTransactionProvider(IOptions optionsAccessor, IOptions aelfClientConfigOptions, IDistributedCacheSerializer serializer, IAElfClientService aelfClientService, IBridgeInService bridgeInService, - INethereumService nethereumService) + INethereumService nethereumService, IOptions blockConfirmationOptions) : base(optionsAccessor) { _serializer = serializer; @@ -47,6 +48,7 @@ public TransmitTransactionProvider(IOptions optionsAccessor, _bridgeInService = bridgeInService; _nethereumService = nethereumService; _aelfClientConfigOptions = aelfClientConfigOptions.Value; + _blockConfirmationOptions = blockConfirmationOptions.Value; } public async Task EnqueueAsync(SendTransmitArgs args) @@ -108,7 +110,7 @@ public async Task UpdateQueueAsync(string chainId) } var currentHeight = await _nethereumService.GetBlockNumberAsync(item.TargetChainId); - if (receipt.BlockNumber.ToLong() >= currentHeight - 12) + if (receipt.BlockNumber.ToLong() >= currentHeight - _blockConfirmationOptions.ConfirmationCount[item.TargetChainId]) { break; } diff --git a/src/AElf.EventHandler/appsettings.json b/src/AElf.EventHandler/appsettings.json index 58d7ab29..72f78060 100644 --- a/src/AElf.EventHandler/appsettings.json +++ b/src/AElf.EventHandler/appsettings.json @@ -145,5 +145,11 @@ "QueryToAddress": "" } ] + }, + "BlockConfirmation": { + "ConfirmationCount": { + "eth": 12, + "bsc": 100 + } } } \ No newline at end of file From 9cb8d65659fe7ee585378eeb156c70ad16b85e51 Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Fri, 19 Aug 2022 16:57:06 +0800 Subject: [PATCH 14/66] feat: update processor. --- .../IBridgeOutService.cs | 6 +- .../Options/BridgeOptions.cs | 2 +- ...IrreversibleBlockFoundLogEventProcessor.cs | 71 ++------ .../QueryCreatedLogEventProcessor.cs | 9 +- .../ReportConfirmedLogEventProcessor.cs | 75 ++++---- .../ReportProposedLogEventProcessor.cs | 11 +- ...ntCommitmentsCollectedLogEventProcessor.cs | 11 +- .../Providers/IDataProvider.cs | 7 +- .../Workers/ReceiptSyncWorker.cs | 161 +++++++++++++++++- 9 files changed, 234 insertions(+), 119 deletions(-) diff --git a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs index 7f0d5993..a22e057a 100644 --- a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs +++ b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs @@ -6,7 +6,7 @@ namespace AElf.Nethereum.Bridge; public interface IBridgeOutService { - Task GetSendReceiptInfosAsync(string clientAlias, string contractAddress, string token, string targetChainId, long fromIndex); + Task GetSendReceiptInfosAsync(string clientAlias, string contractAddress, string token, string targetChainId, long fromIndex,long endIndex); Task GetTransferReceiptIndexAsync(string clientAlias, string contractAddress, List tokens, List targetChainIds); @@ -17,12 +17,12 @@ public class BridgeOutService : ContractServiceBase, IBridgeOutService, ITransie protected override string SmartContractName { get; } = "BridgeOut"; public async Task GetSendReceiptInfosAsync(string clientAlias, string contractAddress, - string token, string targetChainId, long fromIndex) + string token, string targetChainId, long fromIndex,long endIndex) { var function = GetFunction(clientAlias, contractAddress, "getSendReceiptInfos"); var evmGetReceiptInfos = - await function.CallDeserializingToObjectAsync(token, targetChainId, fromIndex); + await function.CallDeserializingToObjectAsync(token, targetChainId, fromIndex,endIndex); return evmGetReceiptInfos; } diff --git a/src/AElf.EventHandler/Options/BridgeOptions.cs b/src/AElf.EventHandler/Options/BridgeOptions.cs index c799e6d3..b7b71d78 100644 --- a/src/AElf.EventHandler/Options/BridgeOptions.cs +++ b/src/AElf.EventHandler/Options/BridgeOptions.cs @@ -13,7 +13,7 @@ public class BridgeOptions public class BridgeItem { - public string FromChainId { get; set; } + //public string FromChainId { get; set; } public string EthereumClientAlias { get; set; } public string EthereumBridgeInContractAddress { get; set; } public string OriginToken { get; set; } diff --git a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs index 45e04bc7..1281d6ca 100644 --- a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs @@ -36,6 +36,7 @@ public class IrreversibleBlockFoundLogEventProcessor : LogEventProcessorBase _logger; private readonly string _lockAbi; + private readonly AElfChainAliasOptions _aelfChainAliasOptions; public IrreversibleBlockFoundLogEventProcessor( IOptionsSnapshot contractAddressOptions, @@ -48,7 +49,8 @@ public IrreversibleBlockFoundLogEventProcessor( BridgeService bridgeService, IMerkleTreeContractService merkleTreeContractService, INethereumService nethereumService, - ILogger logger) : base(contractAddressOptions) + ILogger logger, + IOptionsSnapshot aelfChainAliasOptions) : base(contractAddressOptions) { _ethereumContractOptions = ethereumContractOptions.Value; _latestQueriedReceiptCountProvider = latestQueriedReceiptCountProvider; @@ -61,6 +63,7 @@ public IrreversibleBlockFoundLogEventProcessor( _contractAddressOptions = contractAddressOptions.Value; _bridgeContractService = bridgeService; _nethereumService = nethereumService; + _aelfChainAliasOptions = aelfChainAliasOptions.Value; { var file = Path.Combine(_ethereumContractOptions.AbiFileDirectory, @@ -101,8 +104,6 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) var sendReceiptIndexDto = await _bridgeOutService.GetTransferReceiptIndexAsync(aliasAddress.Item1,aliasAddress.Item2,tokenList,targetChainIdList); for (var i = 0; i < tokenList.Count; i++) { - var ethereumBlockNumber = await _nethereumService.GetBlockNumberAsync(aliasAddress.Item1); - if (ethereumBlockNumber - sendReceiptIndexDto.BlockTimes[i] <= 12) continue; tokenIndex[tokenList[i]] = sendReceiptIndexDto.Indexes[i]; sendQueryList[item[i].SwapId] = item[i]; } @@ -110,21 +111,22 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) foreach (var (swapId,item) in sendQueryList) { - await SendQueryAsync(item,tokenIndex[item.OriginToken]); + await SendQueryAsync(context.ChainId.ToString(),item,tokenIndex[item.OriginToken]); } } - private async Task QueryEthereumReceiptIndex(IGrouping item) - { - } - private async Task SendQueryAsync(BridgeItem bridgeItem, BigInteger tokenIndex) + // private async Task QueryEthereumReceiptIndex(IGrouping item) + // { + // } + private async Task SendQueryAsync(string chainId,BridgeItem bridgeItem, BigInteger tokenIndex) { var swapId = bridgeItem.SwapId; - var spaceId = await _bridgeContractService.GetSpaceIdBySwapIdAsync(Hash.LoadFromBase64(swapId)); + var clientAlias = _aelfChainAliasOptions.Mapping[chainId]; + var spaceId = await _bridgeContractService.GetSpaceIdBySwapIdAsync(clientAlias,Hash.LoadFromBase64(swapId)); var lastRecordedLeafIndex = (await _merkleTreeContractService.GetLastLeafIndexAsync( - new GetLastLeafIndexInput + clientAlias,new GetLastLeafIndexInput { SpaceId = spaceId })).Value; @@ -170,58 +172,11 @@ private async Task SendQueryAsync(BridgeItem bridgeItem, BigInteger tokenIndex) _logger.LogInformation($"About to send Query transaction for token swapping, QueryInput: {queryInput}"); - var sendTxResult = await _oracleService.QueryAsync(queryInput); + var sendTxResult = await _oracleService.QueryAsync(clientAlias,queryInput); _logger.LogInformation($"Query tx id: {sendTxResult.Transaction.GetHash()}"); _latestQueriedReceiptCountProvider.Set(swapId, (int) tokenIndex + 1); _logger.LogInformation( $"Latest queried receipt count: {_latestQueriedReceiptCountProvider.Get(swapId)}"); } - - //Format Bridge Config => {ethereum contract address -> alias -> {token[],targetChainId[]}} - // var bridgeGroup = _bridgeOptions.Bridges.GroupBy(e => e.EthereumBridgeInContractAddress).ToList(); - // foreach (var bridge in bridgeGroup) - // { - // _logger.LogInformation($"Querying ethereum contract address : {bridge.Key}."); - // var bridgeGroupByAlias = bridge.GroupBy(e => e.EthereumClientAlias); - // foreach (var item in bridgeGroupByAlias) - // { - // var ethereumClientAlias = item.Key; - // var tokenList = item.Select(e => e.OriginToken).ToList(); - // var targetChainIdList = item.Select(e => e.TargetChainId).ToList(); - // var sendReceiptIndexDto = await _bridgeOutService.GetTransferReceiptIndexAsync(ethereumClientAlias,tokenList,targetChainIdList); - // - // var swapTokenMap = new Dictionary(); - // foreach (var bridgeItem in item) - // { - // swapTokenMap[bridgeItem.SwapId] = bridgeItem; - // } - // var tokenIndex = new Dictionary(); - // var blockNumber = new Dictionary(); - // for (var i = 0; i < tokenList.Count; i++) - // { - // tokenIndex[tokenList[i]] = sendReceiptIndexDto.Indexes[i]; - // blockNumber[tokenList[i]] = sendReceiptIndexDto.BlockTimes[i]; - // } - // - // for (var i = 0; i < tokenList.Count; i++) - // { - // var ethereumBlockNumber = await _nethereumService.GetBlockNumberAsync(ethereumClientAlias); - // if (ethereumBlockNumber - blockNumber[tokenList[i]] < 12) - // { - // tokenList.Remove(tokenList[i]); - // } - // } - // var swapTokenMapSend = swapTokenMap.Select(pair => tokenList.Contains(pair.Value.OriginToken) ? pair : default).ToList(); - // foreach (var (swapId, value) in swapTokenMapSend) - // { - // var index = tokenIndex[value.OriginToken]; - // - // - // - // - // } - // - // } - // } } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs index 0e0eb74b..e81cdc70 100644 --- a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs @@ -18,6 +18,7 @@ internal class QueryCreatedLogEventProcessor : LogEventProcessorBase "Oracle"; private readonly ILogger _logger; @@ -28,6 +29,7 @@ public QueryCreatedLogEventProcessor( ILogger logger, IOptionsSnapshot bridgeOptions, IOptionsSnapshot oracleOptions, + IOptionsSnapshot aelfClientConfigOptions, IOracleService oracleService) : base(contractAddressOptions) { @@ -37,6 +39,7 @@ public QueryCreatedLogEventProcessor( _bridgeOptions = bridgeOptions.Value; _oracleOptions = oracleOptions.Value; _oracleService = oracleService; + _aElfClientConfigOptions = aelfClientConfigOptions.Value; } public override async Task ProcessAsync(LogEvent logEvent, EventContext context) @@ -45,6 +48,7 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) queryCreated.MergeFrom(logEvent); _logger.LogInformation(queryCreated.ToString()); + var nodeAddress = Address.FromBase58(_bridgeOptions.AccountAddress); var firstDesignatedNodeAddress = queryCreated.DesignatedNodeList.Value.First(); //var queryToken = queryCreated.Token; // Query token means the ethereum contract address oracle node should cares in report case. @@ -62,7 +66,7 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) return; } - var salt = _saltProvider.GetSalt(queryCreated.QueryId); + var salt = _saltProvider.GetSalt(context.ChainId.ToString(),queryCreated.QueryId); _logger.LogInformation($"Queried data: {data}, salt: {salt}"); var commitInput = new CommitInput { @@ -71,8 +75,9 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) HashHelper.ComputeFrom(data), HashHelper.ConcatAndCompute(salt, HashHelper.ComputeFrom(_bridgeOptions.AccountAddress))) }; + var clientAlias = _aElfClientConfigOptions.Mapping[context.ChainId.ToString()]; _logger.LogInformation($"Sending Commit tx with input: {commitInput}"); - var transactionResult = await _oracleService.CommitAsync(commitInput); + var transactionResult = await _oracleService.CommitAsync(clientAlias,commitInput); _logger.LogInformation($"[Commit] Tx id {transactionResult.TransactionResult}"); } } diff --git a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs index a966203d..9f1ccebd 100644 --- a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs @@ -3,6 +3,7 @@ using System.IO; using System.Linq; using System.Threading.Tasks; +using AElf.Client.Core.Extensions; using AElf.Client.Core.Options; using AElf.Contracts.Report; using AElf.Nethereum.Core.Options; @@ -21,15 +22,18 @@ internal class ReportConfirmedLogEventProcessor : LogEventProcessorBase logger, IOptionsSnapshot contractAddressOptions, IReportProvider reportProvider, ISignatureRecoverableInfoProvider signaturesRecoverableInfoProvider, - IOptionsSnapshot ethereumContractOptions) : base(contractAddressOptions) + IOptionsSnapshot ethereumContractOptions, + ITransmitTransactionProvider transmitTransactionProvider) : base(contractAddressOptions) { _logger = logger; _signaturesRecoverableInfoProvider = signaturesRecoverableInfoProvider; + _transmitTransactionProvider = transmitTransactionProvider; _ethereumContractOptions = ethereumContractOptions.Value; _reportProvider = reportProvider; var file = Path.Combine(_ethereumContractOptions.AbiFileDirectory, @@ -40,46 +44,35 @@ public ReportConfirmedLogEventProcessor(ILogger "Report"; private readonly ILogger _logger; @@ -30,7 +31,8 @@ public ReportProposedLogEventProcessor( IAElfAccountProvider accountProvider, ILogger logger, IOptionsSnapshot bridgeOptions, - IOptionsSnapshot AElfConfigOptions) : base(contractAddressOptions) + IOptionsSnapshot aelfConfigOptions, + IOptionsSnapshot aelfChainAliasOptions) : base(contractAddressOptions) { _logger = logger; _contractAddressOptions = contractAddressOptions.Value; @@ -38,19 +40,20 @@ public ReportProposedLogEventProcessor( _reportService = reportService; _accountProvider = accountProvider; _bridgeOptions = bridgeOptions.Value; - _aelfClientConfigOptions = AElfConfigOptions.Value; + _aelfClientConfigOptions = aelfConfigOptions.Value; + _aelfChainAliasOptions = aelfChainAliasOptions.Value; } public override async Task ProcessAsync(LogEvent logEvent, EventContext context) { var reportProposed = new ReportProposed(); reportProposed.MergeFrom(logEvent); - + _logger.LogInformation($"New report: {reportProposed}"); var privateKey = _accountProvider.GetPrivateKey(_aelfClientConfigOptions.AccountAlias); - var sendTxResult = await _reportService.ConfirmReportAsync(new ConfirmReportInput + var sendTxResult = await _reportService.ConfirmReportAsync(_aelfChainAliasOptions.Mapping[context.ChainId.ToString()],new ConfirmReportInput { Token = reportProposed.Token, RoundId = reportProposed.RoundId, diff --git a/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs index 4f8ca707..01b3502a 100644 --- a/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs @@ -18,13 +18,15 @@ internal class SufficientCommitmentsCollectedLogEventProcessor : private readonly ILogger _logger; private readonly OracleOptions _oracleOptions; private readonly IOracleService _oracleService; + private readonly AElfChainAliasOptions _aelfChainAliasOptions; public SufficientCommitmentsCollectedLogEventProcessor( IOptionsSnapshot contractAddressOptions, ISaltProvider saltProvider, IDataProvider dataProvider, ILogger logger, IOptionsSnapshot oracleOptions, - IOracleService oracleService) : base(contractAddressOptions) + IOracleService oracleService, + IOptionsSnapshot aelfChainAliasOptions) : base(contractAddressOptions) { _saltProvider = saltProvider; _dataProvider = dataProvider; @@ -32,6 +34,7 @@ public SufficientCommitmentsCollectedLogEventProcessor( _contractAddressOptions = contractAddressOptions.Value; _oracleOptions = oracleOptions.Value; _oracleService = oracleService; + _aelfChainAliasOptions = aelfChainAliasOptions.Value; } public override string ContractName => "Oracle"; @@ -48,16 +51,14 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) } _logger.LogInformation($"Get data for revealing: {data}"); - // var node = new NodeManager(_configOptions.BlockChainEndpoint, _configOptions.AccountAddress, - // _configOptions.AccountPassword); var revealInput = new RevealInput { QueryId = collected.QueryId, Data = data, - Salt = _saltProvider.GetSalt(collected.QueryId) + Salt = _saltProvider.GetSalt(context.ChainId.ToString(),collected.QueryId) }; _logger.LogInformation($"Sending Reveal tx with input: {revealInput}"); - var transaction = await _oracleService.RevealAsync(revealInput); + var transaction = await _oracleService.RevealAsync(_aelfChainAliasOptions.Mapping[context.ChainId.ToString()],revealInput); _logger.LogInformation($"[Reveal] Transaction : {transaction}"); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Providers/IDataProvider.cs b/src/AElf.EventHandler/Providers/IDataProvider.cs index 73234342..05d05eba 100644 --- a/src/AElf.EventHandler/Providers/IDataProvider.cs +++ b/src/AElf.EventHandler/Providers/IDataProvider.cs @@ -84,10 +84,10 @@ public async Task GetDataAsync(Hash queryId, string title = null, List c.SwapId == swapId); + var bridgeItem = _bridgeOptions.Bridges.Single(c => c.SwapId == swapId); _logger.LogInformation("About to handle record receipt hashes for swapping tokens."); var recordReceiptHashInput = - await GetReceiptHashMap(Hash.LoadFromBase64(swapId), swapConfig, long.Parse(options[0]), + await GetReceiptHashMap(Hash.LoadFromBase64(swapId), bridgeItem, long.Parse(options[0]), long.Parse(options[1])); _logger.LogInformation($"RecordReceiptHashInput: {recordReceiptHashInput}"); _dictionary[queryId] = recordReceiptHashInput; @@ -135,7 +135,8 @@ await GetReceiptHashMap(Hash.LoadFromBase64(swapId), swapConfig, long.Parse(opti private async Task GetReceiptHashMap(Hash swapId, BridgeItem bridgeItem, long start, long end) { var token = _bridgeOptions.Bridges.Single(c => c.SwapId == swapId.ToHex()).OriginToken; - var receiptInfos = await _bridgeOutService.GetSendReceiptInfosAsync(bridgeItem.EthereumClientAlias,bridgeItem.EthereumBridgeOutContractAddress, token, start); + var chainId = _bridgeOptions.Bridges.Single(c => c.SwapId == swapId.ToHex()).TargetChainId; + var receiptInfos = await _bridgeOutService.GetSendReceiptInfosAsync(bridgeItem.EthereumClientAlias,bridgeItem.EthereumBridgeOutContractAddress, token, chainId,start,end); var receiptHashes = new List(); for (var i = 0; i <= end - start; i++) { diff --git a/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs index 10ed41e2..442087c4 100644 --- a/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs +++ b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs @@ -1,5 +1,21 @@ +using System.Collections.Generic; +using System.Linq; +using System.Numerics; using System.Threading.Tasks; +using AElf.Client.Bridge; +using AElf.Client.Core.Options; +using AElf.Client.Election; +using AElf.Client.MerkleTreeContract; +using AElf.Client.Oracle; +using AElf.Contracts.MerkleTreeContract; +using AElf.Contracts.Oracle; +using AElf.Nethereum.Bridge; +using AElf.Nethereum.Core; +using AElf.Types; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Nethereum.RPC.Eth.Blocks; using Volo.Abp.BackgroundWorkers; using Volo.Abp.Threading; @@ -7,14 +23,155 @@ namespace AElf.EventHandler.Workers; public class ReceiptSyncWorker : AsyncPeriodicBackgroundWorkerBase { - public ReceiptSyncWorker(AbpAsyncTimer timer, IServiceScopeFactory serviceScopeFactory - ) : base(timer, + private readonly BridgeOptions _bridgeOptions; + private readonly BridgeOutService _bridgeOutService; + private readonly NethereumService _nethereumService; + private readonly OracleService _oracleService; + private readonly AElfChainAliasOptions _aelfChainAliasOptions; + private readonly BridgeService _bridgeContractService; + private readonly IMerkleTreeContractService _merkleTreeContractService; + private readonly ILatestQueriedReceiptCountProvider _latestQueriedReceiptCountProvider; + private readonly ILogger _logger; + private readonly AElfContractOptions _contractOptions; + private readonly BlockConfirmationOptions _blockConfirmationOptions; + + public ReceiptSyncWorker(AbpAsyncTimer timer, + IServiceScopeFactory serviceScopeFactory, + IOptionsSnapshot bridgeOptions, + IOptionsSnapshot aelfChainAliasOption, + IOptionsSnapshot blockConfirmation, + BridgeOutService bridgeOutService, + NethereumService nethereumService, + OracleService oracleService, + BridgeService bridgeService, + IMerkleTreeContractService merkleTreeContractService, + ILatestQueriedReceiptCountProvider latestQueriedReceiptCountProvider, + ILogger logger, + AElfContractOptions contractOptions) : base(timer, serviceScopeFactory) { Timer.Period = 1000 * 60; + _bridgeOptions = bridgeOptions.Value; + _bridgeOutService = bridgeOutService; + _nethereumService = nethereumService; + _oracleService = oracleService; + _bridgeContractService = bridgeService; + _merkleTreeContractService = merkleTreeContractService; + _aelfChainAliasOptions = aelfChainAliasOption.Value; + _latestQueriedReceiptCountProvider = latestQueriedReceiptCountProvider; + _logger = logger; + _contractOptions = contractOptions; + _blockConfirmationOptions = blockConfirmation.Value; } protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) { + if (!_bridgeOptions.IsSendQuery) return; + var bridgeItemsMap = new Dictionary<(string, string), List>(); + var sendQueryList = new Dictionary(); + var tokenIndex = new Dictionary(); + foreach (var bridgeItem in _bridgeOptions.Bridges) + { + bridgeItemsMap[(bridgeItem.EthereumClientAlias, bridgeItem.EthereumBridgeOutContractAddress)] + .Add(bridgeItem); + } + + foreach (var (aliasAddress, item) in bridgeItemsMap) + { + var tokenList = item.Select(i => i.OriginToken).ToList(); + var targetChainIdList = item.Select(i => i.TargetChainId).ToList(); + var sendReceiptIndexDto = await _bridgeOutService.GetTransferReceiptIndexAsync(aliasAddress.Item1, + aliasAddress.Item2, tokenList, targetChainIdList); + for (var i = 0; i < tokenList.Count; i++) + { + tokenIndex[tokenList[i]] = sendReceiptIndexDto.Indexes[i]; + sendQueryList[item[i].SwapId] = item[i]; + } + } + + foreach (var (swapId, item) in sendQueryList) + { + var targetChainId = _bridgeOptions.Bridges.Single(i => i.SwapId == swapId).TargetChainId; + await SendQueryAsync(targetChainId, item, tokenIndex[item.OriginToken]); + } + } + + private async Task SendQueryAsync(string chainId, BridgeItem bridgeItem, BigInteger tokenIndex) + { + var swapId = bridgeItem.SwapId; + var clientAlias = _aelfChainAliasOptions.Mapping[chainId]; + var spaceId = await _bridgeContractService.GetSpaceIdBySwapIdAsync(clientAlias, Hash.LoadFromBase64(swapId)); + var lastRecordedLeafIndex = (await _merkleTreeContractService.GetLastLeafIndexAsync( + clientAlias, new GetLastLeafIndexInput + { + SpaceId = spaceId + })).Value; + if (lastRecordedLeafIndex == -2) + { + _logger.LogInformation($"Space of id {spaceId} is not created. "); + return; + } + + if (_latestQueriedReceiptCountProvider.Get(swapId) == 0) + { + _latestQueriedReceiptCountProvider.Set(swapId, lastRecordedLeafIndex); + } + + _logger.LogInformation($"Last recorded leaf index : {lastRecordedLeafIndex}."); + if (tokenIndex <= _latestQueriedReceiptCountProvider.Get(swapId)) + { + return; + } + + if (tokenIndex - lastRecordedLeafIndex > 0) + { + var blockNumber = await _nethereumService.GetBlockNumberAsync(bridgeItem.EthereumClientAlias); + var getReceiptInfos = await _bridgeOutService.GetSendReceiptInfosAsync(_aelfChainAliasOptions.Mapping[chainId], + bridgeItem.EthereumBridgeOutContractAddress, bridgeItem.OriginToken, bridgeItem.TargetChainId, + lastRecordedLeafIndex + 1,(long)tokenIndex); + var lastTokenIndexConfirm = lastRecordedLeafIndex; + for (var i = 0; i < lastRecordedLeafIndex - tokenIndex; i++) + { + var blockHeight = getReceiptInfos.Receipts[i].BlockHeight; + var blockConfirmationCount = _blockConfirmationOptions.ConfirmationCount[bridgeItem.EthereumClientAlias]; + if (blockNumber - blockHeight > blockConfirmationCount) continue; + lastTokenIndexConfirm += (i+1); + break; + } + + if (lastTokenIndexConfirm - lastRecordedLeafIndex > 0) + { + var queryInput = new QueryInput + { + Payment = _bridgeOptions.QueryPayment, + QueryInfo = new QueryInfo + { + Title = $"record_receipt_{swapId}", + Options = {(lastRecordedLeafIndex + 1).ToString(), lastTokenIndexConfirm.ToString()} + }, + AggregatorContractAddress = _contractOptions.ContractAddressList["StringAggregator"] + .ConvertAddress(), + CallbackInfo = new CallbackInfo + { + ContractAddress = + _contractOptions.ContractAddressList["Bridge"].ConvertAddress(), + MethodName = "RecordReceiptHash" + }, + DesignatedNodeList = new AddressList + { + Value = {bridgeItem.QueryToAddress.ConvertAddress()} + } + }; + + _logger.LogInformation($"About to send Query transaction for token swapping, QueryInput: {queryInput}"); + + var sendTxResult = await _oracleService.QueryAsync(clientAlias, queryInput); + _logger.LogInformation($"Query tx id: {sendTxResult.Transaction.GetHash()}"); + _latestQueriedReceiptCountProvider.Set(swapId, (int) tokenIndex + 1); + _logger.LogInformation( + $"Latest queried receipt count: {_latestQueriedReceiptCountProvider.Get(swapId)}"); + } + + } } } \ No newline at end of file From 8c87c706b04f5e64014acb471c7d228c50230672 Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Fri, 19 Aug 2022 18:58:46 +0800 Subject: [PATCH 15/66] feat: update bridge proto file. --- .../Protobuf/bridge_contract.proto | 48 ++++++++++++------- .../Options/BridgeOptions.cs | 3 -- .../ReportConfirmedLogEventProcessor.cs | 44 ++++++++++------- 3 files changed, 57 insertions(+), 38 deletions(-) diff --git a/modules/AElf.Client.Protobuf/Protobuf/bridge_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/bridge_contract.proto index b241e29e..c9232e0b 100644 --- a/modules/AElf.Client.Protobuf/Protobuf/bridge_contract.proto +++ b/modules/AElf.Client.Protobuf/Protobuf/bridge_contract.proto @@ -41,14 +41,19 @@ service BridgeContract { } //Gas Fee - rpc SetGasFeeAndPrice(SetGasFeeAndPriceInput) returns(google.protobuf.Empty){ + rpc SetGasFee(SetGasFeeInput) returns(google.protobuf.Empty){ + } + rpc SetGasPrice(SetGasPriceInput) returns (google.protobuf.Empty){ } rpc SetPriceRatio(SetPriceRatioInput) returns (google.protobuf.Empty){ } - rpc GetGasFeeAndPrice(google.protobuf.Empty) returns(GetGasFeeAndPriceOutput){ + rpc GetGasFee(google.protobuf.StringValue) returns (google.protobuf.Int64Value){ + option (aelf.is_view) = true; + } + rpc GetGasPrice(google.protobuf.StringValue) returns(google.protobuf.Int64Value){ option (aelf.is_view) = true; } - rpc GetPriceRatio(GetPriceRatioInput) returns (google.protobuf.Int64Value){ + rpc GetPriceRatio(google.protobuf.StringValue) returns (google.protobuf.DoubleValue){ option (aelf.is_view) = true; } @@ -217,7 +222,23 @@ message Receipt{ aelf.Address owner = 2; string targetAddress = 3; int64 amount = 4; -} +} + +message GasPrice{ + string chain_id = 1; + int64 gas_price = 2; +} + +message GasFee{ + string chain_id = 1; + int64 gas_fee = 2; +} + +message PriceRatio{ + string target_chain_id = 1; + double price_ratio = 2; +} + message ReceiptList{ repeated Receipt value = 1; } @@ -242,24 +263,17 @@ message CreateReceiptInput{ string target_chain_id = 5; } -message SetGasFeeAndPriceInput{ - int64 gas_fee = 1; - int64 gas_price = 2; +message SetGasFeeInput{ + repeated GasFee gas_fee_list = 1; } - -message SetPriceRatioInput{ - string symbol_pair = 1; - int64 price_ratio = 2; +message SetGasPriceInput{ + repeated GasPrice gas_price_list = 1; } -message GetGasFeeAndPriceOutput{ - int64 gas_fee = 1; - int64 gas_price = 2; +message SetPriceRatioInput{ + repeated PriceRatio value = 1; } -message GetPriceRatioInput{ - string symbol_pair = 1; -} message GetReceiptInfoInput{ string receipt_id = 1; diff --git a/src/AElf.EventHandler/Options/BridgeOptions.cs b/src/AElf.EventHandler/Options/BridgeOptions.cs index b7b71d78..5182d67d 100644 --- a/src/AElf.EventHandler/Options/BridgeOptions.cs +++ b/src/AElf.EventHandler/Options/BridgeOptions.cs @@ -13,7 +13,6 @@ public class BridgeOptions public class BridgeItem { - //public string FromChainId { get; set; } public string EthereumClientAlias { get; set; } public string EthereumBridgeInContractAddress { get; set; } public string OriginToken { get; set; } @@ -23,7 +22,5 @@ public class BridgeItem public string MaximumLeafCount { get; set; } public string EthereumSwapId { get; set; } public string TargetChainId { get; set; } - - } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs index 9f1ccebd..e3bc9661 100644 --- a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs @@ -23,19 +23,22 @@ internal class ReportConfirmedLogEventProcessor : LogEventProcessorBase logger, IOptionsSnapshot contractAddressOptions, IReportProvider reportProvider, ISignatureRecoverableInfoProvider signaturesRecoverableInfoProvider, IOptionsSnapshot ethereumContractOptions, - ITransmitTransactionProvider transmitTransactionProvider) : base(contractAddressOptions) + ITransmitTransactionProvider transmitTransactionProvider, + IOptionsSnapshot bridgeOptions) : base(contractAddressOptions) { _logger = logger; _signaturesRecoverableInfoProvider = signaturesRecoverableInfoProvider; _transmitTransactionProvider = transmitTransactionProvider; _ethereumContractOptions = ethereumContractOptions.Value; _reportProvider = reportProvider; + _bridgeOptions = bridgeOptions.Value; var file = Path.Combine(_ethereumContractOptions.AbiFileDirectory, _ethereumContractOptions.ContractInfoList["Bridge"].AbiFileName); if (!string.IsNullOrEmpty(file)) @@ -53,25 +56,30 @@ await _signaturesRecoverableInfoProvider.SetSignatureAsync(context.ChainId.ToStr reportConfirmed.Signature); if (reportConfirmed.IsAllNodeConfirmed) { - var report = - _reportProvider.GetReport(ethereumContractAddress, roundId); - var signatureRecoverableInfos = - await _signaturesRecoverableInfoProvider.GetSignatureAsync(context.ChainId.ToString(),ethereumContractAddress, roundId); - var (reportBytes, rs, ss, vs) = TransferToEthereumParameter(report, signatureRecoverableInfos); + if (_bridgeOptions.IsTransmitter) + { + var report = + _reportProvider.GetReport(ethereumContractAddress, roundId); + var signatureRecoverableInfos = + await _signaturesRecoverableInfoProvider.GetSignatureAsync(context.ChainId.ToString(), + ethereumContractAddress, roundId); + var (reportBytes, rs, ss, vs) = TransferToEthereumParameter(report, signatureRecoverableInfos); - _logger.LogInformation( - $"Try to transmit data to Ethereum, Address: {ethereumContractAddress} RoundId: {reportConfirmed.RoundId}"); + _logger.LogInformation( + $"Try to transmit data to Ethereum, Address: {ethereumContractAddress} RoundId: {reportConfirmed.RoundId}"); - await _transmitTransactionProvider.EnqueueAsync(new SendTransmitArgs - { - Report = reportBytes, - Rs = rs, - Ss = ss, - RawVs = vs, - }); - - await _signaturesRecoverableInfoProvider.RemoveSignatureAsync(context.ChainId.ToString(),ethereumContractAddress, roundId); - _reportProvider.RemoveReport(ethereumContractAddress, roundId); + await _transmitTransactionProvider.EnqueueAsync(new SendTransmitArgs + { + Report = reportBytes, + Rs = rs, + Ss = ss, + RawVs = vs, + }); + + await _signaturesRecoverableInfoProvider.RemoveSignatureAsync(context.ChainId.ToString(), + ethereumContractAddress, roundId); + _reportProvider.RemoveReport(ethereumContractAddress, roundId); + } } } From 072c2b19d2f7f8a182794d90c87c7935ea633f5b Mon Sep 17 00:00:00 2001 From: zhxymh Date: Mon, 22 Aug 2022 18:21:27 +0800 Subject: [PATCH 16/66] feat: add price sync worker --- AElf.Contracts.PortAll.sln | 28 +++++ .../AElf.BlockchainTransactionFee.csproj | 14 +++ .../AElfBlockchainTransactionFeeModule.cs | 19 ++++ .../ApiClient.cs | 42 ++++++++ .../BSCTransactionFeeProvider.cs | 52 +++++++++ .../ChainExplorerApiOptions.cs | 6 ++ .../EthereumTransactionFeeProvider.cs | 51 +++++++++ .../IBlockchainTransactionFeeProvider.cs | 7 ++ .../IBlockchainTransactionFeeService.cs | 30 ++++++ .../TransactionFeeDto.cs | 7 ++ modules/AElf.Client.Bridge/BridgeService.cs | 23 ++++ modules/AElf.Client.Core/AElfClientModule.cs | 3 + .../Protobuf/bridge_contract.proto | 36 +++---- modules/AElf.Client.Report/ReportService.cs | 15 ++- .../AElf.TokenPrice.Abstractions.csproj | 15 +++ .../AElfTokenPriceAbstractionsModule.cs | 15 +++ .../ITokenPriceProvider.cs | 7 ++ .../ITokenPriceService.cs | 52 +++++++++ .../TokenPriceCacheItem.cs | 10 ++ .../TokenPriceOptions.cs | 9 ++ .../AElf.TokenPrice.CoinGecko.csproj | 17 +++ .../AElfTokenPriceCoinGeckoModule.cs | 15 +++ .../CoinGeckoApiConsts.cs | 7 ++ .../CoinGeckoTokenPriceProvider.cs | 100 ++++++++++++++++++ .../IRequestLimitProvider.cs | 48 +++++++++ .../RequestExceedingLimitException.cs | 26 +++++ .../AElf.EventHandler.csproj | 1 - .../EventHandlerAppModule.cs | 3 +- .../Extensions/AElfClientExtension.cs | 2 +- .../Extensions/TransactionFeeExtension.cs | 2 +- .../Workers/ReceiptSyncWorker.cs | 1 - src/AElf.EventHandler/appsettings.json | 17 --- src/AElf.PriceWorker/AElf.PriceWorker.csproj | 32 ++++++ .../AElfPriceWorkerHostedService.cs | 33 ++++++ src/AElf.PriceWorker/AElfPriceWorkerModule.cs | 36 +++++++ src/AElf.PriceWorker/PriceSyncOptions.cs | 9 ++ src/AElf.PriceWorker/PriceSyncWorker.cs | 66 ++++++++++++ src/AElf.PriceWorker/Program.cs | 59 +++++++++++ src/AElf.PriceWorker/appsettings.json | 75 +++++++++++++ 39 files changed, 939 insertions(+), 51 deletions(-) create mode 100644 modules/AElf.BlockchainTransactionFee/AElf.BlockchainTransactionFee.csproj create mode 100644 modules/AElf.BlockchainTransactionFee/AElfBlockchainTransactionFeeModule.cs create mode 100644 modules/AElf.BlockchainTransactionFee/ApiClient.cs create mode 100644 modules/AElf.BlockchainTransactionFee/BSCTransactionFeeProvider.cs create mode 100644 modules/AElf.BlockchainTransactionFee/ChainExplorerApiOptions.cs create mode 100644 modules/AElf.BlockchainTransactionFee/EthereumTransactionFeeProvider.cs create mode 100644 modules/AElf.BlockchainTransactionFee/IBlockchainTransactionFeeProvider.cs create mode 100644 modules/AElf.BlockchainTransactionFee/IBlockchainTransactionFeeService.cs create mode 100644 modules/AElf.BlockchainTransactionFee/TransactionFeeDto.cs create mode 100644 modules/AElf.TokenPrice.Abstractions/AElf.TokenPrice.Abstractions.csproj create mode 100644 modules/AElf.TokenPrice.Abstractions/AElfTokenPriceAbstractionsModule.cs create mode 100644 modules/AElf.TokenPrice.Abstractions/ITokenPriceProvider.cs create mode 100644 modules/AElf.TokenPrice.Abstractions/ITokenPriceService.cs create mode 100644 modules/AElf.TokenPrice.Abstractions/TokenPriceCacheItem.cs create mode 100644 modules/AElf.TokenPrice.Abstractions/TokenPriceOptions.cs create mode 100644 modules/AElf.TokenPrice.CoinGecko/AElf.TokenPrice.CoinGecko.csproj create mode 100644 modules/AElf.TokenPrice.CoinGecko/AElfTokenPriceCoinGeckoModule.cs create mode 100644 modules/AElf.TokenPrice.CoinGecko/CoinGeckoApiConsts.cs create mode 100644 modules/AElf.TokenPrice.CoinGecko/CoinGeckoTokenPriceProvider.cs create mode 100644 modules/AElf.TokenPrice.CoinGecko/IRequestLimitProvider.cs create mode 100644 modules/AElf.TokenPrice.CoinGecko/RequestExceedingLimitException.cs create mode 100644 src/AElf.PriceWorker/AElf.PriceWorker.csproj create mode 100644 src/AElf.PriceWorker/AElfPriceWorkerHostedService.cs create mode 100644 src/AElf.PriceWorker/AElfPriceWorkerModule.cs create mode 100644 src/AElf.PriceWorker/PriceSyncOptions.cs create mode 100644 src/AElf.PriceWorker/PriceSyncWorker.cs create mode 100644 src/AElf.PriceWorker/Program.cs create mode 100644 src/AElf.PriceWorker/appsettings.json diff --git a/AElf.Contracts.PortAll.sln b/AElf.Contracts.PortAll.sln index 65ce73cf..e06f8585 100644 --- a/AElf.Contracts.PortAll.sln +++ b/AElf.Contracts.PortAll.sln @@ -69,6 +69,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Client.Bridge", "modul EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.Nethereum.Bridge", "modules\AElf.Nethereum.Bridge\AElf.Nethereum.Bridge.csproj", "{1AC48421-CF85-44B9-B79A-6D41F8C09FF8}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.BlockchainTransactionFee", "modules\AElf.BlockchainTransactionFee\AElf.BlockchainTransactionFee.csproj", "{0D9CCDEA-1E0B-4428-8DA7-F040CD971816}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.TokenPrice.Abstractions", "modules\AElf.TokenPrice.Abstractions\AElf.TokenPrice.Abstractions.csproj", "{F51259FD-7510-4166-8E96-C0C13DFA811F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.TokenPrice.CoinGecko", "modules\AElf.TokenPrice.CoinGecko\AElf.TokenPrice.CoinGecko.csproj", "{94EB8357-3CE0-4750-A167-8BCF7740BFB2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AElf.PriceWorker", "src\AElf.PriceWorker\AElf.PriceWorker.csproj", "{63E22799-0213-42B3-A751-1592349180B9}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -179,6 +187,22 @@ Global {1AC48421-CF85-44B9-B79A-6D41F8C09FF8}.Debug|Any CPU.Build.0 = Debug|Any CPU {1AC48421-CF85-44B9-B79A-6D41F8C09FF8}.Release|Any CPU.ActiveCfg = Release|Any CPU {1AC48421-CF85-44B9-B79A-6D41F8C09FF8}.Release|Any CPU.Build.0 = Release|Any CPU + {0D9CCDEA-1E0B-4428-8DA7-F040CD971816}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0D9CCDEA-1E0B-4428-8DA7-F040CD971816}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0D9CCDEA-1E0B-4428-8DA7-F040CD971816}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0D9CCDEA-1E0B-4428-8DA7-F040CD971816}.Release|Any CPU.Build.0 = Release|Any CPU + {F51259FD-7510-4166-8E96-C0C13DFA811F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F51259FD-7510-4166-8E96-C0C13DFA811F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F51259FD-7510-4166-8E96-C0C13DFA811F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F51259FD-7510-4166-8E96-C0C13DFA811F}.Release|Any CPU.Build.0 = Release|Any CPU + {94EB8357-3CE0-4750-A167-8BCF7740BFB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {94EB8357-3CE0-4750-A167-8BCF7740BFB2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {94EB8357-3CE0-4750-A167-8BCF7740BFB2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {94EB8357-3CE0-4750-A167-8BCF7740BFB2}.Release|Any CPU.Build.0 = Release|Any CPU + {63E22799-0213-42B3-A751-1592349180B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {63E22799-0213-42B3-A751-1592349180B9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {63E22799-0213-42B3-A751-1592349180B9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {63E22799-0213-42B3-A751-1592349180B9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -210,6 +234,10 @@ Global {4175F31E-5ED6-4B67-973C-51B0C44BE74B} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039} {ADD0EBAC-F957-4D59-AF43-C10D31DFB2DA} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039} {1AC48421-CF85-44B9-B79A-6D41F8C09FF8} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039} + {0D9CCDEA-1E0B-4428-8DA7-F040CD971816} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039} + {F51259FD-7510-4166-8E96-C0C13DFA811F} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039} + {94EB8357-3CE0-4750-A167-8BCF7740BFB2} = {FDE8EA32-0CD6-464B-A974-B6C3A3FB7039} + {63E22799-0213-42B3-A751-1592349180B9} = {21D85A91-5BB8-4912-8107-49435A461AAC} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {D7426B41-E959-40E4-9ED8-ED8D9C50F133} diff --git a/modules/AElf.BlockchainTransactionFee/AElf.BlockchainTransactionFee.csproj b/modules/AElf.BlockchainTransactionFee/AElf.BlockchainTransactionFee.csproj new file mode 100644 index 00000000..a3adf259 --- /dev/null +++ b/modules/AElf.BlockchainTransactionFee/AElf.BlockchainTransactionFee.csproj @@ -0,0 +1,14 @@ + + + + net6.0 + enable + enable + + + + + + + + diff --git a/modules/AElf.BlockchainTransactionFee/AElfBlockchainTransactionFeeModule.cs b/modules/AElf.BlockchainTransactionFee/AElfBlockchainTransactionFeeModule.cs new file mode 100644 index 00000000..456511a2 --- /dev/null +++ b/modules/AElf.BlockchainTransactionFee/AElfBlockchainTransactionFeeModule.cs @@ -0,0 +1,19 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Caching; +using Volo.Abp.Modularity; + +namespace AElf.BlockchainTransactionFee +{ + [DependsOn(typeof(AbpCachingModule))] + public class AElfBlockchainTransactionFeeModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + var configuration = context.Services.GetConfiguration(); + Configure(configuration.GetSection("ChainExplorerApi")); + context.Services.AddTransient(); + context.Services.AddTransient(); + context.Services.AddTransient(); + } + } +} \ No newline at end of file diff --git a/modules/AElf.BlockchainTransactionFee/ApiClient.cs b/modules/AElf.BlockchainTransactionFee/ApiClient.cs new file mode 100644 index 00000000..e6c93806 --- /dev/null +++ b/modules/AElf.BlockchainTransactionFee/ApiClient.cs @@ -0,0 +1,42 @@ +using System.Net; +using System.Text.Json; +using Newtonsoft.Json; + +namespace AElf.BlockchainTransactionFee; + +public class ApiClient +{ + private readonly HttpClient _httpClient; + + public ApiClient() + { + _httpClient = new HttpClient(); + } + + public async Task GetAsync(string uri) + { + var proxy = new WebProxy + { + Address = new Uri("http://127.0.0.1:1087"), + }; + var clientHandler = new HttpClientHandler() + { + Proxy = proxy, + }; + HttpClient.DefaultProxy = proxy; + + var response = await _httpClient.GetAsync(uri) + .ConfigureAwait(false); + response.EnsureSuccessStatusCode(); + + var responseContent = await response.Content.ReadAsStringAsync(); + try + { + return JsonConvert.DeserializeObject(responseContent); + } + catch (Exception e) + { + throw new HttpRequestException(e.Message); + } + } +} \ No newline at end of file diff --git a/modules/AElf.BlockchainTransactionFee/BSCTransactionFeeProvider.cs b/modules/AElf.BlockchainTransactionFee/BSCTransactionFeeProvider.cs new file mode 100644 index 00000000..81d30935 --- /dev/null +++ b/modules/AElf.BlockchainTransactionFee/BSCTransactionFeeProvider.cs @@ -0,0 +1,52 @@ +using Microsoft.Extensions.Options; +using Volo.Abp.DependencyInjection; + +namespace AElf.BlockchainTransactionFee; + +public class BSCTransactionFeeProvider : IBlockchainTransactionFeeProvider +{ + public string BlockChain { get; } = "BSC"; + + private readonly ApiClient _apiClient; + + private readonly ChainExplorerApiOptions _chainExplorerApiOptions; + + public BSCTransactionFeeProvider(ApiClient apiClient, + IOptionsSnapshot blockchainExplorerApiOptions) + { + _apiClient = apiClient; + _chainExplorerApiOptions = blockchainExplorerApiOptions.Value; + } + + public async Task GetTransactionFee() + { + var result = await _apiClient.GetAsync>( + $"https://api.bscscan.com/api?module=gastracker&action=gasoracle&apikey={_chainExplorerApiOptions.ApiKeys[BlockChain]}"); + if (result.Message != "OK") + { + throw new HttpRequestException($"BSC api failed: {result.Message}"); + } + + return new TransactionFeeDto + { + Symbol = "BNB", + Fee = decimal.Parse(result.Result.SafeGasPrice) + }; + } +} + +public class BSCApiResult +{ + public string Message { get; set; } + + public T Result { get; set; } +} + +public class BSCGasTracker +{ + public string FastGasPrice { get; set; } + public string LastBlock { get; set; } + public string ProposeGasPrice { get; set; } + public string SafeGasPrice { get; set; } + public string UsdPrice { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.BlockchainTransactionFee/ChainExplorerApiOptions.cs b/modules/AElf.BlockchainTransactionFee/ChainExplorerApiOptions.cs new file mode 100644 index 00000000..a49af71b --- /dev/null +++ b/modules/AElf.BlockchainTransactionFee/ChainExplorerApiOptions.cs @@ -0,0 +1,6 @@ +namespace AElf.BlockchainTransactionFee; + +public class ChainExplorerApiOptions +{ + public Dictionary ApiKeys { get; set; } = new(); +} \ No newline at end of file diff --git a/modules/AElf.BlockchainTransactionFee/EthereumTransactionFeeProvider.cs b/modules/AElf.BlockchainTransactionFee/EthereumTransactionFeeProvider.cs new file mode 100644 index 00000000..b7043e0d --- /dev/null +++ b/modules/AElf.BlockchainTransactionFee/EthereumTransactionFeeProvider.cs @@ -0,0 +1,51 @@ +using Microsoft.Extensions.Options; +using Volo.Abp.DependencyInjection; + +namespace AElf.BlockchainTransactionFee; + +public class EthereumTransactionFeeProvider : IBlockchainTransactionFeeProvider +{ + public string BlockChain { get; } = "Ethereum"; + + private readonly ApiClient _apiClient; + + private readonly ChainExplorerApiOptions _chainExplorerApiOptions; + + public EthereumTransactionFeeProvider(ApiClient apiClient, + IOptionsSnapshot blockchainExplorerApiOptions) + { + _apiClient = apiClient; + _chainExplorerApiOptions = blockchainExplorerApiOptions.Value; + } + + public async Task GetTransactionFee() + { + var result = await _apiClient.GetAsync>( + $"https://api.etherscan.io/api?module=gastracker&action=gasoracle&apikey={_chainExplorerApiOptions.ApiKeys[BlockChain]}"); + if (result.Message != "OK") + { + throw new HttpRequestException($"Ethereum api failed: {result.Message}"); + } + + return new TransactionFeeDto + { + Symbol = "ETH", + Fee = decimal.Parse(result.Result.SafeGasPrice) + }; + } +} + +public class EthereumApiResult +{ + public string Message { get; set; } + + public T Result { get; set; } +} + +public class EthereumGasTracker +{ + public string FastGasPrice { get; set; } + public string LastBlock { get; set; } + public string ProposeGasPrice { get; set; } + public string SafeGasPrice { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.BlockchainTransactionFee/IBlockchainTransactionFeeProvider.cs b/modules/AElf.BlockchainTransactionFee/IBlockchainTransactionFeeProvider.cs new file mode 100644 index 00000000..718177af --- /dev/null +++ b/modules/AElf.BlockchainTransactionFee/IBlockchainTransactionFeeProvider.cs @@ -0,0 +1,7 @@ +namespace AElf.BlockchainTransactionFee; + +public interface IBlockchainTransactionFeeProvider +{ + string BlockChain { get; } + Task GetTransactionFee(); +} \ No newline at end of file diff --git a/modules/AElf.BlockchainTransactionFee/IBlockchainTransactionFeeService.cs b/modules/AElf.BlockchainTransactionFee/IBlockchainTransactionFeeService.cs new file mode 100644 index 00000000..efd9eaaa --- /dev/null +++ b/modules/AElf.BlockchainTransactionFee/IBlockchainTransactionFeeService.cs @@ -0,0 +1,30 @@ +using Microsoft.Extensions.Caching.Distributed; +using Volo.Abp.Caching; +using Volo.Abp.DependencyInjection; + +namespace AElf.BlockchainTransactionFee; + +public interface IBlockchainTransactionFeeService +{ + Task GetTransactionFeeAsync(string chainName); +} + +public class BlockchainTransactionFeeService : IBlockchainTransactionFeeService, ITransientDependency +{ + private readonly IEnumerable _blockchainTransactionFeeProviders; + + public BlockchainTransactionFeeService( + IEnumerable blockchainTransactionFeeProviders) + { + _blockchainTransactionFeeProviders = blockchainTransactionFeeProviders; + } + + public async Task GetTransactionFeeAsync(string chainName) + { + var provider = _blockchainTransactionFeeProviders.First(o => o.BlockChain == chainName); + var fee = await provider.GetTransactionFee(); + return fee; + } +} + + diff --git a/modules/AElf.BlockchainTransactionFee/TransactionFeeDto.cs b/modules/AElf.BlockchainTransactionFee/TransactionFeeDto.cs new file mode 100644 index 00000000..81c5fa61 --- /dev/null +++ b/modules/AElf.BlockchainTransactionFee/TransactionFeeDto.cs @@ -0,0 +1,7 @@ +namespace AElf.BlockchainTransactionFee; + +public class TransactionFeeDto +{ + public string Symbol { get; set; } + public decimal Fee { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.Client.Bridge/BridgeService.cs b/modules/AElf.Client.Bridge/BridgeService.cs index 9954a319..5a90e03a 100644 --- a/modules/AElf.Client.Bridge/BridgeService.cs +++ b/modules/AElf.Client.Bridge/BridgeService.cs @@ -1,5 +1,6 @@ using AElf.Client.Core; using AElf.Client.Core.Options; +using AElf.Contracts.Bridge; using AElf.Contracts.Report; using AElf.Types; using Microsoft.Extensions.Options; @@ -10,6 +11,8 @@ namespace AElf.Client.Bridge; public interface IBridgeService { Task GetSpaceIdBySwapIdAsync(string clientAlias, Hash swapId); + Task SetGasPriceAsync(string clientAlias, SetGasPriceInput input); + Task SetPriceRatioAsync(string clientAlias, SetPriceRatioInput input); } public class BridgeService : ContractServiceBase, IBridgeService, ITransientDependency @@ -34,4 +37,24 @@ public async Task GetSpaceIdBySwapIdAsync(string clientAlias, Hash swapId) return Hash.LoadFromByteArray(result); } + + public async Task SetGasPriceAsync(string clientAlias, SetGasPriceInput input) + { + var tx = await PerformSendTransactionAsync("SetGasPrice", input, clientAlias); + return new SendTransactionResult + { + Transaction = tx, + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) + }; + } + + public async Task SetPriceRatioAsync(string clientAlias, SetPriceRatioInput input) + { + var tx = await PerformSendTransactionAsync("SetPriceRatio", input, clientAlias); + return new SendTransactionResult + { + Transaction = tx, + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) + }; + } } \ No newline at end of file diff --git a/modules/AElf.Client.Core/AElfClientModule.cs b/modules/AElf.Client.Core/AElfClientModule.cs index f038d333..af5b05f1 100644 --- a/modules/AElf.Client.Core/AElfClientModule.cs +++ b/modules/AElf.Client.Core/AElfClientModule.cs @@ -20,7 +20,10 @@ public override void ConfigureServices(ServiceConfigurationContext context) Configure(options => { configuration.GetSection("AElfAccount").Bind(options); }); Configure(options => { configuration.GetSection("AElfClientConfig").Bind(options); }); Configure(options => { configuration.GetSection("AElfMinerAccount").Bind(options); }); + Configure(options => { configuration.GetSection("AElfContract").Bind(options); }); + context.Services.AddSingleton(); + context.Services.AddAutoMapperObjectMapper(); Configure(options => diff --git a/modules/AElf.Client.Protobuf/Protobuf/bridge_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/bridge_contract.proto index c9232e0b..d90d70f3 100644 --- a/modules/AElf.Client.Protobuf/Protobuf/bridge_contract.proto +++ b/modules/AElf.Client.Protobuf/Protobuf/bridge_contract.proto @@ -50,10 +50,10 @@ service BridgeContract { rpc GetGasFee(google.protobuf.StringValue) returns (google.protobuf.Int64Value){ option (aelf.is_view) = true; } - rpc GetGasPrice(google.protobuf.StringValue) returns(google.protobuf.Int64Value){ + rpc GetGasPrice(google.protobuf.StringValue) returns(google.protobuf.StringValue){ option (aelf.is_view) = true; } - rpc GetPriceRatio(google.protobuf.StringValue) returns (google.protobuf.DoubleValue){ + rpc GetPriceRatio(google.protobuf.StringValue) returns (google.protobuf.StringValue){ option (aelf.is_view) = true; } @@ -222,23 +222,7 @@ message Receipt{ aelf.Address owner = 2; string targetAddress = 3; int64 amount = 4; -} - -message GasPrice{ - string chain_id = 1; - int64 gas_price = 2; -} - -message GasFee{ - string chain_id = 1; - int64 gas_fee = 2; -} - -message PriceRatio{ - string target_chain_id = 1; - double price_ratio = 2; -} - +} message ReceiptList{ repeated Receipt value = 1; } @@ -270,9 +254,23 @@ message SetGasPriceInput{ repeated GasPrice gas_price_list = 1; } +message GasPrice{ + string chain_id = 1; + int64 gas_price = 2; +} + +message GasFee{ + string chain_id = 1; + int64 gas_fee = 2; +} + message SetPriceRatioInput{ repeated PriceRatio value = 1; } +message PriceRatio{ + string target_chain_id = 1; + int64 price_ratio = 2; +} message GetReceiptInfoInput{ diff --git a/modules/AElf.Client.Report/ReportService.cs b/modules/AElf.Client.Report/ReportService.cs index c4a8074d..b92b0917 100644 --- a/modules/AElf.Client.Report/ReportService.cs +++ b/modules/AElf.Client.Report/ReportService.cs @@ -32,34 +32,31 @@ public ReportService(IAElfClientService clientService, public async Task ProposeReportAsync(string clientAlias, CallbackInput proposeReportInput) { - var useClientAlias = _clientConfigOptions.ClientAlias; - var tx = await PerformSendTransactionAsync("ProposeReport", proposeReportInput, useClientAlias); + var tx = await PerformSendTransactionAsync("ProposeReport", proposeReportInput, clientAlias); return new SendTransactionResult { Transaction = tx, - TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), useClientAlias) + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) }; } public async Task ConfirmReportAsync(string clientAlias, ConfirmReportInput confirmReportInput) { - var useClientAlias = _clientConfigOptions.ClientAlias; - var tx = await PerformSendTransactionAsync("ConfirmReport", confirmReportInput, useClientAlias); + var tx = await PerformSendTransactionAsync("ConfirmReport", confirmReportInput, clientAlias); return new SendTransactionResult { Transaction = tx, - TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), useClientAlias) + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) }; } public async Task RejectReportAsync(string clientAlias, RejectReportInput rejectReportInput) { - var useClientAlias = _clientConfigOptions.ClientAlias; - var tx = await PerformSendTransactionAsync("RejectReport", rejectReportInput, useClientAlias); + var tx = await PerformSendTransactionAsync("RejectReport", rejectReportInput, clientAlias); return new SendTransactionResult { Transaction = tx, - TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), useClientAlias) + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) }; } } \ No newline at end of file diff --git a/modules/AElf.TokenPrice.Abstractions/AElf.TokenPrice.Abstractions.csproj b/modules/AElf.TokenPrice.Abstractions/AElf.TokenPrice.Abstractions.csproj new file mode 100644 index 00000000..1bb32702 --- /dev/null +++ b/modules/AElf.TokenPrice.Abstractions/AElf.TokenPrice.Abstractions.csproj @@ -0,0 +1,15 @@ + + + + net6.0 + enable + enable + AElf.TokenPrice + + + + + + + + diff --git a/modules/AElf.TokenPrice.Abstractions/AElfTokenPriceAbstractionsModule.cs b/modules/AElf.TokenPrice.Abstractions/AElfTokenPriceAbstractionsModule.cs new file mode 100644 index 00000000..e4efc2c4 --- /dev/null +++ b/modules/AElf.TokenPrice.Abstractions/AElfTokenPriceAbstractionsModule.cs @@ -0,0 +1,15 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Caching; +using Volo.Abp.Modularity; + +namespace AElf.TokenPrice +{ + public class AElfTokenPriceAbstractionsModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + var configuration = context.Services.GetConfiguration(); + Configure(configuration.GetSection("TokenPrice")); + } + } +} \ No newline at end of file diff --git a/modules/AElf.TokenPrice.Abstractions/ITokenPriceProvider.cs b/modules/AElf.TokenPrice.Abstractions/ITokenPriceProvider.cs new file mode 100644 index 00000000..2a217215 --- /dev/null +++ b/modules/AElf.TokenPrice.Abstractions/ITokenPriceProvider.cs @@ -0,0 +1,7 @@ +namespace AElf.TokenPrice; + +public interface ITokenPriceProvider +{ + Task GetPriceAsync(string coinId); + Task GetHistoryPriceAsync(string coinId, DateTime dateTime); +} \ No newline at end of file diff --git a/modules/AElf.TokenPrice.Abstractions/ITokenPriceService.cs b/modules/AElf.TokenPrice.Abstractions/ITokenPriceService.cs new file mode 100644 index 00000000..4fcf8a58 --- /dev/null +++ b/modules/AElf.TokenPrice.Abstractions/ITokenPriceService.cs @@ -0,0 +1,52 @@ +using Microsoft.Extensions.Caching.Distributed; +using Microsoft.Extensions.Options; +using Volo.Abp.Caching; +using Volo.Abp.DependencyInjection; + +namespace AElf.TokenPrice; + +public interface ITokenPriceService +{ + Task GetPriceAsync(string symbol); + Task GetHistoryPriceAsync(string symbol, DateTime dateTime); +} + +public class TokenPriceService : ITokenPriceService, ITransientDependency +{ + private readonly TokenPriceOptions _options; + private readonly ITokenPriceProvider _tokenPriceProvider; + + public TokenPriceService(IOptionsSnapshot options, ITokenPriceProvider tokenPriceProvider) + { + _tokenPriceProvider = tokenPriceProvider; + _options = options.Value; + } + + public async Task GetPriceAsync(string symbol) + { + symbol = symbol.ToUpper(); + var coinId = GetCoinIdAsync(symbol); + var price = await _tokenPriceProvider.GetPriceAsync(coinId); + return price; + } + + public async Task GetHistoryPriceAsync(string symbol, DateTime dateTime) + { + symbol = symbol.ToUpper(); + var date = dateTime.Date; + var coinId = GetCoinIdAsync(symbol); + var price = await _tokenPriceProvider.GetHistoryPriceAsync(coinId, date); + return price; + } + + private string GetCoinIdAsync(string symbol) + { + var coinId = _options.CoinIdMapping.TryGetValue(symbol, out var id) ? id : null; + if (coinId.IsNullOrWhiteSpace()) + { + throw new NotSupportedException($"Do not support symbol: {symbol}"); + } + + return coinId; + } +} \ No newline at end of file diff --git a/modules/AElf.TokenPrice.Abstractions/TokenPriceCacheItem.cs b/modules/AElf.TokenPrice.Abstractions/TokenPriceCacheItem.cs new file mode 100644 index 00000000..cfb6910e --- /dev/null +++ b/modules/AElf.TokenPrice.Abstractions/TokenPriceCacheItem.cs @@ -0,0 +1,10 @@ +namespace AElf.TokenPrice; + +[Serializable] +public class TokenPriceCacheItem +{ + public string Symbol { get; set; } + public string CoinId { get; set; } + public decimal Price { get; set; } + public DateTime Timestamp { get; set; } +} \ No newline at end of file diff --git a/modules/AElf.TokenPrice.Abstractions/TokenPriceOptions.cs b/modules/AElf.TokenPrice.Abstractions/TokenPriceOptions.cs new file mode 100644 index 00000000..a23103b3 --- /dev/null +++ b/modules/AElf.TokenPrice.Abstractions/TokenPriceOptions.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace AElf.TokenPrice +{ + public class TokenPriceOptions + { + public Dictionary CoinIdMapping { get; set; } = new(); + } +} \ No newline at end of file diff --git a/modules/AElf.TokenPrice.CoinGecko/AElf.TokenPrice.CoinGecko.csproj b/modules/AElf.TokenPrice.CoinGecko/AElf.TokenPrice.CoinGecko.csproj new file mode 100644 index 00000000..abdea150 --- /dev/null +++ b/modules/AElf.TokenPrice.CoinGecko/AElf.TokenPrice.CoinGecko.csproj @@ -0,0 +1,17 @@ + + + + net6.0 + + + + + + + + + + + + + diff --git a/modules/AElf.TokenPrice.CoinGecko/AElfTokenPriceCoinGeckoModule.cs b/modules/AElf.TokenPrice.CoinGecko/AElfTokenPriceCoinGeckoModule.cs new file mode 100644 index 00000000..038aac29 --- /dev/null +++ b/modules/AElf.TokenPrice.CoinGecko/AElfTokenPriceCoinGeckoModule.cs @@ -0,0 +1,15 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Caching; +using Volo.Abp.Modularity; + +namespace AElf.TokenPrice.CoinGecko +{ + [DependsOn(typeof(AbpCachingModule))] + public class AElfTokenPriceCoinGeckoModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + var configuration = context.Services.GetConfiguration(); + } + } +} \ No newline at end of file diff --git a/modules/AElf.TokenPrice.CoinGecko/CoinGeckoApiConsts.cs b/modules/AElf.TokenPrice.CoinGecko/CoinGeckoApiConsts.cs new file mode 100644 index 00000000..9047a18e --- /dev/null +++ b/modules/AElf.TokenPrice.CoinGecko/CoinGeckoApiConsts.cs @@ -0,0 +1,7 @@ +namespace AElf.TokenPrice.CoinGecko +{ + public class CoinGeckoApiConsts + { + public const string RequestTimeCacheKey = "RequestTime"; + } +} \ No newline at end of file diff --git a/modules/AElf.TokenPrice.CoinGecko/CoinGeckoTokenPriceProvider.cs b/modules/AElf.TokenPrice.CoinGecko/CoinGeckoTokenPriceProvider.cs new file mode 100644 index 00000000..2bd8414c --- /dev/null +++ b/modules/AElf.TokenPrice.CoinGecko/CoinGeckoTokenPriceProvider.cs @@ -0,0 +1,100 @@ +using System; +using System.Net; +using System.Net.Http; +using System.Threading.Tasks; +using CoinGecko.Clients; +using CoinGecko.Interfaces; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Volo.Abp.DependencyInjection; + +namespace AElf.TokenPrice.CoinGecko +{ + public class CoinGeckoTokenPriceProvider : ITokenPriceProvider, ITransientDependency + { + private readonly ICoinGeckoClient _coinGeckoClient; + private readonly IRequestLimitProvider _requestLimitProvider; + + private const string UsdSymbol = "usd"; + + public ILogger Logger { get; set; } + + public CoinGeckoTokenPriceProvider(IRequestLimitProvider requestLimitProvider) + { + _requestLimitProvider = requestLimitProvider; + _coinGeckoClient = CoinGeckoClient.Instance; + + Logger = NullLogger.Instance; + } + + public async Task GetPriceAsync(string coinId) + { + try + { + var proxy = new WebProxy + { + Address = new Uri("http://127.0.0.1:1087"), + }; + var clientHandler = new HttpClientHandler() + { + Proxy = proxy, + }; + var client = new CoinGeckoClient(clientHandler); + + var coinData = + await RequestAsync(async () => + await client.SimpleClient.GetSimplePrice(new[] {coinId}, new[] { UsdSymbol })); + + if (!coinData.TryGetValue(coinId,out var value)) + { + return 0; + } + + return value[UsdSymbol].Value; + } + catch (Exception ex) + { + Logger.LogError(ex, $"can not get current price :{coinId}."); + throw; + } + } + + public async Task GetHistoryPriceAsync(string coinId, DateTime dateTime) + { + try + { + // var proxy = new WebProxy + // { + // Address = new Uri("http://127.0.0.1:1087"), + // }; + // var clientHandler = new HttpClientHandler() + // { + // Proxy = proxy, + // }; + // var client = new CoinGeckoClient(clientHandler); + + var coinData = + await RequestAsync(async () => await _coinGeckoClient.CoinsClient.GetHistoryByCoinId(coinId, + dateTime.ToString("dd-MM-yyyy"), "false")); + + if (coinData.MarketData == null) + { + return 0; + } + + return (decimal) coinData.MarketData.CurrentPrice[UsdSymbol].Value; + } + catch (Exception ex) + { + Logger.LogError(ex, $"can not get :{coinId} price."); + throw; + } + } + + private async Task RequestAsync(Func> task) + { + await _requestLimitProvider.RecordRequestAsync(); + return await task(); + } + } +} \ No newline at end of file diff --git a/modules/AElf.TokenPrice.CoinGecko/IRequestLimitProvider.cs b/modules/AElf.TokenPrice.CoinGecko/IRequestLimitProvider.cs new file mode 100644 index 00000000..21f54c0d --- /dev/null +++ b/modules/AElf.TokenPrice.CoinGecko/IRequestLimitProvider.cs @@ -0,0 +1,48 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Caching.Distributed; +using Volo.Abp.Caching; +using Volo.Abp.DependencyInjection; + +namespace AElf.TokenPrice.CoinGecko +{ + public interface IRequestLimitProvider + { + Task RecordRequestAsync(); + } + + public class RequestLimitProvider : IRequestLimitProvider, ISingletonDependency + { + private readonly IDistributedCache _requestTimeCache; + + // The CoinGecko limit 100 requests/minute; + private const int MaxRequestTime = 90; + + public RequestLimitProvider(IDistributedCache requestTimeCache) + { + _requestTimeCache = requestTimeCache; + } + + public async Task RecordRequestAsync() + { + var requestTime = await _requestTimeCache.GetOrAddAsync(CoinGeckoApiConsts.RequestTimeCacheKey, + async () => new RequestTime(), () => new DistributedCacheEntryOptions + { + AbsoluteExpiration = DateTimeOffset.UtcNow.AddMinutes(1) + }); + requestTime.Time += 1; + + if (requestTime.Time > MaxRequestTime) + { + throw new RequestExceedingLimitException("The request exceeded the limit."); + } + + await _requestTimeCache.SetAsync(CoinGeckoApiConsts.RequestTimeCacheKey, requestTime); + } + } + + public class RequestTime + { + public int Time { get; set; } + } +} \ No newline at end of file diff --git a/modules/AElf.TokenPrice.CoinGecko/RequestExceedingLimitException.cs b/modules/AElf.TokenPrice.CoinGecko/RequestExceedingLimitException.cs new file mode 100644 index 00000000..42eb516d --- /dev/null +++ b/modules/AElf.TokenPrice.CoinGecko/RequestExceedingLimitException.cs @@ -0,0 +1,26 @@ +using System; +using System.Runtime.Serialization; + +namespace AElf.TokenPrice.CoinGecko +{ + public class RequestExceedingLimitException: Exception + { + public RequestExceedingLimitException() + { + } + + public RequestExceedingLimitException(string message) : base(message) + { + } + + public RequestExceedingLimitException(string message, Exception inner) : base(message, inner) + { + } + + protected RequestExceedingLimitException( + SerializationInfo info, + StreamingContext context) : base(info, context) + { + } + } +} \ No newline at end of file diff --git a/src/AElf.EventHandler/AElf.EventHandler.csproj b/src/AElf.EventHandler/AElf.EventHandler.csproj index d73c2253..762dd781 100644 --- a/src/AElf.EventHandler/AElf.EventHandler.csproj +++ b/src/AElf.EventHandler/AElf.EventHandler.csproj @@ -10,7 +10,6 @@ - diff --git a/src/AElf.EventHandler/EventHandlerAppModule.cs b/src/AElf.EventHandler/EventHandlerAppModule.cs index 385488d0..4d6ba6b0 100644 --- a/src/AElf.EventHandler/EventHandlerAppModule.cs +++ b/src/AElf.EventHandler/EventHandlerAppModule.cs @@ -80,10 +80,9 @@ public override void ConfigureServices(ServiceConfigurationContext context) context.Services.AddTransient(typeof(ILogEventProcessor<>), typeof(LogEventProcessorBase<>)); context.Services.AddSingleton(); } - public override void OnApplicationInitialization(ApplicationInitializationContext context) { - //context.AddBackgroundWorkerAsync(); + context.AddBackgroundWorkerAsync(); //context.AddBackgroundWorkerAsync(); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Extensions/AElfClientExtension.cs b/src/AElf.EventHandler/Extensions/AElfClientExtension.cs index d82dd145..49d56b82 100644 --- a/src/AElf.EventHandler/Extensions/AElfClientExtension.cs +++ b/src/AElf.EventHandler/Extensions/AElfClientExtension.cs @@ -1,4 +1,4 @@ -using AElf.Client.Service; +using AElf.Client; namespace AElf.EventHandler { diff --git a/src/AElf.EventHandler/Extensions/TransactionFeeExtension.cs b/src/AElf.EventHandler/Extensions/TransactionFeeExtension.cs index 2a6cbe02..c7353add 100644 --- a/src/AElf.EventHandler/Extensions/TransactionFeeExtension.cs +++ b/src/AElf.EventHandler/Extensions/TransactionFeeExtension.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using AElf.Client.Dto; -using AElf.Client.MultiToken; +using AElf.Contracts.MultiToken; using AElf.Types; using Google.Protobuf; diff --git a/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs index 442087c4..efeff342 100644 --- a/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs +++ b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs @@ -4,7 +4,6 @@ using System.Threading.Tasks; using AElf.Client.Bridge; using AElf.Client.Core.Options; -using AElf.Client.Election; using AElf.Client.MerkleTreeContract; using AElf.Client.Oracle; using AElf.Contracts.MerkleTreeContract; diff --git a/src/AElf.EventHandler/appsettings.json b/src/AElf.EventHandler/appsettings.json index 72f78060..24bd6c5f 100644 --- a/src/AElf.EventHandler/appsettings.json +++ b/src/AElf.EventHandler/appsettings.json @@ -36,22 +36,10 @@ { "Alias": "Ean", "PrivateKey": "8cc296e44d9e8881942e75a21ebc116ed3f29e39e0eaace1c92dc21e86d215c3", - "Address": "2AiXjNszZwUMdonm2RYb3GsB3aLUU3hkD1fxoazMwqPAamerLQ", - "Password": "aelftest" - }, - { - "Alias": "Test1", - "Address": "215tht8WyakoxNK4SvsR132jChydxE27RtJN8HSk1UXxuDQnmM", - "Password": "aelftest" }, { "Alias": "Test2", "PrivateKey": "5e2f12d13e4527ad1128e07db00f1614ec6b8b51662e68d4fdb42125ab384195" - }, - { - "Alias": "eanz", - "Address": "2HeW7S9HZrbRJZeivMppUuUY3djhWdfVnP5zrDsz8wqq6hKMfT", - "Password": "zhaoyiqi" } ] }, @@ -80,11 +68,6 @@ { "Alias": "Ean", "PrivateKey": "99e3b0664a3d38d89937c8549ddd1d9e725426c5cdfad05ce55d15464c49b5c0" - }, - { - "Alias": "Test1", - "Address": "0xB72ca421Ad2f462db0b91aB9428EE1947Cf3d59e", - "Password": "test" } ] }, diff --git a/src/AElf.PriceWorker/AElf.PriceWorker.csproj b/src/AElf.PriceWorker/AElf.PriceWorker.csproj new file mode 100644 index 00000000..4f4ab383 --- /dev/null +++ b/src/AElf.PriceWorker/AElf.PriceWorker.csproj @@ -0,0 +1,32 @@ + + + + Exe + net6.0 + + + + + + + + + + + + + + + + PreserveNewest + Always + + + + + + + + + + diff --git a/src/AElf.PriceWorker/AElfPriceWorkerHostedService.cs b/src/AElf.PriceWorker/AElfPriceWorkerHostedService.cs new file mode 100644 index 00000000..9016248e --- /dev/null +++ b/src/AElf.PriceWorker/AElfPriceWorkerHostedService.cs @@ -0,0 +1,33 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; +using Volo.Abp; + +namespace AElf.PriceWorker; + +public class AElfPriceWorkerHostedService : IHostedService +{ + private readonly IAbpApplicationWithExternalServiceProvider _application; + private readonly IServiceProvider _serviceProvider; + + public AElfPriceWorkerHostedService( + IAbpApplicationWithExternalServiceProvider application, + IServiceProvider serviceProvider) + { + _application = application; + _serviceProvider = serviceProvider; + } + + public Task StartAsync(CancellationToken cancellationToken) + { + _application.Initialize(_serviceProvider); + return Task.CompletedTask; + } + + public Task StopAsync(CancellationToken cancellationToken) + { + _application.Shutdown(); + return Task.CompletedTask; + } +} diff --git a/src/AElf.PriceWorker/AElfPriceWorkerModule.cs b/src/AElf.PriceWorker/AElfPriceWorkerModule.cs new file mode 100644 index 00000000..4235f928 --- /dev/null +++ b/src/AElf.PriceWorker/AElfPriceWorkerModule.cs @@ -0,0 +1,36 @@ +using AElf.BlockchainTransactionFee; +using AElf.Client.Bridge; +using AElf.Client.Core; +using AElf.TokenPrice; +using AElf.TokenPrice.CoinGecko; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; +using Volo.Abp.Autofac; +using Volo.Abp.BackgroundWorkers; +using Volo.Abp.Modularity; + +namespace AElf.PriceWorker; + +[DependsOn( + typeof(AbpAutofacModule), + typeof(AElfClientModule), + typeof(AElfClientBridgeModule), + typeof(AElfBlockchainTransactionFeeModule), + typeof(AElfTokenPriceAbstractionsModule), + typeof(AElfTokenPriceCoinGeckoModule), + typeof(AbpBackgroundWorkersModule) +)] +public class AElfPriceWorkerModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + var configuration = context.Services.GetConfiguration(); + Configure(configuration.GetSection("PriceSync")); + context.Services.AddHostedService(); + } + + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + context.AddBackgroundWorkerAsync(); + } +} \ No newline at end of file diff --git a/src/AElf.PriceWorker/PriceSyncOptions.cs b/src/AElf.PriceWorker/PriceSyncOptions.cs new file mode 100644 index 00000000..c4430052 --- /dev/null +++ b/src/AElf.PriceWorker/PriceSyncOptions.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace AElf.PriceWorker; + +public class PriceSyncOptions +{ + public List SourceChains { get; set; } = new(); + public List TargetChains { get; set; } = new(); +} \ No newline at end of file diff --git a/src/AElf.PriceWorker/PriceSyncWorker.cs b/src/AElf.PriceWorker/PriceSyncWorker.cs new file mode 100644 index 00000000..e06b4ce2 --- /dev/null +++ b/src/AElf.PriceWorker/PriceSyncWorker.cs @@ -0,0 +1,66 @@ +using System; +using System.Threading.Tasks; +using AElf.BlockchainTransactionFee; +using AElf.Client.Bridge; +using AElf.Contracts.Bridge; +using AElf.TokenPrice; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using Volo.Abp.BackgroundWorkers; +using Volo.Abp.Threading; + +namespace AElf.PriceWorker; + +public class PriceSyncWorker : AsyncPeriodicBackgroundWorkerBase +{ + private readonly PriceSyncOptions _priceSyncOptions; + private readonly IBridgeService _bridgeService; + private readonly IBlockchainTransactionFeeService _blockchainTransactionFeeService; + private readonly ITokenPriceService _tokenPriceService; + + public PriceSyncWorker(AbpAsyncTimer timer, IServiceScopeFactory serviceScopeFactory, + IOptionsSnapshot priceSyncOptions, IBridgeService bridgeService, + IBlockchainTransactionFeeService blockchainTransactionFeeService, ITokenPriceService tokenPriceService) : base( + timer, serviceScopeFactory) + { + _bridgeService = bridgeService; + _blockchainTransactionFeeService = blockchainTransactionFeeService; + _tokenPriceService = tokenPriceService; + _priceSyncOptions = priceSyncOptions.Value; + + Timer.Period = 1000 * 1; + } + + protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) + { + var setGasPriceInput = new SetGasPriceInput(); + var setPriceRatioInput = new SetPriceRatioInput(); + + var elfPrice = await _tokenPriceService.GetPriceAsync("ELF"); + var ethPrice = await _tokenPriceService.GetPriceAsync("ETH"); + var ratio = (long)(ethPrice * (decimal)Math.Pow(10, 8) / elfPrice); + + foreach (var item in _priceSyncOptions.SourceChains) + { + var gasFee = await _blockchainTransactionFeeService.GetTransactionFeeAsync(item); + var feeWei = (long)(gasFee.Fee * (decimal)Math.Pow(10, 9)); + setGasPriceInput.GasPriceList.Add(new GasPrice + { + ChainId = item, + GasPrice_ = feeWei + }); + + setPriceRatioInput.Value.Add(new PriceRatio + { + TargetChainId = item, + PriceRatio_ = ratio + }); + } + + foreach (var item in _priceSyncOptions.TargetChains) + { + await _bridgeService.SetGasPriceAsync(item, setGasPriceInput); + await _bridgeService.SetPriceRatioAsync(item, setPriceRatioInput); + } + } +} \ No newline at end of file diff --git a/src/AElf.PriceWorker/Program.cs b/src/AElf.PriceWorker/Program.cs new file mode 100644 index 00000000..77454bd8 --- /dev/null +++ b/src/AElf.PriceWorker/Program.cs @@ -0,0 +1,59 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Serilog; +using Serilog.Events; + +namespace AElf.PriceWorker +{ + public class Program + { + public static async Task Main(string[] args) + { + var configuration = new ConfigurationBuilder() + .AddJsonFile("appsettings.json") + .Build(); + + Log.Logger = new LoggerConfiguration() +#if DEBUG + .MinimumLevel.Debug() +#else + .MinimumLevel.Information() +#endif + .MinimumLevel.Override("Microsoft", LogEventLevel.Information) + .Enrich.FromLogContext() + .ReadFrom.Configuration(configuration) +#if DEBUG + .WriteTo.Async(c => c.Console()) +#endif + .CreateLogger(); + + try + { + Log.Information("Starting AElf.PriceWorker."); + await CreateHostBuilder(args).RunConsoleAsync(); + return 0; + } + catch (Exception ex) + { + Log.Fatal(ex, "Host terminated unexpectedly!"); + return 1; + } + finally + { + Log.CloseAndFlush(); + } + } + + internal static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddApplication(); + }) + .UseAutofac() + .UseSerilog(); + } +} \ No newline at end of file diff --git a/src/AElf.PriceWorker/appsettings.json b/src/AElf.PriceWorker/appsettings.json new file mode 100644 index 00000000..642c2404 --- /dev/null +++ b/src/AElf.PriceWorker/appsettings.json @@ -0,0 +1,75 @@ +{ + "AElfClient": { + "ClientConfigList": [ + { + "Alias": "Example", + "Endpoint": "http://192.168.0.31:6800", + "UserName": "", + "Password": "", + "Timeout": 100 + } + ] + }, + "AElfAccount": { + "KeyDirectory": "", + "AccountConfigList": [ + { + "Alias": "Ean", + "PrivateKey": "8cc296e44d9e8881942e75a21ebc116ed3f29e39e0eaace1c92dc21e86d215c3", + }, + { + "Alias": "Test2", + "PrivateKey": "5e2f12d13e4527ad1128e07db00f1614ec6b8b51662e68d4fdb42125ab384195" + } + ] + }, + "AElfClientConfig": { + "ClientAlias": "TestNetSideChain2", + "MainChainClientAlias": "TestNetMainChain", + "SideChainClientAlias": "TestNetSideChain2", + "AccountAlias": "eanz" + }, + "AElfContract": { + "ContractDirectory": "", + "ContractAddressList": { + "MerkleTreeContractAddress": "2RHf2fxsnEaM3wb6N1yGqPupNZbcCY98LgWbGSFWmWzgEs5Sjo", + "BridgeContractAddress": "pykr77ft9UUKJZLVq15wCH8PinBSjVRQ12sD1Ayq92mKFsJ1i", + "OracleContractAddress": "2ZpYFeE4yWjrcKLBoj1iwbfYnbo9hK7exvfGTdqcq77QSxpzNH" + } + }, + "PriceSync": { + "SourceChains": ["Ethereum","BSC"], + "TargetChains": ["AELF", "tDVW"] + }, + "TokenPrice": { + "CoinIdMapping": { + "ELF": "aelf", + "ETH": "ethereum", + "BNB": "binancecoin" + } + }, + "ChainExplorerApi": { + "ApiKeys": { + "Ethereum": "", + "BSC": "" + } + }, + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + }, + "Serilog": { + "WriteTo": [ + { + "Name": "RollingFile", + "Args": { + "pathFormat": "Logs/log-{Date}.log", + "retainedFileCountLimit": 2 + } + } + ] + } +} \ No newline at end of file From 87fe4db1e89cc978752f7165ddf7ecd11f2d14c8 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Tue, 23 Aug 2022 16:07:14 +0800 Subject: [PATCH 17/66] feat: add multi chain contract address --- modules/AElf.Client.Bridge/BridgeService.cs | 9 +- .../AElf.Client.Core/ContractServiceBase.cs | 45 ++--- .../Options/AElfContractOptions.cs | 2 +- .../MerkleTreeContract.cs | 7 +- modules/AElf.Client.Oracle/OracleService.cs | 6 +- modules/AElf.Client.Report/ReportService.cs | 7 +- .../Options/EthereumContractOptions.cs | 2 +- .../AggregateDataReceivedLogEventProcessor.cs | 2 +- .../Processors/ILogEventProcessor.cs | 2 +- ...IrreversibleBlockFoundLogEventProcessor.cs | 166 +----------------- .../Processors/LogEventProcessorBase.cs | 19 +- .../QueryCompletedLogEventProcessor.cs | 2 +- .../QueryCreatedLogEventProcessor.cs | 2 +- .../QueryDataRecordedLogEventProcessor.cs | 31 ---- .../ReportConfirmedLogEventProcessor.cs | 2 +- .../ReportProposedLogEventProcessor.cs | 2 +- ...ntCommitmentsCollectedLogEventProcessor.cs | 2 +- .../TransactionResultListEventHandler.cs | 10 +- .../Workers/ReceiptSyncWorker.cs | 4 +- src/AElf.EventHandler/appsettings.json | 14 +- src/AElf.PriceWorker/appsettings.json | 8 +- 21 files changed, 84 insertions(+), 260 deletions(-) delete mode 100644 src/AElf.EventHandler/Processors/QueryDataRecordedLogEventProcessor.cs diff --git a/modules/AElf.Client.Bridge/BridgeService.cs b/modules/AElf.Client.Bridge/BridgeService.cs index 5a90e03a..38aa1f92 100644 --- a/modules/AElf.Client.Bridge/BridgeService.cs +++ b/modules/AElf.Client.Bridge/BridgeService.cs @@ -20,11 +20,10 @@ public class BridgeService : ContractServiceBase, IBridgeService, ITransientDepe private readonly IAElfClientService _clientService; private readonly AElfContractOptions _contractOptions; - private const string ContractName = "BridgeContractAddress"; + protected override string SmartContractName { get; }= "BridgeContractAddress"; public BridgeService(IAElfClientService clientService, - IOptionsSnapshot contractOptions) : base(clientService, - Address.FromBase58(contractOptions.Value.ContractAddressList[ContractName])) + IOptionsSnapshot contractOptions) { _clientService = clientService; _contractOptions = contractOptions.Value; @@ -32,7 +31,7 @@ public BridgeService(IAElfClientService clientService, public async Task GetSpaceIdBySwapIdAsync(string clientAlias, Hash swapId) { - var result = await _clientService.ViewAsync(_contractOptions.ContractAddressList["ContractName"], "GetSpaceIdBySwapId", + var result = await _clientService.ViewAsync(GetContractAddress(clientAlias), "GetSpaceIdBySwapId", swapId, clientAlias); return Hash.LoadFromByteArray(result); @@ -57,4 +56,6 @@ public async Task SetPriceRatioAsync(string clientAlias, TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) }; } + + } \ No newline at end of file diff --git a/modules/AElf.Client.Core/ContractServiceBase.cs b/modules/AElf.Client.Core/ContractServiceBase.cs index 3120bbf5..1f18f104 100644 --- a/modules/AElf.Client.Core/ContractServiceBase.cs +++ b/modules/AElf.Client.Core/ContractServiceBase.cs @@ -1,43 +1,23 @@ +using AElf.Client.Core.Options; using Google.Protobuf; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; using Volo.Abp.Threading; namespace AElf.Client.Core; -public class ContractServiceBase +public abstract class ContractServiceBase { - private readonly IAElfClientService _clientService; - protected string SmartContractName { get; } - protected Address? ContractAddress { get; set; } - + public IAElfClientService ClientService { get; set; } + public IOptionsSnapshot ContractOptions { get; set; } + protected abstract string SmartContractName { get; } public ILogger Logger { get; set; } - protected ContractServiceBase(IAElfClientService clientService, string smartContractName) - { - _clientService = clientService; - SmartContractName = smartContractName; - } - - protected ContractServiceBase(IAElfClientService clientService, Address contractAddress) - { - _clientService = clientService; - ContractAddress = contractAddress; - } - protected async Task PerformSendTransactionAsync(string methodName, IMessage parameter, - string useClientAlias, string? smartContractName = null) + string useClientAlias) { - if (smartContractName == null) - { - smartContractName = SmartContractName; - } - - if (ContractAddress != null) - { - return await _clientService.SendAsync(ContractAddress.ToBase58(), methodName, parameter, useClientAlias); - } - - return await _clientService.SendSystemAsync(smartContractName, methodName, parameter, useClientAlias); + var contractAddress = GetContractAddress(useClientAlias); + return await ClientService.SendAsync(contractAddress, methodName, parameter, useClientAlias); } protected async Task PerformGetTransactionResultAsync(string transactionId, @@ -46,10 +26,15 @@ protected async Task PerformGetTransactionResultAsync(string TransactionResult txResult; do { - txResult = await _clientService.GetTransactionResultAsync(transactionId, useClientAlias); + txResult = await ClientService.GetTransactionResultAsync(transactionId, useClientAlias); } while (txResult.Status == TransactionResultStatus.Pending); Logger.LogInformation("{TxResult}", txResult); return txResult; } + + protected string GetContractAddress(string chainId) + { + return ContractOptions.Value.ContractAddressList[chainId][SmartContractName]; + } } \ No newline at end of file diff --git a/modules/AElf.Client.Core/Options/AElfContractOptions.cs b/modules/AElf.Client.Core/Options/AElfContractOptions.cs index 1a4d3e4e..fe2161c2 100644 --- a/modules/AElf.Client.Core/Options/AElfContractOptions.cs +++ b/modules/AElf.Client.Core/Options/AElfContractOptions.cs @@ -3,5 +3,5 @@ namespace AElf.Client.Core.Options; public class AElfContractOptions { public string ContractDirectory { get; set; } - public Dictionary ContractAddressList { get; set; } = new(); + public Dictionary> ContractAddressList { get; set; } = new(); } \ No newline at end of file diff --git a/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs b/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs index 9720b737..2d8513a4 100644 --- a/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs +++ b/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs @@ -21,11 +21,10 @@ public class MerkleTreeContractService : ContractServiceBase, IMerkleTreeContrac private readonly IAElfClientService _clientService; private readonly AElfContractOptions _contractOptions; - private const string ContractName = "MerkleTreeContractAddress"; + protected override string SmartContractName { get; } = "MerkleTreeContract"; public MerkleTreeContractService(IAElfClientService clientService, - IOptionsSnapshot contractOptions) : base(clientService, - Address.FromBase58(contractOptions.Value.ContractAddressList[ContractName])) + IOptionsSnapshot contractOptions) { _clientService = clientService; _contractOptions = contractOptions.Value; @@ -43,7 +42,7 @@ public async Task CreateSpaceAsync(string clientAlias, Cr public async Task GetLastLeafIndexAsync(string clientAlias, GetLastLeafIndexInput getLastLeafIndexInput) { - var result = await _clientService.ViewAsync(_contractOptions.ContractAddressList[ContractName], "GetLastLeafIndex", + var result = await _clientService.ViewAsync(GetContractAddress(clientAlias), "GetLastLeafIndex", getLastLeafIndexInput, clientAlias); var actualResult = new Int64Value(); actualResult.MergeFrom(result); diff --git a/modules/AElf.Client.Oracle/OracleService.cs b/modules/AElf.Client.Oracle/OracleService.cs index 23698c44..dfd6b729 100644 --- a/modules/AElf.Client.Oracle/OracleService.cs +++ b/modules/AElf.Client.Oracle/OracleService.cs @@ -23,10 +23,11 @@ public class OracleService : ContractServiceBase, IOracleService, ITransientDepe private readonly IAElfClientService _clientService; private readonly AElfClientConfigOptions _clientConfigOptions; + protected override string SmartContractName { get; } = "OracleContract"; + public OracleService(IAElfClientService clientService, IOptionsSnapshot clientConfigOptions, - IOptionsSnapshot contractOptions) : base(clientService, - Address.FromBase58(contractOptions.Value.ContractAddressList["OracleContractAddress"])) + IOptionsSnapshot contractOptions) { _clientService = clientService; _clientConfigOptions = clientConfigOptions.Value; @@ -71,4 +72,5 @@ public async Task CancelQueryAsync(string clientAlias, Ha TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) }; } + } \ No newline at end of file diff --git a/modules/AElf.Client.Report/ReportService.cs b/modules/AElf.Client.Report/ReportService.cs index b92b0917..a9b60f23 100644 --- a/modules/AElf.Client.Report/ReportService.cs +++ b/modules/AElf.Client.Report/ReportService.cs @@ -21,10 +21,11 @@ public class ReportService : ContractServiceBase, IReportService, ITransientDepe private readonly IAElfClientService _clientService; private readonly AElfClientConfigOptions _clientConfigOptions; + protected override string SmartContractName { get; } = "ReportContract"; + public ReportService(IAElfClientService clientService, IOptionsSnapshot clientConfigOptions, - IOptionsSnapshot contractOptions) : base(clientService, - Address.FromBase58(contractOptions.Value.ContractAddressList["ReportContractAddress"])) + IOptionsSnapshot contractOptions) { _clientService = clientService; _clientConfigOptions = clientConfigOptions.Value; @@ -59,4 +60,6 @@ public async Task RejectReportAsync(string clientAlias, R TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) }; } + + } \ No newline at end of file diff --git a/modules/AElf.Nethereum.Core/Options/EthereumContractOptions.cs b/modules/AElf.Nethereum.Core/Options/EthereumContractOptions.cs index 97888c7f..cf469fe1 100644 --- a/modules/AElf.Nethereum.Core/Options/EthereumContractOptions.cs +++ b/modules/AElf.Nethereum.Core/Options/EthereumContractOptions.cs @@ -2,7 +2,7 @@ namespace AElf.Nethereum.Core.Options; public class EthereumContractOptions { - public string AbiFileDirectory { get; set; } + public string AbiFileDirectory { get; set; } = "ContractBuild"; public Dictionary ContractInfoList { get; set; } } diff --git a/src/AElf.EventHandler/Processors/AggregateDataReceivedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/AggregateDataReceivedLogEventProcessor.cs index 8e887272..5e639d07 100644 --- a/src/AElf.EventHandler/Processors/AggregateDataReceivedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/AggregateDataReceivedLogEventProcessor.cs @@ -19,7 +19,7 @@ public AggregateDataReceivedLogEventProcessor(IOptionsSnapshot "IntegerAggregator"; + public override string ContractName => "IntegerAggregatorContract"; public override Task ProcessAsync(LogEvent logEvent, EventContext context) { diff --git a/src/AElf.EventHandler/Processors/ILogEventProcessor.cs b/src/AElf.EventHandler/Processors/ILogEventProcessor.cs index faafc6e0..b57871f6 100644 --- a/src/AElf.EventHandler/Processors/ILogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ILogEventProcessor.cs @@ -15,6 +15,6 @@ public interface ILogEventProcessor { string ContractName { get; } Task ProcessAsync(LogEvent logEvent, EventContext context); - bool IsMatch(string contractAddress, string logEventName); + bool IsMatch(int chainId, string contractAddress, string logEventName); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs index 1281d6ca..4575f178 100644 --- a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs @@ -1,182 +1,32 @@ -using System.Collections.Generic; -using System.IO; -using System.Linq; using System.Threading.Tasks; -using AElf.Client.Bridge; using AElf.Client.Core.Extensions; using AElf.Client.Core.Options; -using AElf.Client.MerkleTreeContract; -using AElf.Client.Oracle; using AElf.Contracts.Consensus.AEDPoS; -using AElf.Contracts.MerkleTreeContract; -using AElf.Contracts.Oracle; -using AElf.Nethereum.Bridge; -using AElf.Nethereum.Core; -using AElf.Nethereum.Core.Options; using AElf.Types; -using AutoMapper.Mappers; -using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Org.BouncyCastle.Math; -using BigInteger = System.Numerics.BigInteger; namespace AElf.EventHandler; public class IrreversibleBlockFoundLogEventProcessor : LogEventProcessorBase { - private readonly AElfContractOptions _contractAddressOptions; - private readonly BridgeOptions _bridgeOptions; - private readonly EthereumContractOptions _ethereumContractOptions; - private readonly OracleOptions _oracleOptions; - private readonly ILatestQueriedReceiptCountProvider _latestQueriedReceiptCountProvider; - private readonly BridgeService _bridgeContractService; - private readonly IOracleService _oracleService; - private readonly IBridgeOutService _bridgeOutService; - private readonly INethereumService _nethereumService; - private readonly IMerkleTreeContractService _merkleTreeContractService; - private readonly ILogger _logger; - private readonly string _lockAbi; - private readonly AElfChainAliasOptions _aelfChainAliasOptions; + private readonly ITransmitTransactionProvider _transmitTransactionProvider; public IrreversibleBlockFoundLogEventProcessor( IOptionsSnapshot contractAddressOptions, - IOptionsSnapshot bridgeOptions, - IOptionsSnapshot ethereumContractOptions, - IOptionsSnapshot oracleOptions, - ILatestQueriedReceiptCountProvider latestQueriedReceiptCountProvider, - IOracleService oracleService, - IBridgeOutService bridgeOutService, - BridgeService bridgeService, - IMerkleTreeContractService merkleTreeContractService, - INethereumService nethereumService, - ILogger logger, - IOptionsSnapshot aelfChainAliasOptions) : base(contractAddressOptions) + ITransmitTransactionProvider transmitTransactionProvider) : base(contractAddressOptions) { - _ethereumContractOptions = ethereumContractOptions.Value; - _latestQueriedReceiptCountProvider = latestQueriedReceiptCountProvider; - _oracleService = oracleService; - _merkleTreeContractService = merkleTreeContractService; - _logger = logger; - _bridgeOptions = bridgeOptions.Value; - _bridgeOutService = bridgeOutService; - _oracleOptions = oracleOptions.Value; - _contractAddressOptions = contractAddressOptions.Value; - _bridgeContractService = bridgeService; - _nethereumService = nethereumService; - _aelfChainAliasOptions = aelfChainAliasOptions.Value; - - { - var file = Path.Combine(_ethereumContractOptions.AbiFileDirectory, - _ethereumContractOptions.ContractInfoList["Bridge"].AbiFileName); - if (!string.IsNullOrEmpty(file)) - { - if (!File.Exists(file)) - { - _logger.LogError($"Cannot found file {file}"); - } - - _lockAbi = JsonHelper.ReadJson(file, "abi"); - } - } + _transmitTransactionProvider = transmitTransactionProvider; } - public override string ContractName => "Consensus"; + public override string ContractName => "ConsensusContract"; public override async Task ProcessAsync(LogEvent logEvent, EventContext context) { var libFound = new IrreversibleBlockFound(); libFound.MergeFrom(logEvent); - _logger.LogInformation($"IrreversibleBlockFound: {libFound}"); - - if (!_bridgeOptions.IsSendQuery) return; - var bridgeItemsMap = new Dictionary<(string, string), List>(); - var sendQueryList = new Dictionary(); - var tokenIndex = new Dictionary(); - foreach (var bridgeItem in _bridgeOptions.Bridges) - { - bridgeItemsMap[(bridgeItem.EthereumClientAlias, bridgeItem.EthereumBridgeOutContractAddress)].Add(bridgeItem); - } - - foreach (var (aliasAddress,item) in bridgeItemsMap) - { - var tokenList = item.Select(i => i.OriginToken).ToList(); - var targetChainIdList = item.Select(i => i.TargetChainId).ToList(); - var sendReceiptIndexDto = await _bridgeOutService.GetTransferReceiptIndexAsync(aliasAddress.Item1,aliasAddress.Item2,tokenList,targetChainIdList); - for (var i = 0; i < tokenList.Count; i++) - { - tokenIndex[tokenList[i]] = sendReceiptIndexDto.Indexes[i]; - sendQueryList[item[i].SwapId] = item[i]; - } - } - - foreach (var (swapId,item) in sendQueryList) - { - await SendQueryAsync(context.ChainId.ToString(),item,tokenIndex[item.OriginToken]); - } - - - } - - // private async Task QueryEthereumReceiptIndex(IGrouping item) - // { - // } - private async Task SendQueryAsync(string chainId,BridgeItem bridgeItem, BigInteger tokenIndex) - { - var swapId = bridgeItem.SwapId; - var clientAlias = _aelfChainAliasOptions.Mapping[chainId]; - var spaceId = await _bridgeContractService.GetSpaceIdBySwapIdAsync(clientAlias,Hash.LoadFromBase64(swapId)); - var lastRecordedLeafIndex = (await _merkleTreeContractService.GetLastLeafIndexAsync( - clientAlias,new GetLastLeafIndexInput - { - SpaceId = spaceId - })).Value; - if (lastRecordedLeafIndex == -2) - { - _logger.LogInformation($"Space of id {spaceId} is not created. "); - return; - } - if (_latestQueriedReceiptCountProvider.Get(swapId) == 0) - { - _latestQueriedReceiptCountProvider.Set(swapId,lastRecordedLeafIndex); - } - _logger.LogInformation($"Last recorded leaf index : {lastRecordedLeafIndex}."); - if (tokenIndex <= _latestQueriedReceiptCountProvider.Get(swapId)) - { - return; - } - - var notRecordLeafCount = tokenIndex - lastRecordedLeafIndex; - if (notRecordLeafCount > 0) - { - var queryInput = new QueryInput - { - Payment = _bridgeOptions.QueryPayment, - QueryInfo = new QueryInfo - { - Title = $"record_receipt_{swapId}", - Options = {(lastRecordedLeafIndex + 1).ToString(), notRecordLeafCount.ToString()} - }, - AggregatorContractAddress = _contractAddressOptions.ContractAddressList["StringAggregator"] - .ConvertAddress(), - CallbackInfo = new CallbackInfo - { - ContractAddress = - _contractAddressOptions.ContractAddressList["Bridge"].ConvertAddress(), - MethodName = "RecordReceiptHash" - }, - DesignatedNodeList = new AddressList - { - Value = {bridgeItem.QueryToAddress.ConvertAddress()} - } - }; - - _logger.LogInformation($"About to send Query transaction for token swapping, QueryInput: {queryInput}"); - - var sendTxResult = await _oracleService.QueryAsync(clientAlias,queryInput); - _logger.LogInformation($"Query tx id: {sendTxResult.Transaction.GetHash()}"); - _latestQueriedReceiptCountProvider.Set(swapId, (int) tokenIndex + 1); - _logger.LogInformation( - $"Latest queried receipt count: {_latestQueriedReceiptCountProvider.Get(swapId)}"); - } + // _logger.LogInformation($"IrreversibleBlockFound: {libFound}"); + // + // + // await _transmitTransactionProvider.SendByLibAsync() } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs b/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs index 0162e94c..f9e1d312 100644 --- a/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs +++ b/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs @@ -21,16 +21,23 @@ public LogEventProcessorBase(IOptionsSnapshot contractAddre public abstract Task ProcessAsync(LogEvent logEvent, EventContext context); - public string GetContractAddress() + public string GetContractAddress(int chainId) { - return _contractOptions.ContractAddressList.TryGetValue(ContractName, out var contractAddress) - ? contractAddress - : string.Empty; + if (_contractOptions.ContractAddressList.TryGetValue(ChainHelper.ConvertChainIdToBase58(chainId), + out var contractAddresses)) + { + if (contractAddresses.TryGetValue(ContractName, out var contractAddress)) + { + return contractAddress; + } + } + + return string.Empty; } - public bool IsMatch(string contractAddress, string logEventName) + public bool IsMatch(int chainId, string contractAddress, string logEventName) { - var actualContractAddress = GetContractAddress(); + var actualContractAddress = GetContractAddress(chainId); if (actualContractAddress == string.Empty) { return false; diff --git a/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs index 44a9bedf..73ac70cd 100644 --- a/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs @@ -11,7 +11,7 @@ namespace AElf.EventHandler; internal class QueryCompletedLogEventProcessor : LogEventProcessorBase { - public override string ContractName => "Oracle"; + public override string ContractName => "OracleContract"; private readonly ILogger _logger; public QueryCompletedLogEventProcessor(ILogger logger, diff --git a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs index e81cdc70..7daae193 100644 --- a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs @@ -19,7 +19,7 @@ internal class QueryCreatedLogEventProcessor : LogEventProcessorBase "Oracle"; + public override string ContractName => "OracleContract"; private readonly ILogger _logger; public QueryCreatedLogEventProcessor( diff --git a/src/AElf.EventHandler/Processors/QueryDataRecordedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/QueryDataRecordedLogEventProcessor.cs deleted file mode 100644 index d82efb82..00000000 --- a/src/AElf.EventHandler/Processors/QueryDataRecordedLogEventProcessor.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Threading.Tasks; -using AElf.Client.Core.Options; -using AElf.Contracts.OracleUser; -using AElf.Types; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; -using Volo.Abp.DependencyInjection; - -namespace AElf.EventHandler; - -internal class QueryDataRecordedLogEventProcessor : LogEventProcessorBase, ITransientDependency -{ - private readonly ILogger _logger; - - public QueryDataRecordedLogEventProcessor(IOptionsSnapshot contractAddressOptions, - ILogger logger) : base(contractAddressOptions) - { - _logger = logger; - } - - public override string ContractName => "OracleUser"; - - public override Task ProcessAsync(LogEvent logEvent, EventContext context) - { - var queryDataRecorded = new QueryDataRecorded(); - queryDataRecorded.MergeFrom(logEvent); - _logger.LogInformation($"[Callback] Query data recorded: {queryDataRecorded}"); - - return Task.CompletedTask; - } -} \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs index e3bc9661..a65e216f 100644 --- a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs @@ -16,7 +16,7 @@ namespace AElf.EventHandler; internal class ReportConfirmedLogEventProcessor : LogEventProcessorBase { - public override string ContractName => "Report"; + public override string ContractName => "ReportContract"; private readonly ILogger _logger; private readonly ISignatureRecoverableInfoProvider _signaturesRecoverableInfoProvider; private readonly EthereumContractOptions _ethereumContractOptions; diff --git a/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs index 22b1e752..6998360a 100644 --- a/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs @@ -21,7 +21,7 @@ internal class ReportProposedLogEventProcessor : LogEventProcessorBase "Report"; + public override string ContractName => "ReportContract"; private readonly ILogger _logger; public ReportProposedLogEventProcessor( diff --git a/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs index 01b3502a..edd1cd4b 100644 --- a/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs @@ -37,7 +37,7 @@ public SufficientCommitmentsCollectedLogEventProcessor( _aelfChainAliasOptions = aelfChainAliasOptions.Value; } - public override string ContractName => "Oracle"; + public override string ContractName => "OracleContract"; public override async Task ProcessAsync(LogEvent logEvent, EventContext context) { diff --git a/src/AElf.EventHandler/TransactionResultListEventHandler.cs b/src/AElf.EventHandler/TransactionResultListEventHandler.cs index 61baa8d1..64f96943 100644 --- a/src/AElf.EventHandler/TransactionResultListEventHandler.cs +++ b/src/AElf.EventHandler/TransactionResultListEventHandler.cs @@ -30,8 +30,14 @@ public TransactionResultListEventHandler(IEnumerable logEven public async Task HandleEventAsync(TransactionResultListEto eventData) { + if (!_contractAddressOptions.ContractAddressList.TryGetValue( + ChainHelper.ConvertChainIdToBase58(eventData.ChainId), out var contractAddresses)) + { + return; + } + var usefulLogEventProcessors = _logEventProcessors.Where(p => - _contractAddressOptions.ContractAddressList.ContainsKey(p.ContractName)).ToList(); + contractAddresses.ContainsKey(p.ContractName)).ToList(); foreach (var txResultEto in eventData.TransactionResults.Values.SelectMany(result => result)) { @@ -40,7 +46,7 @@ public async Task HandleEventAsync(TransactionResultListEto eventData) _logger.LogInformation($"Received event log {eventLog.Name} of contract {eventLog.Address}"); foreach (var logEventProcessor in usefulLogEventProcessors) { - if (logEventProcessor.IsMatch(eventLog.Address, eventLog.Name)) + if (logEventProcessor.IsMatch(eventData.ChainId, eventLog.Address, eventLog.Name)) { _logger.LogInformation("Pushing aforementioned event log to processor."); await logEventProcessor.ProcessAsync(new LogEvent diff --git a/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs index efeff342..7b91193d 100644 --- a/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs +++ b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs @@ -148,12 +148,12 @@ private async Task SendQueryAsync(string chainId, BridgeItem bridgeItem, BigInte Title = $"record_receipt_{swapId}", Options = {(lastRecordedLeafIndex + 1).ToString(), lastTokenIndexConfirm.ToString()} }, - AggregatorContractAddress = _contractOptions.ContractAddressList["StringAggregator"] + AggregatorContractAddress = _contractOptions.ContractAddressList[chainId]["StringAggregatorContract"] .ConvertAddress(), CallbackInfo = new CallbackInfo { ContractAddress = - _contractOptions.ContractAddressList["Bridge"].ConvertAddress(), + _contractOptions.ContractAddressList[chainId]["BridgeContract"].ConvertAddress(), MethodName = "RecordReceiptHash" }, DesignatedNodeList = new AddressList diff --git a/src/AElf.EventHandler/appsettings.json b/src/AElf.EventHandler/appsettings.json index 24bd6c5f..7f5bf39b 100644 --- a/src/AElf.EventHandler/appsettings.json +++ b/src/AElf.EventHandler/appsettings.json @@ -22,7 +22,7 @@ "AElfClient": { "ClientConfigList": [ { - "Alias": "Example", + "Alias": "AELF", "Endpoint": "http://192.168.0.31:6800", "UserName": "", "Password": "", @@ -35,7 +35,7 @@ "AccountConfigList": [ { "Alias": "Ean", - "PrivateKey": "8cc296e44d9e8881942e75a21ebc116ed3f29e39e0eaace1c92dc21e86d215c3", + "PrivateKey": "8cc296e44d9e8881942e75a21ebc116ed3f29e39e0eaace1c92dc21e86d215c3" }, { "Alias": "Test2", @@ -82,13 +82,15 @@ "AElfContract": { "ContractDirectory": "", "ContractAddressList": { - "MerkleTreeContractAddress": "2RHf2fxsnEaM3wb6N1yGqPupNZbcCY98LgWbGSFWmWzgEs5Sjo", - "BridgeContractAddress": "pykr77ft9UUKJZLVq15wCH8PinBSjVRQ12sD1Ayq92mKFsJ1i", - "OracleContractAddress": "2ZpYFeE4yWjrcKLBoj1iwbfYnbo9hK7exvfGTdqcq77QSxpzNH" + "AELF": { + "MerkleTreeContract": "2RHf2fxsnEaM3wb6N1yGqPupNZbcCY98LgWbGSFWmWzgEs5Sjo", + "BridgeContract": "pykr77ft9UUKJZLVq15wCH8PinBSjVRQ12sD1Ayq92mKFsJ1i", + "OracleContract": "2ZpYFeE4yWjrcKLBoj1iwbfYnbo9hK7exvfGTdqcq77QSxpzNH", + "StringAggregatorContract": "" + } } }, "EthereumContract": { - "AbiFileDirectory": "", "ContractInfoList": { "Regiment": { "AbiFileName": "RegimentAbi.json" diff --git a/src/AElf.PriceWorker/appsettings.json b/src/AElf.PriceWorker/appsettings.json index 642c2404..a66934d1 100644 --- a/src/AElf.PriceWorker/appsettings.json +++ b/src/AElf.PriceWorker/appsettings.json @@ -31,10 +31,10 @@ }, "AElfContract": { "ContractDirectory": "", - "ContractAddressList": { - "MerkleTreeContractAddress": "2RHf2fxsnEaM3wb6N1yGqPupNZbcCY98LgWbGSFWmWzgEs5Sjo", - "BridgeContractAddress": "pykr77ft9UUKJZLVq15wCH8PinBSjVRQ12sD1Ayq92mKFsJ1i", - "OracleContractAddress": "2ZpYFeE4yWjrcKLBoj1iwbfYnbo9hK7exvfGTdqcq77QSxpzNH" + "AELF": { + "MerkleTreeContract": "2RHf2fxsnEaM3wb6N1yGqPupNZbcCY98LgWbGSFWmWzgEs5Sjo", + "BridgeContract": "pykr77ft9UUKJZLVq15wCH8PinBSjVRQ12sD1Ayq92mKFsJ1i", + "OracleContract": "2ZpYFeE4yWjrcKLBoj1iwbfYnbo9hK7exvfGTdqcq77QSxpzNH" } }, "PriceSync": { From a074691a60d8762ba2d755d7cd7a58f8fd2831a1 Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Tue, 23 Aug 2022 16:23:54 +0800 Subject: [PATCH 18/66] feat: update others to AElf processors. . --- .../QueryCreatedLogEventProcessor.cs | 2 +- .../ReportConfirmedLogEventProcessor.cs | 11 +++- .../ReportProposedLogEventProcessor.cs | 4 +- ...ntCommitmentsCollectedLogEventProcessor.cs | 2 +- .../Providers/IDataProvider.cs | 63 +------------------ .../Workers/ReceiptSyncWorker.cs | 40 ++++++------ 6 files changed, 35 insertions(+), 87 deletions(-) diff --git a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs index 7daae193..002e5cee 100644 --- a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs @@ -78,7 +78,7 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) var clientAlias = _aElfClientConfigOptions.Mapping[context.ChainId.ToString()]; _logger.LogInformation($"Sending Commit tx with input: {commitInput}"); var transactionResult = await _oracleService.CommitAsync(clientAlias,commitInput); - _logger.LogInformation($"[Commit] Tx id {transactionResult.TransactionResult}"); + _logger.LogInformation($"[Commit] Transaction id {transactionResult.TransactionResult.TransactionId}"); } } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs index a65e216f..9d6e0e0a 100644 --- a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using AElf.Client.Core.Extensions; using AElf.Client.Core.Options; +using AElf.Client.Report; using AElf.Contracts.Report; using AElf.Nethereum.Core.Options; using AElf.Types; @@ -31,7 +32,8 @@ public ReportConfirmedLogEventProcessor(ILogger ethereumContractOptions, ITransmitTransactionProvider transmitTransactionProvider, - IOptionsSnapshot bridgeOptions) : base(contractAddressOptions) + IOptionsSnapshot bridgeOptions, + IReportService reportContractService) : base(contractAddressOptions) { _logger = logger; _signaturesRecoverableInfoProvider = signaturesRecoverableInfoProvider; @@ -66,10 +68,13 @@ await _signaturesRecoverableInfoProvider.GetSignatureAsync(context.ChainId.ToStr var (reportBytes, rs, ss, vs) = TransferToEthereumParameter(report, signatureRecoverableInfos); _logger.LogInformation( - $"Try to transmit data to Ethereum, Address: {ethereumContractAddress} RoundId: {reportConfirmed.RoundId}"); - + $"Try to transmit data, TargetChainId: {reportConfirmed.TargetChainId} Address: {ethereumContractAddress} RoundId: {reportConfirmed.RoundId}"); + await _transmitTransactionProvider.EnqueueAsync(new SendTransmitArgs { + ChainId = context.ChainId.ToString(), + TargetContractAddress = ethereumContractAddress, + TargetChainId = reportConfirmed.TargetChainId, Report = reportBytes, Rs = rs, Ss = ss, diff --git a/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs index 6998360a..d3bb3ab3 100644 --- a/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs @@ -25,11 +25,11 @@ internal class ReportProposedLogEventProcessor : LogEventProcessorBase _logger; public ReportProposedLogEventProcessor( - IOptionsSnapshot contractAddressOptions, IReportProvider reportProvider, IReportService reportService, IAElfAccountProvider accountProvider, ILogger logger, + IOptionsSnapshot contractAddressOptions, IOptionsSnapshot bridgeOptions, IOptionsSnapshot aelfConfigOptions, IOptionsSnapshot aelfChainAliasOptions) : base(contractAddressOptions) @@ -62,6 +62,6 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) }); _reportProvider.SetReport(reportProposed.Token, reportProposed.RoundId, reportProposed.RawReport); - _logger.LogInformation($"[ConfirmReport] Tx : {sendTxResult}"); + _logger.LogInformation($"[ConfirmReport] Transaction id : {sendTxResult.TransactionResult.TransactionId}"); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs index edd1cd4b..d3629ff5 100644 --- a/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs @@ -59,6 +59,6 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) }; _logger.LogInformation($"Sending Reveal tx with input: {revealInput}"); var transaction = await _oracleService.RevealAsync(_aelfChainAliasOptions.Mapping[context.ChainId.ToString()],revealInput); - _logger.LogInformation($"[Reveal] Transaction : {transaction}"); + _logger.LogInformation($"[Reveal] Transaction id : {transaction.TransactionResult.TransactionId}"); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Providers/IDataProvider.cs b/src/AElf.EventHandler/Providers/IDataProvider.cs index 05d05eba..340754bb 100644 --- a/src/AElf.EventHandler/Providers/IDataProvider.cs +++ b/src/AElf.EventHandler/Providers/IDataProvider.cs @@ -83,7 +83,7 @@ public async Task GetDataAsync(Hash queryId, string title = null, List c.SwapId == swapId); _logger.LogInformation("About to handle record receipt hashes for swapping tokens."); var recordReceiptHashInput = @@ -159,43 +159,6 @@ private async Task GetReceiptHashMap(Hash swapId, BridgeItem bridgeItem, return input.ToString(); } - // private Hash GetHashTokenAmountData(string stringAmount, int originTokenSizeInByte, bool isBigEndian) - // { - // var amount = decimal.Parse(stringAmount); - // var preHolderSize = originTokenSizeInByte - 16; - // int[] amountInIntegers; - // if (isBigEndian) - // { - // amountInIntegers = decimal.GetBits(amount).Reverse().ToArray(); - // if (preHolderSize < 0) - // amountInIntegers = amountInIntegers.TakeLast(originTokenSizeInByte / 4).ToArray(); - // } - // else - // { - // amountInIntegers = decimal.GetBits(amount).ToArray(); - // if (preHolderSize < 0) - // amountInIntegers = amountInIntegers.Take(originTokenSizeInByte / 4).ToArray(); - // } - // - // var amountBytes = new List(); - // - // amountInIntegers.Aggregate(amountBytes, (cur, i) => - // { - // cur.AddRange(i.ToBytes(isBigEndian)); - // return cur; - // }); - // - // if (preHolderSize > 0) - // { - // var placeHolder = Enumerable.Repeat(new byte(), preHolderSize).ToArray(); - // amountBytes = isBigEndian - // ? placeHolder.Concat(amountBytes).ToList() - // : amountBytes.Concat(placeHolder).ToList(); - // } - // - // return HashHelper.ComputeFrom(amountBytes.ToArray()); - // } - private string Aggregate(List dataList) { var finalPrice = dataList.OrderBy(p => p).ToList()[dataList.Count / 2] @@ -298,28 +261,4 @@ private string ParseJson(string response, List attributes) return data; } - - private async Task> GetReceiptInfosAsync(string lockMappingContractAddress, long start, - long end, string nodeUrl, bool canTakeToken) - { - var receiptInfoList = new List(); - // var usingAbi = canTakeToken ? _lockWithTakeTokenAbi : _bridgeAbi; - // if (_web3ManagerForLock == null) - // { - // _web3ManagerForLock = new Web3Manager(nodeUrl, - // _ethereumConfigOptions.Address, - // _ethereumConfigOptions.PrivateKey, usingAbi); - // } - // - // var receiptInfoFunction = - // _web3ManagerForLock.GetFunction(lockMappingContractAddress, "getReceiptInfo"); - // for (var i = start; i <= end; i++) - // { - // var receiptInfo = await receiptInfoFunction.CallDeserializingToObjectAsync(i); - // _logger.LogInformation($"Got receipt info of id {i}: {receiptInfo}"); - // receiptInfoList.Add(receiptInfo); - // } - - return receiptInfoList; - } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs index 7b91193d..bee6325b 100644 --- a/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs +++ b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs @@ -39,14 +39,15 @@ public ReceiptSyncWorker(AbpAsyncTimer timer, IOptionsSnapshot bridgeOptions, IOptionsSnapshot aelfChainAliasOption, IOptionsSnapshot blockConfirmation, + IOptionsSnapshot contractOptions, BridgeOutService bridgeOutService, NethereumService nethereumService, OracleService oracleService, BridgeService bridgeService, IMerkleTreeContractService merkleTreeContractService, ILatestQueriedReceiptCountProvider latestQueriedReceiptCountProvider, - ILogger logger, - AElfContractOptions contractOptions) : base(timer, + ILogger logger + ) : base(timer, serviceScopeFactory) { Timer.Period = 1000 * 60; @@ -59,7 +60,7 @@ public ReceiptSyncWorker(AbpAsyncTimer timer, _aelfChainAliasOptions = aelfChainAliasOption.Value; _latestQueriedReceiptCountProvider = latestQueriedReceiptCountProvider; _logger = logger; - _contractOptions = contractOptions; + _contractOptions = contractOptions.Value; _blockConfirmationOptions = blockConfirmation.Value; } @@ -113,43 +114,46 @@ private async Task SendQueryAsync(string chainId, BridgeItem bridgeItem, BigInte if (_latestQueriedReceiptCountProvider.Get(swapId) == 0) { - _latestQueriedReceiptCountProvider.Set(swapId, lastRecordedLeafIndex); + _latestQueriedReceiptCountProvider.Set(swapId, lastRecordedLeafIndex + 1); } _logger.LogInformation($"Last recorded leaf index : {lastRecordedLeafIndex}."); - if (tokenIndex <= _latestQueriedReceiptCountProvider.Get(swapId)) + var tokenLeafIndex = tokenIndex - 1; + if (tokenLeafIndex < _latestQueriedReceiptCountProvider.Get(swapId)) { return; } - - if (tokenIndex - lastRecordedLeafIndex > 0) + + var notRecordTokenNumber = tokenLeafIndex - lastRecordedLeafIndex; + if (notRecordTokenNumber > 0) { var blockNumber = await _nethereumService.GetBlockNumberAsync(bridgeItem.EthereumClientAlias); var getReceiptInfos = await _bridgeOutService.GetSendReceiptInfosAsync(_aelfChainAliasOptions.Mapping[chainId], bridgeItem.EthereumBridgeOutContractAddress, bridgeItem.OriginToken, bridgeItem.TargetChainId, - lastRecordedLeafIndex + 1,(long)tokenIndex); - var lastTokenIndexConfirm = lastRecordedLeafIndex; - for (var i = 0; i < lastRecordedLeafIndex - tokenIndex; i++) + lastRecordedLeafIndex+2,(long)tokenIndex); + var lastLeafIndexConfirm = lastRecordedLeafIndex; + for (var i = 0; i < tokenLeafIndex - lastRecordedLeafIndex; i++) { var blockHeight = getReceiptInfos.Receipts[i].BlockHeight; var blockConfirmationCount = _blockConfirmationOptions.ConfirmationCount[bridgeItem.EthereumClientAlias]; if (blockNumber - blockHeight > blockConfirmationCount) continue; - lastTokenIndexConfirm += (i+1); + lastLeafIndexConfirm += (i+1); break; } + _logger.LogInformation($"Last confirmed token index:{lastLeafIndexConfirm+1}"); - if (lastTokenIndexConfirm - lastRecordedLeafIndex > 0) + if (lastLeafIndexConfirm - lastRecordedLeafIndex > 0) { + _logger.LogInformation($"Start to query token : from index {lastRecordedLeafIndex + 2},end index {lastLeafIndexConfirm + 1}"); var queryInput = new QueryInput { Payment = _bridgeOptions.QueryPayment, QueryInfo = new QueryInfo { Title = $"record_receipt_{swapId}", - Options = {(lastRecordedLeafIndex + 1).ToString(), lastTokenIndexConfirm.ToString()} + Options = {(lastRecordedLeafIndex + 2).ToString(), (lastLeafIndexConfirm+1).ToString()} }, - AggregatorContractAddress = _contractOptions.ContractAddressList[chainId]["StringAggregatorContract"] - .ConvertAddress(), + AggregatorContractAddress = _contractOptions.ContractAddressList[chainId]["StringAggregatorContract"].ConvertAddress(), CallbackInfo = new CallbackInfo { ContractAddress = @@ -165,10 +169,10 @@ private async Task SendQueryAsync(string chainId, BridgeItem bridgeItem, BigInte _logger.LogInformation($"About to send Query transaction for token swapping, QueryInput: {queryInput}"); var sendTxResult = await _oracleService.QueryAsync(clientAlias, queryInput); - _logger.LogInformation($"Query tx id: {sendTxResult.Transaction.GetHash()}"); - _latestQueriedReceiptCountProvider.Set(swapId, (int) tokenIndex + 1); + _logger.LogInformation($"Query transaction id : {sendTxResult.TransactionResult.TransactionId}"); + _latestQueriedReceiptCountProvider.Set(swapId, lastLeafIndexConfirm + 2); _logger.LogInformation( - $"Latest queried receipt count: {_latestQueriedReceiptCountProvider.Get(swapId)}"); + $"Next token index should start with tokenindex:{_latestQueriedReceiptCountProvider.Get(swapId)}"); } } From 63bf6cf989214a06a7012ac0dd2e47578eea5e8a Mon Sep 17 00:00:00 2001 From: zhxymh Date: Tue, 23 Aug 2022 16:27:35 +0800 Subject: [PATCH 19/66] feat: send transmit by lib --- ...IrreversibleBlockFoundLogEventProcessor.cs | 20 ++++++++++++++----- .../Processors/LogEventProcessorBase.cs | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs index 4575f178..05b16a19 100644 --- a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs @@ -1,8 +1,11 @@ using System.Threading.Tasks; +using AElf.Client.Core; using AElf.Client.Core.Extensions; using AElf.Client.Core.Options; using AElf.Contracts.Consensus.AEDPoS; using AElf.Types; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; namespace AElf.EventHandler; @@ -10,12 +13,18 @@ namespace AElf.EventHandler; public class IrreversibleBlockFoundLogEventProcessor : LogEventProcessorBase { private readonly ITransmitTransactionProvider _transmitTransactionProvider; + private readonly IAElfClientService _aelfClientService; + public ILogger Logger { get; set; } public IrreversibleBlockFoundLogEventProcessor( IOptionsSnapshot contractAddressOptions, - ITransmitTransactionProvider transmitTransactionProvider) : base(contractAddressOptions) + ITransmitTransactionProvider transmitTransactionProvider, IAElfClientService aelfClientService) : base( + contractAddressOptions) { _transmitTransactionProvider = transmitTransactionProvider; + _aelfClientService = aelfClientService; + + Logger = NullLogger.Instance; } public override string ContractName => "ConsensusContract"; @@ -24,9 +33,10 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) { var libFound = new IrreversibleBlockFound(); libFound.MergeFrom(logEvent); - // _logger.LogInformation($"IrreversibleBlockFound: {libFound}"); - // - // - // await _transmitTransactionProvider.SendByLibAsync() + Logger.LogInformation($"IrreversibleBlockFound: {libFound}"); + + var chainId = ChainHelper.ConvertChainIdToBase58(context.ChainId); + var block = await _aelfClientService.GetBlockByHeightAsync(chainId,libFound.IrreversibleBlockHeight); + await _transmitTransactionProvider.SendByLibAsync(chainId, block.BlockHash, block.Header.Height); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs b/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs index f9e1d312..c13bdb76 100644 --- a/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs +++ b/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs @@ -12,7 +12,7 @@ public abstract class LogEventProcessorBase : ILogEventProcessor { private readonly AElfContractOptions _contractOptions; - public LogEventProcessorBase(IOptionsSnapshot contractAddressOptions) + protected LogEventProcessorBase(IOptionsSnapshot contractAddressOptions) { _contractOptions = contractAddressOptions.Value; } From c8731b68b5d3640f5e028d9858bc30b23f85257c Mon Sep 17 00:00:00 2001 From: zhxymh Date: Tue, 23 Aug 2022 16:34:56 +0800 Subject: [PATCH 20/66] fix: fix parameter --- modules/AElf.Nethereum.Bridge/GetSendReceiptIndexDTO.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/AElf.Nethereum.Bridge/GetSendReceiptIndexDTO.cs b/modules/AElf.Nethereum.Bridge/GetSendReceiptIndexDTO.cs index cdde5fea..3c41e7dc 100644 --- a/modules/AElf.Nethereum.Bridge/GetSendReceiptIndexDTO.cs +++ b/modules/AElf.Nethereum.Bridge/GetSendReceiptIndexDTO.cs @@ -6,5 +6,5 @@ namespace AElf.Nethereum.Bridge; [FunctionOutput] public class GetSendReceiptIndexDTO : IFunctionOutputDTO { - [Parameter("tuple[]", "indexs", 1)] public List Indexes { get; set; } + [Parameter("tuple[]", "indexes", 1)] public List Indexes { get; set; } } \ No newline at end of file From 9f1939197e39be38fa851ffc8b5f3656a371d24c Mon Sep 17 00:00:00 2001 From: zhxymh Date: Wed, 24 Aug 2022 10:27:36 +0800 Subject: [PATCH 21/66] feat: improve config --- modules/AElf.Client.Bridge/BridgeService.cs | 26 ++++++----- modules/AElf.Client.Core/AElfClientModule.cs | 1 + .../AElf.Client.Core/ContractServiceBase.cs | 13 +++--- .../Options/AElfChainAliasOptions.cs | 4 +- .../MerkleTreeContract.cs | 21 ++++----- modules/AElf.Client.Oracle/OracleService.cs | 43 +++++++------------ modules/AElf.Client.Report/ReportService.cs | 35 ++++++--------- .../AElf.Nethereum.Bridge/IBridgeInService.cs | 8 ++-- .../IBridgeOutService.cs | 12 +++--- .../AElfNethereumClientModule.cs | 3 +- .../ContractServiceBase.cs | 19 ++++---- .../INethereumClientProvider.cs | 9 ++-- .../Options/EthereumAElfChainAliasOptions.cs | 6 +++ .../EthereumClientAccountMappingOptions.cs | 6 --- .../Options/EthereumClientConfigOptions.cs | 9 +--- .../Options/EthereumClientOptions.cs | 12 ++++++ .../EventHandlerAppModule.cs | 2 +- .../Options/BridgeOptions.cs | 5 +-- .../QueryCreatedLogEventProcessor.cs | 6 +-- .../ReportConfirmedLogEventProcessor.cs | 8 +--- .../ReportProposedLogEventProcessor.cs | 12 +----- ...ntCommitmentsCollectedLogEventProcessor.cs | 12 +----- .../Providers/IDataProvider.cs | 2 +- .../Workers/ReceiptSyncWorker.cs | 15 +++---- .../Workers/TransmitTransactionWorker.cs | 1 + src/AElf.EventHandler/appsettings.json | 6 +-- 26 files changed, 126 insertions(+), 170 deletions(-) rename {src/AElf.EventHandler => modules/AElf.Client.Core}/Options/AElfChainAliasOptions.cs (62%) create mode 100644 modules/AElf.Nethereum.Core/Options/EthereumAElfChainAliasOptions.cs delete mode 100644 modules/AElf.Nethereum.Core/Options/EthereumClientAccountMappingOptions.cs create mode 100644 modules/AElf.Nethereum.Core/Options/EthereumClientOptions.cs diff --git a/modules/AElf.Client.Bridge/BridgeService.cs b/modules/AElf.Client.Bridge/BridgeService.cs index 38aa1f92..635300bc 100644 --- a/modules/AElf.Client.Bridge/BridgeService.cs +++ b/modules/AElf.Client.Bridge/BridgeService.cs @@ -10,9 +10,9 @@ namespace AElf.Client.Bridge; public interface IBridgeService { - Task GetSpaceIdBySwapIdAsync(string clientAlias, Hash swapId); - Task SetGasPriceAsync(string clientAlias, SetGasPriceInput input); - Task SetPriceRatioAsync(string clientAlias, SetPriceRatioInput input); + Task GetSpaceIdBySwapIdAsync(string chainId, Hash swapId); + Task SetGasPriceAsync(string chainId, SetGasPriceInput input); + Task SetPriceRatioAsync(string chainId, SetPriceRatioInput input); } public class BridgeService : ContractServiceBase, IBridgeService, ITransientDependency @@ -29,33 +29,31 @@ public BridgeService(IAElfClientService clientService, _contractOptions = contractOptions.Value; } - public async Task GetSpaceIdBySwapIdAsync(string clientAlias, Hash swapId) + public async Task GetSpaceIdBySwapIdAsync(string chainId, Hash swapId) { - var result = await _clientService.ViewAsync(GetContractAddress(clientAlias), "GetSpaceIdBySwapId", - swapId, clientAlias); + var result = await _clientService.ViewAsync(GetContractAddress(chainId), "GetSpaceIdBySwapId", + swapId, chainId); return Hash.LoadFromByteArray(result); } - public async Task SetGasPriceAsync(string clientAlias, SetGasPriceInput input) + public async Task SetGasPriceAsync(string chainId, SetGasPriceInput input) { - var tx = await PerformSendTransactionAsync("SetGasPrice", input, clientAlias); + var tx = await PerformSendTransactionAsync("SetGasPrice", input, chainId); return new SendTransactionResult { Transaction = tx, - TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), chainId) }; } - public async Task SetPriceRatioAsync(string clientAlias, SetPriceRatioInput input) + public async Task SetPriceRatioAsync(string chainId, SetPriceRatioInput input) { - var tx = await PerformSendTransactionAsync("SetPriceRatio", input, clientAlias); + var tx = await PerformSendTransactionAsync("SetPriceRatio", input, chainId); return new SendTransactionResult { Transaction = tx, - TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), chainId) }; } - - } \ No newline at end of file diff --git a/modules/AElf.Client.Core/AElfClientModule.cs b/modules/AElf.Client.Core/AElfClientModule.cs index af5b05f1..a68382cc 100644 --- a/modules/AElf.Client.Core/AElfClientModule.cs +++ b/modules/AElf.Client.Core/AElfClientModule.cs @@ -21,6 +21,7 @@ public override void ConfigureServices(ServiceConfigurationContext context) Configure(options => { configuration.GetSection("AElfClientConfig").Bind(options); }); Configure(options => { configuration.GetSection("AElfMinerAccount").Bind(options); }); Configure(options => { configuration.GetSection("AElfContract").Bind(options); }); + Configure(options => { configuration.GetSection("AElfChainAlias").Bind(options); }); context.Services.AddSingleton(); diff --git a/modules/AElf.Client.Core/ContractServiceBase.cs b/modules/AElf.Client.Core/ContractServiceBase.cs index 1f18f104..c3cf4206 100644 --- a/modules/AElf.Client.Core/ContractServiceBase.cs +++ b/modules/AElf.Client.Core/ContractServiceBase.cs @@ -12,21 +12,24 @@ public abstract class ContractServiceBase public IOptionsSnapshot ContractOptions { get; set; } protected abstract string SmartContractName { get; } public ILogger Logger { get; set; } + public IOptionsSnapshot _aelfChainAliasOptions { get; set; } protected async Task PerformSendTransactionAsync(string methodName, IMessage parameter, - string useClientAlias) + string chainId) { - var contractAddress = GetContractAddress(useClientAlias); - return await ClientService.SendAsync(contractAddress, methodName, parameter, useClientAlias); + var contractAddress = GetContractAddress(chainId); + var clientAlias = _aelfChainAliasOptions.Value.Mapping[chainId]; + return await ClientService.SendAsync(contractAddress, methodName, parameter, clientAlias); } protected async Task PerformGetTransactionResultAsync(string transactionId, - string useClientAlias) + string chainId) { TransactionResult txResult; + var clientAlias = _aelfChainAliasOptions.Value.Mapping[chainId]; do { - txResult = await ClientService.GetTransactionResultAsync(transactionId, useClientAlias); + txResult = await ClientService.GetTransactionResultAsync(transactionId, clientAlias); } while (txResult.Status == TransactionResultStatus.Pending); Logger.LogInformation("{TxResult}", txResult); diff --git a/src/AElf.EventHandler/Options/AElfChainAliasOptions.cs b/modules/AElf.Client.Core/Options/AElfChainAliasOptions.cs similarity index 62% rename from src/AElf.EventHandler/Options/AElfChainAliasOptions.cs rename to modules/AElf.Client.Core/Options/AElfChainAliasOptions.cs index 20dd588d..0a53aa58 100644 --- a/src/AElf.EventHandler/Options/AElfChainAliasOptions.cs +++ b/modules/AElf.Client.Core/Options/AElfChainAliasOptions.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -namespace AElf.EventHandler; +namespace AElf.Client.Core.Options; public class AElfChainAliasOptions { diff --git a/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs b/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs index 2d8513a4..d51a40a6 100644 --- a/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs +++ b/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs @@ -11,39 +11,36 @@ namespace AElf.Client.MerkleTreeContract; public interface IMerkleTreeContractService { - Task CreateSpaceAsync(string clientAlias, CreateSpaceInput createSpaceInput); + Task CreateSpaceAsync(string chainId, CreateSpaceInput createSpaceInput); - Task GetLastLeafIndexAsync(string clientAlias, GetLastLeafIndexInput getLastLeafIndexInput); + Task GetLastLeafIndexAsync(string chainId, GetLastLeafIndexInput getLastLeafIndexInput); } public class MerkleTreeContractService : ContractServiceBase, IMerkleTreeContractService, ITransientDependency { private readonly IAElfClientService _clientService; - private readonly AElfContractOptions _contractOptions; protected override string SmartContractName { get; } = "MerkleTreeContract"; - public MerkleTreeContractService(IAElfClientService clientService, - IOptionsSnapshot contractOptions) + public MerkleTreeContractService(IAElfClientService clientService) { _clientService = clientService; - _contractOptions = contractOptions.Value; } - public async Task CreateSpaceAsync(string clientAlias, CreateSpaceInput createSpaceInput) + public async Task CreateSpaceAsync(string chainId, CreateSpaceInput createSpaceInput) { - var tx = await PerformSendTransactionAsync("CreateSpace", createSpaceInput, clientAlias); + var tx = await PerformSendTransactionAsync("CreateSpace", createSpaceInput, chainId); return new SendTransactionResult { Transaction = tx, - TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), chainId) }; } - public async Task GetLastLeafIndexAsync(string clientAlias, GetLastLeafIndexInput getLastLeafIndexInput) + public async Task GetLastLeafIndexAsync(string chainId, GetLastLeafIndexInput getLastLeafIndexInput) { - var result = await _clientService.ViewAsync(GetContractAddress(clientAlias), "GetLastLeafIndex", - getLastLeafIndexInput, clientAlias); + var result = await _clientService.ViewAsync(GetContractAddress(chainId), "GetLastLeafIndex", + getLastLeafIndexInput, chainId); var actualResult = new Int64Value(); actualResult.MergeFrom(result); return actualResult; diff --git a/modules/AElf.Client.Oracle/OracleService.cs b/modules/AElf.Client.Oracle/OracleService.cs index dfd6b729..6f6f6b20 100644 --- a/modules/AElf.Client.Oracle/OracleService.cs +++ b/modules/AElf.Client.Oracle/OracleService.cs @@ -9,67 +9,56 @@ namespace AElf.Client.Oracle; public interface IOracleService { - Task QueryAsync(string clientAlias, QueryInput queryInput); + Task QueryAsync(string chainId, QueryInput queryInput); - Task CommitAsync(string clientAlias, CommitInput commitInput); + Task CommitAsync(string chainId, CommitInput commitInput); - Task RevealAsync(string clientAlias, RevealInput revealInput); + Task RevealAsync(string chainId, RevealInput revealInput); - Task CancelQueryAsync(string clientAlias, Hash cancelQueryInput); + Task CancelQueryAsync(string chainId, Hash cancelQueryInput); } public class OracleService : ContractServiceBase, IOracleService, ITransientDependency { - private readonly IAElfClientService _clientService; - private readonly AElfClientConfigOptions _clientConfigOptions; - protected override string SmartContractName { get; } = "OracleContract"; - public OracleService(IAElfClientService clientService, - IOptionsSnapshot clientConfigOptions, - IOptionsSnapshot contractOptions) - { - _clientService = clientService; - _clientConfigOptions = clientConfigOptions.Value; - } - - public async Task QueryAsync(string clientAlias, QueryInput queryInput) + public async Task QueryAsync(string chainId, QueryInput queryInput) { - var tx = await PerformSendTransactionAsync("Query", queryInput, clientAlias); + var tx = await PerformSendTransactionAsync("Query", queryInput, chainId); return new SendTransactionResult { Transaction = tx, - TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), chainId) }; } - public async Task CommitAsync(string clientAlias, CommitInput commitInput) + public async Task CommitAsync(string chainId, CommitInput commitInput) { - var tx = await PerformSendTransactionAsync("Commit", commitInput, clientAlias); + var tx = await PerformSendTransactionAsync("Commit", commitInput, chainId); return new SendTransactionResult { Transaction = tx, - TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), chainId) }; } - public async Task RevealAsync(string clientAlias, RevealInput revealInput) + public async Task RevealAsync(string chainId, RevealInput revealInput) { - var tx = await PerformSendTransactionAsync("Reveal", revealInput, clientAlias); + var tx = await PerformSendTransactionAsync("Reveal", revealInput, chainId); return new SendTransactionResult { Transaction = tx, - TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), chainId) }; } - public async Task CancelQueryAsync(string clientAlias, Hash cancelQueryInput) + public async Task CancelQueryAsync(string chainId, Hash cancelQueryInput) { - var tx = await PerformSendTransactionAsync("CancelQuery", cancelQueryInput, clientAlias); + var tx = await PerformSendTransactionAsync("CancelQuery", cancelQueryInput, chainId); return new SendTransactionResult { Transaction = tx, - TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), chainId) }; } diff --git a/modules/AElf.Client.Report/ReportService.cs b/modules/AElf.Client.Report/ReportService.cs index a9b60f23..17104600 100644 --- a/modules/AElf.Client.Report/ReportService.cs +++ b/modules/AElf.Client.Report/ReportService.cs @@ -9,55 +9,44 @@ namespace AElf.Client.Report; public interface IReportService { - Task ProposeReportAsync(string clientAlias, CallbackInput proposeReportInput); + Task ProposeReportAsync(string chainId, CallbackInput proposeReportInput); - Task ConfirmReportAsync(string clientAlias, ConfirmReportInput confirmReportInput); + Task ConfirmReportAsync(string chainId, ConfirmReportInput confirmReportInput); - Task RejectReportAsync(string clientAlias, RejectReportInput rejectReportInput); + Task RejectReportAsync(string chainId, RejectReportInput rejectReportInput); } public class ReportService : ContractServiceBase, IReportService, ITransientDependency { - private readonly IAElfClientService _clientService; - private readonly AElfClientConfigOptions _clientConfigOptions; - protected override string SmartContractName { get; } = "ReportContract"; - public ReportService(IAElfClientService clientService, - IOptionsSnapshot clientConfigOptions, - IOptionsSnapshot contractOptions) - { - _clientService = clientService; - _clientConfigOptions = clientConfigOptions.Value; - } - - public async Task ProposeReportAsync(string clientAlias, CallbackInput proposeReportInput) + public async Task ProposeReportAsync(string chainId, CallbackInput proposeReportInput) { - var tx = await PerformSendTransactionAsync("ProposeReport", proposeReportInput, clientAlias); + var tx = await PerformSendTransactionAsync("ProposeReport", proposeReportInput, chainId); return new SendTransactionResult { Transaction = tx, - TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), chainId) }; } - public async Task ConfirmReportAsync(string clientAlias, ConfirmReportInput confirmReportInput) + public async Task ConfirmReportAsync(string chainId, ConfirmReportInput confirmReportInput) { - var tx = await PerformSendTransactionAsync("ConfirmReport", confirmReportInput, clientAlias); + var tx = await PerformSendTransactionAsync("ConfirmReport", confirmReportInput, chainId); return new SendTransactionResult { Transaction = tx, - TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), chainId) }; } - public async Task RejectReportAsync(string clientAlias, RejectReportInput rejectReportInput) + public async Task RejectReportAsync(string chainId, RejectReportInput rejectReportInput) { - var tx = await PerformSendTransactionAsync("RejectReport", rejectReportInput, clientAlias); + var tx = await PerformSendTransactionAsync("RejectReport", rejectReportInput, chainId); return new SendTransactionResult { Transaction = tx, - TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), clientAlias) + TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), chainId) }; } diff --git a/modules/AElf.Nethereum.Bridge/IBridgeInService.cs b/modules/AElf.Nethereum.Bridge/IBridgeInService.cs index 641eef9c..f2b38807 100644 --- a/modules/AElf.Nethereum.Bridge/IBridgeInService.cs +++ b/modules/AElf.Nethereum.Bridge/IBridgeInService.cs @@ -6,18 +6,18 @@ namespace AElf.Nethereum.Bridge; public interface IBridgeInService { - Task TransmitAsync(string clientAlias, string contractAddress, byte[] report, byte[][] rs, byte[][] ss, byte[] rawVs); + Task TransmitAsync(string chainId, string contractAddress, byte[] report, byte[][] rs, byte[][] ss, byte[] rawVs); } public class BridgeInService : ContractServiceBase, IBridgeInService, ITransientDependency { protected override string SmartContractName { get; } = "BridgeIn"; - public async Task TransmitAsync(string clientAlias, string contractAddress, byte[] report, + public async Task TransmitAsync(string chainId, string contractAddress, byte[] report, byte[][] rs, byte[][] ss, byte[] rawVs) { - var setValueFunction = GetFunction(clientAlias, contractAddress, "transmit"); - var sender = GetAccount(clientAlias).Address; + var setValueFunction = GetFunction(chainId, contractAddress, "transmit"); + var sender = GetAccount().Address; var gas = await setValueFunction.EstimateGasAsync(sender, null, null, report, rs, ss, rawVs); var transactionResult = await setValueFunction.SendTransactionAsync(sender, gas, null, null, report, diff --git a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs index a22e057a..2ff349a7 100644 --- a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs +++ b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs @@ -6,9 +6,9 @@ namespace AElf.Nethereum.Bridge; public interface IBridgeOutService { - Task GetSendReceiptInfosAsync(string clientAlias, string contractAddress, string token, string targetChainId, long fromIndex,long endIndex); + Task GetSendReceiptInfosAsync(string chainId, string contractAddress, string token, string targetChainId, long fromIndex,long endIndex); - Task GetTransferReceiptIndexAsync(string clientAlias, string contractAddress, List tokens, + Task GetTransferReceiptIndexAsync(string chainId, string contractAddress, List tokens, List targetChainIds); } @@ -16,20 +16,20 @@ public class BridgeOutService : ContractServiceBase, IBridgeOutService, ITransie { protected override string SmartContractName { get; } = "BridgeOut"; - public async Task GetSendReceiptInfosAsync(string clientAlias, string contractAddress, + public async Task GetSendReceiptInfosAsync(string chainId, string contractAddress, string token, string targetChainId, long fromIndex,long endIndex) { - var function = GetFunction(clientAlias, contractAddress, "getSendReceiptInfos"); + var function = GetFunction(chainId, contractAddress, "getSendReceiptInfos"); var evmGetReceiptInfos = await function.CallDeserializingToObjectAsync(token, targetChainId, fromIndex,endIndex); return evmGetReceiptInfos; } - public async Task GetTransferReceiptIndexAsync(string clientAlias, string contractAddress, + public async Task GetTransferReceiptIndexAsync(string chainId, string contractAddress, List tokens, List targetChainIds) { - var function = GetFunction(clientAlias, contractAddress, "getSendReceiptIndex"); + var function = GetFunction(chainId, contractAddress, "getSendReceiptIndex"); var evmGetReceiptInfos = await function.CallDeserializingToObjectAsync(tokens, targetChainIds); diff --git a/modules/AElf.Nethereum.Core/AElfNethereumClientModule.cs b/modules/AElf.Nethereum.Core/AElfNethereumClientModule.cs index 48eeed95..80c59c03 100644 --- a/modules/AElf.Nethereum.Core/AElfNethereumClientModule.cs +++ b/modules/AElf.Nethereum.Core/AElfNethereumClientModule.cs @@ -19,6 +19,7 @@ public override void ConfigureServices(ServiceConfigurationContext context) Configure(configuration.GetSection("EthereumAccount")); Configure(configuration.GetSection("EthereumClientConfig")); Configure(configuration.GetSection("EthereumContract")); - Configure(configuration.GetSection("EthereumClientAccountMapping")); + Configure(configuration.GetSection("EthereumAElfChainAlias")); + Configure(configuration.GetSection("EthereumClient")); } } \ No newline at end of file diff --git a/modules/AElf.Nethereum.Core/ContractServiceBase.cs b/modules/AElf.Nethereum.Core/ContractServiceBase.cs index 1b86e10c..f363262a 100644 --- a/modules/AElf.Nethereum.Core/ContractServiceBase.cs +++ b/modules/AElf.Nethereum.Core/ContractServiceBase.cs @@ -12,28 +12,29 @@ public abstract class ContractServiceBase { public INethereumClientProvider NethereumClientProvider { get; set; } public INethereumAccountProvider NethereumAccountProvider { get; set; } - public EthereumClientAccountMappingOptions EthereumClientAccountMappingOptions { get; set; } - public EthereumContractOptions EthereumContractOptions { get; set; } + public IOptionsSnapshot EthereumContractOptions { get; set; } + public IOptionsSnapshot EthereumClientConfigOptions { get; set; } + public IOptionsSnapshot EthereumAElfChainAliasOptions { get; set; } protected abstract string SmartContractName { get; } - protected Function GetFunction(string clientAlias, string contractAddress, string methodName) + protected Function GetFunction(string chainId, string contractAddress, string methodName) { - var accountAlias = EthereumClientAccountMappingOptions.Mapping[clientAlias]; + var clientAlias = EthereumAElfChainAliasOptions.Value.Mapping[chainId]; + var accountAlias = EthereumClientConfigOptions.Value.AccountAlias; var client = NethereumClientProvider.GetClient(clientAlias, accountAlias); var contract = client.Eth.GetContract(GetAbi(), contractAddress); return contract.GetFunction(methodName); } - protected Account GetAccount(string clientAlias) + protected Account GetAccount() { - var accountAlias = EthereumClientAccountMappingOptions.Mapping[clientAlias]; - return NethereumAccountProvider.GetAccount(accountAlias); + return NethereumAccountProvider.GetAccount(EthereumClientConfigOptions.Value.AccountAlias); } private string GetAbi() { - var path = Path.Combine(EthereumContractOptions.AbiFileDirectory, - EthereumContractOptions.ContractInfoList[SmartContractName].AbiFileName); + var path = Path.Combine(EthereumContractOptions.Value.AbiFileDirectory, + EthereumContractOptions.Value.ContractInfoList[SmartContractName].AbiFileName); using var file = System.IO.File.OpenText(path); using var reader = new JsonTextReader(file); diff --git a/modules/AElf.Nethereum.Core/INethereumClientProvider.cs b/modules/AElf.Nethereum.Core/INethereumClientProvider.cs index 086a2c5e..9ea9d7e1 100644 --- a/modules/AElf.Nethereum.Core/INethereumClientProvider.cs +++ b/modules/AElf.Nethereum.Core/INethereumClientProvider.cs @@ -13,21 +13,22 @@ public interface INethereumClientProvider public class NethereumClientProvider : ConcurrentDictionary, INethereumClientProvider, ISingletonDependency { - private readonly EthereumClientConfigOptions _ethereumClientConfigOptions; + private readonly EthereumClientOptions _ethereumClientOptions; private readonly INethereumAccountProvider _nethereumAccountProvider; - public NethereumClientProvider(IOptionsSnapshot ethereumClientConfigOptions, + public NethereumClientProvider(IOptionsSnapshot ethereumClientOptions, INethereumAccountProvider nethereumAccountProvider) { _nethereumAccountProvider = nethereumAccountProvider; - _ethereumClientConfigOptions = ethereumClientConfigOptions.Value; + _ethereumClientOptions = ethereumClientOptions.Value; } public Web3 GetClient(string clientAlias, string accountAlias = null) { var keys = Keys.Where(o => o.ClientAlias == clientAlias && o.AccountAlias == accountAlias).ToList(); if (keys.Count == 0) - {var clientConfig = _ethereumClientConfigOptions.ClientConfigList + { + var clientConfig = _ethereumClientOptions.ClientConfigList .FirstOrDefault(o => o.Alias == clientAlias); Web3 client; if (string.IsNullOrWhiteSpace(accountAlias)) diff --git a/modules/AElf.Nethereum.Core/Options/EthereumAElfChainAliasOptions.cs b/modules/AElf.Nethereum.Core/Options/EthereumAElfChainAliasOptions.cs new file mode 100644 index 00000000..58f8d5d4 --- /dev/null +++ b/modules/AElf.Nethereum.Core/Options/EthereumAElfChainAliasOptions.cs @@ -0,0 +1,6 @@ +namespace AElf.Nethereum.Core.Options; + +public class EthereumAElfChainAliasOptions +{ + public Dictionary Mapping { get; set; } = new(); +} \ No newline at end of file diff --git a/modules/AElf.Nethereum.Core/Options/EthereumClientAccountMappingOptions.cs b/modules/AElf.Nethereum.Core/Options/EthereumClientAccountMappingOptions.cs deleted file mode 100644 index 7330e487..00000000 --- a/modules/AElf.Nethereum.Core/Options/EthereumClientAccountMappingOptions.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace AElf.Nethereum.Core.Options; - -public class EthereumClientAccountMappingOptions -{ - public Dictionary Mapping { get; set; } -} \ No newline at end of file diff --git a/modules/AElf.Nethereum.Core/Options/EthereumClientConfigOptions.cs b/modules/AElf.Nethereum.Core/Options/EthereumClientConfigOptions.cs index bbd1ec73..48ff25cb 100644 --- a/modules/AElf.Nethereum.Core/Options/EthereumClientConfigOptions.cs +++ b/modules/AElf.Nethereum.Core/Options/EthereumClientConfigOptions.cs @@ -2,12 +2,5 @@ namespace AElf.Nethereum.Core.Options; public class EthereumClientConfigOptions { - public List ClientConfigList { get; set; } = new(); -} - -public class EthereumClient -{ - public string Alias { get; set; } - - public string Url { get; set; } + public string AccountAlias { get; set; } } \ No newline at end of file diff --git a/modules/AElf.Nethereum.Core/Options/EthereumClientOptions.cs b/modules/AElf.Nethereum.Core/Options/EthereumClientOptions.cs new file mode 100644 index 00000000..8f8211a3 --- /dev/null +++ b/modules/AElf.Nethereum.Core/Options/EthereumClientOptions.cs @@ -0,0 +1,12 @@ +namespace AElf.Nethereum.Core.Options; + +public class EthereumClientOptions +{ + public List ClientConfigList { get; set; } +} + +public class EthereumClient +{ + public string Alias { get; set; } + public string Url { get; set; } +} \ No newline at end of file diff --git a/src/AElf.EventHandler/EventHandlerAppModule.cs b/src/AElf.EventHandler/EventHandlerAppModule.cs index 4d6ba6b0..bdf599de 100644 --- a/src/AElf.EventHandler/EventHandlerAppModule.cs +++ b/src/AElf.EventHandler/EventHandlerAppModule.cs @@ -3,6 +3,7 @@ using System.Security.Authentication; using AElf.Client.Bridge; using AElf.Client.Core; +using AElf.Client.Core.Options; using AElf.Client.MerkleTree; using AElf.Client.Oracle; using AElf.Client.Report; @@ -74,7 +75,6 @@ public override void ConfigureServices(ServiceConfigurationContext context) Configure(configuration.GetSection("Oracle")); Configure(configuration.GetSection("Bridge")); - Configure(configuration.GetSection("AElfChainAlias")); Configure(configuration.GetSection("BlockConfirmation")); context.Services.AddHostedService(); context.Services.AddTransient(typeof(ILogEventProcessor<>), typeof(LogEventProcessorBase<>)); diff --git a/src/AElf.EventHandler/Options/BridgeOptions.cs b/src/AElf.EventHandler/Options/BridgeOptions.cs index 5182d67d..7cf11d11 100644 --- a/src/AElf.EventHandler/Options/BridgeOptions.cs +++ b/src/AElf.EventHandler/Options/BridgeOptions.cs @@ -13,7 +13,8 @@ public class BridgeOptions public class BridgeItem { - public string EthereumClientAlias { get; set; } + public string ChainId { get; set; } + public string TargetChainId { get; set; } public string EthereumBridgeInContractAddress { get; set; } public string OriginToken { get; set; } public string QueryToAddress { get; set; } @@ -21,6 +22,4 @@ public class BridgeItem public string SwapId { get; set; } public string MaximumLeafCount { get; set; } public string EthereumSwapId { get; set; } - public string TargetChainId { get; set; } - } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs index 002e5cee..7a81d577 100644 --- a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs @@ -18,7 +18,6 @@ internal class QueryCreatedLogEventProcessor : LogEventProcessorBase "OracleContract"; private readonly ILogger _logger; @@ -29,7 +28,6 @@ public QueryCreatedLogEventProcessor( ILogger logger, IOptionsSnapshot bridgeOptions, IOptionsSnapshot oracleOptions, - IOptionsSnapshot aelfClientConfigOptions, IOracleService oracleService) : base(contractAddressOptions) { @@ -39,7 +37,6 @@ public QueryCreatedLogEventProcessor( _bridgeOptions = bridgeOptions.Value; _oracleOptions = oracleOptions.Value; _oracleService = oracleService; - _aElfClientConfigOptions = aelfClientConfigOptions.Value; } public override async Task ProcessAsync(LogEvent logEvent, EventContext context) @@ -75,9 +72,8 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) HashHelper.ComputeFrom(data), HashHelper.ConcatAndCompute(salt, HashHelper.ComputeFrom(_bridgeOptions.AccountAddress))) }; - var clientAlias = _aElfClientConfigOptions.Mapping[context.ChainId.ToString()]; _logger.LogInformation($"Sending Commit tx with input: {commitInput}"); - var transactionResult = await _oracleService.CommitAsync(clientAlias,commitInput); + var transactionResult = await _oracleService.CommitAsync(ChainHelper.ConvertChainIdToBase58(context.ChainId),commitInput); _logger.LogInformation($"[Commit] Transaction id {transactionResult.TransactionResult.TransactionId}"); } } diff --git a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs index 9d6e0e0a..a50548b1 100644 --- a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs @@ -22,7 +22,6 @@ internal class ReportConfirmedLogEventProcessor : LogEventProcessorBase ethereumContractOptions, ITransmitTransactionProvider transmitTransactionProvider, - IOptionsSnapshot bridgeOptions, - IReportService reportContractService) : base(contractAddressOptions) + IOptionsSnapshot bridgeOptions) : base(contractAddressOptions) { _logger = logger; _signaturesRecoverableInfoProvider = signaturesRecoverableInfoProvider; @@ -41,10 +39,6 @@ public ReportConfirmedLogEventProcessor(ILogger { - private readonly AElfContractOptions _contractAddressOptions; private readonly IReportProvider _reportProvider; private readonly IReportService _reportService; private readonly IAElfAccountProvider _accountProvider; - private readonly BridgeOptions _bridgeOptions; private readonly AElfClientConfigOptions _aelfClientConfigOptions; - private readonly AElfChainAliasOptions _aelfChainAliasOptions; public override string ContractName => "ReportContract"; private readonly ILogger _logger; @@ -30,18 +27,13 @@ public ReportProposedLogEventProcessor( IAElfAccountProvider accountProvider, ILogger logger, IOptionsSnapshot contractAddressOptions, - IOptionsSnapshot bridgeOptions, - IOptionsSnapshot aelfConfigOptions, - IOptionsSnapshot aelfChainAliasOptions) : base(contractAddressOptions) + IOptionsSnapshot aelfConfigOptions) : base(contractAddressOptions) { _logger = logger; - _contractAddressOptions = contractAddressOptions.Value; _reportProvider = reportProvider; _reportService = reportService; _accountProvider = accountProvider; - _bridgeOptions = bridgeOptions.Value; _aelfClientConfigOptions = aelfConfigOptions.Value; - _aelfChainAliasOptions = aelfChainAliasOptions.Value; } public override async Task ProcessAsync(LogEvent logEvent, EventContext context) @@ -53,7 +45,7 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) var privateKey = _accountProvider.GetPrivateKey(_aelfClientConfigOptions.AccountAlias); - var sendTxResult = await _reportService.ConfirmReportAsync(_aelfChainAliasOptions.Mapping[context.ChainId.ToString()],new ConfirmReportInput + var sendTxResult = await _reportService.ConfirmReportAsync(ChainHelper.ConvertChainIdToBase58(context.ChainId),new ConfirmReportInput { Token = reportProposed.Token, RoundId = reportProposed.RoundId, diff --git a/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs index d3629ff5..0912e0af 100644 --- a/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs @@ -14,27 +14,19 @@ internal class SufficientCommitmentsCollectedLogEventProcessor : { private readonly ISaltProvider _saltProvider; private readonly IDataProvider _dataProvider; - private readonly AElfContractOptions _contractAddressOptions; private readonly ILogger _logger; - private readonly OracleOptions _oracleOptions; private readonly IOracleService _oracleService; - private readonly AElfChainAliasOptions _aelfChainAliasOptions; public SufficientCommitmentsCollectedLogEventProcessor( IOptionsSnapshot contractAddressOptions, ISaltProvider saltProvider, IDataProvider dataProvider, ILogger logger, - IOptionsSnapshot oracleOptions, - IOracleService oracleService, - IOptionsSnapshot aelfChainAliasOptions) : base(contractAddressOptions) + IOracleService oracleService) : base(contractAddressOptions) { _saltProvider = saltProvider; _dataProvider = dataProvider; _logger = logger; - _contractAddressOptions = contractAddressOptions.Value; - _oracleOptions = oracleOptions.Value; _oracleService = oracleService; - _aelfChainAliasOptions = aelfChainAliasOptions.Value; } public override string ContractName => "OracleContract"; @@ -58,7 +50,7 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) Salt = _saltProvider.GetSalt(context.ChainId.ToString(),collected.QueryId) }; _logger.LogInformation($"Sending Reveal tx with input: {revealInput}"); - var transaction = await _oracleService.RevealAsync(_aelfChainAliasOptions.Mapping[context.ChainId.ToString()],revealInput); + var transaction = await _oracleService.RevealAsync(ChainHelper.ConvertChainIdToBase58(context.ChainId),revealInput); _logger.LogInformation($"[Reveal] Transaction id : {transaction.TransactionResult.TransactionId}"); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Providers/IDataProvider.cs b/src/AElf.EventHandler/Providers/IDataProvider.cs index 340754bb..2a07667c 100644 --- a/src/AElf.EventHandler/Providers/IDataProvider.cs +++ b/src/AElf.EventHandler/Providers/IDataProvider.cs @@ -136,7 +136,7 @@ private async Task GetReceiptHashMap(Hash swapId, BridgeItem bridgeItem, { var token = _bridgeOptions.Bridges.Single(c => c.SwapId == swapId.ToHex()).OriginToken; var chainId = _bridgeOptions.Bridges.Single(c => c.SwapId == swapId.ToHex()).TargetChainId; - var receiptInfos = await _bridgeOutService.GetSendReceiptInfosAsync(bridgeItem.EthereumClientAlias,bridgeItem.EthereumBridgeOutContractAddress, token, chainId,start,end); + var receiptInfos = await _bridgeOutService.GetSendReceiptInfosAsync(bridgeItem.ChainId,bridgeItem.EthereumBridgeOutContractAddress, token, chainId,start,end); var receiptHashes = new List(); for (var i = 0; i <= end - start; i++) { diff --git a/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs index bee6325b..109cb215 100644 --- a/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs +++ b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs @@ -72,7 +72,7 @@ protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext worker var tokenIndex = new Dictionary(); foreach (var bridgeItem in _bridgeOptions.Bridges) { - bridgeItemsMap[(bridgeItem.EthereumClientAlias, bridgeItem.EthereumBridgeOutContractAddress)] + bridgeItemsMap[(bridgeItem.ChainId, bridgeItem.EthereumBridgeOutContractAddress)] .Add(bridgeItem); } @@ -99,10 +99,9 @@ protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext worker private async Task SendQueryAsync(string chainId, BridgeItem bridgeItem, BigInteger tokenIndex) { var swapId = bridgeItem.SwapId; - var clientAlias = _aelfChainAliasOptions.Mapping[chainId]; - var spaceId = await _bridgeContractService.GetSpaceIdBySwapIdAsync(clientAlias, Hash.LoadFromBase64(swapId)); + var spaceId = await _bridgeContractService.GetSpaceIdBySwapIdAsync(chainId, Hash.LoadFromBase64(swapId)); var lastRecordedLeafIndex = (await _merkleTreeContractService.GetLastLeafIndexAsync( - clientAlias, new GetLastLeafIndexInput + chainId, new GetLastLeafIndexInput { SpaceId = spaceId })).Value; @@ -127,15 +126,15 @@ private async Task SendQueryAsync(string chainId, BridgeItem bridgeItem, BigInte var notRecordTokenNumber = tokenLeafIndex - lastRecordedLeafIndex; if (notRecordTokenNumber > 0) { - var blockNumber = await _nethereumService.GetBlockNumberAsync(bridgeItem.EthereumClientAlias); - var getReceiptInfos = await _bridgeOutService.GetSendReceiptInfosAsync(_aelfChainAliasOptions.Mapping[chainId], + var blockNumber = await _nethereumService.GetBlockNumberAsync(bridgeItem.ChainId); + var getReceiptInfos = await _bridgeOutService.GetSendReceiptInfosAsync(bridgeItem.ChainId, bridgeItem.EthereumBridgeOutContractAddress, bridgeItem.OriginToken, bridgeItem.TargetChainId, lastRecordedLeafIndex+2,(long)tokenIndex); var lastLeafIndexConfirm = lastRecordedLeafIndex; for (var i = 0; i < tokenLeafIndex - lastRecordedLeafIndex; i++) { var blockHeight = getReceiptInfos.Receipts[i].BlockHeight; - var blockConfirmationCount = _blockConfirmationOptions.ConfirmationCount[bridgeItem.EthereumClientAlias]; + var blockConfirmationCount = _blockConfirmationOptions.ConfirmationCount[bridgeItem.ChainId]; if (blockNumber - blockHeight > blockConfirmationCount) continue; lastLeafIndexConfirm += (i+1); break; @@ -168,7 +167,7 @@ private async Task SendQueryAsync(string chainId, BridgeItem bridgeItem, BigInte _logger.LogInformation($"About to send Query transaction for token swapping, QueryInput: {queryInput}"); - var sendTxResult = await _oracleService.QueryAsync(clientAlias, queryInput); + var sendTxResult = await _oracleService.QueryAsync(chainId, queryInput); _logger.LogInformation($"Query transaction id : {sendTxResult.TransactionResult.TransactionId}"); _latestQueriedReceiptCountProvider.Set(swapId, lastLeafIndexConfirm + 2); _logger.LogInformation( diff --git a/src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs b/src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs index 542ee9a1..10383ce6 100644 --- a/src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs +++ b/src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs @@ -1,4 +1,5 @@ using System.Threading.Tasks; +using AElf.Client.Core.Options; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Volo.Abp.BackgroundWorkers; diff --git a/src/AElf.EventHandler/appsettings.json b/src/AElf.EventHandler/appsettings.json index 7f5bf39b..4669ab54 100644 --- a/src/AElf.EventHandler/appsettings.json +++ b/src/AElf.EventHandler/appsettings.json @@ -51,7 +51,7 @@ }, "AElfChainAlias": { "Mapping": { - "9992731": "Test1" + "AELF": "ClientAlias" } }, "EthereumClient": { @@ -74,9 +74,9 @@ "EthereumClientConfig": { "AccountAlias": "Test1" }, - "EthereumClientAccountMapping": { + "EthereumChainAlias": { "Mapping": { - "ClientAlias": "AccountAlias" + "Ethereum": "ClientAlias" } }, "AElfContract": { From b4c99e74152c1cd526ba15ecfd5956064fe46414 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Wed, 24 Aug 2022 12:53:10 +0800 Subject: [PATCH 22/66] fix: fix price sync --- modules/AElf.Client.Bridge/BridgeService.cs | 24 ++++++++++- .../AElf.Client.Core/ContractServiceBase.cs | 6 +-- .../MerkleTreeContract.cs | 3 +- src/AElf.PriceWorker/PriceSyncOptions.cs | 8 +++- src/AElf.PriceWorker/PriceSyncWorker.cs | 37 +++++++++++++--- src/AElf.PriceWorker/appsettings.json | 42 ++++++++++++------- 6 files changed, 93 insertions(+), 27 deletions(-) diff --git a/modules/AElf.Client.Bridge/BridgeService.cs b/modules/AElf.Client.Bridge/BridgeService.cs index 635300bc..ed936e8d 100644 --- a/modules/AElf.Client.Bridge/BridgeService.cs +++ b/modules/AElf.Client.Bridge/BridgeService.cs @@ -3,6 +3,8 @@ using AElf.Contracts.Bridge; using AElf.Contracts.Report; using AElf.Types; +using Google.Protobuf; +using Google.Protobuf.WellKnownTypes; using Microsoft.Extensions.Options; using Volo.Abp.DependencyInjection; @@ -13,6 +15,8 @@ public interface IBridgeService Task GetSpaceIdBySwapIdAsync(string chainId, Hash swapId); Task SetGasPriceAsync(string chainId, SetGasPriceInput input); Task SetPriceRatioAsync(string chainId, SetPriceRatioInput input); + Task GetGasPriceAsync(string chainId, StringValue input); + Task GetPriceRatioAsync(string chainId, StringValue input); } public class BridgeService : ContractServiceBase, IBridgeService, ITransientDependency @@ -20,7 +24,7 @@ public class BridgeService : ContractServiceBase, IBridgeService, ITransientDepe private readonly IAElfClientService _clientService; private readonly AElfContractOptions _contractOptions; - protected override string SmartContractName { get; }= "BridgeContractAddress"; + protected override string SmartContractName { get; }= "BridgeContract"; public BridgeService(IAElfClientService clientService, IOptionsSnapshot contractOptions) @@ -56,4 +60,22 @@ public async Task SetPriceRatioAsync(string chainId, SetP TransactionResult = await PerformGetTransactionResultAsync(tx.GetHash().ToHex(), chainId) }; } + + public async Task GetGasPriceAsync(string chainId, StringValue input) + { + var result = await _clientService.ViewAsync(GetContractAddress(chainId), "GetGasPrice", + input, AElfChainAliasOptions.Value.Mapping[chainId]); + var actualResult = new StringValue(); + actualResult.MergeFrom(result); + return actualResult; + } + + public async Task GetPriceRatioAsync(string chainId, StringValue input) + { + var result = await _clientService.ViewAsync(GetContractAddress(chainId), "GetPriceRatio", + input, AElfChainAliasOptions.Value.Mapping[chainId]); + var actualResult = new StringValue(); + actualResult.MergeFrom(result); + return actualResult; + } } \ No newline at end of file diff --git a/modules/AElf.Client.Core/ContractServiceBase.cs b/modules/AElf.Client.Core/ContractServiceBase.cs index c3cf4206..80a2995d 100644 --- a/modules/AElf.Client.Core/ContractServiceBase.cs +++ b/modules/AElf.Client.Core/ContractServiceBase.cs @@ -12,13 +12,13 @@ public abstract class ContractServiceBase public IOptionsSnapshot ContractOptions { get; set; } protected abstract string SmartContractName { get; } public ILogger Logger { get; set; } - public IOptionsSnapshot _aelfChainAliasOptions { get; set; } + public IOptionsSnapshot AElfChainAliasOptions { get; set; } protected async Task PerformSendTransactionAsync(string methodName, IMessage parameter, string chainId) { var contractAddress = GetContractAddress(chainId); - var clientAlias = _aelfChainAliasOptions.Value.Mapping[chainId]; + var clientAlias = AElfChainAliasOptions.Value.Mapping[chainId]; return await ClientService.SendAsync(contractAddress, methodName, parameter, clientAlias); } @@ -26,7 +26,7 @@ protected async Task PerformGetTransactionResultAsync(string string chainId) { TransactionResult txResult; - var clientAlias = _aelfChainAliasOptions.Value.Mapping[chainId]; + var clientAlias = AElfChainAliasOptions.Value.Mapping[chainId]; do { txResult = await ClientService.GetTransactionResultAsync(transactionId, clientAlias); diff --git a/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs b/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs index d51a40a6..64bffd5d 100644 --- a/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs +++ b/modules/AElf.Client.MerkleTree/MerkleTreeContract.cs @@ -39,8 +39,9 @@ public async Task CreateSpaceAsync(string chainId, Create public async Task GetLastLeafIndexAsync(string chainId, GetLastLeafIndexInput getLastLeafIndexInput) { + var clientAlias = AElfChainAliasOptions.Value.Mapping[chainId]; var result = await _clientService.ViewAsync(GetContractAddress(chainId), "GetLastLeafIndex", - getLastLeafIndexInput, chainId); + getLastLeafIndexInput, clientAlias); var actualResult = new Int64Value(); actualResult.MergeFrom(result); return actualResult; diff --git a/src/AElf.PriceWorker/PriceSyncOptions.cs b/src/AElf.PriceWorker/PriceSyncOptions.cs index c4430052..ecf85b8b 100644 --- a/src/AElf.PriceWorker/PriceSyncOptions.cs +++ b/src/AElf.PriceWorker/PriceSyncOptions.cs @@ -4,6 +4,12 @@ namespace AElf.PriceWorker; public class PriceSyncOptions { - public List SourceChains { get; set; } = new(); + public List SourceChains { get; set; } = new(); public List TargetChains { get; set; } = new(); +} + +public class ChainItem +{ + public string ChainId { get; set; } + public string NativeToken { get; set; } } \ No newline at end of file diff --git a/src/AElf.PriceWorker/PriceSyncWorker.cs b/src/AElf.PriceWorker/PriceSyncWorker.cs index e06b4ce2..e6c2cd26 100644 --- a/src/AElf.PriceWorker/PriceSyncWorker.cs +++ b/src/AElf.PriceWorker/PriceSyncWorker.cs @@ -4,6 +4,7 @@ using AElf.Client.Bridge; using AElf.Contracts.Bridge; using AElf.TokenPrice; +using Google.Protobuf.WellKnownTypes; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Volo.Abp.BackgroundWorkers; @@ -37,25 +38,49 @@ protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext worker var setPriceRatioInput = new SetPriceRatioInput(); var elfPrice = await _tokenPriceService.GetPriceAsync("ELF"); - var ethPrice = await _tokenPriceService.GetPriceAsync("ETH"); - var ratio = (long)(ethPrice * (decimal)Math.Pow(10, 8) / elfPrice); foreach (var item in _priceSyncOptions.SourceChains) { - var gasFee = await _blockchainTransactionFeeService.GetTransactionFeeAsync(item); + var gasFee = await _blockchainTransactionFeeService.GetTransactionFeeAsync(item.ChainId); var feeWei = (long)(gasFee.Fee * (decimal)Math.Pow(10, 9)); setGasPriceInput.GasPriceList.Add(new GasPrice { - ChainId = item, + ChainId = item.ChainId, GasPrice_ = feeWei }); - + + decimal nativePrice = await _tokenPriceService.GetPriceAsync(item.NativeToken); + var ratio = (long)(nativePrice * (decimal)Math.Pow(10, 8) / elfPrice); setPriceRatioInput.Value.Add(new PriceRatio { - TargetChainId = item, + TargetChainId = item.ChainId, PriceRatio_ = ratio }); } + // + // setGasPriceInput.GasPriceList.Add(new GasPrice + // { + // ChainId = "Ethereum", + // GasPrice_ = 56120000000 + // }); + // + // setGasPriceInput.GasPriceList.Add(new GasPrice + // { + // ChainId = "BSC", + // GasPrice_ = 16120000000 + // }); + // + // setPriceRatioInput.Value.Add(new PriceRatio + // { + // TargetChainId = "Ethereum", + // PriceRatio_ = 135475890000 + // }); + // + // setPriceRatioInput.Value.Add(new PriceRatio + // { + // TargetChainId = "BSC", + // PriceRatio_ = 2475890000 + // }); foreach (var item in _priceSyncOptions.TargetChains) { diff --git a/src/AElf.PriceWorker/appsettings.json b/src/AElf.PriceWorker/appsettings.json index a66934d1..f658920b 100644 --- a/src/AElf.PriceWorker/appsettings.json +++ b/src/AElf.PriceWorker/appsettings.json @@ -2,8 +2,8 @@ "AElfClient": { "ClientConfigList": [ { - "Alias": "Example", - "Endpoint": "http://192.168.0.31:6800", + "Alias": "AELF-Test", + "Endpoint": "http://192.168.67.47:8000", "UserName": "", "Password": "", "Timeout": 100 @@ -14,12 +14,8 @@ "KeyDirectory": "", "AccountConfigList": [ { - "Alias": "Ean", - "PrivateKey": "8cc296e44d9e8881942e75a21ebc116ed3f29e39e0eaace1c92dc21e86d215c3", - }, - { - "Alias": "Test2", - "PrivateKey": "5e2f12d13e4527ad1128e07db00f1614ec6b8b51662e68d4fdb42125ab384195" + "Alias": "bp", + "PrivateKey": "8d1d8002802dd6fcd80ae9f5c5c6e4914a1120427c2108c5334353ffc270497b" } ] }, @@ -27,19 +23,35 @@ "ClientAlias": "TestNetSideChain2", "MainChainClientAlias": "TestNetMainChain", "SideChainClientAlias": "TestNetSideChain2", - "AccountAlias": "eanz" + "AccountAlias": "bp" }, "AElfContract": { "ContractDirectory": "", - "AELF": { - "MerkleTreeContract": "2RHf2fxsnEaM3wb6N1yGqPupNZbcCY98LgWbGSFWmWzgEs5Sjo", - "BridgeContract": "pykr77ft9UUKJZLVq15wCH8PinBSjVRQ12sD1Ayq92mKFsJ1i", - "OracleContract": "2ZpYFeE4yWjrcKLBoj1iwbfYnbo9hK7exvfGTdqcq77QSxpzNH" + "ContractAddressList": { + "AELF": { + "BridgeContract": "2hqsqJndRAZGzk96fsEvyuVBTAvoBjcuwTjkuyJffBPueJFrLa" + } + } + }, + "AElfChainAlias": { + "Mapping": { + "AELF": "AELF-Test" } }, "PriceSync": { - "SourceChains": ["Ethereum","BSC"], - "TargetChains": ["AELF", "tDVW"] + "SourceChains": [ + { + "ChainId": "Ethereum", + "NativeToken": "ETH" + }, + { + "ChainId": "BSC", + "NativeToken": "BNB" + } + ], + "TargetChains": [ + "AELF" + ] }, "TokenPrice": { "CoinIdMapping": { From 244db556439f5da33b7dc4f4678c5cc95e8daa4b Mon Sep 17 00:00:00 2001 From: zhxymh Date: Wed, 24 Aug 2022 19:55:25 +0800 Subject: [PATCH 23/66] fix: fix bridge in and out --- .../GetSendReceiptIndexDTO.cs | 3 +- .../AElf.Nethereum.Bridge/IBridgeInService.cs | 31 +- .../IBridgeOutService.cs | 33 +- .../ContractBuild/BridgeInAbi.json | 504 +++++++++++++++ .../ContractBuild/BridgeOutAbi.json | 609 ++++++++++++++++++ .../EventHandlerAppModule.cs | 3 +- .../Providers/IDataProvider.cs | 26 +- .../Providers/ITransmitTransactionProvider.cs | 8 +- .../Workers/ReceiptSyncWorker.cs | 10 +- src/AElf.EventHandler/appsettings.json | 46 +- 10 files changed, 1182 insertions(+), 91 deletions(-) create mode 100644 src/AElf.EventHandler/ContractBuild/BridgeInAbi.json create mode 100644 src/AElf.EventHandler/ContractBuild/BridgeOutAbi.json diff --git a/modules/AElf.Nethereum.Bridge/GetSendReceiptIndexDTO.cs b/modules/AElf.Nethereum.Bridge/GetSendReceiptIndexDTO.cs index 3c41e7dc..1ac2c27f 100644 --- a/modules/AElf.Nethereum.Bridge/GetSendReceiptIndexDTO.cs +++ b/modules/AElf.Nethereum.Bridge/GetSendReceiptIndexDTO.cs @@ -6,5 +6,6 @@ namespace AElf.Nethereum.Bridge; [FunctionOutput] public class GetSendReceiptIndexDTO : IFunctionOutputDTO { - [Parameter("tuple[]", "indexes", 1)] public List Indexes { get; set; } + [Parameter("uint256[]", "indexes", 1)] + public List Indexes { get; set; } } \ No newline at end of file diff --git a/modules/AElf.Nethereum.Bridge/IBridgeInService.cs b/modules/AElf.Nethereum.Bridge/IBridgeInService.cs index f2b38807..9bb4117e 100644 --- a/modules/AElf.Nethereum.Bridge/IBridgeInService.cs +++ b/modules/AElf.Nethereum.Bridge/IBridgeInService.cs @@ -6,22 +6,33 @@ namespace AElf.Nethereum.Bridge; public interface IBridgeInService { - Task TransmitAsync(string chainId, string contractAddress, byte[] report, byte[][] rs, byte[][] ss, byte[] rawVs); + Task GetSendReceiptInfosAsync(string chainId, string contractAddress, string token, string targetChainId, long fromIndex,long endIndex); + + Task GetTransferReceiptIndexAsync(string chainId, string contractAddress, List tokens, + List targetChainIds); } public class BridgeInService : ContractServiceBase, IBridgeInService, ITransientDependency { protected override string SmartContractName { get; } = "BridgeIn"; - public async Task TransmitAsync(string chainId, string contractAddress, byte[] report, - byte[][] rs, byte[][] ss, byte[] rawVs) + public async Task GetSendReceiptInfosAsync(string chainId, string contractAddress, + string token, string targetChainId, long fromIndex,long endIndex) + { + var function = GetFunction(chainId, contractAddress, "getSendReceiptInfos"); + + var evmGetReceiptInfos = + await function.CallDeserializingToObjectAsync(token, targetChainId, fromIndex,endIndex); + return evmGetReceiptInfos; + } + + public async Task GetTransferReceiptIndexAsync(string chainId, string contractAddress, + List tokens, List targetChainIds) { - var setValueFunction = GetFunction(chainId, contractAddress, "transmit"); - var sender = GetAccount().Address; - var gas = await setValueFunction.EstimateGasAsync(sender, null, null, report, rs, ss, rawVs); - var transactionResult = - await setValueFunction.SendTransactionAsync(sender, gas, null, null, report, - rs, ss, rawVs); - return transactionResult; + var function = GetFunction(chainId, contractAddress, "getSendReceiptIndex"); + + var evmGetReceiptInfos = + await function.CallDeserializingToObjectAsync(tokens, targetChainIds); + return evmGetReceiptInfos; } } \ No newline at end of file diff --git a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs index 2ff349a7..8c7caa98 100644 --- a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs +++ b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs @@ -6,33 +6,22 @@ namespace AElf.Nethereum.Bridge; public interface IBridgeOutService { - Task GetSendReceiptInfosAsync(string chainId, string contractAddress, string token, string targetChainId, long fromIndex,long endIndex); - - Task GetTransferReceiptIndexAsync(string chainId, string contractAddress, List tokens, - List targetChainIds); + Task TransmitAsync(string chainId, string contractAddress, byte[] report, byte[][] rs, byte[][] ss, byte[] rawVs); } public class BridgeOutService : ContractServiceBase, IBridgeOutService, ITransientDependency { protected override string SmartContractName { get; } = "BridgeOut"; - - public async Task GetSendReceiptInfosAsync(string chainId, string contractAddress, - string token, string targetChainId, long fromIndex,long endIndex) + + public async Task TransmitAsync(string chainId, string contractAddress, byte[] report, + byte[][] rs, byte[][] ss, byte[] rawVs) { - var function = GetFunction(chainId, contractAddress, "getSendReceiptInfos"); - - var evmGetReceiptInfos = - await function.CallDeserializingToObjectAsync(token, targetChainId, fromIndex,endIndex); - return evmGetReceiptInfos; - } - - public async Task GetTransferReceiptIndexAsync(string chainId, string contractAddress, - List tokens, List targetChainIds) - { - var function = GetFunction(chainId, contractAddress, "getSendReceiptIndex"); - - var evmGetReceiptInfos = - await function.CallDeserializingToObjectAsync(tokens, targetChainIds); - return evmGetReceiptInfos; + var setValueFunction = GetFunction(chainId, contractAddress, "transmit"); + var sender = GetAccount().Address; + var gas = await setValueFunction.EstimateGasAsync(sender, null, null, report, rs, ss, rawVs); + var transactionResult = + await setValueFunction.SendTransactionAsync(sender, gas, null, null, report, + rs, ss, rawVs); + return transactionResult; } } \ No newline at end of file diff --git a/src/AElf.EventHandler/ContractBuild/BridgeInAbi.json b/src/AElf.EventHandler/ContractBuild/BridgeInAbi.json new file mode 100644 index 00000000..dc83d5c8 --- /dev/null +++ b/src/AElf.EventHandler/ContractBuild/BridgeInAbi.json @@ -0,0 +1,504 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "BridgeIn", + "sourceName": "contracts/BridgeIn.sol", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "receiptId", + "type": "string" + }, + { + "indexed": false, + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "NewReceipt", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "chainId", + "type": "string" + } + ], + "name": "TokenAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "chainId", + "type": "string" + } + ], + "name": "TokenRemoved", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "tokenKey", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "receiptIndex", + "type": "uint256" + } + ], + "name": "_generateReceiptId", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "string", + "name": "chainId", + "type": "string" + } + ], + "name": "_generateTokenKey", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "string", + "name": "chainId", + "type": "string" + } + ], + "name": "addToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "string", + "name": "targetChainId", + "type": "string" + }, + { + "internalType": "string", + "name": "targetAddress", + "type": "string" + } + ], + "name": "createReceipt", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "string", + "name": "targetChainId", + "type": "string" + } + ], + "name": "getMyReceipts", + "outputs": [ + { + "internalType": "string[]", + "name": "", + "type": "string[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "string[]", + "name": "targetChainIds", + "type": "string[]" + } + ], + "name": "getSendReceiptIndex", + "outputs": [ + { + "internalType": "uint256[]", + "name": "indexes", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "string", + "name": "targetChainId", + "type": "string" + }, + { + "internalType": "uint256", + "name": "fromIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endIndex", + "type": "uint256" + } + ], + "name": "getSendReceiptInfos", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockHeight", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockTime", + "type": "uint256" + }, + { + "internalType": "string", + "name": "targetChainId", + "type": "string" + }, + { + "internalType": "string", + "name": "targetAddress", + "type": "string" + }, + { + "internalType": "string", + "name": "receiptId", + "type": "string" + } + ], + "internalType": "struct BridgeIn.Receipt[]", + "name": "_receipts", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "string", + "name": "chainId", + "type": "string" + } + ], + "name": "isSupported", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "ownerToReceipts", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "receipts", + "outputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockHeight", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockTime", + "type": "uint256" + }, + { + "internalType": "string", + "name": "targetChainId", + "type": "string" + }, + { + "internalType": "string", + "name": "targetAddress", + "type": "string" + }, + { + "internalType": "string", + "name": "receiptId", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "string", + "name": "chainId", + "type": "string" + } + ], + "name": "removeToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "totalAmountInReceipts", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x60806040523480156200001157600080fd5b5062000032620000266200003860201b60201c565b6200004060201b60201c565b62000104565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b613a7580620001146000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a61161009757806398cf2dcd1161006657806398cf2dcd146102b1578063dc78d137146102e1578063e469640a14610311578063f2fde38b1461032d576100f5565b8063715018a61461023d57806381020a34146102475780638da5cb5b146102775780638f2c7eaf14610295576100f5565b80634fa4c941116100d35780634fa4c94114610176578063526da4c5146101a6578063538a802a146101d65780636da3dbbd1461020d576100f5565b80632c8da560146100fa578063407d83d914610116578063446f95b414610146575b600080fd5b610114600480360381019061010f91906122fd565b610349565b005b610130600480360381019061012b91906122fd565b610466565b60405161013d9190612378565b60405180910390f35b610160600480360381019061015b91906124d4565b6104d7565b60405161016d9190612549565b60405180910390f35b610190600480360381019061018b9190612590565b610552565b60405161019d91906125d6565b60405180910390f35b6101c060048036038101906101bb919061261d565b61056a565b6040516101cd91906126e5565b60405180910390f35b6101f060048036038101906101eb919061261d565b6105ef565b604051610204989796959493929190612716565b60405180910390f35b610227600480360381019061022291906128c2565b61082c565b60405161023491906129fc565b60405180910390f35b6102456109b3565b005b610261600480360381019061025c9190612a1e565b6109c7565b60405161026e9190612b9e565b60405180910390f35b61027f610b4c565b60405161028c9190612bc0565b60405180910390f35b6102af60048036038101906102aa91906122fd565b610b75565b005b6102cb60048036038101906102c69190612bdb565b610c92565b6040516102d89190612df2565b60405180910390f35b6102fb60048036038101906102f69190612e14565b611115565b60405161030891906126e5565b60405180910390f35b61032b60048036038101906103269190612e67565b6111db565b005b61034760048036038101906103429190612f0e565b611626565b005b610351610b4c565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103b590612f87565b60405180910390fd5b600061040e8484848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104d7565b90506104248160046116aa90919063ffffffff16565b507f7afee0f1b802cc0f66c67890e26b4566251859cf2cd8de79b86aed7251d9756a84848460405161045893929190612fd4565b60405180910390a150505050565b6000806104b78585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104d7565b90506104cd8160046116c190919063ffffffff16565b9150509392505050565b6000600283836040516020016104ee92919061308a565b60405160208183030381529060405260405161050a91906130f9565b602060405180830381855afa158015610527573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061054a9190613125565b905092915050565b60026020528060005260406000206000915090505481565b60606000610577846116d8565b905060006040518060400160405280600181526020017f2e00000000000000000000000000000000000000000000000000000000000000815250905060006105be85611717565b90508282826040516020016105d593929190613152565b604051602081830303815290604052935050505092915050565b6001602052816000526040600020818154811061060b57600080fd5b9060005260206000209060080201600091509150508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600201549080600301549080600401549080600501805461068d906131b2565b80601f01602080910402602001604051908101604052809291908181526020018280546106b9906131b2565b80156107065780601f106106db57610100808354040283529160200191610706565b820191906000526020600020905b8154815290600101906020018083116106e957829003601f168201915b50505050509080600601805461071b906131b2565b80601f0160208091040260200160405190810160405280929190818152602001828054610747906131b2565b80156107945780601f1061076957610100808354040283529160200191610794565b820191906000526020600020905b81548152906001019060200180831161077757829003601f168201915b5050505050908060070180546107a9906131b2565b80601f01602080910402602001604051908101604052809291908181526020018280546107d5906131b2565b80156108225780601f106107f757610100808354040283529160200191610822565b820191906000526020600020905b81548152906001019060200180831161080557829003601f168201915b5050505050905088565b606082829050845114610874576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086b90613256565b60405180910390fd5b835167ffffffffffffffff81111561088f5761088e6123a9565b5b6040519080825280602002602001820160405280156108bd5781602001602082028036833780820191505090505b50905060005b84518110156109ab5760006109598683815181106108e4576108e3613276565b5b60200260200101518686858181106108ff576108fe613276565b5b905060200281019061091191906132b4565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104d7565b90506000600160008381526020019081526020016000208054905090508084848151811061098a57610989613276565b5b602002602001018181525050505080806109a390613346565b9150506108c3565b509392505050565b6109bb611878565b6109c560006118f6565b565b60606000610a198585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104d7565b90506000600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b82821015610b39578382906000526020600020018054610aac906131b2565b80601f0160208091040260200160405190810160405280929190818152602001828054610ad8906131b2565b8015610b255780601f10610afa57610100808354040283529160200191610b25565b820191906000526020600020905b815481529060010190602001808311610b0857829003601f168201915b505050505081526020019060010190610a8d565b5050505090508092505050949350505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610b7d610b4c565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610bea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be190612f87565b60405180910390fd5b6000610c3a8484848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104d7565b9050610c508160046119ba90919063ffffffff16565b507f617a625823f687a1440db57ae598a2ba91f2c2d180bb2adc78e5fbfed162ca33848484604051610c8493929190612fd4565b60405180910390a150505050565b60606000610ce48787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104d7565b9050600060016000838152602001908152602001600020805490501415610d0b575061110c565b60016000828152602001908152602001600020805490508311158015610d315750600084115b610d70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d67906133db565b60405180910390fd5b6000610d986001610d8a87876119d190919063ffffffff16565b6119e790919063ffffffff16565b90508067ffffffffffffffff811115610db457610db36123a9565b5b604051908082528060200260200182016040528015610ded57816020015b610dda612112565b815260200190600190039081610dd25790505b5092506000600186610dff91906133fb565b90505b8481101561110857600160008481526020019081526020016000208181548110610e2f57610e2e613276565b5b9060005260206000209060080201604051806101000160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600282015481526020016003820154815260200160048201548152602001600582018054610f23906131b2565b80601f0160208091040260200160405190810160405280929190818152602001828054610f4f906131b2565b8015610f9c5780601f10610f7157610100808354040283529160200191610f9c565b820191906000526020600020905b815481529060010190602001808311610f7f57829003601f168201915b50505050508152602001600682018054610fb5906131b2565b80601f0160208091040260200160405190810160405280929190818152602001828054610fe1906131b2565b801561102e5780601f106110035761010080835404028352916020019161102e565b820191906000526020600020905b81548152906001019060200180831161101157829003601f168201915b50505050508152602001600782018054611047906131b2565b80601f0160208091040260200160405190810160405280929190818152602001828054611073906131b2565b80156110c05780601f10611095576101008083540402835291602001916110c0565b820191906000526020600020905b8154815290600101906020018083116110a357829003601f168201915b5050505050815250508482815181106110dc576110db613276565b5b602002602001018190525080806110f290613346565b915050808061110090613346565b915050610e02565b5050505b95945050505050565b6003602052826000526040600020602052816000526040600020818154811061113d57600080fd5b906000526020600020016000925092505050805461115a906131b2565b80601f0160208091040260200160405190810160405280929190818152602001828054611186906131b2565b80156111d35780601f106111a8576101008083540402835291602001916111d3565b820191906000526020600020905b8154815290600101906020018083116111b657829003601f168201915b505050505081565b600061122b8786868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104d7565b90506112418160046116c190919063ffffffff16565b611280576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611277906134a1565b60405180910390fd5b6112ad3330888a73ffffffffffffffffffffffffffffffffffffffff166119fd909392919063ffffffff16565b60006112d86001806000858152602001908152602001600020805490506119e790919063ffffffff16565b905060006112e6838361056a565b9050600160008481526020019081526020016000206040518061010001604052808b73ffffffffffffffffffffffffffffffffffffffff1681526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018a815260200143815260200142815260200189898080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050815260200187878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050815260200183815250908060018154018082558091505060019003906000526020600020906008020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020155606082015181600301556080820151816004015560a08201518160050190805190602001906114da929190612183565b5060c08201518160060190805190602001906114f7929190612183565b5060e0820151816007019080519060200190611514929190612183565b50505061153d8860026000868152602001908152602001600020546119e790919063ffffffff16565b6002600085815260200190815260200160002081905550600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000848152602001908152602001600020819080600181540180825580915050600190039060005260206000200160009091909190915090805190602001906115dd929190612183565b507f50ca3994210a330ab9ce981c2856cfdcec3e63e889ae3cea5202478d40dff2d5818a8b8b60405161161394939291906134c1565b60405180910390a1505050505050505050565b61162e611878565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561169e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116959061357f565b60405180910390fd5b6116a7816118f6565b50565b60006116b98360000183611a86565b905092915050565b60006116d08360000183611af6565b905092915050565b60606116e382611b19565b6116f0608084901b611b19565b60405160200161170192919061360c565b6040516020818303038152906040529050919050565b6060600082141561175f576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050611873565b600082905060005b6000821461179157808061177a90613346565b915050600a8261178a9190613672565b9150611767565b60008167ffffffffffffffff8111156117ad576117ac6123a9565b5b6040519080825280601f01601f1916602001820160405280156117df5781602001600182028036833780820191505090505b5090505b6000851461186c576001826117f891906133fb565b9150600a8561180791906136a3565b603061181391906136d4565b60f81b81838151811061182957611828613276565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856118659190613672565b94506117e3565b8093505050505b919050565b611880611d79565b73ffffffffffffffffffffffffffffffffffffffff1661189e610b4c565b73ffffffffffffffffffffffffffffffffffffffff16146118f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118eb90613776565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60006119c98360000183611d81565b905092915050565b600081836119df91906133fb565b905092915050565b600081836119f591906136d4565b905092915050565b611a80846323b872dd60e01b858585604051602401611a1e93929190613796565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611e95565b50505050565b6000611a928383611af6565b611aeb578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050611af0565b600090505b92915050565b600080836001016000848152602001908152602001600020541415905092915050565b6000604077ffffffffffffffff0000000000000000000000000000000060001b836fffffffffffffffffffffffffffffffff191616901c7fffffffffffffffff00000000000000000000000000000000000000000000000060001b836fffffffffffffffffffffffffffffffff19161617905060207bffffffff000000000000000000000000ffffffff000000000000000060001b8216901c7fffffffff000000000000000000000000ffffffff00000000000000000000000060001b821617905060107dffff000000000000ffff000000000000ffff000000000000ffff0000000060001b8216901c7fffff000000000000ffff000000000000ffff000000000000ffff00000000000060001b821617905060087eff000000ff000000ff000000ff000000ff000000ff000000ff000000ff000060001b8216901c7fff000000ff000000ff000000ff000000ff000000ff000000ff000000ff00000060001b821617905060087f0f000f000f000f000f000f000f000f000f000f000f000f000f000f000f000f0060001b8216901c60047ff000f000f000f000f000f000f000f000f000f000f000f000f000f000f000f00060001b8316901c17905060277f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f60047f06060606060606060606060606060606060606060606060606060606060606068460001c611d2991906136d4565b901c16611d3691906137cd565b8160001c7f3030303030303030303030303030303030303030303030303030303030303030611d6591906136d4565b611d6f91906136d4565b60001b9050919050565b600033905090565b60008083600101600084815260200190815260200160002054905060008114611e89576000600182611db391906133fb565b9050600060018660000180549050611dcb91906133fb565b9050818114611e3a576000866000018281548110611dec57611deb613276565b5b9060005260206000200154905080876000018481548110611e1057611e0f613276565b5b90600052602060002001819055508387600101600083815260200190815260200160002081905550505b85600001805480611e4e57611e4d613827565b5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611e8f565b60009150505b92915050565b6000611ef7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611f5c9092919063ffffffff16565b9050600081511115611f575780806020019051810190611f179190613882565b611f56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f4d90613921565b60405180910390fd5b5b505050565b6060611f6b8484600085611f74565b90509392505050565b606082471015611fb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fb0906139b3565b60405180910390fd5b611fc285612088565b612001576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ff890613a1f565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161202a91906130f9565b60006040518083038185875af1925050503d8060008114612067576040519150601f19603f3d011682016040523d82523d6000602084013e61206c565b606091505b509150915061207c8282866120ab565b92505050949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b606083156120bb5782905061210b565b6000835111156120ce5782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161210291906126e5565b60405180910390fd5b9392505050565b604051806101000160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160008152602001600081526020016060815260200160608152602001606081525090565b82805461218f906131b2565b90600052602060002090601f0160209004810192826121b157600085556121f8565b82601f106121ca57805160ff19168380011785556121f8565b828001600101855582156121f8579182015b828111156121f75782518255916020019190600101906121dc565b5b5090506122059190612209565b5090565b5b8082111561222257600081600090555060010161220a565b5090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006122658261223a565b9050919050565b6122758161225a565b811461228057600080fd5b50565b6000813590506122928161226c565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f8401126122bd576122bc612298565b5b8235905067ffffffffffffffff8111156122da576122d961229d565b5b6020830191508360018202830111156122f6576122f56122a2565b5b9250929050565b60008060006040848603121561231657612315612230565b5b600061232486828701612283565b935050602084013567ffffffffffffffff81111561234557612344612235565b5b612351868287016122a7565b92509250509250925092565b60008115159050919050565b6123728161235d565b82525050565b600060208201905061238d6000830184612369565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6123e182612398565b810181811067ffffffffffffffff82111715612400576123ff6123a9565b5b80604052505050565b6000612413612226565b905061241f82826123d8565b919050565b600067ffffffffffffffff82111561243f5761243e6123a9565b5b61244882612398565b9050602081019050919050565b82818337600083830152505050565b600061247761247284612424565b612409565b90508281526020810184848401111561249357612492612393565b5b61249e848285612455565b509392505050565b600082601f8301126124bb576124ba612298565b5b81356124cb848260208601612464565b91505092915050565b600080604083850312156124eb576124ea612230565b5b60006124f985828601612283565b925050602083013567ffffffffffffffff81111561251a57612519612235565b5b612526858286016124a6565b9150509250929050565b6000819050919050565b61254381612530565b82525050565b600060208201905061255e600083018461253a565b92915050565b61256d81612530565b811461257857600080fd5b50565b60008135905061258a81612564565b92915050565b6000602082840312156125a6576125a5612230565b5b60006125b48482850161257b565b91505092915050565b6000819050919050565b6125d0816125bd565b82525050565b60006020820190506125eb60008301846125c7565b92915050565b6125fa816125bd565b811461260557600080fd5b50565b600081359050612617816125f1565b92915050565b6000806040838503121561263457612633612230565b5b60006126428582860161257b565b925050602061265385828601612608565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561269757808201518184015260208101905061267c565b838111156126a6576000848401525b50505050565b60006126b78261265d565b6126c18185612668565b93506126d1818560208601612679565b6126da81612398565b840191505092915050565b600060208201905081810360008301526126ff81846126ac565b905092915050565b6127108161225a565b82525050565b60006101008201905061272c600083018b612707565b612739602083018a612707565b61274660408301896125c7565b61275360608301886125c7565b61276060808301876125c7565b81810360a083015261277281866126ac565b905081810360c083015261278681856126ac565b905081810360e083015261279a81846126ac565b90509998505050505050505050565b600067ffffffffffffffff8211156127c4576127c36123a9565b5b602082029050602081019050919050565b60006127e86127e3846127a9565b612409565b9050808382526020820190506020840283018581111561280b5761280a6122a2565b5b835b8181101561283457806128208882612283565b84526020840193505060208101905061280d565b5050509392505050565b600082601f83011261285357612852612298565b5b81356128638482602086016127d5565b91505092915050565b60008083601f84011261288257612881612298565b5b8235905067ffffffffffffffff81111561289f5761289e61229d565b5b6020830191508360208202830111156128bb576128ba6122a2565b5b9250929050565b6000806000604084860312156128db576128da612230565b5b600084013567ffffffffffffffff8111156128f9576128f8612235565b5b6129058682870161283e565b935050602084013567ffffffffffffffff81111561292657612925612235565b5b6129328682870161286c565b92509250509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b612973816125bd565b82525050565b6000612985838361296a565b60208301905092915050565b6000602082019050919050565b60006129a98261293e565b6129b38185612949565b93506129be8361295a565b8060005b838110156129ef5781516129d68882612979565b97506129e183612991565b9250506001810190506129c2565b5085935050505092915050565b60006020820190508181036000830152612a16818461299e565b905092915050565b60008060008060608587031215612a3857612a37612230565b5b6000612a4687828801612283565b9450506020612a5787828801612283565b935050604085013567ffffffffffffffff811115612a7857612a77612235565b5b612a84878288016122a7565b925092505092959194509250565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600082825260208201905092915050565b6000612ada8261265d565b612ae48185612abe565b9350612af4818560208601612679565b612afd81612398565b840191505092915050565b6000612b148383612acf565b905092915050565b6000602082019050919050565b6000612b3482612a92565b612b3e8185612a9d565b935083602082028501612b5085612aae565b8060005b85811015612b8c5784840389528151612b6d8582612b08565b9450612b7883612b1c565b925060208a01995050600181019050612b54565b50829750879550505050505092915050565b60006020820190508181036000830152612bb88184612b29565b905092915050565b6000602082019050612bd56000830184612707565b92915050565b600080600080600060808688031215612bf757612bf6612230565b5b6000612c0588828901612283565b955050602086013567ffffffffffffffff811115612c2657612c25612235565b5b612c32888289016122a7565b94509450506040612c4588828901612608565b9250506060612c5688828901612608565b9150509295509295909350565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b612c988161225a565b82525050565b600061010083016000830151612cb76000860182612c8f565b506020830151612cca6020860182612c8f565b506040830151612cdd604086018261296a565b506060830151612cf0606086018261296a565b506080830151612d03608086018261296a565b5060a083015184820360a0860152612d1b8282612acf565b91505060c083015184820360c0860152612d358282612acf565b91505060e083015184820360e0860152612d4f8282612acf565b9150508091505092915050565b6000612d688383612c9e565b905092915050565b6000602082019050919050565b6000612d8882612c63565b612d928185612c6e565b935083602082028501612da485612c7f565b8060005b85811015612de05784840389528151612dc18582612d5c565b9450612dcc83612d70565b925060208a01995050600181019050612da8565b50829750879550505050505092915050565b60006020820190508181036000830152612e0c8184612d7d565b905092915050565b600080600060608486031215612e2d57612e2c612230565b5b6000612e3b86828701612283565b9350506020612e4c8682870161257b565b9250506040612e5d86828701612608565b9150509250925092565b60008060008060008060808789031215612e8457612e83612230565b5b6000612e9289828a01612283565b9650506020612ea389828a01612608565b955050604087013567ffffffffffffffff811115612ec457612ec3612235565b5b612ed089828a016122a7565b9450945050606087013567ffffffffffffffff811115612ef357612ef2612235565b5b612eff89828a016122a7565b92509250509295509295509295565b600060208284031215612f2457612f23612230565b5b6000612f3284828501612283565b91505092915050565b7f4e6f207065726d697373696f6e00000000000000000000000000000000000000600082015250565b6000612f71600d83612668565b9150612f7c82612f3b565b602082019050919050565b60006020820190508181036000830152612fa081612f64565b9050919050565b6000612fb38385612668565b9350612fc0838584612455565b612fc983612398565b840190509392505050565b6000604082019050612fe96000830186612707565b8181036020830152612ffc818486612fa7565b9050949350505050565b60008160601b9050919050565b600061301e82613006565b9050919050565b600061303082613013565b9050919050565b6130486130438261225a565b613025565b82525050565b600081905092915050565b60006130648261265d565b61306e818561304e565b935061307e818560208601612679565b80840191505092915050565b60006130968285613037565b6014820191506130a68284613059565b91508190509392505050565b600081519050919050565b600081905092915050565b60006130d3826130b2565b6130dd81856130bd565b93506130ed818560208601612679565b80840191505092915050565b600061310582846130c8565b915081905092915050565b60008151905061311f81612564565b92915050565b60006020828403121561313b5761313a612230565b5b600061314984828501613110565b91505092915050565b600061315e8286613059565b915061316a8285613059565b91506131768284613059565b9150819050949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806131ca57607f821691505b602082108114156131de576131dd613183565b5b50919050565b7f496e76616c696420746f6b656e732f746172676574436861696e49647320696e60008201527f7075740000000000000000000000000000000000000000000000000000000000602082015250565b6000613240602383612668565b915061324b826131e4565b604082019050919050565b6000602082019050818103600083015261326f81613233565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b600080833560016020038436030381126132d1576132d06132a5565b5b80840192508235915067ffffffffffffffff8211156132f3576132f26132aa565b5b60208301925060018202360383131561330f5761330e6132af565b5b509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000613351826125bd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561338457613383613317565b5b600182019050919050565b7f496e76616c696420696e70757400000000000000000000000000000000000000600082015250565b60006133c5600d83612668565b91506133d08261338f565b602082019050919050565b600060208201905081810360008301526133f4816133b8565b9050919050565b6000613406826125bd565b9150613411836125bd565b92508282101561342457613423613317565b5b828203905092915050565b7f546f6b656e206973206e6f7420737570706f727420696e20746861742063686160008201527f696e000000000000000000000000000000000000000000000000000000000000602082015250565b600061348b602283612668565b91506134968261342f565b604082019050919050565b600060208201905081810360008301526134ba8161347e565b9050919050565b600060808201905081810360008301526134db81876126ac565b90506134ea6020830186612707565b6134f76040830185612707565b61350460608301846125c7565b95945050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613569602683612668565b91506135748261350d565b604082019050919050565b600060208201905081810360008301526135988161355c565b9050919050565b7f3078000000000000000000000000000000000000000000000000000000000000600082015250565b60006135d560028361304e565b91506135e08261359f565b600282019050919050565b6000819050919050565b61360661360182612530565b6135eb565b82525050565b6000613617826135c8565b915061362382856135f5565b60208201915061363382846135f5565b6020820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061367d826125bd565b9150613688836125bd565b92508261369857613697613643565b5b828204905092915050565b60006136ae826125bd565b91506136b9836125bd565b9250826136c9576136c8613643565b5b828206905092915050565b60006136df826125bd565b91506136ea836125bd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561371f5761371e613317565b5b828201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613760602083612668565b915061376b8261372a565b602082019050919050565b6000602082019050818103600083015261378f81613753565b9050919050565b60006060820190506137ab6000830186612707565b6137b86020830185612707565b6137c560408301846125c7565b949350505050565b60006137d8826125bd565b91506137e3836125bd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561381c5761381b613317565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b61385f8161235d565b811461386a57600080fd5b50565b60008151905061387c81613856565b92915050565b60006020828403121561389857613897612230565b5b60006138a68482850161386d565b91505092915050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b600061390b602a83612668565b9150613916826138af565b604082019050919050565b6000602082019050818103600083015261393a816138fe565b9050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b600061399d602683612668565b91506139a882613941565b604082019050919050565b600060208201905081810360008301526139cc81613990565b9050919050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b6000613a09601d83612668565b9150613a14826139d3565b602082019050919050565b60006020820190508181036000830152613a38816139fc565b905091905056fea2646970667358221220e52275daf0c3587218e5ff074e4504e652623bd2e9e0e7f5bd4138d49058698864736f6c63430008090033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a61161009757806398cf2dcd1161006657806398cf2dcd146102b1578063dc78d137146102e1578063e469640a14610311578063f2fde38b1461032d576100f5565b8063715018a61461023d57806381020a34146102475780638da5cb5b146102775780638f2c7eaf14610295576100f5565b80634fa4c941116100d35780634fa4c94114610176578063526da4c5146101a6578063538a802a146101d65780636da3dbbd1461020d576100f5565b80632c8da560146100fa578063407d83d914610116578063446f95b414610146575b600080fd5b610114600480360381019061010f91906122fd565b610349565b005b610130600480360381019061012b91906122fd565b610466565b60405161013d9190612378565b60405180910390f35b610160600480360381019061015b91906124d4565b6104d7565b60405161016d9190612549565b60405180910390f35b610190600480360381019061018b9190612590565b610552565b60405161019d91906125d6565b60405180910390f35b6101c060048036038101906101bb919061261d565b61056a565b6040516101cd91906126e5565b60405180910390f35b6101f060048036038101906101eb919061261d565b6105ef565b604051610204989796959493929190612716565b60405180910390f35b610227600480360381019061022291906128c2565b61082c565b60405161023491906129fc565b60405180910390f35b6102456109b3565b005b610261600480360381019061025c9190612a1e565b6109c7565b60405161026e9190612b9e565b60405180910390f35b61027f610b4c565b60405161028c9190612bc0565b60405180910390f35b6102af60048036038101906102aa91906122fd565b610b75565b005b6102cb60048036038101906102c69190612bdb565b610c92565b6040516102d89190612df2565b60405180910390f35b6102fb60048036038101906102f69190612e14565b611115565b60405161030891906126e5565b60405180910390f35b61032b60048036038101906103269190612e67565b6111db565b005b61034760048036038101906103429190612f0e565b611626565b005b610351610b4c565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103b590612f87565b60405180910390fd5b600061040e8484848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104d7565b90506104248160046116aa90919063ffffffff16565b507f7afee0f1b802cc0f66c67890e26b4566251859cf2cd8de79b86aed7251d9756a84848460405161045893929190612fd4565b60405180910390a150505050565b6000806104b78585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104d7565b90506104cd8160046116c190919063ffffffff16565b9150509392505050565b6000600283836040516020016104ee92919061308a565b60405160208183030381529060405260405161050a91906130f9565b602060405180830381855afa158015610527573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061054a9190613125565b905092915050565b60026020528060005260406000206000915090505481565b60606000610577846116d8565b905060006040518060400160405280600181526020017f2e00000000000000000000000000000000000000000000000000000000000000815250905060006105be85611717565b90508282826040516020016105d593929190613152565b604051602081830303815290604052935050505092915050565b6001602052816000526040600020818154811061060b57600080fd5b9060005260206000209060080201600091509150508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600201549080600301549080600401549080600501805461068d906131b2565b80601f01602080910402602001604051908101604052809291908181526020018280546106b9906131b2565b80156107065780601f106106db57610100808354040283529160200191610706565b820191906000526020600020905b8154815290600101906020018083116106e957829003601f168201915b50505050509080600601805461071b906131b2565b80601f0160208091040260200160405190810160405280929190818152602001828054610747906131b2565b80156107945780601f1061076957610100808354040283529160200191610794565b820191906000526020600020905b81548152906001019060200180831161077757829003601f168201915b5050505050908060070180546107a9906131b2565b80601f01602080910402602001604051908101604052809291908181526020018280546107d5906131b2565b80156108225780601f106107f757610100808354040283529160200191610822565b820191906000526020600020905b81548152906001019060200180831161080557829003601f168201915b5050505050905088565b606082829050845114610874576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086b90613256565b60405180910390fd5b835167ffffffffffffffff81111561088f5761088e6123a9565b5b6040519080825280602002602001820160405280156108bd5781602001602082028036833780820191505090505b50905060005b84518110156109ab5760006109598683815181106108e4576108e3613276565b5b60200260200101518686858181106108ff576108fe613276565b5b905060200281019061091191906132b4565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104d7565b90506000600160008381526020019081526020016000208054905090508084848151811061098a57610989613276565b5b602002602001018181525050505080806109a390613346565b9150506108c3565b509392505050565b6109bb611878565b6109c560006118f6565b565b60606000610a198585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104d7565b90506000600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b82821015610b39578382906000526020600020018054610aac906131b2565b80601f0160208091040260200160405190810160405280929190818152602001828054610ad8906131b2565b8015610b255780601f10610afa57610100808354040283529160200191610b25565b820191906000526020600020905b815481529060010190602001808311610b0857829003601f168201915b505050505081526020019060010190610a8d565b5050505090508092505050949350505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610b7d610b4c565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610bea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be190612f87565b60405180910390fd5b6000610c3a8484848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104d7565b9050610c508160046119ba90919063ffffffff16565b507f617a625823f687a1440db57ae598a2ba91f2c2d180bb2adc78e5fbfed162ca33848484604051610c8493929190612fd4565b60405180910390a150505050565b60606000610ce48787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104d7565b9050600060016000838152602001908152602001600020805490501415610d0b575061110c565b60016000828152602001908152602001600020805490508311158015610d315750600084115b610d70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d67906133db565b60405180910390fd5b6000610d986001610d8a87876119d190919063ffffffff16565b6119e790919063ffffffff16565b90508067ffffffffffffffff811115610db457610db36123a9565b5b604051908082528060200260200182016040528015610ded57816020015b610dda612112565b815260200190600190039081610dd25790505b5092506000600186610dff91906133fb565b90505b8481101561110857600160008481526020019081526020016000208181548110610e2f57610e2e613276565b5b9060005260206000209060080201604051806101000160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600282015481526020016003820154815260200160048201548152602001600582018054610f23906131b2565b80601f0160208091040260200160405190810160405280929190818152602001828054610f4f906131b2565b8015610f9c5780601f10610f7157610100808354040283529160200191610f9c565b820191906000526020600020905b815481529060010190602001808311610f7f57829003601f168201915b50505050508152602001600682018054610fb5906131b2565b80601f0160208091040260200160405190810160405280929190818152602001828054610fe1906131b2565b801561102e5780601f106110035761010080835404028352916020019161102e565b820191906000526020600020905b81548152906001019060200180831161101157829003601f168201915b50505050508152602001600782018054611047906131b2565b80601f0160208091040260200160405190810160405280929190818152602001828054611073906131b2565b80156110c05780601f10611095576101008083540402835291602001916110c0565b820191906000526020600020905b8154815290600101906020018083116110a357829003601f168201915b5050505050815250508482815181106110dc576110db613276565b5b602002602001018190525080806110f290613346565b915050808061110090613346565b915050610e02565b5050505b95945050505050565b6003602052826000526040600020602052816000526040600020818154811061113d57600080fd5b906000526020600020016000925092505050805461115a906131b2565b80601f0160208091040260200160405190810160405280929190818152602001828054611186906131b2565b80156111d35780601f106111a8576101008083540402835291602001916111d3565b820191906000526020600020905b8154815290600101906020018083116111b657829003601f168201915b505050505081565b600061122b8786868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506104d7565b90506112418160046116c190919063ffffffff16565b611280576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611277906134a1565b60405180910390fd5b6112ad3330888a73ffffffffffffffffffffffffffffffffffffffff166119fd909392919063ffffffff16565b60006112d86001806000858152602001908152602001600020805490506119e790919063ffffffff16565b905060006112e6838361056a565b9050600160008481526020019081526020016000206040518061010001604052808b73ffffffffffffffffffffffffffffffffffffffff1681526020013373ffffffffffffffffffffffffffffffffffffffff1681526020018a815260200143815260200142815260200189898080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050815260200187878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050815260200183815250908060018154018082558091505060019003906000526020600020906008020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020155606082015181600301556080820151816004015560a08201518160050190805190602001906114da929190612183565b5060c08201518160060190805190602001906114f7929190612183565b5060e0820151816007019080519060200190611514929190612183565b50505061153d8860026000868152602001908152602001600020546119e790919063ffffffff16565b6002600085815260200190815260200160002081905550600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000848152602001908152602001600020819080600181540180825580915050600190039060005260206000200160009091909190915090805190602001906115dd929190612183565b507f50ca3994210a330ab9ce981c2856cfdcec3e63e889ae3cea5202478d40dff2d5818a8b8b60405161161394939291906134c1565b60405180910390a1505050505050505050565b61162e611878565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561169e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116959061357f565b60405180910390fd5b6116a7816118f6565b50565b60006116b98360000183611a86565b905092915050565b60006116d08360000183611af6565b905092915050565b60606116e382611b19565b6116f0608084901b611b19565b60405160200161170192919061360c565b6040516020818303038152906040529050919050565b6060600082141561175f576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050611873565b600082905060005b6000821461179157808061177a90613346565b915050600a8261178a9190613672565b9150611767565b60008167ffffffffffffffff8111156117ad576117ac6123a9565b5b6040519080825280601f01601f1916602001820160405280156117df5781602001600182028036833780820191505090505b5090505b6000851461186c576001826117f891906133fb565b9150600a8561180791906136a3565b603061181391906136d4565b60f81b81838151811061182957611828613276565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856118659190613672565b94506117e3565b8093505050505b919050565b611880611d79565b73ffffffffffffffffffffffffffffffffffffffff1661189e610b4c565b73ffffffffffffffffffffffffffffffffffffffff16146118f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118eb90613776565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60006119c98360000183611d81565b905092915050565b600081836119df91906133fb565b905092915050565b600081836119f591906136d4565b905092915050565b611a80846323b872dd60e01b858585604051602401611a1e93929190613796565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611e95565b50505050565b6000611a928383611af6565b611aeb578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050611af0565b600090505b92915050565b600080836001016000848152602001908152602001600020541415905092915050565b6000604077ffffffffffffffff0000000000000000000000000000000060001b836fffffffffffffffffffffffffffffffff191616901c7fffffffffffffffff00000000000000000000000000000000000000000000000060001b836fffffffffffffffffffffffffffffffff19161617905060207bffffffff000000000000000000000000ffffffff000000000000000060001b8216901c7fffffffff000000000000000000000000ffffffff00000000000000000000000060001b821617905060107dffff000000000000ffff000000000000ffff000000000000ffff0000000060001b8216901c7fffff000000000000ffff000000000000ffff000000000000ffff00000000000060001b821617905060087eff000000ff000000ff000000ff000000ff000000ff000000ff000000ff000060001b8216901c7fff000000ff000000ff000000ff000000ff000000ff000000ff000000ff00000060001b821617905060087f0f000f000f000f000f000f000f000f000f000f000f000f000f000f000f000f0060001b8216901c60047ff000f000f000f000f000f000f000f000f000f000f000f000f000f000f000f00060001b8316901c17905060277f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f60047f06060606060606060606060606060606060606060606060606060606060606068460001c611d2991906136d4565b901c16611d3691906137cd565b8160001c7f3030303030303030303030303030303030303030303030303030303030303030611d6591906136d4565b611d6f91906136d4565b60001b9050919050565b600033905090565b60008083600101600084815260200190815260200160002054905060008114611e89576000600182611db391906133fb565b9050600060018660000180549050611dcb91906133fb565b9050818114611e3a576000866000018281548110611dec57611deb613276565b5b9060005260206000200154905080876000018481548110611e1057611e0f613276565b5b90600052602060002001819055508387600101600083815260200190815260200160002081905550505b85600001805480611e4e57611e4d613827565b5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611e8f565b60009150505b92915050565b6000611ef7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611f5c9092919063ffffffff16565b9050600081511115611f575780806020019051810190611f179190613882565b611f56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f4d90613921565b60405180910390fd5b5b505050565b6060611f6b8484600085611f74565b90509392505050565b606082471015611fb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fb0906139b3565b60405180910390fd5b611fc285612088565b612001576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ff890613a1f565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161202a91906130f9565b60006040518083038185875af1925050503d8060008114612067576040519150601f19603f3d011682016040523d82523d6000602084013e61206c565b606091505b509150915061207c8282866120ab565b92505050949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b606083156120bb5782905061210b565b6000835111156120ce5782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161210291906126e5565b60405180910390fd5b9392505050565b604051806101000160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff1681526020016000815260200160008152602001600081526020016060815260200160608152602001606081525090565b82805461218f906131b2565b90600052602060002090601f0160209004810192826121b157600085556121f8565b82601f106121ca57805160ff19168380011785556121f8565b828001600101855582156121f8579182015b828111156121f75782518255916020019190600101906121dc565b5b5090506122059190612209565b5090565b5b8082111561222257600081600090555060010161220a565b5090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006122658261223a565b9050919050565b6122758161225a565b811461228057600080fd5b50565b6000813590506122928161226c565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f8401126122bd576122bc612298565b5b8235905067ffffffffffffffff8111156122da576122d961229d565b5b6020830191508360018202830111156122f6576122f56122a2565b5b9250929050565b60008060006040848603121561231657612315612230565b5b600061232486828701612283565b935050602084013567ffffffffffffffff81111561234557612344612235565b5b612351868287016122a7565b92509250509250925092565b60008115159050919050565b6123728161235d565b82525050565b600060208201905061238d6000830184612369565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6123e182612398565b810181811067ffffffffffffffff82111715612400576123ff6123a9565b5b80604052505050565b6000612413612226565b905061241f82826123d8565b919050565b600067ffffffffffffffff82111561243f5761243e6123a9565b5b61244882612398565b9050602081019050919050565b82818337600083830152505050565b600061247761247284612424565b612409565b90508281526020810184848401111561249357612492612393565b5b61249e848285612455565b509392505050565b600082601f8301126124bb576124ba612298565b5b81356124cb848260208601612464565b91505092915050565b600080604083850312156124eb576124ea612230565b5b60006124f985828601612283565b925050602083013567ffffffffffffffff81111561251a57612519612235565b5b612526858286016124a6565b9150509250929050565b6000819050919050565b61254381612530565b82525050565b600060208201905061255e600083018461253a565b92915050565b61256d81612530565b811461257857600080fd5b50565b60008135905061258a81612564565b92915050565b6000602082840312156125a6576125a5612230565b5b60006125b48482850161257b565b91505092915050565b6000819050919050565b6125d0816125bd565b82525050565b60006020820190506125eb60008301846125c7565b92915050565b6125fa816125bd565b811461260557600080fd5b50565b600081359050612617816125f1565b92915050565b6000806040838503121561263457612633612230565b5b60006126428582860161257b565b925050602061265385828601612608565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561269757808201518184015260208101905061267c565b838111156126a6576000848401525b50505050565b60006126b78261265d565b6126c18185612668565b93506126d1818560208601612679565b6126da81612398565b840191505092915050565b600060208201905081810360008301526126ff81846126ac565b905092915050565b6127108161225a565b82525050565b60006101008201905061272c600083018b612707565b612739602083018a612707565b61274660408301896125c7565b61275360608301886125c7565b61276060808301876125c7565b81810360a083015261277281866126ac565b905081810360c083015261278681856126ac565b905081810360e083015261279a81846126ac565b90509998505050505050505050565b600067ffffffffffffffff8211156127c4576127c36123a9565b5b602082029050602081019050919050565b60006127e86127e3846127a9565b612409565b9050808382526020820190506020840283018581111561280b5761280a6122a2565b5b835b8181101561283457806128208882612283565b84526020840193505060208101905061280d565b5050509392505050565b600082601f83011261285357612852612298565b5b81356128638482602086016127d5565b91505092915050565b60008083601f84011261288257612881612298565b5b8235905067ffffffffffffffff81111561289f5761289e61229d565b5b6020830191508360208202830111156128bb576128ba6122a2565b5b9250929050565b6000806000604084860312156128db576128da612230565b5b600084013567ffffffffffffffff8111156128f9576128f8612235565b5b6129058682870161283e565b935050602084013567ffffffffffffffff81111561292657612925612235565b5b6129328682870161286c565b92509250509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b612973816125bd565b82525050565b6000612985838361296a565b60208301905092915050565b6000602082019050919050565b60006129a98261293e565b6129b38185612949565b93506129be8361295a565b8060005b838110156129ef5781516129d68882612979565b97506129e183612991565b9250506001810190506129c2565b5085935050505092915050565b60006020820190508181036000830152612a16818461299e565b905092915050565b60008060008060608587031215612a3857612a37612230565b5b6000612a4687828801612283565b9450506020612a5787828801612283565b935050604085013567ffffffffffffffff811115612a7857612a77612235565b5b612a84878288016122a7565b925092505092959194509250565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600082825260208201905092915050565b6000612ada8261265d565b612ae48185612abe565b9350612af4818560208601612679565b612afd81612398565b840191505092915050565b6000612b148383612acf565b905092915050565b6000602082019050919050565b6000612b3482612a92565b612b3e8185612a9d565b935083602082028501612b5085612aae565b8060005b85811015612b8c5784840389528151612b6d8582612b08565b9450612b7883612b1c565b925060208a01995050600181019050612b54565b50829750879550505050505092915050565b60006020820190508181036000830152612bb88184612b29565b905092915050565b6000602082019050612bd56000830184612707565b92915050565b600080600080600060808688031215612bf757612bf6612230565b5b6000612c0588828901612283565b955050602086013567ffffffffffffffff811115612c2657612c25612235565b5b612c32888289016122a7565b94509450506040612c4588828901612608565b9250506060612c5688828901612608565b9150509295509295909350565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b612c988161225a565b82525050565b600061010083016000830151612cb76000860182612c8f565b506020830151612cca6020860182612c8f565b506040830151612cdd604086018261296a565b506060830151612cf0606086018261296a565b506080830151612d03608086018261296a565b5060a083015184820360a0860152612d1b8282612acf565b91505060c083015184820360c0860152612d358282612acf565b91505060e083015184820360e0860152612d4f8282612acf565b9150508091505092915050565b6000612d688383612c9e565b905092915050565b6000602082019050919050565b6000612d8882612c63565b612d928185612c6e565b935083602082028501612da485612c7f565b8060005b85811015612de05784840389528151612dc18582612d5c565b9450612dcc83612d70565b925060208a01995050600181019050612da8565b50829750879550505050505092915050565b60006020820190508181036000830152612e0c8184612d7d565b905092915050565b600080600060608486031215612e2d57612e2c612230565b5b6000612e3b86828701612283565b9350506020612e4c8682870161257b565b9250506040612e5d86828701612608565b9150509250925092565b60008060008060008060808789031215612e8457612e83612230565b5b6000612e9289828a01612283565b9650506020612ea389828a01612608565b955050604087013567ffffffffffffffff811115612ec457612ec3612235565b5b612ed089828a016122a7565b9450945050606087013567ffffffffffffffff811115612ef357612ef2612235565b5b612eff89828a016122a7565b92509250509295509295509295565b600060208284031215612f2457612f23612230565b5b6000612f3284828501612283565b91505092915050565b7f4e6f207065726d697373696f6e00000000000000000000000000000000000000600082015250565b6000612f71600d83612668565b9150612f7c82612f3b565b602082019050919050565b60006020820190508181036000830152612fa081612f64565b9050919050565b6000612fb38385612668565b9350612fc0838584612455565b612fc983612398565b840190509392505050565b6000604082019050612fe96000830186612707565b8181036020830152612ffc818486612fa7565b9050949350505050565b60008160601b9050919050565b600061301e82613006565b9050919050565b600061303082613013565b9050919050565b6130486130438261225a565b613025565b82525050565b600081905092915050565b60006130648261265d565b61306e818561304e565b935061307e818560208601612679565b80840191505092915050565b60006130968285613037565b6014820191506130a68284613059565b91508190509392505050565b600081519050919050565b600081905092915050565b60006130d3826130b2565b6130dd81856130bd565b93506130ed818560208601612679565b80840191505092915050565b600061310582846130c8565b915081905092915050565b60008151905061311f81612564565b92915050565b60006020828403121561313b5761313a612230565b5b600061314984828501613110565b91505092915050565b600061315e8286613059565b915061316a8285613059565b91506131768284613059565b9150819050949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806131ca57607f821691505b602082108114156131de576131dd613183565b5b50919050565b7f496e76616c696420746f6b656e732f746172676574436861696e49647320696e60008201527f7075740000000000000000000000000000000000000000000000000000000000602082015250565b6000613240602383612668565b915061324b826131e4565b604082019050919050565b6000602082019050818103600083015261326f81613233565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b600080833560016020038436030381126132d1576132d06132a5565b5b80840192508235915067ffffffffffffffff8211156132f3576132f26132aa565b5b60208301925060018202360383131561330f5761330e6132af565b5b509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000613351826125bd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561338457613383613317565b5b600182019050919050565b7f496e76616c696420696e70757400000000000000000000000000000000000000600082015250565b60006133c5600d83612668565b91506133d08261338f565b602082019050919050565b600060208201905081810360008301526133f4816133b8565b9050919050565b6000613406826125bd565b9150613411836125bd565b92508282101561342457613423613317565b5b828203905092915050565b7f546f6b656e206973206e6f7420737570706f727420696e20746861742063686160008201527f696e000000000000000000000000000000000000000000000000000000000000602082015250565b600061348b602283612668565b91506134968261342f565b604082019050919050565b600060208201905081810360008301526134ba8161347e565b9050919050565b600060808201905081810360008301526134db81876126ac565b90506134ea6020830186612707565b6134f76040830185612707565b61350460608301846125c7565b95945050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613569602683612668565b91506135748261350d565b604082019050919050565b600060208201905081810360008301526135988161355c565b9050919050565b7f3078000000000000000000000000000000000000000000000000000000000000600082015250565b60006135d560028361304e565b91506135e08261359f565b600282019050919050565b6000819050919050565b61360661360182612530565b6135eb565b82525050565b6000613617826135c8565b915061362382856135f5565b60208201915061363382846135f5565b6020820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061367d826125bd565b9150613688836125bd565b92508261369857613697613643565b5b828204905092915050565b60006136ae826125bd565b91506136b9836125bd565b9250826136c9576136c8613643565b5b828206905092915050565b60006136df826125bd565b91506136ea836125bd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561371f5761371e613317565b5b828201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613760602083612668565b915061376b8261372a565b602082019050919050565b6000602082019050818103600083015261378f81613753565b9050919050565b60006060820190506137ab6000830186612707565b6137b86020830185612707565b6137c560408301846125c7565b949350505050565b60006137d8826125bd565b91506137e3836125bd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561381c5761381b613317565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b61385f8161235d565b811461386a57600080fd5b50565b60008151905061387c81613856565b92915050565b60006020828403121561389857613897612230565b5b60006138a68482850161386d565b91505092915050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b600061390b602a83612668565b9150613916826138af565b604082019050919050565b6000602082019050818103600083015261393a816138fe565b9050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b600061399d602683612668565b91506139a882613941565b604082019050919050565b600060208201905081810360008301526139cc81613990565b9050919050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b6000613a09601d83612668565b9150613a14826139d3565b602082019050919050565b60006020820190508181036000830152613a38816139fc565b905091905056fea2646970667358221220e52275daf0c3587218e5ff074e4504e652623bd2e9e0e7f5bd4138d49058698864736f6c63430008090033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/src/AElf.EventHandler/ContractBuild/BridgeOutAbi.json b/src/AElf.EventHandler/ContractBuild/BridgeOutAbi.json new file mode 100644 index 00000000..79707780 --- /dev/null +++ b/src/AElf.EventHandler/ContractBuild/BridgeOutAbi.json @@ -0,0 +1,609 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "BridgeOut", + "sourceName": "contracts/BridgeOut.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_merkleTree", + "type": "address" + }, + { + "internalType": "address", + "name": "_regiment", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "swapId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "transmiter", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "receiptIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "receiptHash", + "type": "bytes32" + } + ], + "name": "NewTransmission", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "swapId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "chainId", + "type": "string" + } + ], + "name": "SwapPairAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "receiveAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "TokenSwapEvent", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "string", + "name": "chainId", + "type": "string" + } + ], + "name": "_generateTokenKey", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_receiptId", + "type": "string" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_receiverAddress", + "type": "address" + } + ], + "name": "computeLeafHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "_leafHash", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint64", + "name": "originShare", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "targetShare", + "type": "uint64" + } + ], + "internalType": "struct BridgeOut.SwapRatio", + "name": "swapRatio", + "type": "tuple" + } + ], + "internalType": "struct BridgeOut.SwapTargetToken[]", + "name": "targetTokens", + "type": "tuple[]" + }, + { + "internalType": "string", + "name": "fromChainId", + "type": "string" + }, + { + "internalType": "bytes32", + "name": "regimentId", + "type": "bytes32" + } + ], + "name": "createSwap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "swapHashId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "tokens", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amounts", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "string[]", + "name": "targetChainIds", + "type": "string[]" + } + ], + "name": "getReceiveReceiptIndex", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "string", + "name": "targetChainId", + "type": "string" + }, + { + "internalType": "uint256", + "name": "fromIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endIndex", + "type": "uint256" + } + ], + "name": "getReceivedReceiptInfos", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "address", + "name": "targetAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockHeight", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockTime", + "type": "uint256" + }, + { + "internalType": "string", + "name": "targetChainId", + "type": "string" + }, + { + "internalType": "string", + "name": "receiptId", + "type": "string" + } + ], + "internalType": "struct BridgeOut.ReceivedReceipt[]", + "name": "_receipts", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "string", + "name": "targetChainId", + "type": "string" + } + ], + "name": "getSwapId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "swapId", + "type": "bytes32" + } + ], + "name": "getSwapInfo", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "swapId", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "fromChainId", + "type": "string" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint64", + "name": "originShare", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "targetShare", + "type": "uint64" + } + ], + "internalType": "struct BridgeOut.SwapRatio", + "name": "swapRatio", + "type": "tuple" + } + ], + "internalType": "struct BridgeOut.SwapTargetToken[]", + "name": "swapTargetTokenList", + "type": "tuple[]" + }, + { + "internalType": "bytes32", + "name": "regimentId", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "spaceId", + "type": "bytes32" + } + ], + "internalType": "struct BridgeOut.SwapInfo", + "name": "swapInfo", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "receiptHash", + "type": "bytes32" + } + ], + "name": "isReceiptRecorded", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "spaceId", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "receiptId", + "type": "string" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiverAddress", + "type": "address" + } + ], + "name": "merkleTreeVerify", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "swapId", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "receiptId", + "type": "string" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiverAddress", + "type": "address" + } + ], + "name": "swapToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "swapHashId", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "_report", + "type": "bytes" + }, + { + "internalType": "bytes32[]", + "name": "_rs", + "type": "bytes32[]" + }, + { + "internalType": "bytes32[]", + "name": "_ss", + "type": "bytes32[]" + }, + { + "internalType": "bytes32", + "name": "_rawVs", + "type": "bytes32" + } + ], + "name": "transmit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "swapHashId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x60806040523480156200001157600080fd5b506040516200622438038062006224833981810160405281019062000037919062000217565b620000576200004b620000e160201b60201c565b620000e960201b60201c565b81600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050506200025e565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620001df82620001b2565b9050919050565b620001f181620001d2565b8114620001fd57600080fd5b50565b6000815190506200021181620001e6565b92915050565b60008060408385031215620002315762000230620001ad565b5b6000620002418582860162000200565b9250506020620002548582860162000200565b9150509250929050565b615fb6806200026e6000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80638a0bb6f911610097578063c045e88711610066578063c045e887146102d1578063cb2b48a5146102ed578063d954863c1461031d578063f2fde38b1461033957610100565b80638a0bb6f9146102375780638da5cb5b14610267578063a6fb97d114610285578063b33ff450146102a157610100565b80634c038c45116100d35780634c038c45146101b157806368591baa146101e1578063715018a6146101fd57806371d0c5ca1461020757610100565b806303b1ccdb146101055780632d0fc6b4146101215780633f19efbe14610151578063446f95b414610181575b600080fd5b61011f600480360381019061011a9190613691565b610355565b005b61013b60048036038101906101369190613719565b610cc9565b60405161014891906139aa565b60405180910390f35b61016b60048036038101906101669190613b60565b610ed3565b6040516101789190613c9a565b60405180910390f35b61019b60048036038101906101969190613d71565b61105a565b6040516101a89190613ddc565b60405180910390f35b6101cb60048036038101906101c69190613719565b6110d5565b6040516101d89190613e12565b60405180910390f35b6101fb60048036038101906101f69190613ed9565b6110f4565b005b6102056115ff565b005b610221600480360381019061021c9190613fb5565b611613565b60405161022e9190613ddc565b60405180910390f35b610251600480360381019061024c9190614015565b611684565b60405161025e9190614202565b60405180910390f35b61026f611a4e565b60405161027c9190614233565b60405180910390f35b61029f600480360381019061029a919061424e565b611a77565b005b6102bb60048036038101906102b69190613691565b611d9e565b6040516102c89190613ddc565b60405180910390f35b6102eb60048036038101906102e691906142f7565b612090565b005b6103076004803603810190610302919061438c565b612467565b6040516103149190613ddc565b60405180910390f35b6103376004803603810190610332919061424e565b612640565b005b610353600480360381019061034e91906143fb565b6129a7565b005b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ba906144ab565b60405180910390fd5b6000600360008781526020019081526020016000206004015490506000801b811415610424576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161041b90614517565b60405180910390fd5b60008311610467576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045e90614583565b60405180910390fd5b6000600360008881526020019081526020016000209050600061048d8388888888611d9e565b90506000600760008381526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610539576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610530906145ef565b60405180910390fd5b848160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600083600201805480602002602001604051908101604052809291908181526020016000905b828210156106a257838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff168152505081525050815260200190600101906105a2565b50505050905060005b815181101561091a5760008560020182815481106106cc576106cb61460f565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600560008e815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060006107d385858151811061076c5761076b61460f565b5b6020026020010151602001516000015167ffffffffffffffff166107c587878151811061079c5761079b61460f565b5b6020026020010151602001516020015167ffffffffffffffff168e612a2b90919063ffffffff16565b612a4190919063ffffffff16565b9050816000015481111561081c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108139061468a565b60405180910390fd5b610833818360000154612a5790919063ffffffff16565b82600001819055508273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8b836040518363ffffffff1660e01b81526004016108769291906146b9565b602060405180830381600087803b15801561089057600080fd5b505af11580156108a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c8919061470e565b507fb0c1e4d18ea737b756410ab0296768c15a87c12eeb368f360ecc5be61a11b4db8a84836040516108fc9392919061473b565b60405180910390a15050508080610912906147a1565b9150506106ab565b506000610a0d856002016000815481106109375761093661460f565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600360008e8152602001908152602001600020600101805461098a90614819565b80601f01602080910402602001604051908101604052809291908181526020018280546109b690614819565b8015610a035780601f106109d857610100808354040283529160200191610a03565b820191906000526020600020905b8154815290600101906020018083116109e657829003601f168201915b505050505061105a565b9050600860008281526020019081526020016000206040518060e0016040528087600201600081548110610a4457610a4361460f565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1681526020018a8152602001438152602001428152602001600360008f81526020019081526020016000206001018054610ae090614819565b80601f0160208091040260200160405190810160405280929190818152602001828054610b0c90614819565b8015610b595780601f10610b2e57610100808354040283529160200191610b59565b820191906000526020600020905b815481529060010190602001808311610b3c57829003601f168201915b505050505081526020018c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050815250908060018154018082558091505060019003906000526020600020906007020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020155606082015181600301556080820151816004015560a0820151816005019080519060200190610c9c929190613384565b5060c0820151816006019080519060200190610cb9929190613384565b5050505050505050505050505050565b610cd161340a565b600360008381526020019081526020016000206040518060a001604052908160008201548152602001600182018054610d0990614819565b80601f0160208091040260200160405190810160405280929190818152602001828054610d3590614819565b8015610d825780601f10610d5757610100808354040283529160200191610d82565b820191906000526020600020905b815481529060010190602001808311610d6557829003601f168201915b5050505050815260200160028201805480602002602001604051908101604052809291908181526020016000905b82821015610eb057838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250508152505081526020019060010190610db0565b505050508152602001600382015481526020016004820154815250509050919050565b606082829050845114610f1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f12906148bd565b60405180910390fd5b6000845167ffffffffffffffff811115610f3857610f376139cc565b5b604051908082528060200260200182016040528015610f665781602001602082028036833780820191505090505b50905060005b855181101561104e576000611002878381518110610f8d57610f8c61460f565b5b6020026020010151878785818110610fa857610fa761460f565b5b9050602002810190610fba91906148ec565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061105a565b9050600860008281526020019081526020016000208054905083838151811061102e5761102d61460f565b5b602002602001018181525050508080611046906147a1565b915050610f6c565b50809150509392505050565b6000600283836040516020016110719291906149d3565b60405160208183030381529060405260405161108d9190614a42565b602060405180830381855afa1580156110aa573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906110cd9190614a6e565b905092915050565b6000806006600084815260200190815260200160002054119050919050565b6000600360008a81526020019081526020016000209050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323c849858260030154336040518363ffffffff1660e01b815260040161116c929190614a9b565b60206040518083038186803b15801561118457600080fd5b505afa158015611198573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111bc919061470e565b6111fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f290614b10565b60405180910390fd5b60005b868690508110156113b7576000898960405161121b929190614b55565b60405180910390206040516020016112339190614bdb565b60405160208183030381529060405280519060200120905060006112b082601b8786602081106112665761126561460f565b5b1a60f81b60f81c6112779190614c0e565b8b8b8781811061128a5761128961460f565b5b905060200201358a8a888181106112a4576112a361460f565b5b90506020020135612a6d565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323c849858560030154836040518363ffffffff1660e01b8152600401611313929190614a9b565b60206040518083038186803b15801561132b57600080fd5b505afa15801561133f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611363919061470e565b6113a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139990614c91565b60405180910390fd5b505080806113af906147a1565b9150506111fe565b506000806114088a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050612a98565b915091506000600167ffffffffffffffff811115611429576114286139cc565b5b6040519080825280602002602001820160405280156114575781602001602082028036833780820191505090505b509050818160008151811061146f5761146e61460f565b5b60200260200101818152505060006006600084815260200190815260200160002054146114d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c890614cfd565b60405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637d9778368660040154846040518363ffffffff1660e01b8152600401611534929190614dcc565b602060405180830381600087803b15801561154e57600080fd5b505af1158015611562573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115869190614e11565b905061159c600182612abc90919063ffffffff16565b60066000858152602001908152602001600020819055507f6319bf84e3d2c97dd1991c07818c14950ceb6f48ce6d85f063be3c60905ea1b98d3386866040516115e89493929190614e3e565b60405180910390a150505050505050505050505050565b611607612ad2565b6116116000612b50565b565b6000806116648585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061105a565b905060046000828152602001908152602001600020549150509392505050565b606060006116d68787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061105a565b9050600860008281526020019081526020016000208054905083111580156116fe5750600084115b61173d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173490614ecf565b60405180910390fd5b600061176560016117578787612a5790919063ffffffff16565b612abc90919063ffffffff16565b90508067ffffffffffffffff811115611781576117806139cc565b5b6040519080825280602002602001820160405280156117ba57816020015b6117a7613442565b81526020019060019003908161179f5790505b50925060006001866117cc9190614eef565b90505b84811015611a42576008600084815260200190815260200160002081815481106117fc576117fb61460f565b5b90600052602060002090600702016040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820154815260200160038201548152602001600482015481526020016005820180546118ef90614819565b80601f016020809104026020016040519081016040528092919081815260200182805461191b90614819565b80156119685780601f1061193d57610100808354040283529160200191611968565b820191906000526020600020905b81548152906001019060200180831161194b57829003601f168201915b5050505050815260200160068201805461198190614819565b80601f01602080910402602001604051908101604052809291908181526020018280546119ad90614819565b80156119fa5780601f106119cf576101008083540402835291602001916119fa565b820191906000526020600020905b8154815290600101906020018083116119dd57829003601f168201915b505050505081525050848281518110611a1657611a1561460f565b5b60200260200101819052508080611a2c906147a1565b9150508080611a3a906147a1565b9150506117cf565b50505095945050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600360008581526020019081526020016000209050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639a96679e8260030154336040518363ffffffff1660e01b8152600401611aef929190614a9b565b60206040518083038186803b158015611b0757600080fd5b505afa158015611b1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b3f919061470e565b611b7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7590614f6f565b60405180910390fd5b611caf8382600201805480602002602001604051908101604052809291908181526020016000905b82821015611ca657838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250508152505081526020019060010190611ba6565b50505050612c14565b50611d16826005600087815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154612a5790919063ffffffff16565b6005600086815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550611d9833838573ffffffffffffffffffffffffffffffffffffffff16612ca09092919063ffffffff16565b50505050565b60006060806000611df488888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508787612467565b90506000611e1f60016006600085815260200190815260200160002054612a5790919063ffffffff16565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631b32d71a8b836040518363ffffffff1660e01b8152600401611e7e929190614f8f565b60006040518083038186803b158015611e9657600080fd5b505afa158015611eaa573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190611ed3919061513e565b909192509091508094508195505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631669b10e8b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fd2973ca8e866040518363ffffffff1660e01b8152600401611f7e929190614f8f565b60206040518083038186803b158015611f9657600080fd5b505afa158015611faa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fce9190614e11565b8588886040518663ffffffff1660e01b8152600401611ff195949392919061529b565b60206040518083038186803b15801561200957600080fd5b505afa15801561201d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612041919061470e565b612080576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161207790615348565b60405180910390fd5b8194505050505095945050505050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166376e2775583336040518363ffffffff1660e01b81526004016120ef929190614a9b565b60206040518083038186803b15801561210757600080fd5b505afa15801561211b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061213f919061470e565b905080612181576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161217890614f6f565b60405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632a99732a84600a6040518363ffffffff1660e01b81526004016121e19291906153ad565b602060405180830381600087803b1580156121fb57600080fd5b505af115801561220f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122339190614a6e565b905060008036604051612247929190614b55565b604051809103902090506000888860008181106122675761226661460f565b5b905060600201600001602081019061227f91906143fb565b905084600360008481526020019081526020016000206003018190555082600360008481526020019081526020016000206004018190555081600360008481526020019081526020016000206000018190555086866003600085815260200190815260200160002060010191906122f79291906134ab565b5060006123488289898080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061105a565b905082600460008381526020019081526020016000208190555060005b8a8a905081101561241d576123a48b8b838181106123865761238561460f565b5b90506060020160200180360381019061239f9190615457565b612d26565b600360008581526020019081526020016000206002018b8b838181106123cd576123cc61460f565b5b9050606002019080600181540180825580915050600190039060005260206000209060020201600090919091909150818161240891906156d0565b50508080612415906147a1565b915050612365565b507f909c724b9d08d0463115fc7fa6d2c8e51e6eafa867725be497bdb9a53a6cac4f83838a8a604051612453949392919061570b565b60405180910390a150505050505050505050565b60008060028560405160200161247d919061574b565b6040516020818303038152906040526040516124999190614a42565b602060405180830381855afa1580156124b6573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906124d99190614a6e565b905060006002856040516020016124f09190615783565b60405160208183030381529060405260405161250c9190614a42565b602060405180830381855afa158015612529573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061254c9190614a6e565b90506000600285604051602001612563919061579e565b60405160208183030381529060405260405161257f9190614a42565b602060405180830381855afa15801561259c573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906125bf9190614a6e565b905060028383836040516020016125d8939291906157b9565b6040516020818303038152906040526040516125f49190614a42565b602060405180830381855afa158015612611573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906126349190614a6e565b93505050509392505050565b6000600360008581526020019081526020016000209050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639a96679e8260030154336040518363ffffffff1660e01b81526004016126b8929190614a9b565b60206040518083038186803b1580156126d057600080fd5b505afa1580156126e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612708919061470e565b612747576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161273e90614f6f565b60405180910390fd5b6128788382600201805480602002602001604051908101604052809291908181526020016000905b8282101561286f57838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681525050815250508152602001906001019061276f565b50505050612c14565b6128b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128ae9061583c565b60405180910390fd5b6128e43330848673ffffffffffffffffffffffffffffffffffffffff16612d94909392919063ffffffff16565b61294a826005600087815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154612abc90919063ffffffff16565b6005600086815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555050505050565b6129af612ad2565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612a1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a16906158ce565b60405180910390fd5b612a2881612b50565b50565b60008183612a3991906158ee565b905092915050565b60008183612a4f9190615977565b905092915050565b60008183612a659190614eef565b905092915050565b6000806000612a7e87878787612e1d565b91509150612a8b81612f2a565b8192505050949350505050565b60008082806020019051810190612aaf91906159a8565b8092508193505050915091565b60008183612aca91906159e8565b905092915050565b612ada6130ff565b73ffffffffffffffffffffffffffffffffffffffff16612af8611a4e565b73ffffffffffffffffffffffffffffffffffffffff1614612b4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b4590615a8a565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080600090505b8251811015612c94578373ffffffffffffffffffffffffffffffffffffffff16838281518110612c4f57612c4e61460f565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff161415612c81576001915050612c9a565b8080612c8c906147a1565b915050612c1c565b50600090505b92915050565b612d218363a9059cbb60e01b8484604051602401612cbf9291906146b9565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613107565b505050565b6000816000015167ffffffffffffffff16118015612d5257506000816020015167ffffffffffffffff16115b612d91576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d8890615af6565b60405180910390fd5b50565b612e17846323b872dd60e01b858585604051602401612db59392919061473b565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613107565b50505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115612e58576000600391509150612f21565b601b8560ff1614158015612e705750601c8560ff1614155b15612e82576000600491509150612f21565b600060018787878760405160008152602001604052604051612ea79493929190615b25565b6020604051602081039080840390855afa158015612ec9573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612f1857600060019250925050612f21565b80600092509250505b94509492505050565b60006004811115612f3e57612f3d615b6a565b5b816004811115612f5157612f50615b6a565b5b1415612f5c576130fc565b60016004811115612f7057612f6f615b6a565b5b816004811115612f8357612f82615b6a565b5b1415612fc4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612fbb90615be5565b60405180910390fd5b60026004811115612fd857612fd7615b6a565b5b816004811115612feb57612fea615b6a565b5b141561302c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161302390615c51565b60405180910390fd5b600360048111156130405761303f615b6a565b5b81600481111561305357613052615b6a565b5b1415613094576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161308b90615ce3565b60405180910390fd5b6004808111156130a7576130a6615b6a565b5b8160048111156130ba576130b9615b6a565b5b14156130fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130f290615d75565b60405180910390fd5b5b50565b600033905090565b6000613169826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166131ce9092919063ffffffff16565b90506000815111156131c95780806020019051810190613189919061470e565b6131c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131bf90615e07565b60405180910390fd5b5b505050565b60606131dd84846000856131e6565b90509392505050565b60608247101561322b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161322290615e99565b60405180910390fd5b613234856132fa565b613273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161326a90615f05565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161329c9190614a42565b60006040518083038185875af1925050503d80600081146132d9576040519150601f19603f3d011682016040523d82523d6000602084013e6132de565b606091505b50915091506132ee82828661331d565b92505050949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6060831561332d5782905061337d565b6000835111156133405782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133749190615f5e565b60405180910390fd5b9392505050565b82805461339090614819565b90600052602060002090601f0160209004810192826133b257600085556133f9565b82601f106133cb57805160ff19168380011785556133f9565b828001600101855582156133f9579182015b828111156133f85782518255916020019190600101906133dd565b5b5090506134069190613531565b5090565b6040518060a0016040528060008019168152602001606081526020016060815260200160008019168152602001600080191681525090565b6040518060e00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160608152602001606081525090565b8280546134b790614819565b90600052602060002090601f0160209004810192826134d95760008555613520565b82601f106134f257803560ff1916838001178555613520565b82800160010185558215613520579182015b8281111561351f578235825591602001919060010190613504565b5b50905061352d9190613531565b5090565b5b8082111561354a576000816000905550600101613532565b5090565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b61357581613562565b811461358057600080fd5b50565b6000813590506135928161356c565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f8401126135bd576135bc613598565b5b8235905067ffffffffffffffff8111156135da576135d961359d565b5b6020830191508360018202830111156135f6576135f56135a2565b5b9250929050565b6000819050919050565b613610816135fd565b811461361b57600080fd5b50565b60008135905061362d81613607565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061365e82613633565b9050919050565b61366e81613653565b811461367957600080fd5b50565b60008135905061368b81613665565b92915050565b6000806000806000608086880312156136ad576136ac613558565b5b60006136bb88828901613583565b955050602086013567ffffffffffffffff8111156136dc576136db61355d565b5b6136e8888289016135a7565b945094505060406136fb8882890161361e565b925050606061370c8882890161367c565b9150509295509295909350565b60006020828403121561372f5761372e613558565b5b600061373d84828501613583565b91505092915050565b61374f81613562565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561378f578082015181840152602081019050613774565b8381111561379e576000848401525b50505050565b6000601f19601f8301169050919050565b60006137c082613755565b6137ca8185613760565b93506137da818560208601613771565b6137e3816137a4565b840191505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61382381613653565b82525050565b600067ffffffffffffffff82169050919050565b61384681613829565b82525050565b604082016000820151613862600085018261383d565b506020820151613875602085018261383d565b50505050565b606082016000820151613891600085018261381a565b5060208201516138a4602085018261384c565b50505050565b60006138b6838361387b565b60608301905092915050565b6000602082019050919050565b60006138da826137ee565b6138e481856137f9565b93506138ef8361380a565b8060005b8381101561392057815161390788826138aa565b9750613912836138c2565b9250506001810190506138f3565b5085935050505092915050565b600060a0830160008301516139456000860182613746565b506020830151848203602086015261395d82826137b5565b9150506040830151848203604086015261397782826138cf565b915050606083015161398c6060860182613746565b50608083015161399f6080860182613746565b508091505092915050565b600060208201905081810360008301526139c4818461392d565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613a04826137a4565b810181811067ffffffffffffffff82111715613a2357613a226139cc565b5b80604052505050565b6000613a3661354e565b9050613a4282826139fb565b919050565b600067ffffffffffffffff821115613a6257613a616139cc565b5b602082029050602081019050919050565b6000613a86613a8184613a47565b613a2c565b90508083825260208201905060208402830185811115613aa957613aa86135a2565b5b835b81811015613ad25780613abe888261367c565b845260208401935050602081019050613aab565b5050509392505050565b600082601f830112613af157613af0613598565b5b8135613b01848260208601613a73565b91505092915050565b60008083601f840112613b2057613b1f613598565b5b8235905067ffffffffffffffff811115613b3d57613b3c61359d565b5b602083019150836020820283011115613b5957613b586135a2565b5b9250929050565b600080600060408486031215613b7957613b78613558565b5b600084013567ffffffffffffffff811115613b9757613b9661355d565b5b613ba386828701613adc565b935050602084013567ffffffffffffffff811115613bc457613bc361355d565b5b613bd086828701613b0a565b92509250509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613c11816135fd565b82525050565b6000613c238383613c08565b60208301905092915050565b6000602082019050919050565b6000613c4782613bdc565b613c518185613be7565b9350613c5c83613bf8565b8060005b83811015613c8d578151613c748882613c17565b9750613c7f83613c2f565b925050600181019050613c60565b5085935050505092915050565b60006020820190508181036000830152613cb48184613c3c565b905092915050565b600080fd5b600067ffffffffffffffff821115613cdc57613cdb6139cc565b5b613ce5826137a4565b9050602081019050919050565b82818337600083830152505050565b6000613d14613d0f84613cc1565b613a2c565b905082815260208101848484011115613d3057613d2f613cbc565b5b613d3b848285613cf2565b509392505050565b600082601f830112613d5857613d57613598565b5b8135613d68848260208601613d01565b91505092915050565b60008060408385031215613d8857613d87613558565b5b6000613d968582860161367c565b925050602083013567ffffffffffffffff811115613db757613db661355d565b5b613dc385828601613d43565b9150509250929050565b613dd681613562565b82525050565b6000602082019050613df16000830184613dcd565b92915050565b60008115159050919050565b613e0c81613df7565b82525050565b6000602082019050613e276000830184613e03565b92915050565b60008083601f840112613e4357613e42613598565b5b8235905067ffffffffffffffff811115613e6057613e5f61359d565b5b602083019150836001820283011115613e7c57613e7b6135a2565b5b9250929050565b60008083601f840112613e9957613e98613598565b5b8235905067ffffffffffffffff811115613eb657613eb561359d565b5b602083019150836020820283011115613ed257613ed16135a2565b5b9250929050565b60008060008060008060008060a0898b031215613ef957613ef8613558565b5b6000613f078b828c01613583565b985050602089013567ffffffffffffffff811115613f2857613f2761355d565b5b613f348b828c01613e2d565b9750975050604089013567ffffffffffffffff811115613f5757613f5661355d565b5b613f638b828c01613e83565b9550955050606089013567ffffffffffffffff811115613f8657613f8561355d565b5b613f928b828c01613e83565b93509350506080613fa58b828c01613583565b9150509295985092959890939650565b600080600060408486031215613fce57613fcd613558565b5b6000613fdc8682870161367c565b935050602084013567ffffffffffffffff811115613ffd57613ffc61355d565b5b614009868287016135a7565b92509250509250925092565b60008060008060006080868803121561403157614030613558565b5b600061403f8882890161367c565b955050602086013567ffffffffffffffff8111156140605761405f61355d565b5b61406c888289016135a7565b9450945050604061407f8882890161361e565b92505060606140908882890161361e565b9150509295509295909350565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600060e0830160008301516140e1600086018261381a565b5060208301516140f4602086018261381a565b5060408301516141076040860182613c08565b50606083015161411a6060860182613c08565b50608083015161412d6080860182613c08565b5060a083015184820360a086015261414582826137b5565b91505060c083015184820360c086015261415f82826137b5565b9150508091505092915050565b600061417883836140c9565b905092915050565b6000602082019050919050565b60006141988261409d565b6141a281856140a8565b9350836020820285016141b4856140b9565b8060005b858110156141f057848403895281516141d1858261416c565b94506141dc83614180565b925060208a019950506001810190506141b8565b50829750879550505050505092915050565b6000602082019050818103600083015261421c818461418d565b905092915050565b61422d81613653565b82525050565b60006020820190506142486000830184614224565b92915050565b60008060006060848603121561426757614266613558565b5b600061427586828701613583565b93505060206142868682870161367c565b92505060406142978682870161361e565b9150509250925092565b60008083601f8401126142b7576142b6613598565b5b8235905067ffffffffffffffff8111156142d4576142d361359d565b5b6020830191508360608202830111156142f0576142ef6135a2565b5b9250929050565b60008060008060006060868803121561431357614312613558565b5b600086013567ffffffffffffffff8111156143315761433061355d565b5b61433d888289016142a1565b9550955050602086013567ffffffffffffffff8111156143605761435f61355d565b5b61436c888289016135a7565b9350935050604061437f88828901613583565b9150509295509295909350565b6000806000606084860312156143a5576143a4613558565b5b600084013567ffffffffffffffff8111156143c3576143c261355d565b5b6143cf86828701613d43565b93505060206143e08682870161361e565b92505060406143f18682870161367c565b9150509250925092565b60006020828403121561441157614410613558565b5b600061441f8482850161367c565b91505092915050565b600082825260208201905092915050565b7f6f6e6c7920726563656976657220686173207065726d697373696f6e20746f2060008201527f7377617020746f6b656e00000000000000000000000000000000000000000000602082015250565b6000614495602a83614428565b91506144a082614439565b604082019050919050565b600060208201905081810360008301526144c481614488565b9050919050565b7f746f6b656e20737761702070616972206e6f7420666f756e6400000000000000600082015250565b6000614501601983614428565b915061450c826144cb565b602082019050919050565b60006020820190508181036000830152614530816144f4565b9050919050565b7f696e76616c696420616d6f756e74000000000000000000000000000000000000600082015250565b600061456d600e83614428565b915061457882614537565b602082019050919050565b6000602082019050818103600083015261459c81614560565b9050919050565b7f616c726561647920636c61696d65640000000000000000000000000000000000600082015250565b60006145d9600f83614428565b91506145e4826145a3565b602082019050919050565b60006020820190508181036000830152614608816145cc565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f6465706f736974206e6f7420656e6f7567687400000000000000000000000000600082015250565b6000614674601383614428565b915061467f8261463e565b602082019050919050565b600060208201905081810360008301526146a381614667565b9050919050565b6146b3816135fd565b82525050565b60006040820190506146ce6000830185614224565b6146db60208301846146aa565b9392505050565b6146eb81613df7565b81146146f657600080fd5b50565b600081519050614708816146e2565b92915050565b60006020828403121561472457614723613558565b5b6000614732848285016146f9565b91505092915050565b60006060820190506147506000830186614224565b61475d6020830185614224565b61476a60408301846146aa565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006147ac826135fd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156147df576147de614772565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061483157607f821691505b60208210811415614845576148446147ea565b5b50919050565b7f496e76616c696420746f6b656e732f746172676574436861696e49647320696e60008201527f7075740000000000000000000000000000000000000000000000000000000000602082015250565b60006148a7602383614428565b91506148b28261484b565b604082019050919050565b600060208201905081810360008301526148d68161489a565b9050919050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112614909576149086148dd565b5b80840192508235915067ffffffffffffffff82111561492b5761492a6148e2565b5b602083019250600182023603831315614947576149466148e7565b5b509250929050565b60008160601b9050919050565b60006149678261494f565b9050919050565b60006149798261495c565b9050919050565b61499161498c82613653565b61496e565b82525050565b600081905092915050565b60006149ad82613755565b6149b78185614997565b93506149c7818560208601613771565b80840191505092915050565b60006149df8285614980565b6014820191506149ef82846149a2565b91508190509392505050565b600081519050919050565b600081905092915050565b6000614a1c826149fb565b614a268185614a06565b9350614a36818560208601613771565b80840191505092915050565b6000614a4e8284614a11565b915081905092915050565b600081519050614a688161356c565b92915050565b600060208284031215614a8457614a83613558565b5b6000614a9284828501614a59565b91505092915050565b6000604082019050614ab06000830185613dcd565b614abd6020830184614224565b9392505050565b7f4e6f207065726d697373696f6e20746f207472616e736d697400000000000000600082015250565b6000614afa601983614428565b9150614b0582614ac4565b602082019050919050565b60006020820190508181036000830152614b2981614aed565b9050919050565b6000614b3c8385614a06565b9350614b49838584613cf2565b82840190509392505050565b6000614b62828486614b30565b91508190509392505050565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600082015250565b6000614ba4601c83614997565b9150614baf82614b6e565b601c82019050919050565b6000819050919050565b614bd5614bd082613562565b614bba565b82525050565b6000614be682614b97565b9150614bf28284614bc4565b60208201915081905092915050565b600060ff82169050919050565b6000614c1982614c01565b9150614c2483614c01565b92508260ff03821115614c3a57614c39614772565b5b828201905092915050565b7f4e6f207065726d697373696f6e20746f207369676e0000000000000000000000600082015250565b6000614c7b601583614428565b9150614c8682614c45565b602082019050919050565b60006020820190508181036000830152614caa81614c6e565b9050919050565b7f616c7265616479207265636f7264656400000000000000000000000000000000600082015250565b6000614ce7601083614428565b9150614cf282614cb1565b602082019050919050565b60006020820190508181036000830152614d1681614cda565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000614d558383613746565b60208301905092915050565b6000602082019050919050565b6000614d7982614d1d565b614d838185614d28565b9350614d8e83614d39565b8060005b83811015614dbf578151614da68882614d49565b9750614db183614d61565b925050600181019050614d92565b5085935050505092915050565b6000604082019050614de16000830185613dcd565b8181036020830152614df38184614d6e565b90509392505050565b600081519050614e0b81613607565b92915050565b600060208284031215614e2757614e26613558565b5b6000614e3584828501614dfc565b91505092915050565b6000608082019050614e536000830187613dcd565b614e606020830186614224565b614e6d60408301856146aa565b614e7a6060830184613dcd565b95945050505050565b7f496e76616c696420696e70757400000000000000000000000000000000000000600082015250565b6000614eb9600d83614428565b9150614ec482614e83565b602082019050919050565b60006020820190508181036000830152614ee881614eac565b9050919050565b6000614efa826135fd565b9150614f05836135fd565b925082821015614f1857614f17614772565b5b828203905092915050565b7f4e6f207065726d697373696f6e2e000000000000000000000000000000000000600082015250565b6000614f59600e83614428565b9150614f6482614f23565b602082019050919050565b60006020820190508181036000830152614f8881614f4c565b9050919050565b6000604082019050614fa46000830185613dcd565b614fb160208301846146aa565b9392505050565b600067ffffffffffffffff821115614fd357614fd26139cc565b5b602082029050602081019050919050565b6000614ff7614ff284614fb8565b613a2c565b9050808382526020820190506020840283018581111561501a576150196135a2565b5b835b81811015615043578061502f8882614a59565b84526020840193505060208101905061501c565b5050509392505050565b600082601f83011261506257615061613598565b5b8151615072848260208601614fe4565b91505092915050565b600067ffffffffffffffff821115615096576150956139cc565b5b602082029050602081019050919050565b60006150ba6150b58461507b565b613a2c565b905080838252602082019050602084028301858111156150dd576150dc6135a2565b5b835b8181101561510657806150f288826146f9565b8452602084019350506020810190506150df565b5050509392505050565b600082601f83011261512557615124613598565b5b81516151358482602086016150a7565b91505092915050565b6000806000806080858703121561515857615157613558565b5b600061516687828801614dfc565b945050602061517787828801614dfc565b935050604085015167ffffffffffffffff8111156151985761519761355d565b5b6151a48782880161504d565b925050606085015167ffffffffffffffff8111156151c5576151c461355d565b5b6151d187828801615110565b91505092959194509250565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61521281613df7565b82525050565b60006152248383615209565b60208301905092915050565b6000602082019050919050565b6000615248826151dd565b61525281856151e8565b935061525d836151f9565b8060005b8381101561528e5781516152758882615218565b975061528083615230565b925050600181019050615261565b5085935050505092915050565b600060a0820190506152b06000830188613dcd565b6152bd60208301876146aa565b6152ca6040830186613dcd565b81810360608301526152dc8185614d6e565b905081810360808301526152f0818461523d565b90509695505050505050565b7f6661696c656420746f207377617020746f6b656e000000000000000000000000600082015250565b6000615332601483614428565b915061533d826152fc565b602082019050919050565b6000602082019050818103600083015261536181615325565b9050919050565b6000819050919050565b6000819050919050565b600061539761539261538d84615368565b615372565b6135fd565b9050919050565b6153a78161537c565b82525050565b60006040820190506153c26000830185613dcd565b6153cf602083018461539e565b9392505050565b600080fd5b6153e481613829565b81146153ef57600080fd5b50565b600081359050615401816153db565b92915050565b60006040828403121561541d5761541c6153d6565b5b6154276040613a2c565b90506000615437848285016153f2565b600083015250602061544b848285016153f2565b60208301525092915050565b60006040828403121561546d5761546c613558565b5b600061547b84828501615407565b91505092915050565b6000813561549181613665565b80915050919050565b60008160001b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff6154c78461549a565b9350801983169250808416831791505092915050565b60006154f86154f36154ee84613633565b615372565b613633565b9050919050565b600061550a826154dd565b9050919050565b600061551c826154ff565b9050919050565b6000819050919050565b61553682615511565b61554961554282615523565b83546154a7565b8255505050565b6000813561555d816153db565b80915050919050565b600067ffffffffffffffff61557a8461549a565b9350801983169250808416831791505092915050565b60006155ab6155a66155a184613829565b615372565b613829565b9050919050565b6000819050919050565b6155c582615590565b6155d86155d1826155b2565b8354615566565b8255505050565b60008160401b9050919050565b60006fffffffffffffffff0000000000000000615608846155df565b9350801983169250808416831791505092915050565b61562782615590565b61563a615633826155b2565b83546155ec565b8255505050565b60008101600083018061565381615550565b905061565f81846155bc565b50505060008101602083018061567481615550565b9050615680818461561e565b5050505050565b6156918282615641565b5050565b6000810160008301806156a781615484565b90506156b3818461552d565b5050506001810160208301806156c98184615687565b5050505050565b6156da8282615695565b5050565b60006156ea8385614428565b93506156f7838584613cf2565b615700836137a4565b840190509392505050565b60006060820190506157206000830187613dcd565b61572d6020830186614224565b81810360408301526157408184866156de565b905095945050505050565b600061575782846149a2565b915081905092915050565b6000819050919050565b61577d615778826135fd565b615762565b82525050565b600061578f828461576c565b60208201915081905092915050565b60006157aa8284614980565b60148201915081905092915050565b60006060820190506157ce6000830186613dcd565b6157db6020830185613dcd565b6157e86040830184613dcd565b949350505050565b7f496e76616c696420746f6b656e00000000000000000000000000000000000000600082015250565b6000615826600d83614428565b9150615831826157f0565b602082019050919050565b6000602082019050818103600083015261585581615819565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006158b8602683614428565b91506158c38261585c565b604082019050919050565b600060208201905081810360008301526158e7816158ab565b9050919050565b60006158f9826135fd565b9150615904836135fd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561593d5761593c614772565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000615982826135fd565b915061598d836135fd565b92508261599d5761599c615948565b5b828204905092915050565b600080604083850312156159bf576159be613558565b5b60006159cd85828601614dfc565b92505060206159de85828601614a59565b9150509250929050565b60006159f3826135fd565b91506159fe836135fd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115615a3357615a32614772565b5b828201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000615a74602083614428565b9150615a7f82615a3e565b602082019050919050565b60006020820190508181036000830152615aa381615a67565b9050919050565b7f696e76616c6964207377617020726174696f0000000000000000000000000000600082015250565b6000615ae0601283614428565b9150615aeb82615aaa565b602082019050919050565b60006020820190508181036000830152615b0f81615ad3565b9050919050565b615b1f81614c01565b82525050565b6000608082019050615b3a6000830187613dcd565b615b476020830186615b16565b615b546040830185613dcd565b615b616060830184613dcd565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000615bcf601883614428565b9150615bda82615b99565b602082019050919050565b60006020820190508181036000830152615bfe81615bc2565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000615c3b601f83614428565b9150615c4682615c05565b602082019050919050565b60006020820190508181036000830152615c6a81615c2e565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000615ccd602283614428565b9150615cd882615c71565b604082019050919050565b60006020820190508181036000830152615cfc81615cc0565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202776272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000615d5f602283614428565b9150615d6a82615d03565b604082019050919050565b60006020820190508181036000830152615d8e81615d52565b9050919050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b6000615df1602a83614428565b9150615dfc82615d95565b604082019050919050565b60006020820190508181036000830152615e2081615de4565b9050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b6000615e83602683614428565b9150615e8e82615e27565b604082019050919050565b60006020820190508181036000830152615eb281615e76565b9050919050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b6000615eef601d83614428565b9150615efa82615eb9565b602082019050919050565b60006020820190508181036000830152615f1e81615ee2565b9050919050565b6000615f3082613755565b615f3a8185614428565b9350615f4a818560208601613771565b615f53816137a4565b840191505092915050565b60006020820190508181036000830152615f788184615f25565b90509291505056fea2646970667358221220cd14309a537b6d34604d2907a8f5399d4dd61ba224a6fd4064d8f95c5359420864736f6c63430008090033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638a0bb6f911610097578063c045e88711610066578063c045e887146102d1578063cb2b48a5146102ed578063d954863c1461031d578063f2fde38b1461033957610100565b80638a0bb6f9146102375780638da5cb5b14610267578063a6fb97d114610285578063b33ff450146102a157610100565b80634c038c45116100d35780634c038c45146101b157806368591baa146101e1578063715018a6146101fd57806371d0c5ca1461020757610100565b806303b1ccdb146101055780632d0fc6b4146101215780633f19efbe14610151578063446f95b414610181575b600080fd5b61011f600480360381019061011a9190613691565b610355565b005b61013b60048036038101906101369190613719565b610cc9565b60405161014891906139aa565b60405180910390f35b61016b60048036038101906101669190613b60565b610ed3565b6040516101789190613c9a565b60405180910390f35b61019b60048036038101906101969190613d71565b61105a565b6040516101a89190613ddc565b60405180910390f35b6101cb60048036038101906101c69190613719565b6110d5565b6040516101d89190613e12565b60405180910390f35b6101fb60048036038101906101f69190613ed9565b6110f4565b005b6102056115ff565b005b610221600480360381019061021c9190613fb5565b611613565b60405161022e9190613ddc565b60405180910390f35b610251600480360381019061024c9190614015565b611684565b60405161025e9190614202565b60405180910390f35b61026f611a4e565b60405161027c9190614233565b60405180910390f35b61029f600480360381019061029a919061424e565b611a77565b005b6102bb60048036038101906102b69190613691565b611d9e565b6040516102c89190613ddc565b60405180910390f35b6102eb60048036038101906102e691906142f7565b612090565b005b6103076004803603810190610302919061438c565b612467565b6040516103149190613ddc565b60405180910390f35b6103376004803603810190610332919061424e565b612640565b005b610353600480360381019061034e91906143fb565b6129a7565b005b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ba906144ab565b60405180910390fd5b6000600360008781526020019081526020016000206004015490506000801b811415610424576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161041b90614517565b60405180910390fd5b60008311610467576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045e90614583565b60405180910390fd5b6000600360008881526020019081526020016000209050600061048d8388888888611d9e565b90506000600760008381526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610539576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610530906145ef565b60405180910390fd5b848160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600083600201805480602002602001604051908101604052809291908181526020016000905b828210156106a257838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff168152505081525050815260200190600101906105a2565b50505050905060005b815181101561091a5760008560020182815481106106cc576106cb61460f565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600560008e815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060006107d385858151811061076c5761076b61460f565b5b6020026020010151602001516000015167ffffffffffffffff166107c587878151811061079c5761079b61460f565b5b6020026020010151602001516020015167ffffffffffffffff168e612a2b90919063ffffffff16565b612a4190919063ffffffff16565b9050816000015481111561081c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108139061468a565b60405180910390fd5b610833818360000154612a5790919063ffffffff16565b82600001819055508273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8b836040518363ffffffff1660e01b81526004016108769291906146b9565b602060405180830381600087803b15801561089057600080fd5b505af11580156108a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c8919061470e565b507fb0c1e4d18ea737b756410ab0296768c15a87c12eeb368f360ecc5be61a11b4db8a84836040516108fc9392919061473b565b60405180910390a15050508080610912906147a1565b9150506106ab565b506000610a0d856002016000815481106109375761093661460f565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600360008e8152602001908152602001600020600101805461098a90614819565b80601f01602080910402602001604051908101604052809291908181526020018280546109b690614819565b8015610a035780601f106109d857610100808354040283529160200191610a03565b820191906000526020600020905b8154815290600101906020018083116109e657829003601f168201915b505050505061105a565b9050600860008281526020019081526020016000206040518060e0016040528087600201600081548110610a4457610a4361460f565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1681526020018a8152602001438152602001428152602001600360008f81526020019081526020016000206001018054610ae090614819565b80601f0160208091040260200160405190810160405280929190818152602001828054610b0c90614819565b8015610b595780601f10610b2e57610100808354040283529160200191610b59565b820191906000526020600020905b815481529060010190602001808311610b3c57829003601f168201915b505050505081526020018c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050815250908060018154018082558091505060019003906000526020600020906007020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020155606082015181600301556080820151816004015560a0820151816005019080519060200190610c9c929190613384565b5060c0820151816006019080519060200190610cb9929190613384565b5050505050505050505050505050565b610cd161340a565b600360008381526020019081526020016000206040518060a001604052908160008201548152602001600182018054610d0990614819565b80601f0160208091040260200160405190810160405280929190818152602001828054610d3590614819565b8015610d825780601f10610d5757610100808354040283529160200191610d82565b820191906000526020600020905b815481529060010190602001808311610d6557829003601f168201915b5050505050815260200160028201805480602002602001604051908101604052809291908181526020016000905b82821015610eb057838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250508152505081526020019060010190610db0565b505050508152602001600382015481526020016004820154815250509050919050565b606082829050845114610f1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f12906148bd565b60405180910390fd5b6000845167ffffffffffffffff811115610f3857610f376139cc565b5b604051908082528060200260200182016040528015610f665781602001602082028036833780820191505090505b50905060005b855181101561104e576000611002878381518110610f8d57610f8c61460f565b5b6020026020010151878785818110610fa857610fa761460f565b5b9050602002810190610fba91906148ec565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061105a565b9050600860008281526020019081526020016000208054905083838151811061102e5761102d61460f565b5b602002602001018181525050508080611046906147a1565b915050610f6c565b50809150509392505050565b6000600283836040516020016110719291906149d3565b60405160208183030381529060405260405161108d9190614a42565b602060405180830381855afa1580156110aa573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906110cd9190614a6e565b905092915050565b6000806006600084815260200190815260200160002054119050919050565b6000600360008a81526020019081526020016000209050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323c849858260030154336040518363ffffffff1660e01b815260040161116c929190614a9b565b60206040518083038186803b15801561118457600080fd5b505afa158015611198573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111bc919061470e565b6111fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f290614b10565b60405180910390fd5b60005b868690508110156113b7576000898960405161121b929190614b55565b60405180910390206040516020016112339190614bdb565b60405160208183030381529060405280519060200120905060006112b082601b8786602081106112665761126561460f565b5b1a60f81b60f81c6112779190614c0e565b8b8b8781811061128a5761128961460f565b5b905060200201358a8a888181106112a4576112a361460f565b5b90506020020135612a6d565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323c849858560030154836040518363ffffffff1660e01b8152600401611313929190614a9b565b60206040518083038186803b15801561132b57600080fd5b505afa15801561133f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611363919061470e565b6113a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139990614c91565b60405180910390fd5b505080806113af906147a1565b9150506111fe565b506000806114088a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050612a98565b915091506000600167ffffffffffffffff811115611429576114286139cc565b5b6040519080825280602002602001820160405280156114575781602001602082028036833780820191505090505b509050818160008151811061146f5761146e61460f565b5b60200260200101818152505060006006600084815260200190815260200160002054146114d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c890614cfd565b60405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637d9778368660040154846040518363ffffffff1660e01b8152600401611534929190614dcc565b602060405180830381600087803b15801561154e57600080fd5b505af1158015611562573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115869190614e11565b905061159c600182612abc90919063ffffffff16565b60066000858152602001908152602001600020819055507f6319bf84e3d2c97dd1991c07818c14950ceb6f48ce6d85f063be3c60905ea1b98d3386866040516115e89493929190614e3e565b60405180910390a150505050505050505050505050565b611607612ad2565b6116116000612b50565b565b6000806116648585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061105a565b905060046000828152602001908152602001600020549150509392505050565b606060006116d68787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061105a565b9050600860008281526020019081526020016000208054905083111580156116fe5750600084115b61173d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173490614ecf565b60405180910390fd5b600061176560016117578787612a5790919063ffffffff16565b612abc90919063ffffffff16565b90508067ffffffffffffffff811115611781576117806139cc565b5b6040519080825280602002602001820160405280156117ba57816020015b6117a7613442565b81526020019060019003908161179f5790505b50925060006001866117cc9190614eef565b90505b84811015611a42576008600084815260200190815260200160002081815481106117fc576117fb61460f565b5b90600052602060002090600702016040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820154815260200160038201548152602001600482015481526020016005820180546118ef90614819565b80601f016020809104026020016040519081016040528092919081815260200182805461191b90614819565b80156119685780601f1061193d57610100808354040283529160200191611968565b820191906000526020600020905b81548152906001019060200180831161194b57829003601f168201915b5050505050815260200160068201805461198190614819565b80601f01602080910402602001604051908101604052809291908181526020018280546119ad90614819565b80156119fa5780601f106119cf576101008083540402835291602001916119fa565b820191906000526020600020905b8154815290600101906020018083116119dd57829003601f168201915b505050505081525050848281518110611a1657611a1561460f565b5b60200260200101819052508080611a2c906147a1565b9150508080611a3a906147a1565b9150506117cf565b50505095945050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600360008581526020019081526020016000209050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639a96679e8260030154336040518363ffffffff1660e01b8152600401611aef929190614a9b565b60206040518083038186803b158015611b0757600080fd5b505afa158015611b1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b3f919061470e565b611b7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7590614f6f565b60405180910390fd5b611caf8382600201805480602002602001604051908101604052809291908181526020016000905b82821015611ca657838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250508152505081526020019060010190611ba6565b50505050612c14565b50611d16826005600087815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154612a5790919063ffffffff16565b6005600086815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550611d9833838573ffffffffffffffffffffffffffffffffffffffff16612ca09092919063ffffffff16565b50505050565b60006060806000611df488888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508787612467565b90506000611e1f60016006600085815260200190815260200160002054612a5790919063ffffffff16565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631b32d71a8b836040518363ffffffff1660e01b8152600401611e7e929190614f8f565b60006040518083038186803b158015611e9657600080fd5b505afa158015611eaa573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190611ed3919061513e565b909192509091508094508195505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631669b10e8b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fd2973ca8e866040518363ffffffff1660e01b8152600401611f7e929190614f8f565b60206040518083038186803b158015611f9657600080fd5b505afa158015611faa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fce9190614e11565b8588886040518663ffffffff1660e01b8152600401611ff195949392919061529b565b60206040518083038186803b15801561200957600080fd5b505afa15801561201d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612041919061470e565b612080576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161207790615348565b60405180910390fd5b8194505050505095945050505050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166376e2775583336040518363ffffffff1660e01b81526004016120ef929190614a9b565b60206040518083038186803b15801561210757600080fd5b505afa15801561211b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061213f919061470e565b905080612181576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161217890614f6f565b60405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632a99732a84600a6040518363ffffffff1660e01b81526004016121e19291906153ad565b602060405180830381600087803b1580156121fb57600080fd5b505af115801561220f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122339190614a6e565b905060008036604051612247929190614b55565b604051809103902090506000888860008181106122675761226661460f565b5b905060600201600001602081019061227f91906143fb565b905084600360008481526020019081526020016000206003018190555082600360008481526020019081526020016000206004018190555081600360008481526020019081526020016000206000018190555086866003600085815260200190815260200160002060010191906122f79291906134ab565b5060006123488289898080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061105a565b905082600460008381526020019081526020016000208190555060005b8a8a905081101561241d576123a48b8b838181106123865761238561460f565b5b90506060020160200180360381019061239f9190615457565b612d26565b600360008581526020019081526020016000206002018b8b838181106123cd576123cc61460f565b5b9050606002019080600181540180825580915050600190039060005260206000209060020201600090919091909150818161240891906156d0565b50508080612415906147a1565b915050612365565b507f909c724b9d08d0463115fc7fa6d2c8e51e6eafa867725be497bdb9a53a6cac4f83838a8a604051612453949392919061570b565b60405180910390a150505050505050505050565b60008060028560405160200161247d919061574b565b6040516020818303038152906040526040516124999190614a42565b602060405180830381855afa1580156124b6573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906124d99190614a6e565b905060006002856040516020016124f09190615783565b60405160208183030381529060405260405161250c9190614a42565b602060405180830381855afa158015612529573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061254c9190614a6e565b90506000600285604051602001612563919061579e565b60405160208183030381529060405260405161257f9190614a42565b602060405180830381855afa15801561259c573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906125bf9190614a6e565b905060028383836040516020016125d8939291906157b9565b6040516020818303038152906040526040516125f49190614a42565b602060405180830381855afa158015612611573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906126349190614a6e565b93505050509392505050565b6000600360008581526020019081526020016000209050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639a96679e8260030154336040518363ffffffff1660e01b81526004016126b8929190614a9b565b60206040518083038186803b1580156126d057600080fd5b505afa1580156126e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612708919061470e565b612747576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161273e90614f6f565b60405180910390fd5b6128788382600201805480602002602001604051908101604052809291908181526020016000905b8282101561286f57838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681525050815250508152602001906001019061276f565b50505050612c14565b6128b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128ae9061583c565b60405180910390fd5b6128e43330848673ffffffffffffffffffffffffffffffffffffffff16612d94909392919063ffffffff16565b61294a826005600087815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154612abc90919063ffffffff16565b6005600086815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555050505050565b6129af612ad2565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612a1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a16906158ce565b60405180910390fd5b612a2881612b50565b50565b60008183612a3991906158ee565b905092915050565b60008183612a4f9190615977565b905092915050565b60008183612a659190614eef565b905092915050565b6000806000612a7e87878787612e1d565b91509150612a8b81612f2a565b8192505050949350505050565b60008082806020019051810190612aaf91906159a8565b8092508193505050915091565b60008183612aca91906159e8565b905092915050565b612ada6130ff565b73ffffffffffffffffffffffffffffffffffffffff16612af8611a4e565b73ffffffffffffffffffffffffffffffffffffffff1614612b4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b4590615a8a565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080600090505b8251811015612c94578373ffffffffffffffffffffffffffffffffffffffff16838281518110612c4f57612c4e61460f565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff161415612c81576001915050612c9a565b8080612c8c906147a1565b915050612c1c565b50600090505b92915050565b612d218363a9059cbb60e01b8484604051602401612cbf9291906146b9565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613107565b505050565b6000816000015167ffffffffffffffff16118015612d5257506000816020015167ffffffffffffffff16115b612d91576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d8890615af6565b60405180910390fd5b50565b612e17846323b872dd60e01b858585604051602401612db59392919061473b565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613107565b50505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115612e58576000600391509150612f21565b601b8560ff1614158015612e705750601c8560ff1614155b15612e82576000600491509150612f21565b600060018787878760405160008152602001604052604051612ea79493929190615b25565b6020604051602081039080840390855afa158015612ec9573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612f1857600060019250925050612f21565b80600092509250505b94509492505050565b60006004811115612f3e57612f3d615b6a565b5b816004811115612f5157612f50615b6a565b5b1415612f5c576130fc565b60016004811115612f7057612f6f615b6a565b5b816004811115612f8357612f82615b6a565b5b1415612fc4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612fbb90615be5565b60405180910390fd5b60026004811115612fd857612fd7615b6a565b5b816004811115612feb57612fea615b6a565b5b141561302c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161302390615c51565b60405180910390fd5b600360048111156130405761303f615b6a565b5b81600481111561305357613052615b6a565b5b1415613094576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161308b90615ce3565b60405180910390fd5b6004808111156130a7576130a6615b6a565b5b8160048111156130ba576130b9615b6a565b5b14156130fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130f290615d75565b60405180910390fd5b5b50565b600033905090565b6000613169826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166131ce9092919063ffffffff16565b90506000815111156131c95780806020019051810190613189919061470e565b6131c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131bf90615e07565b60405180910390fd5b5b505050565b60606131dd84846000856131e6565b90509392505050565b60608247101561322b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161322290615e99565b60405180910390fd5b613234856132fa565b613273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161326a90615f05565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161329c9190614a42565b60006040518083038185875af1925050503d80600081146132d9576040519150601f19603f3d011682016040523d82523d6000602084013e6132de565b606091505b50915091506132ee82828661331d565b92505050949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6060831561332d5782905061337d565b6000835111156133405782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133749190615f5e565b60405180910390fd5b9392505050565b82805461339090614819565b90600052602060002090601f0160209004810192826133b257600085556133f9565b82601f106133cb57805160ff19168380011785556133f9565b828001600101855582156133f9579182015b828111156133f85782518255916020019190600101906133dd565b5b5090506134069190613531565b5090565b6040518060a0016040528060008019168152602001606081526020016060815260200160008019168152602001600080191681525090565b6040518060e00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160608152602001606081525090565b8280546134b790614819565b90600052602060002090601f0160209004810192826134d95760008555613520565b82601f106134f257803560ff1916838001178555613520565b82800160010185558215613520579182015b8281111561351f578235825591602001919060010190613504565b5b50905061352d9190613531565b5090565b5b8082111561354a576000816000905550600101613532565b5090565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b61357581613562565b811461358057600080fd5b50565b6000813590506135928161356c565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f8401126135bd576135bc613598565b5b8235905067ffffffffffffffff8111156135da576135d961359d565b5b6020830191508360018202830111156135f6576135f56135a2565b5b9250929050565b6000819050919050565b613610816135fd565b811461361b57600080fd5b50565b60008135905061362d81613607565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061365e82613633565b9050919050565b61366e81613653565b811461367957600080fd5b50565b60008135905061368b81613665565b92915050565b6000806000806000608086880312156136ad576136ac613558565b5b60006136bb88828901613583565b955050602086013567ffffffffffffffff8111156136dc576136db61355d565b5b6136e8888289016135a7565b945094505060406136fb8882890161361e565b925050606061370c8882890161367c565b9150509295509295909350565b60006020828403121561372f5761372e613558565b5b600061373d84828501613583565b91505092915050565b61374f81613562565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561378f578082015181840152602081019050613774565b8381111561379e576000848401525b50505050565b6000601f19601f8301169050919050565b60006137c082613755565b6137ca8185613760565b93506137da818560208601613771565b6137e3816137a4565b840191505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61382381613653565b82525050565b600067ffffffffffffffff82169050919050565b61384681613829565b82525050565b604082016000820151613862600085018261383d565b506020820151613875602085018261383d565b50505050565b606082016000820151613891600085018261381a565b5060208201516138a4602085018261384c565b50505050565b60006138b6838361387b565b60608301905092915050565b6000602082019050919050565b60006138da826137ee565b6138e481856137f9565b93506138ef8361380a565b8060005b8381101561392057815161390788826138aa565b9750613912836138c2565b9250506001810190506138f3565b5085935050505092915050565b600060a0830160008301516139456000860182613746565b506020830151848203602086015261395d82826137b5565b9150506040830151848203604086015261397782826138cf565b915050606083015161398c6060860182613746565b50608083015161399f6080860182613746565b508091505092915050565b600060208201905081810360008301526139c4818461392d565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613a04826137a4565b810181811067ffffffffffffffff82111715613a2357613a226139cc565b5b80604052505050565b6000613a3661354e565b9050613a4282826139fb565b919050565b600067ffffffffffffffff821115613a6257613a616139cc565b5b602082029050602081019050919050565b6000613a86613a8184613a47565b613a2c565b90508083825260208201905060208402830185811115613aa957613aa86135a2565b5b835b81811015613ad25780613abe888261367c565b845260208401935050602081019050613aab565b5050509392505050565b600082601f830112613af157613af0613598565b5b8135613b01848260208601613a73565b91505092915050565b60008083601f840112613b2057613b1f613598565b5b8235905067ffffffffffffffff811115613b3d57613b3c61359d565b5b602083019150836020820283011115613b5957613b586135a2565b5b9250929050565b600080600060408486031215613b7957613b78613558565b5b600084013567ffffffffffffffff811115613b9757613b9661355d565b5b613ba386828701613adc565b935050602084013567ffffffffffffffff811115613bc457613bc361355d565b5b613bd086828701613b0a565b92509250509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613c11816135fd565b82525050565b6000613c238383613c08565b60208301905092915050565b6000602082019050919050565b6000613c4782613bdc565b613c518185613be7565b9350613c5c83613bf8565b8060005b83811015613c8d578151613c748882613c17565b9750613c7f83613c2f565b925050600181019050613c60565b5085935050505092915050565b60006020820190508181036000830152613cb48184613c3c565b905092915050565b600080fd5b600067ffffffffffffffff821115613cdc57613cdb6139cc565b5b613ce5826137a4565b9050602081019050919050565b82818337600083830152505050565b6000613d14613d0f84613cc1565b613a2c565b905082815260208101848484011115613d3057613d2f613cbc565b5b613d3b848285613cf2565b509392505050565b600082601f830112613d5857613d57613598565b5b8135613d68848260208601613d01565b91505092915050565b60008060408385031215613d8857613d87613558565b5b6000613d968582860161367c565b925050602083013567ffffffffffffffff811115613db757613db661355d565b5b613dc385828601613d43565b9150509250929050565b613dd681613562565b82525050565b6000602082019050613df16000830184613dcd565b92915050565b60008115159050919050565b613e0c81613df7565b82525050565b6000602082019050613e276000830184613e03565b92915050565b60008083601f840112613e4357613e42613598565b5b8235905067ffffffffffffffff811115613e6057613e5f61359d565b5b602083019150836001820283011115613e7c57613e7b6135a2565b5b9250929050565b60008083601f840112613e9957613e98613598565b5b8235905067ffffffffffffffff811115613eb657613eb561359d565b5b602083019150836020820283011115613ed257613ed16135a2565b5b9250929050565b60008060008060008060008060a0898b031215613ef957613ef8613558565b5b6000613f078b828c01613583565b985050602089013567ffffffffffffffff811115613f2857613f2761355d565b5b613f348b828c01613e2d565b9750975050604089013567ffffffffffffffff811115613f5757613f5661355d565b5b613f638b828c01613e83565b9550955050606089013567ffffffffffffffff811115613f8657613f8561355d565b5b613f928b828c01613e83565b93509350506080613fa58b828c01613583565b9150509295985092959890939650565b600080600060408486031215613fce57613fcd613558565b5b6000613fdc8682870161367c565b935050602084013567ffffffffffffffff811115613ffd57613ffc61355d565b5b614009868287016135a7565b92509250509250925092565b60008060008060006080868803121561403157614030613558565b5b600061403f8882890161367c565b955050602086013567ffffffffffffffff8111156140605761405f61355d565b5b61406c888289016135a7565b9450945050604061407f8882890161361e565b92505060606140908882890161361e565b9150509295509295909350565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600060e0830160008301516140e1600086018261381a565b5060208301516140f4602086018261381a565b5060408301516141076040860182613c08565b50606083015161411a6060860182613c08565b50608083015161412d6080860182613c08565b5060a083015184820360a086015261414582826137b5565b91505060c083015184820360c086015261415f82826137b5565b9150508091505092915050565b600061417883836140c9565b905092915050565b6000602082019050919050565b60006141988261409d565b6141a281856140a8565b9350836020820285016141b4856140b9565b8060005b858110156141f057848403895281516141d1858261416c565b94506141dc83614180565b925060208a019950506001810190506141b8565b50829750879550505050505092915050565b6000602082019050818103600083015261421c818461418d565b905092915050565b61422d81613653565b82525050565b60006020820190506142486000830184614224565b92915050565b60008060006060848603121561426757614266613558565b5b600061427586828701613583565b93505060206142868682870161367c565b92505060406142978682870161361e565b9150509250925092565b60008083601f8401126142b7576142b6613598565b5b8235905067ffffffffffffffff8111156142d4576142d361359d565b5b6020830191508360608202830111156142f0576142ef6135a2565b5b9250929050565b60008060008060006060868803121561431357614312613558565b5b600086013567ffffffffffffffff8111156143315761433061355d565b5b61433d888289016142a1565b9550955050602086013567ffffffffffffffff8111156143605761435f61355d565b5b61436c888289016135a7565b9350935050604061437f88828901613583565b9150509295509295909350565b6000806000606084860312156143a5576143a4613558565b5b600084013567ffffffffffffffff8111156143c3576143c261355d565b5b6143cf86828701613d43565b93505060206143e08682870161361e565b92505060406143f18682870161367c565b9150509250925092565b60006020828403121561441157614410613558565b5b600061441f8482850161367c565b91505092915050565b600082825260208201905092915050565b7f6f6e6c7920726563656976657220686173207065726d697373696f6e20746f2060008201527f7377617020746f6b656e00000000000000000000000000000000000000000000602082015250565b6000614495602a83614428565b91506144a082614439565b604082019050919050565b600060208201905081810360008301526144c481614488565b9050919050565b7f746f6b656e20737761702070616972206e6f7420666f756e6400000000000000600082015250565b6000614501601983614428565b915061450c826144cb565b602082019050919050565b60006020820190508181036000830152614530816144f4565b9050919050565b7f696e76616c696420616d6f756e74000000000000000000000000000000000000600082015250565b600061456d600e83614428565b915061457882614537565b602082019050919050565b6000602082019050818103600083015261459c81614560565b9050919050565b7f616c726561647920636c61696d65640000000000000000000000000000000000600082015250565b60006145d9600f83614428565b91506145e4826145a3565b602082019050919050565b60006020820190508181036000830152614608816145cc565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f6465706f736974206e6f7420656e6f7567687400000000000000000000000000600082015250565b6000614674601383614428565b915061467f8261463e565b602082019050919050565b600060208201905081810360008301526146a381614667565b9050919050565b6146b3816135fd565b82525050565b60006040820190506146ce6000830185614224565b6146db60208301846146aa565b9392505050565b6146eb81613df7565b81146146f657600080fd5b50565b600081519050614708816146e2565b92915050565b60006020828403121561472457614723613558565b5b6000614732848285016146f9565b91505092915050565b60006060820190506147506000830186614224565b61475d6020830185614224565b61476a60408301846146aa565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006147ac826135fd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156147df576147de614772565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061483157607f821691505b60208210811415614845576148446147ea565b5b50919050565b7f496e76616c696420746f6b656e732f746172676574436861696e49647320696e60008201527f7075740000000000000000000000000000000000000000000000000000000000602082015250565b60006148a7602383614428565b91506148b28261484b565b604082019050919050565b600060208201905081810360008301526148d68161489a565b9050919050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112614909576149086148dd565b5b80840192508235915067ffffffffffffffff82111561492b5761492a6148e2565b5b602083019250600182023603831315614947576149466148e7565b5b509250929050565b60008160601b9050919050565b60006149678261494f565b9050919050565b60006149798261495c565b9050919050565b61499161498c82613653565b61496e565b82525050565b600081905092915050565b60006149ad82613755565b6149b78185614997565b93506149c7818560208601613771565b80840191505092915050565b60006149df8285614980565b6014820191506149ef82846149a2565b91508190509392505050565b600081519050919050565b600081905092915050565b6000614a1c826149fb565b614a268185614a06565b9350614a36818560208601613771565b80840191505092915050565b6000614a4e8284614a11565b915081905092915050565b600081519050614a688161356c565b92915050565b600060208284031215614a8457614a83613558565b5b6000614a9284828501614a59565b91505092915050565b6000604082019050614ab06000830185613dcd565b614abd6020830184614224565b9392505050565b7f4e6f207065726d697373696f6e20746f207472616e736d697400000000000000600082015250565b6000614afa601983614428565b9150614b0582614ac4565b602082019050919050565b60006020820190508181036000830152614b2981614aed565b9050919050565b6000614b3c8385614a06565b9350614b49838584613cf2565b82840190509392505050565b6000614b62828486614b30565b91508190509392505050565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600082015250565b6000614ba4601c83614997565b9150614baf82614b6e565b601c82019050919050565b6000819050919050565b614bd5614bd082613562565b614bba565b82525050565b6000614be682614b97565b9150614bf28284614bc4565b60208201915081905092915050565b600060ff82169050919050565b6000614c1982614c01565b9150614c2483614c01565b92508260ff03821115614c3a57614c39614772565b5b828201905092915050565b7f4e6f207065726d697373696f6e20746f207369676e0000000000000000000000600082015250565b6000614c7b601583614428565b9150614c8682614c45565b602082019050919050565b60006020820190508181036000830152614caa81614c6e565b9050919050565b7f616c7265616479207265636f7264656400000000000000000000000000000000600082015250565b6000614ce7601083614428565b9150614cf282614cb1565b602082019050919050565b60006020820190508181036000830152614d1681614cda565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000614d558383613746565b60208301905092915050565b6000602082019050919050565b6000614d7982614d1d565b614d838185614d28565b9350614d8e83614d39565b8060005b83811015614dbf578151614da68882614d49565b9750614db183614d61565b925050600181019050614d92565b5085935050505092915050565b6000604082019050614de16000830185613dcd565b8181036020830152614df38184614d6e565b90509392505050565b600081519050614e0b81613607565b92915050565b600060208284031215614e2757614e26613558565b5b6000614e3584828501614dfc565b91505092915050565b6000608082019050614e536000830187613dcd565b614e606020830186614224565b614e6d60408301856146aa565b614e7a6060830184613dcd565b95945050505050565b7f496e76616c696420696e70757400000000000000000000000000000000000000600082015250565b6000614eb9600d83614428565b9150614ec482614e83565b602082019050919050565b60006020820190508181036000830152614ee881614eac565b9050919050565b6000614efa826135fd565b9150614f05836135fd565b925082821015614f1857614f17614772565b5b828203905092915050565b7f4e6f207065726d697373696f6e2e000000000000000000000000000000000000600082015250565b6000614f59600e83614428565b9150614f6482614f23565b602082019050919050565b60006020820190508181036000830152614f8881614f4c565b9050919050565b6000604082019050614fa46000830185613dcd565b614fb160208301846146aa565b9392505050565b600067ffffffffffffffff821115614fd357614fd26139cc565b5b602082029050602081019050919050565b6000614ff7614ff284614fb8565b613a2c565b9050808382526020820190506020840283018581111561501a576150196135a2565b5b835b81811015615043578061502f8882614a59565b84526020840193505060208101905061501c565b5050509392505050565b600082601f83011261506257615061613598565b5b8151615072848260208601614fe4565b91505092915050565b600067ffffffffffffffff821115615096576150956139cc565b5b602082029050602081019050919050565b60006150ba6150b58461507b565b613a2c565b905080838252602082019050602084028301858111156150dd576150dc6135a2565b5b835b8181101561510657806150f288826146f9565b8452602084019350506020810190506150df565b5050509392505050565b600082601f83011261512557615124613598565b5b81516151358482602086016150a7565b91505092915050565b6000806000806080858703121561515857615157613558565b5b600061516687828801614dfc565b945050602061517787828801614dfc565b935050604085015167ffffffffffffffff8111156151985761519761355d565b5b6151a48782880161504d565b925050606085015167ffffffffffffffff8111156151c5576151c461355d565b5b6151d187828801615110565b91505092959194509250565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61521281613df7565b82525050565b60006152248383615209565b60208301905092915050565b6000602082019050919050565b6000615248826151dd565b61525281856151e8565b935061525d836151f9565b8060005b8381101561528e5781516152758882615218565b975061528083615230565b925050600181019050615261565b5085935050505092915050565b600060a0820190506152b06000830188613dcd565b6152bd60208301876146aa565b6152ca6040830186613dcd565b81810360608301526152dc8185614d6e565b905081810360808301526152f0818461523d565b90509695505050505050565b7f6661696c656420746f207377617020746f6b656e000000000000000000000000600082015250565b6000615332601483614428565b915061533d826152fc565b602082019050919050565b6000602082019050818103600083015261536181615325565b9050919050565b6000819050919050565b6000819050919050565b600061539761539261538d84615368565b615372565b6135fd565b9050919050565b6153a78161537c565b82525050565b60006040820190506153c26000830185613dcd565b6153cf602083018461539e565b9392505050565b600080fd5b6153e481613829565b81146153ef57600080fd5b50565b600081359050615401816153db565b92915050565b60006040828403121561541d5761541c6153d6565b5b6154276040613a2c565b90506000615437848285016153f2565b600083015250602061544b848285016153f2565b60208301525092915050565b60006040828403121561546d5761546c613558565b5b600061547b84828501615407565b91505092915050565b6000813561549181613665565b80915050919050565b60008160001b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff6154c78461549a565b9350801983169250808416831791505092915050565b60006154f86154f36154ee84613633565b615372565b613633565b9050919050565b600061550a826154dd565b9050919050565b600061551c826154ff565b9050919050565b6000819050919050565b61553682615511565b61554961554282615523565b83546154a7565b8255505050565b6000813561555d816153db565b80915050919050565b600067ffffffffffffffff61557a8461549a565b9350801983169250808416831791505092915050565b60006155ab6155a66155a184613829565b615372565b613829565b9050919050565b6000819050919050565b6155c582615590565b6155d86155d1826155b2565b8354615566565b8255505050565b60008160401b9050919050565b60006fffffffffffffffff0000000000000000615608846155df565b9350801983169250808416831791505092915050565b61562782615590565b61563a615633826155b2565b83546155ec565b8255505050565b60008101600083018061565381615550565b905061565f81846155bc565b50505060008101602083018061567481615550565b9050615680818461561e565b5050505050565b6156918282615641565b5050565b6000810160008301806156a781615484565b90506156b3818461552d565b5050506001810160208301806156c98184615687565b5050505050565b6156da8282615695565b5050565b60006156ea8385614428565b93506156f7838584613cf2565b615700836137a4565b840190509392505050565b60006060820190506157206000830187613dcd565b61572d6020830186614224565b81810360408301526157408184866156de565b905095945050505050565b600061575782846149a2565b915081905092915050565b6000819050919050565b61577d615778826135fd565b615762565b82525050565b600061578f828461576c565b60208201915081905092915050565b60006157aa8284614980565b60148201915081905092915050565b60006060820190506157ce6000830186613dcd565b6157db6020830185613dcd565b6157e86040830184613dcd565b949350505050565b7f496e76616c696420746f6b656e00000000000000000000000000000000000000600082015250565b6000615826600d83614428565b9150615831826157f0565b602082019050919050565b6000602082019050818103600083015261585581615819565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006158b8602683614428565b91506158c38261585c565b604082019050919050565b600060208201905081810360008301526158e7816158ab565b9050919050565b60006158f9826135fd565b9150615904836135fd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561593d5761593c614772565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000615982826135fd565b915061598d836135fd565b92508261599d5761599c615948565b5b828204905092915050565b600080604083850312156159bf576159be613558565b5b60006159cd85828601614dfc565b92505060206159de85828601614a59565b9150509250929050565b60006159f3826135fd565b91506159fe836135fd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115615a3357615a32614772565b5b828201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000615a74602083614428565b9150615a7f82615a3e565b602082019050919050565b60006020820190508181036000830152615aa381615a67565b9050919050565b7f696e76616c6964207377617020726174696f0000000000000000000000000000600082015250565b6000615ae0601283614428565b9150615aeb82615aaa565b602082019050919050565b60006020820190508181036000830152615b0f81615ad3565b9050919050565b615b1f81614c01565b82525050565b6000608082019050615b3a6000830187613dcd565b615b476020830186615b16565b615b546040830185613dcd565b615b616060830184613dcd565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000615bcf601883614428565b9150615bda82615b99565b602082019050919050565b60006020820190508181036000830152615bfe81615bc2565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000615c3b601f83614428565b9150615c4682615c05565b602082019050919050565b60006020820190508181036000830152615c6a81615c2e565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000615ccd602283614428565b9150615cd882615c71565b604082019050919050565b60006020820190508181036000830152615cfc81615cc0565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202776272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000615d5f602283614428565b9150615d6a82615d03565b604082019050919050565b60006020820190508181036000830152615d8e81615d52565b9050919050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b6000615df1602a83614428565b9150615dfc82615d95565b604082019050919050565b60006020820190508181036000830152615e2081615de4565b9050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b6000615e83602683614428565b9150615e8e82615e27565b604082019050919050565b60006020820190508181036000830152615eb281615e76565b9050919050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b6000615eef601d83614428565b9150615efa82615eb9565b602082019050919050565b60006020820190508181036000830152615f1e81615ee2565b9050919050565b6000615f3082613755565b615f3a8185614428565b9350615f4a818560208601613771565b615f53816137a4565b840191505092915050565b60006020820190508181036000830152615f788184615f25565b90509291505056fea2646970667358221220cd14309a537b6d34604d2907a8f5399d4dd61ba224a6fd4064d8f95c5359420864736f6c63430008090033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/src/AElf.EventHandler/EventHandlerAppModule.cs b/src/AElf.EventHandler/EventHandlerAppModule.cs index bdf599de..44760a3b 100644 --- a/src/AElf.EventHandler/EventHandlerAppModule.cs +++ b/src/AElf.EventHandler/EventHandlerAppModule.cs @@ -79,10 +79,11 @@ public override void ConfigureServices(ServiceConfigurationContext context) context.Services.AddHostedService(); context.Services.AddTransient(typeof(ILogEventProcessor<>), typeof(LogEventProcessorBase<>)); context.Services.AddSingleton(); + context.Services.AddSingleton(); } public override void OnApplicationInitialization(ApplicationInitializationContext context) { - context.AddBackgroundWorkerAsync(); + //context.AddBackgroundWorkerAsync(); //context.AddBackgroundWorkerAsync(); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Providers/IDataProvider.cs b/src/AElf.EventHandler/Providers/IDataProvider.cs index 2a07667c..aec005ec 100644 --- a/src/AElf.EventHandler/Providers/IDataProvider.cs +++ b/src/AElf.EventHandler/Providers/IDataProvider.cs @@ -31,35 +31,17 @@ public class DataProvider : IDataProvider, ISingletonDependency private readonly string _bridgeAbi; private Web3Manager _web3ManagerForLock; private BridgeOptions _bridgeOptions; - private BridgeService _bridgeService; - private IBridgeOutService _bridgeOutService; + private IBridgeInService _bridgeInService; public DataProvider( ILogger logger, - IOptionsSnapshot ethereumContractOptions, - IOptionsSnapshot contractAddressOptions, IOptionsSnapshot bridgeOptions, - BridgeService bridgeService, - BridgeOutService bridgeOutService) + IBridgeInService bridgeInService) { _logger = logger; _bridgeOptions = bridgeOptions.Value; - _bridgeService = bridgeService; - _bridgeOutService = bridgeOutService; + _bridgeInService = bridgeInService; _dictionary = new Dictionary(); - { - var file = Path.Combine(ethereumContractOptions.Value.AbiFileDirectory, - ethereumContractOptions.Value.ContractInfoList["Bridge"].AbiFileName); - if (!string.IsNullOrEmpty(file)) - { - if (!File.Exists(file)) - { - _logger.LogError($"Cannot found file {file}"); - } - - _bridgeAbi = JsonHelper.ReadJson(file, "abi"); - } - } } public async Task GetDataAsync(Hash queryId, string title = null, List options = null) @@ -136,7 +118,7 @@ private async Task GetReceiptHashMap(Hash swapId, BridgeItem bridgeItem, { var token = _bridgeOptions.Bridges.Single(c => c.SwapId == swapId.ToHex()).OriginToken; var chainId = _bridgeOptions.Bridges.Single(c => c.SwapId == swapId.ToHex()).TargetChainId; - var receiptInfos = await _bridgeOutService.GetSendReceiptInfosAsync(bridgeItem.ChainId,bridgeItem.EthereumBridgeOutContractAddress, token, chainId,start,end); + var receiptInfos = await _bridgeInService.GetSendReceiptInfosAsync(bridgeItem.ChainId,bridgeItem.EthereumBridgeOutContractAddress, token, chainId,start,end); var receiptHashes = new List(); for (var i = 0; i <= end - start; i++) { diff --git a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs index 84f50409..d7cb4eb9 100644 --- a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs +++ b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs @@ -27,7 +27,7 @@ public class TransmitTransactionProvider : AbpRedisCache, ITransmitTransactionPr private readonly IDistributedCacheSerializer _serializer; private readonly IAElfClientService _aelfClientService; private readonly AElfClientConfigOptions _aelfClientConfigOptions; - private readonly IBridgeInService _bridgeInService; + private readonly IBridgeOutService _bridgeOutService; private readonly INethereumService _nethereumService; private readonly BlockConfirmationOptions _blockConfirmationOptions; @@ -39,13 +39,13 @@ public class TransmitTransactionProvider : AbpRedisCache, ITransmitTransactionPr public TransmitTransactionProvider(IOptions optionsAccessor, IOptions aelfClientConfigOptions, - IDistributedCacheSerializer serializer, IAElfClientService aelfClientService, IBridgeInService bridgeInService, + IDistributedCacheSerializer serializer, IAElfClientService aelfClientService, IBridgeOutService bridgeOutService, INethereumService nethereumService, IOptions blockConfirmationOptions) : base(optionsAccessor) { _serializer = serializer; _aelfClientService = aelfClientService; - _bridgeInService = bridgeInService; + _bridgeOutService = bridgeOutService; _nethereumService = nethereumService; _aelfClientConfigOptions = aelfClientConfigOptions.Value; _blockConfirmationOptions = blockConfirmationOptions.Value; @@ -76,7 +76,7 @@ public async Task SendByLibAsync(string chainId, string libHash, long libHeight) } else { - var sendResult = await _bridgeInService.TransmitAsync(item.TargetChainId, + var sendResult = await _bridgeOutService.TransmitAsync(item.TargetChainId, item.TargetContractAddress, item.Report, item.Rs, item.Ss, item.RawVs); if (string.IsNullOrWhiteSpace(sendResult)) diff --git a/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs index 109cb215..9cc481dd 100644 --- a/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs +++ b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs @@ -23,7 +23,7 @@ namespace AElf.EventHandler.Workers; public class ReceiptSyncWorker : AsyncPeriodicBackgroundWorkerBase { private readonly BridgeOptions _bridgeOptions; - private readonly BridgeOutService _bridgeOutService; + private readonly BridgeInService _bridgeInService; private readonly NethereumService _nethereumService; private readonly OracleService _oracleService; private readonly AElfChainAliasOptions _aelfChainAliasOptions; @@ -40,7 +40,7 @@ public ReceiptSyncWorker(AbpAsyncTimer timer, IOptionsSnapshot aelfChainAliasOption, IOptionsSnapshot blockConfirmation, IOptionsSnapshot contractOptions, - BridgeOutService bridgeOutService, + BridgeInService bridgeInService, NethereumService nethereumService, OracleService oracleService, BridgeService bridgeService, @@ -52,7 +52,7 @@ ILogger logger { Timer.Period = 1000 * 60; _bridgeOptions = bridgeOptions.Value; - _bridgeOutService = bridgeOutService; + _bridgeInService = bridgeInService; _nethereumService = nethereumService; _oracleService = oracleService; _bridgeContractService = bridgeService; @@ -80,7 +80,7 @@ protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext worker { var tokenList = item.Select(i => i.OriginToken).ToList(); var targetChainIdList = item.Select(i => i.TargetChainId).ToList(); - var sendReceiptIndexDto = await _bridgeOutService.GetTransferReceiptIndexAsync(aliasAddress.Item1, + var sendReceiptIndexDto = await _bridgeInService.GetTransferReceiptIndexAsync(aliasAddress.Item1, aliasAddress.Item2, tokenList, targetChainIdList); for (var i = 0; i < tokenList.Count; i++) { @@ -127,7 +127,7 @@ private async Task SendQueryAsync(string chainId, BridgeItem bridgeItem, BigInte if (notRecordTokenNumber > 0) { var blockNumber = await _nethereumService.GetBlockNumberAsync(bridgeItem.ChainId); - var getReceiptInfos = await _bridgeOutService.GetSendReceiptInfosAsync(bridgeItem.ChainId, + var getReceiptInfos = await _bridgeInService.GetSendReceiptInfosAsync(bridgeItem.ChainId, bridgeItem.EthereumBridgeOutContractAddress, bridgeItem.OriginToken, bridgeItem.TargetChainId, lastRecordedLeafIndex+2,(long)tokenIndex); var lastLeafIndexConfirm = lastRecordedLeafIndex; diff --git a/src/AElf.EventHandler/appsettings.json b/src/AElf.EventHandler/appsettings.json index 4669ab54..8b3f7f17 100644 --- a/src/AElf.EventHandler/appsettings.json +++ b/src/AElf.EventHandler/appsettings.json @@ -11,19 +11,19 @@ }, "MessageQueue": { "Enable": true, - "HostName": "127.0.0.1", - "Uri": "amqp://127.0.0.1:5672", + "HostName": "192.168.67.52", + "Uri": "amqp://192.168.67.52:5672", "Port": "5672", - "ClientName": "AElfBoilerplate-Local-11", - "ExchangeName": "AElfExchange-Local", + "ClientName": "AElf-Oracle-Client", + "ExchangeName": "AElfCrossChain", "UserName": "guest", "Password": "guest" }, "AElfClient": { "ClientConfigList": [ { - "Alias": "AELF", - "Endpoint": "http://192.168.0.31:6800", + "Alias": "AELF-Test", + "Endpoint": "http://192.168.67.47:8000", "UserName": "", "Password": "", "Timeout": 100 @@ -34,12 +34,8 @@ "KeyDirectory": "", "AccountConfigList": [ { - "Alias": "Ean", - "PrivateKey": "8cc296e44d9e8881942e75a21ebc116ed3f29e39e0eaace1c92dc21e86d215c3" - }, - { - "Alias": "Test2", - "PrivateKey": "5e2f12d13e4527ad1128e07db00f1614ec6b8b51662e68d4fdb42125ab384195" + "Alias": "bp", + "PrivateKey": "8d1d8002802dd6fcd80ae9f5c5c6e4914a1120427c2108c5334353ffc270497b" } ] }, @@ -47,18 +43,18 @@ "ClientAlias": "TestNetSideChain2", "MainChainClientAlias": "TestNetMainChain", "SideChainClientAlias": "TestNetSideChain2", - "AccountAlias": "eanz" + "AccountAlias": "bp" }, "AElfChainAlias": { "Mapping": { - "AELF": "ClientAlias" + "AELF": "AELF-Test" } }, "EthereumClient": { "ClientConfigList": [ { - "Alias": "Example", - "Url": "https://kovan.infura.io/v3/4c41b8476e874c178c633ff442a27a1b" + "Alias": "Kovan", + "Url": "https://kovan.infura.io/v3/" } ] }, @@ -66,17 +62,17 @@ "KeyDirectory": "", "AccountConfigList": [ { - "Alias": "Ean", + "Alias": "eth", "PrivateKey": "99e3b0664a3d38d89937c8549ddd1d9e725426c5cdfad05ce55d15464c49b5c0" } ] }, "EthereumClientConfig": { - "AccountAlias": "Test1" + "AccountAlias": "eth" }, "EthereumChainAlias": { "Mapping": { - "Ethereum": "ClientAlias" + "Ethereum": "Kovan" } }, "AElfContract": { @@ -84,22 +80,20 @@ "ContractAddressList": { "AELF": { "MerkleTreeContract": "2RHf2fxsnEaM3wb6N1yGqPupNZbcCY98LgWbGSFWmWzgEs5Sjo", - "BridgeContract": "pykr77ft9UUKJZLVq15wCH8PinBSjVRQ12sD1Ayq92mKFsJ1i", + "BridgeContract": "2hqsqJndRAZGzk96fsEvyuVBTAvoBjcuwTjkuyJffBPueJFrLa", "OracleContract": "2ZpYFeE4yWjrcKLBoj1iwbfYnbo9hK7exvfGTdqcq77QSxpzNH", - "StringAggregatorContract": "" + "ReportContract": "2ZpYFeE4yWjrcKLBoj1iwbfYnbo9hK7exvfGTdqcq77QSxpzNH", + "ConsensusContract": "pGa4e5hNGsgkfjEGm72TEvbF7aRDqKBd4LuXtab4ucMbXLcgJ" } } }, "EthereumContract": { "ContractInfoList": { - "Regiment": { - "AbiFileName": "RegimentAbi.json" - }, "BridgeIn": { - "AbiFileName": "BridgeAbi.json" + "AbiFileName": "BridgeInAbi.json" }, "BridgeOut": { - "AbiFileName": "BridgeAbi.json" + "AbiFileName": "BridgeOutAbi.json" } } }, From 10bb07c7d84e782859183d384c3e5f8866115809 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Thu, 25 Aug 2022 11:04:29 +0800 Subject: [PATCH 24/66] feat: chain id mapping --- .../EventHandlerAppModule.cs | 2 ++ .../Options/ChainIdMappingOptions.cs | 8 +++++++ ...IrreversibleBlockFoundLogEventProcessor.cs | 7 ++++-- .../QueryCreatedLogEventProcessor.cs | 12 ++++++---- .../ReportConfirmedLogEventProcessor.cs | 13 ++++++---- .../ReportProposedLogEventProcessor.cs | 10 +++++--- ...ntCommitmentsCollectedLogEventProcessor.cs | 10 +++++--- .../Providers/IChainIdProvider.cs | 24 +++++++++++++++++++ src/AElf.EventHandler/appsettings.json | 5 ++++ 9 files changed, 74 insertions(+), 17 deletions(-) create mode 100644 src/AElf.EventHandler/Options/ChainIdMappingOptions.cs create mode 100644 src/AElf.EventHandler/Providers/IChainIdProvider.cs diff --git a/src/AElf.EventHandler/EventHandlerAppModule.cs b/src/AElf.EventHandler/EventHandlerAppModule.cs index 44760a3b..fc1dcac6 100644 --- a/src/AElf.EventHandler/EventHandlerAppModule.cs +++ b/src/AElf.EventHandler/EventHandlerAppModule.cs @@ -76,6 +76,8 @@ public override void ConfigureServices(ServiceConfigurationContext context) Configure(configuration.GetSection("Oracle")); Configure(configuration.GetSection("Bridge")); Configure(configuration.GetSection("BlockConfirmation")); + Configure(configuration.GetSection("ChainIdMapping")); + context.Services.AddHostedService(); context.Services.AddTransient(typeof(ILogEventProcessor<>), typeof(LogEventProcessorBase<>)); context.Services.AddSingleton(); diff --git a/src/AElf.EventHandler/Options/ChainIdMappingOptions.cs b/src/AElf.EventHandler/Options/ChainIdMappingOptions.cs new file mode 100644 index 00000000..a6262e47 --- /dev/null +++ b/src/AElf.EventHandler/Options/ChainIdMappingOptions.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic; + +namespace AElf.EventHandler; + +public class ChainIdMappingOptions +{ + public Dictionary Mapping { get; set; } +} \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs index 05b16a19..81a3f4f2 100644 --- a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs @@ -14,15 +14,18 @@ public class IrreversibleBlockFoundLogEventProcessor : LogEventProcessorBase Logger { get; set; } public IrreversibleBlockFoundLogEventProcessor( IOptionsSnapshot contractAddressOptions, - ITransmitTransactionProvider transmitTransactionProvider, IAElfClientService aelfClientService) : base( + ITransmitTransactionProvider transmitTransactionProvider, IAElfClientService aelfClientService, + IChainIdProvider chainIdProvider) : base( contractAddressOptions) { _transmitTransactionProvider = transmitTransactionProvider; _aelfClientService = aelfClientService; + _chainIdProvider = chainIdProvider; Logger = NullLogger.Instance; } @@ -35,7 +38,7 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) libFound.MergeFrom(logEvent); Logger.LogInformation($"IrreversibleBlockFound: {libFound}"); - var chainId = ChainHelper.ConvertChainIdToBase58(context.ChainId); + var chainId = _chainIdProvider.GetChainId(context.ChainId); var block = await _aelfClientService.GetBlockByHeightAsync(chainId,libFound.IrreversibleBlockHeight); await _transmitTransactionProvider.SendByLibAsync(chainId, block.BlockHash, block.Header.Height); } diff --git a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs index 7a81d577..5b74686e 100644 --- a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs @@ -18,6 +18,8 @@ internal class QueryCreatedLogEventProcessor : LogEventProcessorBase "OracleContract"; private readonly ILogger _logger; @@ -28,7 +30,7 @@ public QueryCreatedLogEventProcessor( ILogger logger, IOptionsSnapshot bridgeOptions, IOptionsSnapshot oracleOptions, - IOracleService oracleService) : + IOracleService oracleService, IChainIdProvider chainIdProvider) : base(contractAddressOptions) { _saltProvider = saltProvider; @@ -37,6 +39,7 @@ public QueryCreatedLogEventProcessor( _bridgeOptions = bridgeOptions.Value; _oracleOptions = oracleOptions.Value; _oracleService = oracleService; + _chainIdProvider = chainIdProvider; } public override async Task ProcessAsync(LogEvent logEvent, EventContext context) @@ -44,7 +47,8 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) var queryCreated = new QueryCreated(); queryCreated.MergeFrom(logEvent); _logger.LogInformation(queryCreated.ToString()); - + + var chainId = _chainIdProvider.GetChainId(context.ChainId); var nodeAddress = Address.FromBase58(_bridgeOptions.AccountAddress); var firstDesignatedNodeAddress = queryCreated.DesignatedNodeList.Value.First(); @@ -63,7 +67,7 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) return; } - var salt = _saltProvider.GetSalt(context.ChainId.ToString(),queryCreated.QueryId); + var salt = _saltProvider.GetSalt(chainId, queryCreated.QueryId); _logger.LogInformation($"Queried data: {data}, salt: {salt}"); var commitInput = new CommitInput { @@ -73,7 +77,7 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) HashHelper.ConcatAndCompute(salt, HashHelper.ComputeFrom(_bridgeOptions.AccountAddress))) }; _logger.LogInformation($"Sending Commit tx with input: {commitInput}"); - var transactionResult = await _oracleService.CommitAsync(ChainHelper.ConvertChainIdToBase58(context.ChainId),commitInput); + var transactionResult = await _oracleService.CommitAsync(chainId, commitInput); _logger.LogInformation($"[Commit] Transaction id {transactionResult.TransactionResult.TransactionId}"); } } diff --git a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs index a50548b1..7ad041c4 100644 --- a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs @@ -24,6 +24,7 @@ internal class ReportConfirmedLogEventProcessor : LogEventProcessorBase logger, IOptionsSnapshot contractAddressOptions, @@ -31,11 +32,12 @@ public ReportConfirmedLogEventProcessor(ILogger ethereumContractOptions, ITransmitTransactionProvider transmitTransactionProvider, - IOptionsSnapshot bridgeOptions) : base(contractAddressOptions) + IOptionsSnapshot bridgeOptions, IChainIdProvider chainIdProvider) : base(contractAddressOptions) { _logger = logger; _signaturesRecoverableInfoProvider = signaturesRecoverableInfoProvider; _transmitTransactionProvider = transmitTransactionProvider; + _chainIdProvider = chainIdProvider; _ethereumContractOptions = ethereumContractOptions.Value; _reportProvider = reportProvider; _bridgeOptions = bridgeOptions.Value; @@ -46,9 +48,10 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) var reportConfirmed = new ReportConfirmed(); reportConfirmed.MergeFrom(logEvent); _logger.LogInformation(reportConfirmed.ToString()); + var chainId = _chainIdProvider.GetChainId(context.ChainId); var ethereumContractAddress = reportConfirmed.Token; var roundId = reportConfirmed.RoundId; - await _signaturesRecoverableInfoProvider.SetSignatureAsync(context.ChainId.ToString(),ethereumContractAddress, roundId, + await _signaturesRecoverableInfoProvider.SetSignatureAsync(chainId,ethereumContractAddress, roundId, reportConfirmed.Signature); if (reportConfirmed.IsAllNodeConfirmed) { @@ -57,7 +60,7 @@ await _signaturesRecoverableInfoProvider.SetSignatureAsync(context.ChainId.ToStr var report = _reportProvider.GetReport(ethereumContractAddress, roundId); var signatureRecoverableInfos = - await _signaturesRecoverableInfoProvider.GetSignatureAsync(context.ChainId.ToString(), + await _signaturesRecoverableInfoProvider.GetSignatureAsync(chainId, ethereumContractAddress, roundId); var (reportBytes, rs, ss, vs) = TransferToEthereumParameter(report, signatureRecoverableInfos); @@ -66,7 +69,7 @@ await _signaturesRecoverableInfoProvider.GetSignatureAsync(context.ChainId.ToStr await _transmitTransactionProvider.EnqueueAsync(new SendTransmitArgs { - ChainId = context.ChainId.ToString(), + ChainId = chainId, TargetContractAddress = ethereumContractAddress, TargetChainId = reportConfirmed.TargetChainId, Report = reportBytes, @@ -75,7 +78,7 @@ await _transmitTransactionProvider.EnqueueAsync(new SendTransmitArgs RawVs = vs, }); - await _signaturesRecoverableInfoProvider.RemoveSignatureAsync(context.ChainId.ToString(), + await _signaturesRecoverableInfoProvider.RemoveSignatureAsync(chainId, ethereumContractAddress, roundId); _reportProvider.RemoveReport(ethereumContractAddress, roundId); } diff --git a/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs index b8a21b2c..0ce68430 100644 --- a/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs @@ -17,6 +17,7 @@ internal class ReportProposedLogEventProcessor : LogEventProcessorBase "ReportContract"; private readonly ILogger _logger; @@ -27,9 +28,11 @@ public ReportProposedLogEventProcessor( IAElfAccountProvider accountProvider, ILogger logger, IOptionsSnapshot contractAddressOptions, - IOptionsSnapshot aelfConfigOptions) : base(contractAddressOptions) + IOptionsSnapshot aelfConfigOptions, IChainIdProvider chainIdProvider) : base( + contractAddressOptions) { _logger = logger; + _chainIdProvider = chainIdProvider; _reportProvider = reportProvider; _reportService = reportService; _accountProvider = accountProvider; @@ -42,10 +45,11 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) reportProposed.MergeFrom(logEvent); _logger.LogInformation($"New report: {reportProposed}"); - + + var chainId = _chainIdProvider.GetChainId(context.ChainId); var privateKey = _accountProvider.GetPrivateKey(_aelfClientConfigOptions.AccountAlias); - var sendTxResult = await _reportService.ConfirmReportAsync(ChainHelper.ConvertChainIdToBase58(context.ChainId),new ConfirmReportInput + var sendTxResult = await _reportService.ConfirmReportAsync(chainId,new ConfirmReportInput { Token = reportProposed.Token, RoundId = reportProposed.RoundId, diff --git a/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs index 0912e0af..7aa07fed 100644 --- a/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs @@ -16,17 +16,19 @@ internal class SufficientCommitmentsCollectedLogEventProcessor : private readonly IDataProvider _dataProvider; private readonly ILogger _logger; private readonly IOracleService _oracleService; + private readonly IChainIdProvider _chainIdProvider; public SufficientCommitmentsCollectedLogEventProcessor( IOptionsSnapshot contractAddressOptions, ISaltProvider saltProvider, IDataProvider dataProvider, ILogger logger, - IOracleService oracleService) : base(contractAddressOptions) + IOracleService oracleService, IChainIdProvider chainIdProvider) : base(contractAddressOptions) { _saltProvider = saltProvider; _dataProvider = dataProvider; _logger = logger; _oracleService = oracleService; + _chainIdProvider = chainIdProvider; } public override string ContractName => "OracleContract"; @@ -35,6 +37,8 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) { var collected = new SufficientCommitmentsCollected(); collected.MergeFrom(logEvent); + + var chainId = _chainIdProvider.GetChainId(context.ChainId); var data = await _dataProvider.GetDataAsync(collected.QueryId); if (string.IsNullOrEmpty(data)) { @@ -47,10 +51,10 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) { QueryId = collected.QueryId, Data = data, - Salt = _saltProvider.GetSalt(context.ChainId.ToString(),collected.QueryId) + Salt = _saltProvider.GetSalt(chainId,collected.QueryId) }; _logger.LogInformation($"Sending Reveal tx with input: {revealInput}"); - var transaction = await _oracleService.RevealAsync(ChainHelper.ConvertChainIdToBase58(context.ChainId),revealInput); + var transaction = await _oracleService.RevealAsync(chainId,revealInput); _logger.LogInformation($"[Reveal] Transaction id : {transaction.TransactionResult.TransactionId}"); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Providers/IChainIdProvider.cs b/src/AElf.EventHandler/Providers/IChainIdProvider.cs new file mode 100644 index 00000000..46a94bc2 --- /dev/null +++ b/src/AElf.EventHandler/Providers/IChainIdProvider.cs @@ -0,0 +1,24 @@ +using Microsoft.Extensions.Options; +using Volo.Abp.DependencyInjection; + +namespace AElf.EventHandler; + +public interface IChainIdProvider +{ + string GetChainId(int chainId); +} + +public class ChainIdProvider : IChainIdProvider, ITransientDependency +{ + private readonly ChainIdMappingOptions _chainIdMappingOptions; + + public ChainIdProvider(IOptionsSnapshot chainIdMappingOptions) + { + _chainIdMappingOptions = chainIdMappingOptions.Value; + } + + public string GetChainId(int chainId) + { + return _chainIdMappingOptions.Mapping[chainId]; + } +} \ No newline at end of file diff --git a/src/AElf.EventHandler/appsettings.json b/src/AElf.EventHandler/appsettings.json index 8b3f7f17..d3fd8a69 100644 --- a/src/AElf.EventHandler/appsettings.json +++ b/src/AElf.EventHandler/appsettings.json @@ -130,5 +130,10 @@ "eth": 12, "bsc": 100 } + }, + "ChainIdMapping": { + "Mapping": { + "AELF": "" + } } } \ No newline at end of file From 4695001038603996a71419a87c5119fb214cd5e8 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Thu, 25 Aug 2022 11:25:14 +0800 Subject: [PATCH 25/66] fix: chain id mapping --- src/AElf.EventHandler/Processors/LogEventProcessorBase.cs | 7 +++++-- .../TransactionResultListEventHandler.cs | 8 +++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs b/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs index c13bdb76..23ea30c8 100644 --- a/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs +++ b/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs @@ -11,9 +11,11 @@ namespace AElf.EventHandler public abstract class LogEventProcessorBase : ILogEventProcessor { private readonly AElfContractOptions _contractOptions; + private readonly IChainIdProvider _chainIdProvider; - protected LogEventProcessorBase(IOptionsSnapshot contractAddressOptions) + protected LogEventProcessorBase(IOptionsSnapshot contractAddressOptions, IChainIdProvider chainIdProvider) { + _chainIdProvider = chainIdProvider; _contractOptions = contractAddressOptions.Value; } @@ -23,7 +25,8 @@ protected LogEventProcessorBase(IOptionsSnapshot contractAd public string GetContractAddress(int chainId) { - if (_contractOptions.ContractAddressList.TryGetValue(ChainHelper.ConvertChainIdToBase58(chainId), + var id = _chainIdProvider.GetChainId(chainId); + if (_contractOptions.ContractAddressList.TryGetValue(id, out var contractAddresses)) { if (contractAddresses.TryGetValue(ContractName, out var contractAddress)) diff --git a/src/AElf.EventHandler/TransactionResultListEventHandler.cs b/src/AElf.EventHandler/TransactionResultListEventHandler.cs index 64f96943..8135008f 100644 --- a/src/AElf.EventHandler/TransactionResultListEventHandler.cs +++ b/src/AElf.EventHandler/TransactionResultListEventHandler.cs @@ -18,20 +18,22 @@ public class TransactionResultListEventHandler : IDistributedEventHandler _logEventProcessors; private readonly AElfContractOptions _contractAddressOptions; private readonly ILogger _logger; + private readonly IChainIdProvider _chainIdProvider; public TransactionResultListEventHandler(IEnumerable logEventProcessors, IOptionsSnapshot contractAddressOptions, - ILogger logger) + ILogger logger, IChainIdProvider chainIdProvider) { _logEventProcessors = logEventProcessors; _logger = logger; + _chainIdProvider = chainIdProvider; _contractAddressOptions = contractAddressOptions.Value; } public async Task HandleEventAsync(TransactionResultListEto eventData) { - if (!_contractAddressOptions.ContractAddressList.TryGetValue( - ChainHelper.ConvertChainIdToBase58(eventData.ChainId), out var contractAddresses)) + var chainId = _chainIdProvider.GetChainId(eventData.ChainId); + if (!_contractAddressOptions.ContractAddressList.TryGetValue(chainId, out var contractAddresses)) { return; } From 19281720c45c3dc485473006221e0b42cc1ffa74 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Thu, 25 Aug 2022 11:28:49 +0800 Subject: [PATCH 26/66] feat: improve chain id --- .../Processors/IrreversibleBlockFoundLogEventProcessor.cs | 7 ++----- src/AElf.EventHandler/Processors/LogEventProcessorBase.cs | 7 +++---- .../Processors/QueryCreatedLogEventProcessor.cs | 6 ++---- .../Processors/ReportConfirmedLogEventProcessor.cs | 4 +--- .../Processors/ReportProposedLogEventProcessor.cs | 4 +--- .../SufficientCommitmentsCollectedLogEventProcessor.cs | 6 ++---- 6 files changed, 11 insertions(+), 23 deletions(-) diff --git a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs index 81a3f4f2..64f11027 100644 --- a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs @@ -14,18 +14,15 @@ public class IrreversibleBlockFoundLogEventProcessor : LogEventProcessorBase Logger { get; set; } public IrreversibleBlockFoundLogEventProcessor( IOptionsSnapshot contractAddressOptions, - ITransmitTransactionProvider transmitTransactionProvider, IAElfClientService aelfClientService, - IChainIdProvider chainIdProvider) : base( + ITransmitTransactionProvider transmitTransactionProvider, IAElfClientService aelfClientService) : base( contractAddressOptions) { _transmitTransactionProvider = transmitTransactionProvider; _aelfClientService = aelfClientService; - _chainIdProvider = chainIdProvider; Logger = NullLogger.Instance; } @@ -38,7 +35,7 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) libFound.MergeFrom(logEvent); Logger.LogInformation($"IrreversibleBlockFound: {libFound}"); - var chainId = _chainIdProvider.GetChainId(context.ChainId); + var chainId = ChainIdProvider.GetChainId(context.ChainId); var block = await _aelfClientService.GetBlockByHeightAsync(chainId,libFound.IrreversibleBlockHeight); await _transmitTransactionProvider.SendByLibAsync(chainId, block.BlockHash, block.Header.Height); } diff --git a/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs b/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs index 23ea30c8..a88653f5 100644 --- a/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs +++ b/src/AElf.EventHandler/Processors/LogEventProcessorBase.cs @@ -11,11 +11,10 @@ namespace AElf.EventHandler public abstract class LogEventProcessorBase : ILogEventProcessor { private readonly AElfContractOptions _contractOptions; - private readonly IChainIdProvider _chainIdProvider; + public IChainIdProvider ChainIdProvider { get; set; } - protected LogEventProcessorBase(IOptionsSnapshot contractAddressOptions, IChainIdProvider chainIdProvider) + protected LogEventProcessorBase(IOptionsSnapshot contractAddressOptions) { - _chainIdProvider = chainIdProvider; _contractOptions = contractAddressOptions.Value; } @@ -25,7 +24,7 @@ protected LogEventProcessorBase(IOptionsSnapshot contractAd public string GetContractAddress(int chainId) { - var id = _chainIdProvider.GetChainId(chainId); + var id = ChainIdProvider.GetChainId(chainId); if (_contractOptions.ContractAddressList.TryGetValue(id, out var contractAddresses)) { diff --git a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs index 5b74686e..569e4792 100644 --- a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs @@ -18,7 +18,6 @@ internal class QueryCreatedLogEventProcessor : LogEventProcessorBase "OracleContract"; private readonly ILogger _logger; @@ -30,7 +29,7 @@ public QueryCreatedLogEventProcessor( ILogger logger, IOptionsSnapshot bridgeOptions, IOptionsSnapshot oracleOptions, - IOracleService oracleService, IChainIdProvider chainIdProvider) : + IOracleService oracleService) : base(contractAddressOptions) { _saltProvider = saltProvider; @@ -39,7 +38,6 @@ public QueryCreatedLogEventProcessor( _bridgeOptions = bridgeOptions.Value; _oracleOptions = oracleOptions.Value; _oracleService = oracleService; - _chainIdProvider = chainIdProvider; } public override async Task ProcessAsync(LogEvent logEvent, EventContext context) @@ -48,7 +46,7 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) queryCreated.MergeFrom(logEvent); _logger.LogInformation(queryCreated.ToString()); - var chainId = _chainIdProvider.GetChainId(context.ChainId); + var chainId = ChainIdProvider.GetChainId(context.ChainId); var nodeAddress = Address.FromBase58(_bridgeOptions.AccountAddress); var firstDesignatedNodeAddress = queryCreated.DesignatedNodeList.Value.First(); diff --git a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs index 7ad041c4..381dbfc5 100644 --- a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs @@ -24,7 +24,6 @@ internal class ReportConfirmedLogEventProcessor : LogEventProcessorBase logger, IOptionsSnapshot contractAddressOptions, @@ -37,7 +36,6 @@ public ReportConfirmedLogEventProcessor(ILogger "ReportContract"; private readonly ILogger _logger; @@ -32,7 +31,6 @@ public ReportProposedLogEventProcessor( contractAddressOptions) { _logger = logger; - _chainIdProvider = chainIdProvider; _reportProvider = reportProvider; _reportService = reportService; _accountProvider = accountProvider; @@ -46,7 +44,7 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) _logger.LogInformation($"New report: {reportProposed}"); - var chainId = _chainIdProvider.GetChainId(context.ChainId); + var chainId = ChainIdProvider.GetChainId(context.ChainId); var privateKey = _accountProvider.GetPrivateKey(_aelfClientConfigOptions.AccountAlias); var sendTxResult = await _reportService.ConfirmReportAsync(chainId,new ConfirmReportInput diff --git a/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs index 7aa07fed..05674cc5 100644 --- a/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/SufficientCommitmentsCollectedLogEventProcessor.cs @@ -16,19 +16,17 @@ internal class SufficientCommitmentsCollectedLogEventProcessor : private readonly IDataProvider _dataProvider; private readonly ILogger _logger; private readonly IOracleService _oracleService; - private readonly IChainIdProvider _chainIdProvider; public SufficientCommitmentsCollectedLogEventProcessor( IOptionsSnapshot contractAddressOptions, ISaltProvider saltProvider, IDataProvider dataProvider, ILogger logger, - IOracleService oracleService, IChainIdProvider chainIdProvider) : base(contractAddressOptions) + IOracleService oracleService) : base(contractAddressOptions) { _saltProvider = saltProvider; _dataProvider = dataProvider; _logger = logger; _oracleService = oracleService; - _chainIdProvider = chainIdProvider; } public override string ContractName => "OracleContract"; @@ -38,7 +36,7 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) var collected = new SufficientCommitmentsCollected(); collected.MergeFrom(logEvent); - var chainId = _chainIdProvider.GetChainId(context.ChainId); + var chainId = ChainIdProvider.GetChainId(context.ChainId); var data = await _dataProvider.GetDataAsync(collected.QueryId); if (string.IsNullOrEmpty(data)) { From 09a2963a010b9645679367775ad18189374d1572 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Thu, 25 Aug 2022 11:59:11 +0800 Subject: [PATCH 27/66] feat: add swap hash id for bridge contract --- modules/AElf.Nethereum.Bridge/IBridgeOutService.cs | 8 ++++---- .../Processors/ReportConfirmedLogEventProcessor.cs | 1 + .../Providers/ITransmitTransactionProvider.cs | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs index 8c7caa98..51d227d8 100644 --- a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs +++ b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs @@ -6,21 +6,21 @@ namespace AElf.Nethereum.Bridge; public interface IBridgeOutService { - Task TransmitAsync(string chainId, string contractAddress, byte[] report, byte[][] rs, byte[][] ss, byte[] rawVs); + Task TransmitAsync(string chainId, string contractAddress, byte[] swapHashId, byte[] report, byte[][] rs, byte[][] ss, byte[] rawVs); } public class BridgeOutService : ContractServiceBase, IBridgeOutService, ITransientDependency { protected override string SmartContractName { get; } = "BridgeOut"; - public async Task TransmitAsync(string chainId, string contractAddress, byte[] report, + public async Task TransmitAsync(string chainId, string contractAddress, byte[] swapHashId, byte[] report, byte[][] rs, byte[][] ss, byte[] rawVs) { var setValueFunction = GetFunction(chainId, contractAddress, "transmit"); var sender = GetAccount().Address; - var gas = await setValueFunction.EstimateGasAsync(sender, null, null, report, rs, ss, rawVs); + var gas = await setValueFunction.EstimateGasAsync(sender, null, null, swapHashId, report, rs, ss, rawVs); var transactionResult = - await setValueFunction.SendTransactionAsync(sender, gas, null, null, report, + await setValueFunction.SendTransactionAsync(sender, gas, null, null, swapHashId, report, rs, ss, rawVs); return transactionResult; } diff --git a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs index 381dbfc5..ee020fa0 100644 --- a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs @@ -70,6 +70,7 @@ await _transmitTransactionProvider.EnqueueAsync(new SendTransmitArgs ChainId = chainId, TargetContractAddress = ethereumContractAddress, TargetChainId = reportConfirmed.TargetChainId, + //TODO: SwapHashId = Report = reportBytes, Rs = rs, Ss = ss, diff --git a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs index d7cb4eb9..5ae0bc97 100644 --- a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs +++ b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs @@ -77,7 +77,7 @@ public async Task SendByLibAsync(string chainId, string libHash, long libHeight) else { var sendResult = await _bridgeOutService.TransmitAsync(item.TargetChainId, - item.TargetContractAddress, + item.TargetContractAddress,item.SwapHashId, item.Report, item.Rs, item.Ss, item.RawVs); if (string.IsNullOrWhiteSpace(sendResult)) { @@ -165,6 +165,7 @@ public class SendTransmitArgs public string TargetChainId { get; set; } public string TargetContractAddress { get; set; } public string TransactionId { get; set; } + public byte[] SwapHashId { get; set; } public byte[] Report { get; set; } public byte[][] Rs { get; set; } public byte[][] Ss{ get; set; } From 917f8c55d4d4c27081b546441c5fc877c7ecd358 Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Thu, 25 Aug 2022 17:39:53 +0800 Subject: [PATCH 28/66] feat: add processors. get ethereum swap Id. --- modules/AElf.Client.Bridge/BridgeService.cs | 10 ++++ .../AElf.Client.Report.csproj | 1 + modules/AElf.Client.Report/ReportService.cs | 32 +++++++++++- .../Options/ChainIdMappingOptions.cs | 2 +- .../ReportConfirmedLogEventProcessor.cs | 46 +++++++++++++---- .../ReportProposedLogEventProcessor.cs | 2 - .../Providers/IChainIdProvider.cs | 2 +- .../Providers/IDataProvider.cs | 2 +- .../Providers/ITransmitTransactionProvider.cs | 2 + .../Workers/ReceiptSyncWorker.cs | 8 +-- src/AElf.EventHandler/appsettings.json | 51 +++++++++++-------- 11 files changed, 117 insertions(+), 41 deletions(-) diff --git a/modules/AElf.Client.Bridge/BridgeService.cs b/modules/AElf.Client.Bridge/BridgeService.cs index ed936e8d..6cd97f38 100644 --- a/modules/AElf.Client.Bridge/BridgeService.cs +++ b/modules/AElf.Client.Bridge/BridgeService.cs @@ -17,6 +17,7 @@ public interface IBridgeService Task SetPriceRatioAsync(string chainId, SetPriceRatioInput input); Task GetGasPriceAsync(string chainId, StringValue input); Task GetPriceRatioAsync(string chainId, StringValue input); + Task GetReceiptIdInfoAsync(string chainId, Hash receiptIdHash); } public class BridgeService : ContractServiceBase, IBridgeService, ITransientDependency @@ -78,4 +79,13 @@ public async Task GetPriceRatioAsync(string chainId, StringValue in actualResult.MergeFrom(result); return actualResult; } + + public async Task GetReceiptIdInfoAsync(string chainId, Hash receiptIdHash) + { + var result = await _clientService.ViewAsync(GetContractAddress(chainId), "GetReceiptIdInfo", + receiptIdHash, AElfChainAliasOptions.Value.Mapping[chainId]); + var actualResult = new ReceiptIdInfo(); + actualResult.MergeFrom(result); + return actualResult; + } } \ No newline at end of file diff --git a/modules/AElf.Client.Report/AElf.Client.Report.csproj b/modules/AElf.Client.Report/AElf.Client.Report.csproj index 33db7d5f..4c2cb352 100644 --- a/modules/AElf.Client.Report/AElf.Client.Report.csproj +++ b/modules/AElf.Client.Report/AElf.Client.Report.csproj @@ -8,6 +8,7 @@ + diff --git a/modules/AElf.Client.Report/ReportService.cs b/modules/AElf.Client.Report/ReportService.cs index 17104600..c310518c 100644 --- a/modules/AElf.Client.Report/ReportService.cs +++ b/modules/AElf.Client.Report/ReportService.cs @@ -2,6 +2,8 @@ using AElf.Client.Core.Options; using AElf.Contracts.Report; using AElf.Types; +using Google.Protobuf; +using Google.Protobuf.WellKnownTypes; using Microsoft.Extensions.Options; using Volo.Abp.DependencyInjection; @@ -14,12 +16,22 @@ public interface IReportService Task ConfirmReportAsync(string chainId, ConfirmReportInput confirmReportInput); Task RejectReportAsync(string chainId, RejectReportInput rejectReportInput); + + Task GetRawReportAsync(string chainId, GetRawReportInput getRawReportInput); + + Task GetReportAsync(string chainId, GetReportInput getReportInput); } public class ReportService : ContractServiceBase, IReportService, ITransientDependency { + private readonly IAElfClientService _clientService; protected override string SmartContractName { get; } = "ReportContract"; + public ReportService(IAElfClientService clientService) + { + _clientService = clientService; + } + public async Task ProposeReportAsync(string chainId, CallbackInput proposeReportInput) { var tx = await PerformSendTransactionAsync("ProposeReport", proposeReportInput, chainId); @@ -50,5 +62,23 @@ public async Task RejectReportAsync(string chainId, Rejec }; } - + public async Task GetRawReportAsync(string chainId, GetRawReportInput getRawReportInput) + { + var result = + await _clientService.ViewAsync(GetContractAddress(chainId), "GetRawReport", + getRawReportInput, chainId); + var actualResult = new StringValue(); + actualResult.MergeFrom(result); + return actualResult; + } + + public async Task GetReportAsync(string chainId, GetReportInput getReportInput) + { + var result = + await _clientService.ViewAsync(GetContractAddress(chainId), "GetReport", + getReportInput, chainId); + var actualResult = new Contracts.Report.Report(); + actualResult.MergeFrom(result); + return actualResult; + } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Options/ChainIdMappingOptions.cs b/src/AElf.EventHandler/Options/ChainIdMappingOptions.cs index a6262e47..22033eb3 100644 --- a/src/AElf.EventHandler/Options/ChainIdMappingOptions.cs +++ b/src/AElf.EventHandler/Options/ChainIdMappingOptions.cs @@ -4,5 +4,5 @@ namespace AElf.EventHandler; public class ChainIdMappingOptions { - public Dictionary Mapping { get; set; } + public Dictionary Mapping { get; set; } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs index 381dbfc5..71e5264c 100644 --- a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs @@ -3,6 +3,7 @@ using System.IO; using System.Linq; using System.Threading.Tasks; +using AElf.Client.Bridge; using AElf.Client.Core.Extensions; using AElf.Client.Core.Options; using AElf.Client.Report; @@ -24,6 +25,8 @@ internal class ReportConfirmedLogEventProcessor : LogEventProcessorBase logger, IOptionsSnapshot contractAddressOptions, @@ -31,7 +34,8 @@ public ReportConfirmedLogEventProcessor(ILogger ethereumContractOptions, ITransmitTransactionProvider transmitTransactionProvider, - IOptionsSnapshot bridgeOptions, IChainIdProvider chainIdProvider) : base(contractAddressOptions) + IOptionsSnapshot bridgeOptions, IReportService reportService, + IBridgeService bridgeService) : base(contractAddressOptions) { _logger = logger; _signaturesRecoverableInfoProvider = signaturesRecoverableInfoProvider; @@ -39,6 +43,8 @@ public ReportConfirmedLogEventProcessor(ILogger i.TargetChainId == targetChainId && i.OriginToken == symbol)) + .EthereumSwapId; + + var (swapHashId, reportBytes, rs, ss, vs) = + TransferToEthereumParameter(ethereumSwapId, report.Value, signatureRecoverableInfos); _logger.LogInformation( $"Try to transmit data, TargetChainId: {reportConfirmed.TargetChainId} Address: {ethereumContractAddress} RoundId: {reportConfirmed.RoundId}"); - + await _transmitTransactionProvider.EnqueueAsync(new SendTransmitArgs { ChainId = chainId, @@ -74,16 +101,16 @@ await _transmitTransactionProvider.EnqueueAsync(new SendTransmitArgs Rs = rs, Ss = ss, RawVs = vs, + swapHashId = swapHashId }); await _signaturesRecoverableInfoProvider.RemoveSignatureAsync(chainId, ethereumContractAddress, roundId); - _reportProvider.RemoveReport(ethereumContractAddress, roundId); } } } - public (byte[], byte[][], byte[][], byte[]) TransferToEthereumParameter(string report, + public (byte[], byte[], byte[][], byte[][], byte[]) TransferToEthereumParameter(string swapId, string report, HashSet recoverableInfos) { var signaturesCount = recoverableInfos.Count; @@ -100,6 +127,7 @@ await _signaturesRecoverableInfoProvider.RemoveSignatureAsync(chainId, index++; } - return (ByteStringHelper.FromHexString(report).ToByteArray(), r, s, v); + return (ByteStringHelper.FromHexString(swapId).ToByteArray(), + ByteStringHelper.FromHexString(report).ToByteArray(), r, s, v); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs index 6dec1852..e2df72b8 100644 --- a/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs @@ -54,8 +54,6 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) Signature = SignHelper .GetSignature(reportProposed.RawReport, privateKey).RecoverInfo }); - _reportProvider.SetReport(reportProposed.Token, reportProposed.RoundId, - reportProposed.RawReport); _logger.LogInformation($"[ConfirmReport] Transaction id : {sendTxResult.TransactionResult.TransactionId}"); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Providers/IChainIdProvider.cs b/src/AElf.EventHandler/Providers/IChainIdProvider.cs index 46a94bc2..14b1b4e7 100644 --- a/src/AElf.EventHandler/Providers/IChainIdProvider.cs +++ b/src/AElf.EventHandler/Providers/IChainIdProvider.cs @@ -19,6 +19,6 @@ public ChainIdProvider(IOptionsSnapshot chainIdMappingOpt public string GetChainId(int chainId) { - return _chainIdMappingOptions.Mapping[chainId]; + return _chainIdMappingOptions.Mapping[chainId.ToString()]; } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Providers/IDataProvider.cs b/src/AElf.EventHandler/Providers/IDataProvider.cs index aec005ec..8e27d5bb 100644 --- a/src/AElf.EventHandler/Providers/IDataProvider.cs +++ b/src/AElf.EventHandler/Providers/IDataProvider.cs @@ -118,7 +118,7 @@ private async Task GetReceiptHashMap(Hash swapId, BridgeItem bridgeItem, { var token = _bridgeOptions.Bridges.Single(c => c.SwapId == swapId.ToHex()).OriginToken; var chainId = _bridgeOptions.Bridges.Single(c => c.SwapId == swapId.ToHex()).TargetChainId; - var receiptInfos = await _bridgeInService.GetSendReceiptInfosAsync(bridgeItem.ChainId,bridgeItem.EthereumBridgeOutContractAddress, token, chainId,start,end); + var receiptInfos = await _bridgeInService.GetSendReceiptInfosAsync(bridgeItem.ChainId,bridgeItem.EthereumBridgeInContractAddress, token, chainId,start,end); var receiptHashes = new List(); for (var i = 0; i <= end - start; i++) { diff --git a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs index d7cb4eb9..345b1be2 100644 --- a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs +++ b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs @@ -170,4 +170,6 @@ public class SendTransmitArgs public byte[][] Ss{ get; set; } public byte[] RawVs { get; set; } public int RetryTimes { get; set; } + + public byte[] swapHashId { get; set; } } diff --git a/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs index 9cc481dd..1862a47c 100644 --- a/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs +++ b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs @@ -27,7 +27,7 @@ public class ReceiptSyncWorker : AsyncPeriodicBackgroundWorkerBase private readonly NethereumService _nethereumService; private readonly OracleService _oracleService; private readonly AElfChainAliasOptions _aelfChainAliasOptions; - private readonly BridgeService _bridgeContractService; + private readonly IBridgeService _bridgeContractService; private readonly IMerkleTreeContractService _merkleTreeContractService; private readonly ILatestQueriedReceiptCountProvider _latestQueriedReceiptCountProvider; private readonly ILogger _logger; @@ -43,7 +43,7 @@ public ReceiptSyncWorker(AbpAsyncTimer timer, BridgeInService bridgeInService, NethereumService nethereumService, OracleService oracleService, - BridgeService bridgeService, + IBridgeService bridgeService, IMerkleTreeContractService merkleTreeContractService, ILatestQueriedReceiptCountProvider latestQueriedReceiptCountProvider, ILogger logger @@ -72,7 +72,7 @@ protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext worker var tokenIndex = new Dictionary(); foreach (var bridgeItem in _bridgeOptions.Bridges) { - bridgeItemsMap[(bridgeItem.ChainId, bridgeItem.EthereumBridgeOutContractAddress)] + bridgeItemsMap[(bridgeItem.ChainId, bridgeItem.EthereumBridgeInContractAddress)] .Add(bridgeItem); } @@ -128,7 +128,7 @@ private async Task SendQueryAsync(string chainId, BridgeItem bridgeItem, BigInte { var blockNumber = await _nethereumService.GetBlockNumberAsync(bridgeItem.ChainId); var getReceiptInfos = await _bridgeInService.GetSendReceiptInfosAsync(bridgeItem.ChainId, - bridgeItem.EthereumBridgeOutContractAddress, bridgeItem.OriginToken, bridgeItem.TargetChainId, + bridgeItem.EthereumBridgeInContractAddress, bridgeItem.OriginToken, bridgeItem.TargetChainId, lastRecordedLeafIndex+2,(long)tokenIndex); var lastLeafIndexConfirm = lastRecordedLeafIndex; for (var i = 0; i < tokenLeafIndex - lastRecordedLeafIndex; i++) diff --git a/src/AElf.EventHandler/appsettings.json b/src/AElf.EventHandler/appsettings.json index d3fd8a69..9b08e9d0 100644 --- a/src/AElf.EventHandler/appsettings.json +++ b/src/AElf.EventHandler/appsettings.json @@ -40,7 +40,7 @@ ] }, "AElfClientConfig": { - "ClientAlias": "TestNetSideChain2", + "ClientAlias": "AELF-Test", "MainChainClientAlias": "TestNetMainChain", "SideChainClientAlias": "TestNetSideChain2", "AccountAlias": "bp" @@ -54,7 +54,7 @@ "ClientConfigList": [ { "Alias": "Kovan", - "Url": "https://kovan.infura.io/v3/" + "Url": "https://kovan.infura.io/v3/ed046cb3d9a84513a7d90690ebc7f2ac" } ] }, @@ -63,7 +63,7 @@ "AccountConfigList": [ { "Alias": "eth", - "PrivateKey": "99e3b0664a3d38d89937c8549ddd1d9e725426c5cdfad05ce55d15464c49b5c0" + "PrivateKey": "fe4f97256578452dd92604fbfd06c0bd0ceac595d007b65a8d10cefe8f5d18ef" } ] }, @@ -79,10 +79,11 @@ "ContractDirectory": "", "ContractAddressList": { "AELF": { - "MerkleTreeContract": "2RHf2fxsnEaM3wb6N1yGqPupNZbcCY98LgWbGSFWmWzgEs5Sjo", - "BridgeContract": "2hqsqJndRAZGzk96fsEvyuVBTAvoBjcuwTjkuyJffBPueJFrLa", - "OracleContract": "2ZpYFeE4yWjrcKLBoj1iwbfYnbo9hK7exvfGTdqcq77QSxpzNH", - "ReportContract": "2ZpYFeE4yWjrcKLBoj1iwbfYnbo9hK7exvfGTdqcq77QSxpzNH", + "MerkleTreeContract": "SsSqZWLf7Dk9NWyWyvDwuuY5nzn5n99jiscKZgRPaajZP5p8y", + "BridgeContract": "225ajURvev5rgX8HnMJ8GjbPnRxUrCHoD7HUjhWQqewEJ5GAv1", + "OracleContract": "xsnQafDAhNTeYcooptETqWnYBksFGGXxfcQyJJ5tmu6Ak9ZZt", + "ReportContract": "GwsSp1MZPmkMvXdbfSCDydHhZtDpvqkFpmPvStYho288fb7QZ", + "RegimentContractAddress": "2nyC8hqq3pGnRu8gJzCsTaxXB6snfGxmL2viimKXgEfYWGtjEh", "ConsensusContract": "pGa4e5hNGsgkfjEGm72TEvbF7aRDqKBd4LuXtab4ucMbXLcgJ" } } @@ -101,27 +102,31 @@ "ObserverAssociationAddressList": [] }, "Bridge": { - "IsSendQuery": false, - "IsTransmitter": false, - "QueryPayment": 100000000, + "IsSendQuery": true, + "IsTransmitter": true, + "QueryPayment": 0, "Bridges": [ { - "EthereumClientAlias": "Example", - "OriginToken": "", - "BridgeContractAddress": "", - "SpaceId": "", - "SwapId": "", + "chainId": "Ethereum", + "TargetChainId": "AELF", + "OriginToken": "ELF", + "EthereumBridgeInContractAddress": "0xc7f5D89B3c1B77A1EE9Abc54C8CC42E69df8d8d2", + "SwapId": "5a6d89b4d0eb9dc53073ef55eb9601027d339dd4729c1992a7da59ec1f41ff7a", "MaximumLeafCount": 1024, - "QueryToAddress": "" + "QueryToAddress": "Taikh8VFhM3qbrkC2hd5SzXFsas72gu31SbMZWmgopehdMVQE", + "EthereumSwapId": "", + "EthereumBridgeOutContractAddress": "" }, { - "EthereumClientAlias": "Example2", - "OriginToken": "", - "BridgeContractAddress": "", - "SpaceId": "", + "chainId": "", + "TargetChainId": "Ethereum", + "OriginToken": "ELF", + "EthereumBridgeInContractAddress": "0xc7f5D89B3c1B77A1EE9Abc54C8CC42E69df8d8d2", "SwapId": "", "MaximumLeafCount": 1024, - "QueryToAddress": "" + "QueryToAddress": "Taikh8VFhM3qbrkC2hd5SzXFsas72gu31SbMZWmgopehdMVQE", + "EthereumSwapId": "", + "EthereumBridgeOutContractAddress": "" } ] }, @@ -133,7 +138,9 @@ }, "ChainIdMapping": { "Mapping": { - "AELF": "" + "9992731": "MainChain_AELF", + "1866392": "SideChain_tDVV", + "1931928": "SideChain_tDVW" } } } \ No newline at end of file From 7bf1076ef1e21e641b92a2e33d1cfc228ddb2149 Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Thu, 25 Aug 2022 17:42:53 +0800 Subject: [PATCH 29/66] feat: add ethereum swapHashId --- .../Processors/ReportConfirmedLogEventProcessor.cs | 3 +-- .../Providers/ITransmitTransactionProvider.cs | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs index 4896ff54..fa5939fa 100644 --- a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs @@ -97,12 +97,11 @@ await _transmitTransactionProvider.EnqueueAsync(new SendTransmitArgs ChainId = chainId, TargetContractAddress = ethereumContractAddress, TargetChainId = reportConfirmed.TargetChainId, - //TODO: SwapHashId = Report = reportBytes, Rs = rs, Ss = ss, RawVs = vs, - swapHashId = swapHashId + SwapHashId = swapHashId }); await _signaturesRecoverableInfoProvider.RemoveSignatureAsync(chainId, diff --git a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs index ca365dcc..c938688d 100644 --- a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs +++ b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs @@ -172,5 +172,4 @@ public class SendTransmitArgs public byte[] RawVs { get; set; } public int RetryTimes { get; set; } - public byte[] swapHashId { get; set; } } From c97d95fc726cae4d9875b2bc5b9d19a5fb7d906e Mon Sep 17 00:00:00 2001 From: zhxymh Date: Thu, 25 Aug 2022 17:50:37 +0800 Subject: [PATCH 30/66] fix: fix chain id --- .../Processors/IrreversibleBlockFoundLogEventProcessor.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs index 64f11027..e34c1d04 100644 --- a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs @@ -14,15 +14,18 @@ public class IrreversibleBlockFoundLogEventProcessor : LogEventProcessorBase Logger { get; set; } public IrreversibleBlockFoundLogEventProcessor( IOptionsSnapshot contractAddressOptions, - ITransmitTransactionProvider transmitTransactionProvider, IAElfClientService aelfClientService) : base( + ITransmitTransactionProvider transmitTransactionProvider, IAElfClientService aelfClientService, + IOptionsSnapshot chainAliasOptions) : base( contractAddressOptions) { _transmitTransactionProvider = transmitTransactionProvider; _aelfClientService = aelfClientService; + _chainAliasOptions = chainAliasOptions.Value; Logger = NullLogger.Instance; } @@ -36,7 +39,8 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) Logger.LogInformation($"IrreversibleBlockFound: {libFound}"); var chainId = ChainIdProvider.GetChainId(context.ChainId); - var block = await _aelfClientService.GetBlockByHeightAsync(chainId,libFound.IrreversibleBlockHeight); + var clientAlias = _chainAliasOptions.Mapping[chainId]; + var block = await _aelfClientService.GetBlockByHeightAsync(clientAlias,libFound.IrreversibleBlockHeight); await _transmitTransactionProvider.SendByLibAsync(chainId, block.BlockHash, block.Header.Height); } } \ No newline at end of file From e0f3c4c15fae090a72c704bddc735b18f2ca61ef Mon Sep 17 00:00:00 2001 From: zhxymh Date: Thu, 25 Aug 2022 19:18:00 +0800 Subject: [PATCH 31/66] feat: add log --- src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs index c938688d..30601dd7 100644 --- a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs +++ b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs @@ -85,6 +85,7 @@ public async Task SendByLibAsync(string chainId, string libHash, long libHeight) break; } + Logger.LogError($"Send Transmit transaction. TxId: {sendResult}"); item.TransactionId = sendResult; await EnqueueAsync(GetQueueName(TransmitCheckingQueue,item.ChainId), item); } From 290bfde795db7d2747cb4b32ba1889d3fe534287 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Thu, 25 Aug 2022 19:32:20 +0800 Subject: [PATCH 32/66] fix: fix bridge contract dto --- .../GetReceiptInfosDTO.cs | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/modules/AElf.Nethereum.Bridge/GetReceiptInfosDTO.cs b/modules/AElf.Nethereum.Bridge/GetReceiptInfosDTO.cs index 5d917f0e..d6aaea83 100644 --- a/modules/AElf.Nethereum.Bridge/GetReceiptInfosDTO.cs +++ b/modules/AElf.Nethereum.Bridge/GetReceiptInfosDTO.cs @@ -13,27 +13,20 @@ public class GetReceiptInfosDTO: IFunctionOutputDTO [FunctionOutput] public class ReceiptDTO : IFunctionOutputDTO { - [Parameter("string", "receiptId", 1)] - public string ReceiptId { get; set; } - - [Parameter("address", "asset", 2)] + [Parameter("address", "asset", 1)] public string Asset { get; set; } - - [Parameter("address", "owner", 3)] + [Parameter("address", "owner", 2)] public string Owner { get; set; } - - [Parameter("string", "targetChainId", 4)] - public string TargetChainId { get; set; } - - [Parameter("string", "targetAddress", 5)] - public string TargetAddress { get; set; } - - [Parameter("uint256", "amount", 6)] + [Parameter("uint256", "amount", 3)] public BigInteger Amount { get; set; } - - [Parameter("uint256", "blockHeight", 7)] + [Parameter("uint256", "blockHeight", 4)] public BigInteger BlockHeight { get; set; } - - [Parameter("uint256", "blockTime", 8)] + [Parameter("uint256", "blockTime", 5)] public BigInteger BlockTime { get; set; } + [Parameter("string", "targetChainId", 6)] + public string TargetChainId { get; set; } + [Parameter("string", "targetAddress", 7)] + public string TargetAddress { get; set; } + [Parameter("string", "receiptId", 8)] + public string ReceiptId { get; set; } } \ No newline at end of file From fd32ee3d71c5e8a08cd73500400720673d0c6987 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Fri, 26 Aug 2022 10:18:05 +0800 Subject: [PATCH 33/66] fix: fix config name --- modules/AElf.Nethereum.Core/AElfNethereumClientModule.cs | 2 +- modules/AElf.Nethereum.Core/ContractServiceBase.cs | 2 +- ...eumAElfChainAliasOptions.cs => EthereumChainAliasOptions.cs} | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename modules/AElf.Nethereum.Core/Options/{EthereumAElfChainAliasOptions.cs => EthereumChainAliasOptions.cs} (72%) diff --git a/modules/AElf.Nethereum.Core/AElfNethereumClientModule.cs b/modules/AElf.Nethereum.Core/AElfNethereumClientModule.cs index 80c59c03..c84e8dd5 100644 --- a/modules/AElf.Nethereum.Core/AElfNethereumClientModule.cs +++ b/modules/AElf.Nethereum.Core/AElfNethereumClientModule.cs @@ -19,7 +19,7 @@ public override void ConfigureServices(ServiceConfigurationContext context) Configure(configuration.GetSection("EthereumAccount")); Configure(configuration.GetSection("EthereumClientConfig")); Configure(configuration.GetSection("EthereumContract")); - Configure(configuration.GetSection("EthereumAElfChainAlias")); + Configure(configuration.GetSection("EthereumChainAlias")); Configure(configuration.GetSection("EthereumClient")); } } \ No newline at end of file diff --git a/modules/AElf.Nethereum.Core/ContractServiceBase.cs b/modules/AElf.Nethereum.Core/ContractServiceBase.cs index f363262a..bac35e93 100644 --- a/modules/AElf.Nethereum.Core/ContractServiceBase.cs +++ b/modules/AElf.Nethereum.Core/ContractServiceBase.cs @@ -14,7 +14,7 @@ public abstract class ContractServiceBase public INethereumAccountProvider NethereumAccountProvider { get; set; } public IOptionsSnapshot EthereumContractOptions { get; set; } public IOptionsSnapshot EthereumClientConfigOptions { get; set; } - public IOptionsSnapshot EthereumAElfChainAliasOptions { get; set; } + public IOptionsSnapshot EthereumAElfChainAliasOptions { get; set; } protected abstract string SmartContractName { get; } protected Function GetFunction(string chainId, string contractAddress, string methodName) diff --git a/modules/AElf.Nethereum.Core/Options/EthereumAElfChainAliasOptions.cs b/modules/AElf.Nethereum.Core/Options/EthereumChainAliasOptions.cs similarity index 72% rename from modules/AElf.Nethereum.Core/Options/EthereumAElfChainAliasOptions.cs rename to modules/AElf.Nethereum.Core/Options/EthereumChainAliasOptions.cs index 58f8d5d4..fb9aab2d 100644 --- a/modules/AElf.Nethereum.Core/Options/EthereumAElfChainAliasOptions.cs +++ b/modules/AElf.Nethereum.Core/Options/EthereumChainAliasOptions.cs @@ -1,6 +1,6 @@ namespace AElf.Nethereum.Core.Options; -public class EthereumAElfChainAliasOptions +public class EthereumChainAliasOptions { public Dictionary Mapping { get; set; } = new(); } \ No newline at end of file From f42a6dc305dc85c3a09dbfddaa2779a66beb127a Mon Sep 17 00:00:00 2001 From: zhxymh Date: Fri, 26 Aug 2022 13:17:28 +0800 Subject: [PATCH 34/66] fix: fix deadlock --- modules/AElf.Client.Bridge/BridgeService.cs | 4 ++-- modules/AElf.Client/AElf.Client.csproj | 1 + modules/AElf.Client/TransactionBuilder.cs | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/AElf.Client.Bridge/BridgeService.cs b/modules/AElf.Client.Bridge/BridgeService.cs index 6cd97f38..3a6cae91 100644 --- a/modules/AElf.Client.Bridge/BridgeService.cs +++ b/modules/AElf.Client.Bridge/BridgeService.cs @@ -37,9 +37,9 @@ public BridgeService(IAElfClientService clientService, public async Task GetSpaceIdBySwapIdAsync(string chainId, Hash swapId) { var result = await _clientService.ViewAsync(GetContractAddress(chainId), "GetSpaceIdBySwapId", - swapId, chainId); + swapId, AElfChainAliasOptions.Value.Mapping[chainId]); - return Hash.LoadFromByteArray(result); + return Hash.Parser.ParseFrom(result); } public async Task SetGasPriceAsync(string chainId, SetGasPriceInput input) diff --git a/modules/AElf.Client/AElf.Client.csproj b/modules/AElf.Client/AElf.Client.csproj index 2f7dc852..e6d508f3 100644 --- a/modules/AElf.Client/AElf.Client.csproj +++ b/modules/AElf.Client/AElf.Client.csproj @@ -17,6 +17,7 @@ + diff --git a/modules/AElf.Client/TransactionBuilder.cs b/modules/AElf.Client/TransactionBuilder.cs index beb357f5..c311151e 100644 --- a/modules/AElf.Client/TransactionBuilder.cs +++ b/modules/AElf.Client/TransactionBuilder.cs @@ -1,5 +1,6 @@ using AElf.Cryptography; using Google.Protobuf; +using Volo.Abp.Threading; namespace AElf.Client; @@ -53,7 +54,8 @@ public Transaction Build() { var keyPair = CryptoHelper.FromPrivateKey(PrivateKey); var from = Address.FromPublicKey(keyPair.PublicKey).ToBase58(); - var unsignedTx = _aelfClient.GenerateTransactionAsync(from, ContractAddress, MethodName, Parameter).Result; + var unsignedTx = AsyncHelper.RunSync(async () => + await _aelfClient.GenerateTransactionAsync(from, ContractAddress, MethodName, Parameter)); var signedTx = _aelfClient.SignTransaction(PrivateKey, unsignedTx); return signedTx; } From f9cf0d1c461a1569cc6b41bf5fe9a7e66a747306 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Mon, 29 Aug 2022 19:06:14 +0800 Subject: [PATCH 35/66] fix: fix options --- .../Providers/ITransmitTransactionProvider.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs index 30601dd7..43ba09d6 100644 --- a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs +++ b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs @@ -26,10 +26,10 @@ public class TransmitTransactionProvider : AbpRedisCache, ITransmitTransactionPr { private readonly IDistributedCacheSerializer _serializer; private readonly IAElfClientService _aelfClientService; - private readonly AElfClientConfigOptions _aelfClientConfigOptions; private readonly IBridgeOutService _bridgeOutService; private readonly INethereumService _nethereumService; private readonly BlockConfirmationOptions _blockConfirmationOptions; + private readonly AElfChainAliasOptions _aelfChainAliasOption; public ILogger Logger { get; set; } @@ -38,7 +38,7 @@ public class TransmitTransactionProvider : AbpRedisCache, ITransmitTransactionPr private const string TransmitFailedQueue = "TransmitFailedQueue"; public TransmitTransactionProvider(IOptions optionsAccessor, - IOptions aelfClientConfigOptions, + IOptionsSnapshot aelfChainAliasOption, IDistributedCacheSerializer serializer, IAElfClientService aelfClientService, IBridgeOutService bridgeOutService, INethereumService nethereumService, IOptions blockConfirmationOptions) : base(optionsAccessor) @@ -47,8 +47,8 @@ public TransmitTransactionProvider(IOptions optionsAccessor, _aelfClientService = aelfClientService; _bridgeOutService = bridgeOutService; _nethereumService = nethereumService; - _aelfClientConfigOptions = aelfClientConfigOptions.Value; _blockConfirmationOptions = blockConfirmationOptions.Value; + _aelfChainAliasOption = aelfChainAliasOption.Value; } public async Task EnqueueAsync(SendTransmitArgs args) @@ -66,7 +66,7 @@ public async Task SendByLibAsync(string chainId, string libHash, long libHeight) break; } - var block = await _aelfClientService.GetBlockByHeightAsync(_aelfClientConfigOptions.ClientAlias, item.BlockHeight); + var block = await _aelfClientService.GetBlockByHeightAsync(_aelfChainAliasOption.Mapping[item.ChainId], item.BlockHeight); if (block.BlockHash == item.BlockHash) { if (item.RetryTimes > 3) From 60fd0d952826d1327a24dcbade2946951c392286 Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Mon, 29 Aug 2022 19:50:01 +0800 Subject: [PATCH 36/66] feat: update processor. --- .../Protobuf/report_contract.proto | 41 +++- modules/AElf.Client.Report/ReportService.cs | 4 +- .../AElf.EventHandler.csproj | 8 + .../EventHandlerAppModule.cs | 7 +- .../Options/BridgeOptions.cs | 20 +- .../AggregateDataReceivedLogEventProcessor.cs | 2 +- .../ContractDeployedLogEventProcessor.cs | 2 +- ...IrreversibleBlockFoundLogEventProcessor.cs | 2 +- .../QueryCompletedLogEventProcessor.cs | 2 +- .../ReportConfirmedLogEventProcessor.cs | 18 +- .../ReportProposedLogEventProcessor.cs | 1 + .../Providers/IDataProvider.cs | 14 +- .../Providers/IReceiptProvider.cs | 195 ++++++++++++++++++ .../Providers/ITransmitTransactionProvider.cs | 12 +- .../TransactionResultListEventHandler.cs | 4 +- .../Workers/ReceiptSyncWorker.cs | 144 +------------ .../Workers/TransmitTransactionWorker.cs | 2 +- src/AElf.EventHandler/appsettings.json | 47 ++--- 18 files changed, 329 insertions(+), 196 deletions(-) create mode 100644 src/AElf.EventHandler/Providers/IReceiptProvider.cs diff --git a/modules/AElf.Client.Protobuf/Protobuf/report_contract.proto b/modules/AElf.Client.Protobuf/Protobuf/report_contract.proto index 004ed831..39c2f188 100644 --- a/modules/AElf.Client.Protobuf/Protobuf/report_contract.proto +++ b/modules/AElf.Client.Protobuf/Protobuf/report_contract.proto @@ -73,13 +73,13 @@ service ReportContract { rpc GetSignature (GetSignatureInput) returns (google.protobuf.StringValue) { option (aelf.is_view) = true; } - rpc GetOffChainAggregationInfo (google.protobuf.StringValue) returns (OffChainAggregationInfo) { + rpc GetOffChainAggregationInfo (GetOffChainAggregationInfoInput) returns (OffChainAggregationInfo) { option (aelf.is_view) = true; } rpc GetReportQueryRecord (aelf.Hash) returns (ReportQueryRecord) { option (aelf.is_view) = true; } - rpc GetCurrentRoundId (google.protobuf.StringValue) returns (google.protobuf.Int64Value) { + rpc GetCurrentRoundId (GetCurrentRoundIdInput) returns (google.protobuf.Int64Value) { option (aelf.is_view) = true; } rpc GetRawReport (GetRawReportInput) returns (google.protobuf.StringValue) { @@ -103,7 +103,10 @@ service ReportContract { rpc GetObserverList (aelf.Address) returns (ObserverList) { option (aelf.is_view) = true; } - rpc GetSkipMemberList(google.protobuf.StringValue) returns (MemberList){ + rpc GetSkipMemberList(GetSkipMemberListInput) returns (MemberList){ + option (aelf.is_view) = true; + } + rpc GetTokenByChainId(google.protobuf.StringValue) returns (google.protobuf.StringValue){ option (aelf.is_view) = true; } } @@ -129,12 +132,14 @@ message ConfirmReportInput { string token = 1; int64 round_id = 2; string signature = 3; + string chain_id = 4; } message RejectReportInput { string token = 1; int64 round_id = 2; repeated aelf.Address accusing_nodes = 3; + string chain_id = 4; } message Report { @@ -170,11 +175,13 @@ message GetSignatureInput { string token = 1; int64 round_id = 2; aelf.Address address = 3; + string chain_id = 4; } message GetSignatureMapInput { string token = 1; int64 round_id = 2; + string chain_id = 3; } message SignatureMap { @@ -185,6 +192,11 @@ message MemberList{ repeated aelf.Address value = 1; } +message GetOffChainAggregationInfoInput{ + string chain_id = 1; + string token = 2; +} + message OffChainAggregationInfo { string token = 1; OffChainQueryInfoList off_chain_query_info_list = 2; @@ -224,17 +236,25 @@ message OffChainQueryInfo { message GetReportInput { string token = 1; int64 round_id = 2; + string chain_id = 3; } message GetMerklePathInput { string token = 1; int64 round_id = 2; int32 node_index = 3; + string chain_id = 4; } message GetRawReportInput{ string token = 1; int64 round_id = 2; + string chain_id = 3; +} + +message GetCurrentRoundIdInput{ + string chain_id = 1; + string token = 2; } message GenerateRawReportInput{ @@ -249,17 +269,20 @@ message OffChainQueryInfoList { message AddOffChainQueryInfoInput { string token = 1; - OffChainQueryInfo off_chain_query_info = 2; + string chain_id = 2; + OffChainQueryInfo off_chain_query_info = 3; } message RemoveOffChainQueryInfoInput { string token = 1; - int32 remove_node_index = 2; + string chain_id = 2; + int32 remove_node_index = 3; } message ChangeOffChainQueryInfoInput { string token = 1; - OffChainQueryInfo new_off_chain_query_info = 2; + string chain_id = 2; + OffChainQueryInfo new_off_chain_query_info = 3; } message ApplyObserverInput { @@ -278,6 +301,12 @@ message IsObserverInput { message SetSkipMemberListInput{ string token = 1; MemberList value = 2; + string chain_id = 3; +} + +message GetSkipMemberListInput{ + string token = 1; + string chain_id = 2; } // Events diff --git a/modules/AElf.Client.Report/ReportService.cs b/modules/AElf.Client.Report/ReportService.cs index c310518c..70d6d680 100644 --- a/modules/AElf.Client.Report/ReportService.cs +++ b/modules/AElf.Client.Report/ReportService.cs @@ -66,7 +66,7 @@ public async Task GetRawReportAsync(string chainId, GetRawReportInp { var result = await _clientService.ViewAsync(GetContractAddress(chainId), "GetRawReport", - getRawReportInput, chainId); + getRawReportInput, AElfChainAliasOptions.Value.Mapping[chainId]); var actualResult = new StringValue(); actualResult.MergeFrom(result); return actualResult; @@ -76,7 +76,7 @@ await _clientService.ViewAsync(GetContractAddress(chainId), "GetRawReport", { var result = await _clientService.ViewAsync(GetContractAddress(chainId), "GetReport", - getReportInput, chainId); + getReportInput, AElfChainAliasOptions.Value.Mapping[chainId]); var actualResult = new Contracts.Report.Report(); actualResult.MergeFrom(result); return actualResult; diff --git a/src/AElf.EventHandler/AElf.EventHandler.csproj b/src/AElf.EventHandler/AElf.EventHandler.csproj index 762dd781..6767e60b 100644 --- a/src/AElf.EventHandler/AElf.EventHandler.csproj +++ b/src/AElf.EventHandler/AElf.EventHandler.csproj @@ -58,6 +58,14 @@ Always + + + Always + + + + Always + diff --git a/src/AElf.EventHandler/EventHandlerAppModule.cs b/src/AElf.EventHandler/EventHandlerAppModule.cs index fc1dcac6..313c9fe7 100644 --- a/src/AElf.EventHandler/EventHandlerAppModule.cs +++ b/src/AElf.EventHandler/EventHandlerAppModule.cs @@ -1,6 +1,7 @@ using System; using System.Net.Security; using System.Security.Authentication; +using System.Xml; using AElf.Client.Bridge; using AElf.Client.Core; using AElf.Client.Core.Options; @@ -85,7 +86,11 @@ public override void ConfigureServices(ServiceConfigurationContext context) } public override void OnApplicationInitialization(ApplicationInitializationContext context) { - //context.AddBackgroundWorkerAsync(); + context.AddBackgroundWorkerAsync(); //context.AddBackgroundWorkerAsync(); + // var service = context.ServiceProvider.GetRequiredService(); + // AsyncHelper.RunSync(service.ExecuteAsync); + // var service = context.ServiceProvider.GetRequiredService(); + // var status = AsyncHelper.RunSync(async () => await service.GetChainStatusAsync("AELF-Test")); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Options/BridgeOptions.cs b/src/AElf.EventHandler/Options/BridgeOptions.cs index 7cf11d11..e9e1cf7f 100644 --- a/src/AElf.EventHandler/Options/BridgeOptions.cs +++ b/src/AElf.EventHandler/Options/BridgeOptions.cs @@ -7,19 +7,33 @@ public class BridgeOptions public bool IsSendQuery { get; set; } public bool IsTransmitter { get; set; } public long QueryPayment { get; set; } - public List Bridges { get; set; } + + public List BridgesIn { get; set; } + + public List BridgesOut { get; set; } public string AccountAddress { get; set; } } -public class BridgeItem +//Others -> AElf +public class BridgeItemIn { public string ChainId { get; set; } public string TargetChainId { get; set; } public string EthereumBridgeInContractAddress { get; set; } public string OriginToken { get; set; } public string QueryToAddress { get; set; } - public string EthereumBridgeOutContractAddress { get; set; } public string SwapId { get; set; } public string MaximumLeafCount { get; set; } +} + + +//AElf to others +public class BridgeItemOut +{ + public string ChainId { get; set; } + public string TargetChainId { get; set; } + public string OriginToken { get; set; } + public string QueryToAddress { get; set; } + public string EthereumBridgeOutContractAddress { get; set; } public string EthereumSwapId { get; set; } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Processors/AggregateDataReceivedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/AggregateDataReceivedLogEventProcessor.cs index 5e639d07..c7d8dd93 100644 --- a/src/AElf.EventHandler/Processors/AggregateDataReceivedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/AggregateDataReceivedLogEventProcessor.cs @@ -25,7 +25,7 @@ public override Task ProcessAsync(LogEvent logEvent, EventContext context) { var aggregateDataReceived = new AggregateDataReceived(); aggregateDataReceived.MergeFrom(logEvent); - _logger.LogInformation($"AggregateDataReceived: {aggregateDataReceived}"); + //_logger.LogInformation($"AggregateDataReceived: {aggregateDataReceived}"); return Task.CompletedTask; } diff --git a/src/AElf.EventHandler/Processors/ContractDeployedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ContractDeployedLogEventProcessor.cs index dd633be0..b20826de 100644 --- a/src/AElf.EventHandler/Processors/ContractDeployedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ContractDeployedLogEventProcessor.cs @@ -24,7 +24,7 @@ public override Task ProcessAsync(LogEvent logEvent, EventContext context) var contractDeployed = new ContractDeployed(); contractDeployed.MergeFrom(logEvent); - _logger.LogInformation($"New contract deployed: {contractDeployed}"); + //_logger.LogInformation($"New contract deployed: {contractDeployed}"); return Task.CompletedTask; } diff --git a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs index e34c1d04..c4911e77 100644 --- a/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/IrreversibleBlockFoundLogEventProcessor.cs @@ -36,7 +36,7 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) { var libFound = new IrreversibleBlockFound(); libFound.MergeFrom(logEvent); - Logger.LogInformation($"IrreversibleBlockFound: {libFound}"); + //Logger.LogInformation($"IrreversibleBlockFound: {libFound}"); var chainId = ChainIdProvider.GetChainId(context.ChainId); var clientAlias = _chainAliasOptions.Mapping[chainId]; diff --git a/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs index 73ac70cd..8db513fe 100644 --- a/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs @@ -24,7 +24,7 @@ public override Task ProcessAsync(LogEvent logEvent, EventContext context) { var completed = new QueryCompletedWithAggregation(); completed.MergeFrom(logEvent); - _logger.LogInformation(logEvent.ToString()); + //_logger.LogInformation(logEvent.ToString()); return Task.CompletedTask; } diff --git a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs index fa5939fa..71817682 100644 --- a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs @@ -53,6 +53,7 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) reportConfirmed.MergeFrom(logEvent); _logger.LogInformation(reportConfirmed.ToString()); var chainId = ChainIdProvider.GetChainId(context.ChainId); + var targetChainId = reportConfirmed.TargetChainId; var ethereumContractAddress = reportConfirmed.Token; var roundId = reportConfirmed.RoundId; await _signaturesRecoverableInfoProvider.SetSignatureAsync(chainId, ethereumContractAddress, roundId, @@ -65,25 +66,27 @@ await _signaturesRecoverableInfoProvider.SetSignatureAsync(chainId, ethereumCont // _reportProvider.GetReport(ethereumContractAddress, roundId); var report = await _reportService.GetRawReportAsync(chainId, new GetRawReportInput { + ChainId = targetChainId, Token = ethereumContractAddress, RoundId = roundId }); + _logger.LogInformation($"Confirm raw report:{report.Value}"); var signatureRecoverableInfos = await _signaturesRecoverableInfoProvider.GetSignatureAsync(chainId, ethereumContractAddress, roundId); //GetSwapId - var targetChainId = reportConfirmed.TargetChainId; var receiptId = (await _reportService.GetReportAsync(chainId, new GetReportInput { + ChainId = targetChainId, Token = ethereumContractAddress, RoundId = roundId })).Observations.Value.First().Key; var receiptIdTokenHash = receiptId.Split(".").First(); var symbol = (await _bridgeService.GetReceiptIdInfoAsync(chainId, - Hash.LoadFromHex(receiptIdTokenHash.Substring(1, receiptIdTokenHash.Length - 2)))).Symbol; + Hash.LoadFromHex(receiptIdTokenHash))).Symbol; var ethereumSwapId = - (_bridgeOptions.Bridges.Single(i => i.TargetChainId == targetChainId && i.OriginToken == symbol)) + (_bridgeOptions.BridgesOut.Single(i => i.TargetChainId == targetChainId && i.OriginToken == symbol)) .EthereumSwapId; var (swapHashId, reportBytes, rs, ss, vs) = @@ -101,7 +104,9 @@ await _transmitTransactionProvider.EnqueueAsync(new SendTransmitArgs Rs = rs, Ss = ss, RawVs = vs, - SwapHashId = swapHashId + SwapHashId = swapHashId, + BlockHash = context.BlockHash, + BlockHeight = context.BlockNumber }); await _signaturesRecoverableInfoProvider.RemoveSignatureAsync(chainId, @@ -127,6 +132,11 @@ await _signaturesRecoverableInfoProvider.RemoveSignatureAsync(chainId, index++; } + var r1 = r[0].ToHex(); + var s1 = s[0].ToHex(); + var v1 = v.ToHex(); + + return (ByteStringHelper.FromHexString(swapId).ToByteArray(), ByteStringHelper.FromHexString(report).ToByteArray(), r, s, v); } diff --git a/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs index e2df72b8..fe3a20dd 100644 --- a/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs @@ -49,6 +49,7 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) var sendTxResult = await _reportService.ConfirmReportAsync(chainId,new ConfirmReportInput { + ChainId = reportProposed.TargetChainId, Token = reportProposed.Token, RoundId = reportProposed.RoundId, Signature = SignHelper diff --git a/src/AElf.EventHandler/Providers/IDataProvider.cs b/src/AElf.EventHandler/Providers/IDataProvider.cs index 8e27d5bb..95ab88cc 100644 --- a/src/AElf.EventHandler/Providers/IDataProvider.cs +++ b/src/AElf.EventHandler/Providers/IDataProvider.cs @@ -66,11 +66,11 @@ public async Task GetDataAsync(Hash queryId, string title = null, List c.SwapId == swapId); + var bridgeItem = _bridgeOptions.BridgesIn.Single(c => c.SwapId == swapId); _logger.LogInformation("About to handle record receipt hashes for swapping tokens."); var recordReceiptHashInput = - await GetReceiptHashMap(Hash.LoadFromBase64(swapId), bridgeItem, long.Parse(options[0]), - long.Parse(options[1])); + await GetReceiptHashMap(Hash.LoadFromHex(swapId), bridgeItem, long.Parse(options[0].Split(".").Last()), + long.Parse(options[1].Split(".").Last())); _logger.LogInformation($"RecordReceiptHashInput: {recordReceiptHashInput}"); _dictionary[queryId] = recordReceiptHashInput; return recordReceiptHashInput; @@ -114,10 +114,10 @@ await GetReceiptHashMap(Hash.LoadFromBase64(swapId), bridgeItem, long.Parse(opti return result; } - private async Task GetReceiptHashMap(Hash swapId, BridgeItem bridgeItem, long start, long end) + private async Task GetReceiptHashMap(Hash swapId, BridgeItemIn bridgeItem, long start, long end) { - var token = _bridgeOptions.Bridges.Single(c => c.SwapId == swapId.ToHex()).OriginToken; - var chainId = _bridgeOptions.Bridges.Single(c => c.SwapId == swapId.ToHex()).TargetChainId; + var token = _bridgeOptions.BridgesIn.Single(c => c.SwapId == swapId.ToHex()).OriginToken; + var chainId = _bridgeOptions.BridgesIn.Single(c => c.SwapId == swapId.ToHex()).TargetChainId; var receiptInfos = await _bridgeInService.GetSendReceiptInfosAsync(bridgeItem.ChainId,bridgeItem.EthereumBridgeInContractAddress, token, chainId,start,end); var receiptHashes = new List(); for (var i = 0; i <= end - start; i++) @@ -135,7 +135,7 @@ private async Task GetReceiptHashMap(Hash swapId, BridgeItem bridgeItem, }; for (var i = 0; i <= end - start; i++) { - input.Value.Add(receiptInfos.Receipts[(int)(i + start)].ReceiptId, receiptHashes[i].ToHex()); + input.Value.Add(receiptInfos.Receipts[i].ReceiptId, receiptHashes[i].ToHex()); } return input.ToString(); diff --git a/src/AElf.EventHandler/Providers/IReceiptProvider.cs b/src/AElf.EventHandler/Providers/IReceiptProvider.cs new file mode 100644 index 00000000..2cf611f5 --- /dev/null +++ b/src/AElf.EventHandler/Providers/IReceiptProvider.cs @@ -0,0 +1,195 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Numerics; +using System.Threading.Tasks; +using AElf.Client.Bridge; +using AElf.Client.Core.Options; +using AElf.Client.MerkleTreeContract; +using AElf.Client.Oracle; +using AElf.Contracts.MerkleTreeContract; +using AElf.Contracts.Oracle; +using AElf.EventHandler.Workers; +using AElf.Nethereum.Bridge; +using AElf.Nethereum.Core; +using AElf.Types; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Volo.Abp.Caching.StackExchangeRedis; +using Volo.Abp.DependencyInjection; + +namespace AElf.EventHandler; + +public interface IReceiptProvider +{ + Task ExecuteAsync(); +} + +public class ReceiptProvider : IReceiptProvider, ITransientDependency +{ + private readonly BridgeOptions _bridgeOptions; + private readonly IBridgeInService _bridgeInService; + private readonly INethereumService _nethereumService; + private readonly IOracleService _oracleService; + private readonly AElfChainAliasOptions _aelfChainAliasOptions; + private readonly IBridgeService _bridgeContractService; + private readonly IMerkleTreeContractService _merkleTreeContractService; + private readonly ILatestQueriedReceiptCountProvider _latestQueriedReceiptCountProvider; + private readonly ILogger _logger; + private readonly AElfContractOptions _contractOptions; + private readonly BlockConfirmationOptions _blockConfirmationOptions; + + public ReceiptProvider( + IOptionsSnapshot bridgeOptions, + IOptionsSnapshot aelfChainAliasOption, + IOptionsSnapshot blockConfirmation, + IOptionsSnapshot contractOptions, + IBridgeInService bridgeInService, + INethereumService nethereumService, + IOracleService oracleService, + IBridgeService bridgeService, + IMerkleTreeContractService merkleTreeContractService, + ILatestQueriedReceiptCountProvider latestQueriedReceiptCountProvider, + ILogger logger) + { + _bridgeOptions = bridgeOptions.Value; + _bridgeInService = bridgeInService; + _nethereumService = nethereumService; + _oracleService = oracleService; + _bridgeContractService = bridgeService; + _merkleTreeContractService = merkleTreeContractService; + _aelfChainAliasOptions = aelfChainAliasOption.Value; + _latestQueriedReceiptCountProvider = latestQueriedReceiptCountProvider; + _logger = logger; + _contractOptions = contractOptions.Value; + _blockConfirmationOptions = blockConfirmation.Value; + } + public async Task ExecuteAsync() + { + var bridgeItemsMap = new Dictionary<(string, string), List>(); + var sendQueryList = new Dictionary(); + var tokenIndex = new Dictionary(); + foreach (var bridgeItem in _bridgeOptions.BridgesIn) + { + var key = (bridgeItem.ChainId, bridgeItem.EthereumBridgeInContractAddress); + if (!bridgeItemsMap.TryGetValue(key, out var items)) + { + items = new List(); + } + items.Add(bridgeItem); + bridgeItemsMap[key] = items; + + } + + foreach (var (aliasAddress, item) in bridgeItemsMap) + { + var tokenList = item.Select(i => i.OriginToken).ToList(); + var targetChainIdList = item.Select(i => i.TargetChainId).ToList(); + var sendReceiptIndexDto = await _bridgeInService.GetTransferReceiptIndexAsync(aliasAddress.Item1, + aliasAddress.Item2, tokenList, targetChainIdList); + for (var i = 0; i < tokenList.Count; i++) + { + tokenIndex[tokenList[i]] = sendReceiptIndexDto.Indexes[i]; + sendQueryList[item[i].SwapId] = item[i]; + } + } + + foreach (var (swapId, item) in sendQueryList) + { + var targetChainId = _bridgeOptions.BridgesIn.Single(i => i.SwapId == swapId).TargetChainId; + await SendQueryAsync(targetChainId, item, tokenIndex[item.OriginToken]); + } + } + private async Task SendQueryAsync(string chainId, BridgeItemIn bridgeItem, BigInteger tokenIndex) + { + var swapId = bridgeItem.SwapId; + + var spaceId = await _bridgeContractService.GetSpaceIdBySwapIdAsync(chainId, Hash.LoadFromHex(swapId)); + var lastRecordedLeafIndex = (await _merkleTreeContractService.GetLastLeafIndexAsync( + chainId, new GetLastLeafIndexInput + { + SpaceId = spaceId + })).Value; + if (lastRecordedLeafIndex == -2) + { + _logger.LogInformation($"Space of id {spaceId} is not created. "); + return; + } + + if (_latestQueriedReceiptCountProvider.Get(swapId) == 0) + { + _latestQueriedReceiptCountProvider.Set(swapId, lastRecordedLeafIndex + 1); + _logger.LogInformation($"Next round to query should begin with tokenIndex:{_latestQueriedReceiptCountProvider.Get(swapId)}"); + } + + var nextRoundStartTokenIndex = _latestQueriedReceiptCountProvider.Get(swapId); + + _logger.LogInformation($"Last recorded leaf index : {lastRecordedLeafIndex}."); + + + if (tokenIndex < nextRoundStartTokenIndex) + { + return; + } + var notRecordTokenNumber = tokenIndex - nextRoundStartTokenIndex + 1; + if (notRecordTokenNumber > 0) + { + var blockNumber = await _nethereumService.GetBlockNumberAsync(bridgeItem.ChainId); + var getReceiptInfos = await _bridgeInService.GetSendReceiptInfosAsync(bridgeItem.ChainId, + bridgeItem.EthereumBridgeInContractAddress, bridgeItem.OriginToken, bridgeItem.TargetChainId, + nextRoundStartTokenIndex,(long)tokenIndex); + var lastTokenIndexConfirm = nextRoundStartTokenIndex - 1; + string receiptIdHash = null; + for (var i = 0; i < notRecordTokenNumber; i++) + { + var blockHeight = getReceiptInfos.Receipts[i].BlockHeight; + receiptIdHash = getReceiptInfos.Receipts[i].ReceiptId.Split(".").First(); + var blockConfirmationCount = _blockConfirmationOptions.ConfirmationCount[bridgeItem.ChainId]; + if (blockNumber - blockHeight > blockConfirmationCount) + { + lastTokenIndexConfirm += (i+1); + continue; + } + break; + } + _logger.LogInformation($"Last confirmed token index:{lastTokenIndexConfirm}"); + + _logger.LogInformation($"Token hash in receipt id:{receiptIdHash}"); + + if (lastTokenIndexConfirm - nextRoundStartTokenIndex >= 0) + { + _logger.LogInformation($"Start to query token : from receipt index {nextRoundStartTokenIndex},end receipt index {lastTokenIndexConfirm}"); + var queryInput = new QueryInput + { + Payment = _bridgeOptions.QueryPayment, + QueryInfo = new QueryInfo + { + Title = $"record_receipts_{swapId}", + Options = {$"{receiptIdHash}.{nextRoundStartTokenIndex}", $"{receiptIdHash}.{lastTokenIndexConfirm}"} + }, + AggregatorContractAddress = _contractOptions.ContractAddressList[chainId]["StringAggregatorContract"].ConvertAddress(), + AggregateThreshold = 1, + CallbackInfo = new CallbackInfo + { + ContractAddress = + _contractOptions.ContractAddressList[chainId]["BridgeContract"].ConvertAddress(), + MethodName = "RecordReceiptHash" + }, + DesignatedNodeList = new AddressList + { + Value = {bridgeItem.QueryToAddress.ConvertAddress()} + } + }; + + _logger.LogInformation($"About to send Query transaction for token swapping, QueryInput: {queryInput}"); + + var sendTxResult = await _oracleService.QueryAsync(chainId, queryInput); + _logger.LogInformation($"Query transaction id : {sendTxResult.TransactionResult.TransactionId}"); + _latestQueriedReceiptCountProvider.Set(swapId, lastTokenIndexConfirm + 1); + _logger.LogInformation( + $"Next token index should start with tokenindex:{_latestQueriedReceiptCountProvider.Get(swapId)}"); + } + + } + } +} \ No newline at end of file diff --git a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs index 43ba09d6..8870bfec 100644 --- a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs +++ b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs @@ -3,6 +3,7 @@ using AElf.Client.Core.Options; using AElf.Nethereum.Bridge; using AElf.Nethereum.Core; +using AElf.Nethereum.Core.Options; using Microsoft.Extensions.Caching.StackExchangeRedis; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; @@ -30,7 +31,7 @@ public class TransmitTransactionProvider : AbpRedisCache, ITransmitTransactionPr private readonly INethereumService _nethereumService; private readonly BlockConfirmationOptions _blockConfirmationOptions; private readonly AElfChainAliasOptions _aelfChainAliasOption; - + public EthereumChainAliasOptions _ethereumAElfChainAliasOptions; public ILogger Logger { get; set; } private const string TransmitSendingQueue = "TransmitSendingQueue"; @@ -38,6 +39,7 @@ public class TransmitTransactionProvider : AbpRedisCache, ITransmitTransactionPr private const string TransmitFailedQueue = "TransmitFailedQueue"; public TransmitTransactionProvider(IOptions optionsAccessor, + IOptionsSnapshot ethereumAElfChainAliasOptions, IOptionsSnapshot aelfChainAliasOption, IDistributedCacheSerializer serializer, IAElfClientService aelfClientService, IBridgeOutService bridgeOutService, INethereumService nethereumService, IOptions blockConfirmationOptions) @@ -49,6 +51,7 @@ public TransmitTransactionProvider(IOptions optionsAccessor, _nethereumService = nethereumService; _blockConfirmationOptions = blockConfirmationOptions.Value; _aelfChainAliasOption = aelfChainAliasOption.Value; + _ethereumAElfChainAliasOptions = ethereumAElfChainAliasOptions.Value; } public async Task EnqueueAsync(SendTransmitArgs args) @@ -101,7 +104,8 @@ public async Task UpdateQueueAsync(string chainId) var item = await GetFirstItemAsync(GetQueueName(TransmitCheckingQueue,chainId)); while (item != null) { - var receipt = await _nethereumService.GetTransactionReceiptAsync(item.TargetChainId, item.TransactionId); + var ethAlias = _ethereumAElfChainAliasOptions.Mapping[item.TargetChainId]; + var receipt = await _nethereumService.GetTransactionReceiptAsync(ethAlias, item.TransactionId); if (receipt.Status.Value != 1) { @@ -110,13 +114,13 @@ public async Task UpdateQueueAsync(string chainId) await EnqueueAsync(GetQueueName(TransmitSendingQueue, item.ChainId), item); } - var currentHeight = await _nethereumService.GetBlockNumberAsync(item.TargetChainId); + var currentHeight = await _nethereumService.GetBlockNumberAsync(ethAlias); if (receipt.BlockNumber.ToLong() >= currentHeight - _blockConfirmationOptions.ConfirmationCount[item.TargetChainId]) { break; } - var block = await _nethereumService.GetBlockByNumberAsync(item.TargetChainId, receipt.BlockNumber); + var block = await _nethereumService.GetBlockByNumberAsync(ethAlias, receipt.BlockNumber); if (block.BlockHash != receipt.BlockHash) { Logger.LogError($"Transmit transaction forked. Chain: {item.TargetChainId}, TxId: {item.TransactionId}"); diff --git a/src/AElf.EventHandler/TransactionResultListEventHandler.cs b/src/AElf.EventHandler/TransactionResultListEventHandler.cs index 8135008f..07916383 100644 --- a/src/AElf.EventHandler/TransactionResultListEventHandler.cs +++ b/src/AElf.EventHandler/TransactionResultListEventHandler.cs @@ -45,12 +45,12 @@ public async Task HandleEventAsync(TransactionResultListEto eventData) { foreach (var eventLog in txResultEto.Logs) { - _logger.LogInformation($"Received event log {eventLog.Name} of contract {eventLog.Address}"); + //_logger.LogInformation($"Received event log {eventLog.Name} of contract {eventLog.Address}"); foreach (var logEventProcessor in usefulLogEventProcessors) { if (logEventProcessor.IsMatch(eventData.ChainId, eventLog.Address, eventLog.Name)) { - _logger.LogInformation("Pushing aforementioned event log to processor."); + //_logger.LogInformation("Pushing aforementioned event log to processor."); await logEventProcessor.ProcessAsync(new LogEvent { Indexed = { eventLog.Indexed.Select(ByteString.FromBase64) }, diff --git a/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs index 1862a47c..3bbbc133 100644 --- a/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs +++ b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs @@ -23,157 +23,23 @@ namespace AElf.EventHandler.Workers; public class ReceiptSyncWorker : AsyncPeriodicBackgroundWorkerBase { private readonly BridgeOptions _bridgeOptions; - private readonly BridgeInService _bridgeInService; - private readonly NethereumService _nethereumService; - private readonly OracleService _oracleService; - private readonly AElfChainAliasOptions _aelfChainAliasOptions; - private readonly IBridgeService _bridgeContractService; - private readonly IMerkleTreeContractService _merkleTreeContractService; - private readonly ILatestQueriedReceiptCountProvider _latestQueriedReceiptCountProvider; - private readonly ILogger _logger; - private readonly AElfContractOptions _contractOptions; - private readonly BlockConfirmationOptions _blockConfirmationOptions; + private readonly IReceiptProvider _receiptProvider; public ReceiptSyncWorker(AbpAsyncTimer timer, IServiceScopeFactory serviceScopeFactory, IOptionsSnapshot bridgeOptions, - IOptionsSnapshot aelfChainAliasOption, - IOptionsSnapshot blockConfirmation, - IOptionsSnapshot contractOptions, - BridgeInService bridgeInService, - NethereumService nethereumService, - OracleService oracleService, - IBridgeService bridgeService, - IMerkleTreeContractService merkleTreeContractService, - ILatestQueriedReceiptCountProvider latestQueriedReceiptCountProvider, - ILogger logger - ) : base(timer, + IReceiptProvider receiptProvider + ) : base(timer, serviceScopeFactory) { Timer.Period = 1000 * 60; _bridgeOptions = bridgeOptions.Value; - _bridgeInService = bridgeInService; - _nethereumService = nethereumService; - _oracleService = oracleService; - _bridgeContractService = bridgeService; - _merkleTreeContractService = merkleTreeContractService; - _aelfChainAliasOptions = aelfChainAliasOption.Value; - _latestQueriedReceiptCountProvider = latestQueriedReceiptCountProvider; - _logger = logger; - _contractOptions = contractOptions.Value; - _blockConfirmationOptions = blockConfirmation.Value; + _receiptProvider = receiptProvider; } protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) { if (!_bridgeOptions.IsSendQuery) return; - var bridgeItemsMap = new Dictionary<(string, string), List>(); - var sendQueryList = new Dictionary(); - var tokenIndex = new Dictionary(); - foreach (var bridgeItem in _bridgeOptions.Bridges) - { - bridgeItemsMap[(bridgeItem.ChainId, bridgeItem.EthereumBridgeInContractAddress)] - .Add(bridgeItem); - } - - foreach (var (aliasAddress, item) in bridgeItemsMap) - { - var tokenList = item.Select(i => i.OriginToken).ToList(); - var targetChainIdList = item.Select(i => i.TargetChainId).ToList(); - var sendReceiptIndexDto = await _bridgeInService.GetTransferReceiptIndexAsync(aliasAddress.Item1, - aliasAddress.Item2, tokenList, targetChainIdList); - for (var i = 0; i < tokenList.Count; i++) - { - tokenIndex[tokenList[i]] = sendReceiptIndexDto.Indexes[i]; - sendQueryList[item[i].SwapId] = item[i]; - } - } - - foreach (var (swapId, item) in sendQueryList) - { - var targetChainId = _bridgeOptions.Bridges.Single(i => i.SwapId == swapId).TargetChainId; - await SendQueryAsync(targetChainId, item, tokenIndex[item.OriginToken]); - } - } - - private async Task SendQueryAsync(string chainId, BridgeItem bridgeItem, BigInteger tokenIndex) - { - var swapId = bridgeItem.SwapId; - var spaceId = await _bridgeContractService.GetSpaceIdBySwapIdAsync(chainId, Hash.LoadFromBase64(swapId)); - var lastRecordedLeafIndex = (await _merkleTreeContractService.GetLastLeafIndexAsync( - chainId, new GetLastLeafIndexInput - { - SpaceId = spaceId - })).Value; - if (lastRecordedLeafIndex == -2) - { - _logger.LogInformation($"Space of id {spaceId} is not created. "); - return; - } - - if (_latestQueriedReceiptCountProvider.Get(swapId) == 0) - { - _latestQueriedReceiptCountProvider.Set(swapId, lastRecordedLeafIndex + 1); - } - - _logger.LogInformation($"Last recorded leaf index : {lastRecordedLeafIndex}."); - var tokenLeafIndex = tokenIndex - 1; - if (tokenLeafIndex < _latestQueriedReceiptCountProvider.Get(swapId)) - { - return; - } - - var notRecordTokenNumber = tokenLeafIndex - lastRecordedLeafIndex; - if (notRecordTokenNumber > 0) - { - var blockNumber = await _nethereumService.GetBlockNumberAsync(bridgeItem.ChainId); - var getReceiptInfos = await _bridgeInService.GetSendReceiptInfosAsync(bridgeItem.ChainId, - bridgeItem.EthereumBridgeInContractAddress, bridgeItem.OriginToken, bridgeItem.TargetChainId, - lastRecordedLeafIndex+2,(long)tokenIndex); - var lastLeafIndexConfirm = lastRecordedLeafIndex; - for (var i = 0; i < tokenLeafIndex - lastRecordedLeafIndex; i++) - { - var blockHeight = getReceiptInfos.Receipts[i].BlockHeight; - var blockConfirmationCount = _blockConfirmationOptions.ConfirmationCount[bridgeItem.ChainId]; - if (blockNumber - blockHeight > blockConfirmationCount) continue; - lastLeafIndexConfirm += (i+1); - break; - } - _logger.LogInformation($"Last confirmed token index:{lastLeafIndexConfirm+1}"); - - if (lastLeafIndexConfirm - lastRecordedLeafIndex > 0) - { - _logger.LogInformation($"Start to query token : from index {lastRecordedLeafIndex + 2},end index {lastLeafIndexConfirm + 1}"); - var queryInput = new QueryInput - { - Payment = _bridgeOptions.QueryPayment, - QueryInfo = new QueryInfo - { - Title = $"record_receipt_{swapId}", - Options = {(lastRecordedLeafIndex + 2).ToString(), (lastLeafIndexConfirm+1).ToString()} - }, - AggregatorContractAddress = _contractOptions.ContractAddressList[chainId]["StringAggregatorContract"].ConvertAddress(), - CallbackInfo = new CallbackInfo - { - ContractAddress = - _contractOptions.ContractAddressList[chainId]["BridgeContract"].ConvertAddress(), - MethodName = "RecordReceiptHash" - }, - DesignatedNodeList = new AddressList - { - Value = {bridgeItem.QueryToAddress.ConvertAddress()} - } - }; - - _logger.LogInformation($"About to send Query transaction for token swapping, QueryInput: {queryInput}"); - - var sendTxResult = await _oracleService.QueryAsync(chainId, queryInput); - _logger.LogInformation($"Query transaction id : {sendTxResult.TransactionResult.TransactionId}"); - _latestQueriedReceiptCountProvider.Set(swapId, lastLeafIndexConfirm + 2); - _logger.LogInformation( - $"Next token index should start with tokenindex:{_latestQueriedReceiptCountProvider.Get(swapId)}"); - } - - } + await _receiptProvider.ExecuteAsync(); } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs b/src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs index 10383ce6..f256b6a6 100644 --- a/src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs +++ b/src/AElf.EventHandler/Workers/TransmitTransactionWorker.cs @@ -26,7 +26,7 @@ protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext worker { foreach (var item in _chainAliasOptions.Mapping) { - await _transmitTransactionProvider.UpdateQueueAsync(item.Value); + await _transmitTransactionProvider.UpdateQueueAsync(item.Key); } } } \ No newline at end of file diff --git a/src/AElf.EventHandler/appsettings.json b/src/AElf.EventHandler/appsettings.json index 9b08e9d0..34ef59f7 100644 --- a/src/AElf.EventHandler/appsettings.json +++ b/src/AElf.EventHandler/appsettings.json @@ -47,7 +47,7 @@ }, "AElfChainAlias": { "Mapping": { - "AELF": "AELF-Test" + "MainChain_AELF": "AELF-Test" } }, "EthereumClient": { @@ -63,7 +63,7 @@ "AccountConfigList": [ { "Alias": "eth", - "PrivateKey": "fe4f97256578452dd92604fbfd06c0bd0ceac595d007b65a8d10cefe8f5d18ef" + "PrivateKey": "8d1d8002802dd6fcd80ae9f5c5c6e4914a1120427c2108c5334353ffc270497b" } ] }, @@ -72,18 +72,20 @@ }, "EthereumChainAlias": { "Mapping": { - "Ethereum": "Kovan" + "Ethereum": "Ethereum", + "Kovan" : "Kovan" } }, "AElfContract": { "ContractDirectory": "", "ContractAddressList": { - "AELF": { + "MainChain_AELF": { "MerkleTreeContract": "SsSqZWLf7Dk9NWyWyvDwuuY5nzn5n99jiscKZgRPaajZP5p8y", "BridgeContract": "225ajURvev5rgX8HnMJ8GjbPnRxUrCHoD7HUjhWQqewEJ5GAv1", "OracleContract": "xsnQafDAhNTeYcooptETqWnYBksFGGXxfcQyJJ5tmu6Ak9ZZt", "ReportContract": "GwsSp1MZPmkMvXdbfSCDydHhZtDpvqkFpmPvStYho288fb7QZ", - "RegimentContractAddress": "2nyC8hqq3pGnRu8gJzCsTaxXB6snfGxmL2viimKXgEfYWGtjEh", + "StringAggregatorContract": "2M24EKAecggCnttZ9DUUMCXi4xC67rozA87kFgid9qEwRUMHTs", + "RegimentContract": "2nyC8hqq3pGnRu8gJzCsTaxXB6snfGxmL2viimKXgEfYWGtjEh", "ConsensusContract": "pGa4e5hNGsgkfjEGm72TEvbF7aRDqKBd4LuXtab4ucMbXLcgJ" } } @@ -99,40 +101,39 @@ } }, "Oracle": { - "ObserverAssociationAddressList": [] + "ObserverAssociationAddressList": ["Taikh8VFhM3qbrkC2hd5SzXFsas72gu31SbMZWmgopehdMVQE"] }, "Bridge": { "IsSendQuery": true, "IsTransmitter": true, "QueryPayment": 0, - "Bridges": [ + "AccountAddress":"ZrAFaqdr79MWYkxA49Hp2LUdSVHdP6fJh3kDw4jmgC7HTgrni", + "BridgesIn": [ { - "chainId": "Ethereum", - "TargetChainId": "AELF", - "OriginToken": "ELF", + "chainId": "Kovan", + "TargetChainId": "MainChain_AELF", + "OriginToken": "0xb085f10C869022E8588825f901a54C1ACeb13A07", "EthereumBridgeInContractAddress": "0xc7f5D89B3c1B77A1EE9Abc54C8CC42E69df8d8d2", - "SwapId": "5a6d89b4d0eb9dc53073ef55eb9601027d339dd4729c1992a7da59ec1f41ff7a", + "SwapId": "9a8556e72cfec1afd08beca421ada9a8d56f8102308894e209181367a6415ff9", "MaximumLeafCount": 1024, - "QueryToAddress": "Taikh8VFhM3qbrkC2hd5SzXFsas72gu31SbMZWmgopehdMVQE", - "EthereumSwapId": "", - "EthereumBridgeOutContractAddress": "" - }, + "QueryToAddress": "Taikh8VFhM3qbrkC2hd5SzXFsas72gu31SbMZWmgopehdMVQE" + } + ], + "BridgesOut": [ { - "chainId": "", - "TargetChainId": "Ethereum", + "chainId": "MainChain_AElf", + "TargetChainId": "Kovan", "OriginToken": "ELF", - "EthereumBridgeInContractAddress": "0xc7f5D89B3c1B77A1EE9Abc54C8CC42E69df8d8d2", - "SwapId": "", - "MaximumLeafCount": 1024, "QueryToAddress": "Taikh8VFhM3qbrkC2hd5SzXFsas72gu31SbMZWmgopehdMVQE", - "EthereumSwapId": "", - "EthereumBridgeOutContractAddress": "" + "EthereumSwapId": "0x8cbe63c7458bef338d7da2008521616897109cf1427c1450ec6cb47a5a7df5e6", + "EthereumBridgeOutContractAddress": "0x58E2822eBfd5eC66fCA987C460130EbC5BdA1Eb0" } ] }, "BlockConfirmation": { "ConfirmationCount": { - "eth": 12, + "Ethereum": 12, + "Kovan": 12, "bsc": 100 } }, From 619801cffee8081d0067be9c4596a2fc746a642d Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Tue, 30 Aug 2022 18:16:31 +0800 Subject: [PATCH 37/66] fix: remove some useless info. --- .../EventHandlerAppModule.cs | 2 +- .../QueryCompletedLogEventProcessor.cs | 2 +- .../ReportConfirmedLogEventProcessor.cs | 7 ------- .../Providers/IDataProvider.cs | 2 +- .../Providers/IReceiptProvider.cs | 21 ++++++++++++------- src/AElf.EventHandler/appsettings.json | 6 +++--- 6 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/AElf.EventHandler/EventHandlerAppModule.cs b/src/AElf.EventHandler/EventHandlerAppModule.cs index 313c9fe7..9d8c7655 100644 --- a/src/AElf.EventHandler/EventHandlerAppModule.cs +++ b/src/AElf.EventHandler/EventHandlerAppModule.cs @@ -87,7 +87,7 @@ public override void ConfigureServices(ServiceConfigurationContext context) public override void OnApplicationInitialization(ApplicationInitializationContext context) { context.AddBackgroundWorkerAsync(); - //context.AddBackgroundWorkerAsync(); + context.AddBackgroundWorkerAsync(); // var service = context.ServiceProvider.GetRequiredService(); // AsyncHelper.RunSync(service.ExecuteAsync); // var service = context.ServiceProvider.GetRequiredService(); diff --git a/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs index 8db513fe..73ac70cd 100644 --- a/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/QueryCompletedLogEventProcessor.cs @@ -24,7 +24,7 @@ public override Task ProcessAsync(LogEvent logEvent, EventContext context) { var completed = new QueryCompletedWithAggregation(); completed.MergeFrom(logEvent); - //_logger.LogInformation(logEvent.ToString()); + _logger.LogInformation(logEvent.ToString()); return Task.CompletedTask; } diff --git a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs index 71817682..888a0b2a 100644 --- a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs @@ -62,8 +62,6 @@ await _signaturesRecoverableInfoProvider.SetSignatureAsync(chainId, ethereumCont { if (_bridgeOptions.IsTransmitter) { - // var report = - // _reportProvider.GetReport(ethereumContractAddress, roundId); var report = await _reportService.GetRawReportAsync(chainId, new GetRawReportInput { ChainId = targetChainId, @@ -131,12 +129,7 @@ await _signaturesRecoverableInfoProvider.RemoveSignatureAsync(chainId, v[index] = recoverableInfoBytes.Last(); index++; } - - var r1 = r[0].ToHex(); - var s1 = s[0].ToHex(); - var v1 = v.ToHex(); - return (ByteStringHelper.FromHexString(swapId).ToByteArray(), ByteStringHelper.FromHexString(report).ToByteArray(), r, s, v); } diff --git a/src/AElf.EventHandler/Providers/IDataProvider.cs b/src/AElf.EventHandler/Providers/IDataProvider.cs index 95ab88cc..098bdd86 100644 --- a/src/AElf.EventHandler/Providers/IDataProvider.cs +++ b/src/AElf.EventHandler/Providers/IDataProvider.cs @@ -122,7 +122,7 @@ private async Task GetReceiptHashMap(Hash swapId, BridgeItemIn bridgeIte var receiptHashes = new List(); for (var i = 0; i <= end - start; i++) { - var amountHash = HashHelper.ComputeFrom(receiptInfos.Receipts[i].Amount.ToString()); + var amountHash = HashHelper.ComputeFrom(((decimal)(receiptInfos.Receipts[i].Amount/10000000000)).ToString()); var targetAddressHash = HashHelper.ComputeFrom(receiptInfos.Receipts[i].TargetAddress); var receiptIdHash = HashHelper.ComputeFrom(receiptInfos.Receipts[i].ReceiptId); var hash = HashHelper.ConcatAndCompute(amountHash, targetAddressHash, receiptIdHash); diff --git a/src/AElf.EventHandler/Providers/IReceiptProvider.cs b/src/AElf.EventHandler/Providers/IReceiptProvider.cs index 2cf611f5..efa8fc69 100644 --- a/src/AElf.EventHandler/Providers/IReceiptProvider.cs +++ b/src/AElf.EventHandler/Providers/IReceiptProvider.cs @@ -115,18 +115,23 @@ private async Task SendQueryAsync(string chainId, BridgeItemIn bridgeItem, BigIn _logger.LogInformation($"Space of id {spaceId} is not created. "); return; } - + var nextTokenIndex = lastRecordedLeafIndex == 0 ? 1 : lastRecordedLeafIndex + 2; if (_latestQueriedReceiptCountProvider.Get(swapId) == 0) { - _latestQueriedReceiptCountProvider.Set(swapId, lastRecordedLeafIndex + 1); - _logger.LogInformation($"Next round to query should begin with tokenIndex:{_latestQueriedReceiptCountProvider.Get(swapId)}"); + _latestQueriedReceiptCountProvider.Set(swapId,nextTokenIndex); } - + var nextRoundStartTokenIndex = _latestQueriedReceiptCountProvider.Get(swapId); + _logger.LogInformation($"Next round to query should begin with tokenIndex:{nextRoundStartTokenIndex}"); _logger.LogInformation($"Last recorded leaf index : {lastRecordedLeafIndex}."); + var ifMatchIndex = nextRoundStartTokenIndex == 1 ? 1 : nextTokenIndex - 1; + if (ifMatchIndex != lastRecordedLeafIndex+1) + { + _logger.LogInformation($"Inccorect leaf index. Last recorded leaf index:{lastRecordedLeafIndex};Last recorded receipt index:{lastRecordedLeafIndex+1};Should begin token index:{nextRoundStartTokenIndex}."); + return; + } - if (tokenIndex < nextRoundStartTokenIndex) { return; @@ -147,7 +152,7 @@ private async Task SendQueryAsync(string chainId, BridgeItemIn bridgeItem, BigIn var blockConfirmationCount = _blockConfirmationOptions.ConfirmationCount[bridgeItem.ChainId]; if (blockNumber - blockHeight > blockConfirmationCount) { - lastTokenIndexConfirm += (i+1); + lastTokenIndexConfirm = (i+nextRoundStartTokenIndex); continue; } break; @@ -182,10 +187,10 @@ private async Task SendQueryAsync(string chainId, BridgeItemIn bridgeItem, BigIn }; _logger.LogInformation($"About to send Query transaction for token swapping, QueryInput: {queryInput}"); - + _latestQueriedReceiptCountProvider.Set(swapId, lastTokenIndexConfirm + 1); var sendTxResult = await _oracleService.QueryAsync(chainId, queryInput); _logger.LogInformation($"Query transaction id : {sendTxResult.TransactionResult.TransactionId}"); - _latestQueriedReceiptCountProvider.Set(swapId, lastTokenIndexConfirm + 1); + _logger.LogInformation( $"Next token index should start with tokenindex:{_latestQueriedReceiptCountProvider.Get(swapId)}"); } diff --git a/src/AElf.EventHandler/appsettings.json b/src/AElf.EventHandler/appsettings.json index 34ef59f7..78d8fed9 100644 --- a/src/AElf.EventHandler/appsettings.json +++ b/src/AElf.EventHandler/appsettings.json @@ -113,8 +113,8 @@ "chainId": "Kovan", "TargetChainId": "MainChain_AELF", "OriginToken": "0xb085f10C869022E8588825f901a54C1ACeb13A07", - "EthereumBridgeInContractAddress": "0xc7f5D89B3c1B77A1EE9Abc54C8CC42E69df8d8d2", - "SwapId": "9a8556e72cfec1afd08beca421ada9a8d56f8102308894e209181367a6415ff9", + "EthereumBridgeInContractAddress": "0x40536e47BA0541d5940B29b0423652b797d7FdcA", + "SwapId": "ad7af9718a9822d4ac878d62fe5209885dc567ab12d96220732c97a79322ebab", "MaximumLeafCount": 1024, "QueryToAddress": "Taikh8VFhM3qbrkC2hd5SzXFsas72gu31SbMZWmgopehdMVQE" } @@ -126,7 +126,7 @@ "OriginToken": "ELF", "QueryToAddress": "Taikh8VFhM3qbrkC2hd5SzXFsas72gu31SbMZWmgopehdMVQE", "EthereumSwapId": "0x8cbe63c7458bef338d7da2008521616897109cf1427c1450ec6cb47a5a7df5e6", - "EthereumBridgeOutContractAddress": "0x58E2822eBfd5eC66fCA987C460130EbC5BdA1Eb0" + "EthereumBridgeOutContractAddress": "0x2b8e182ac87d123237f8e28e4DDe8a2b050a1c96" } ] }, From c46f696023d64b60947d0075b73f236ac8c20818 Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Tue, 30 Aug 2022 18:48:18 +0800 Subject: [PATCH 38/66] fix: fix get receiptInfo amount . --- src/AElf.EventHandler/Providers/IDataProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AElf.EventHandler/Providers/IDataProvider.cs b/src/AElf.EventHandler/Providers/IDataProvider.cs index 098bdd86..5a0ca54e 100644 --- a/src/AElf.EventHandler/Providers/IDataProvider.cs +++ b/src/AElf.EventHandler/Providers/IDataProvider.cs @@ -122,7 +122,7 @@ private async Task GetReceiptHashMap(Hash swapId, BridgeItemIn bridgeIte var receiptHashes = new List(); for (var i = 0; i <= end - start; i++) { - var amountHash = HashHelper.ComputeFrom(((decimal)(receiptInfos.Receipts[i].Amount/10000000000)).ToString()); + var amountHash = HashHelper.ComputeFrom((receiptInfos.Receipts[i].Amount).ToString()); var targetAddressHash = HashHelper.ComputeFrom(receiptInfos.Receipts[i].TargetAddress); var receiptIdHash = HashHelper.ComputeFrom(receiptInfos.Receipts[i].ReceiptId); var hash = HashHelper.ConcatAndCompute(amountHash, targetAddressHash, receiptIdHash); From 45777d296b05ef3049b2c32e186ccb72ad2a1d23 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Tue, 30 Aug 2022 19:27:34 +0800 Subject: [PATCH 39/66] feat: update abi --- .../ApiClient.cs | 4 +- .../ContractBuild/BridgeOutAbi.json | 609 ------------------ .../Providers/ITransmitTransactionProvider.cs | 6 +- .../Workers/ReceiptSyncWorker.cs | 14 - src/AElf.PriceWorker/PriceSyncOptions.cs | 1 + src/AElf.PriceWorker/PriceSyncWorker.cs | 28 +- 6 files changed, 10 insertions(+), 652 deletions(-) delete mode 100644 src/AElf.EventHandler/ContractBuild/BridgeOutAbi.json diff --git a/modules/AElf.BlockchainTransactionFee/ApiClient.cs b/modules/AElf.BlockchainTransactionFee/ApiClient.cs index e6c93806..bbfaee5c 100644 --- a/modules/AElf.BlockchainTransactionFee/ApiClient.cs +++ b/modules/AElf.BlockchainTransactionFee/ApiClient.cs @@ -23,9 +23,9 @@ public async Task GetAsync(string uri) { Proxy = proxy, }; - HttpClient.DefaultProxy = proxy; + var client = new HttpClient(clientHandler); - var response = await _httpClient.GetAsync(uri) + var response = await client.GetAsync(uri) .ConfigureAwait(false); response.EnsureSuccessStatusCode(); diff --git a/src/AElf.EventHandler/ContractBuild/BridgeOutAbi.json b/src/AElf.EventHandler/ContractBuild/BridgeOutAbi.json deleted file mode 100644 index 79707780..00000000 --- a/src/AElf.EventHandler/ContractBuild/BridgeOutAbi.json +++ /dev/null @@ -1,609 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "BridgeOut", - "sourceName": "contracts/BridgeOut.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_merkleTree", - "type": "address" - }, - { - "internalType": "address", - "name": "_regiment", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "swapId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "transmiter", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "receiptIndex", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "receiptHash", - "type": "bytes32" - } - ], - "name": "NewTransmission", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "swapId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "string", - "name": "chainId", - "type": "string" - } - ], - "name": "SwapPairAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "receiveAddress", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "TokenSwapEvent", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "string", - "name": "chainId", - "type": "string" - } - ], - "name": "_generateTokenKey", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_receiptId", - "type": "string" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_receiverAddress", - "type": "address" - } - ], - "name": "computeLeafHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "_leafHash", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "components": [ - { - "internalType": "uint64", - "name": "originShare", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "targetShare", - "type": "uint64" - } - ], - "internalType": "struct BridgeOut.SwapRatio", - "name": "swapRatio", - "type": "tuple" - } - ], - "internalType": "struct BridgeOut.SwapTargetToken[]", - "name": "targetTokens", - "type": "tuple[]" - }, - { - "internalType": "string", - "name": "fromChainId", - "type": "string" - }, - { - "internalType": "bytes32", - "name": "regimentId", - "type": "bytes32" - } - ], - "name": "createSwap", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "swapHashId", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "tokens", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amounts", - "type": "uint256" - } - ], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "string[]", - "name": "targetChainIds", - "type": "string[]" - } - ], - "name": "getReceiveReceiptIndex", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "string", - "name": "targetChainId", - "type": "string" - }, - { - "internalType": "uint256", - "name": "fromIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endIndex", - "type": "uint256" - } - ], - "name": "getReceivedReceiptInfos", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - }, - { - "internalType": "address", - "name": "targetAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "blockHeight", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "blockTime", - "type": "uint256" - }, - { - "internalType": "string", - "name": "targetChainId", - "type": "string" - }, - { - "internalType": "string", - "name": "receiptId", - "type": "string" - } - ], - "internalType": "struct BridgeOut.ReceivedReceipt[]", - "name": "_receipts", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "string", - "name": "targetChainId", - "type": "string" - } - ], - "name": "getSwapId", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "swapId", - "type": "bytes32" - } - ], - "name": "getSwapInfo", - "outputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "swapId", - "type": "bytes32" - }, - { - "internalType": "string", - "name": "fromChainId", - "type": "string" - }, - { - "components": [ - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "components": [ - { - "internalType": "uint64", - "name": "originShare", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "targetShare", - "type": "uint64" - } - ], - "internalType": "struct BridgeOut.SwapRatio", - "name": "swapRatio", - "type": "tuple" - } - ], - "internalType": "struct BridgeOut.SwapTargetToken[]", - "name": "swapTargetTokenList", - "type": "tuple[]" - }, - { - "internalType": "bytes32", - "name": "regimentId", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "spaceId", - "type": "bytes32" - } - ], - "internalType": "struct BridgeOut.SwapInfo", - "name": "swapInfo", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "receiptHash", - "type": "bytes32" - } - ], - "name": "isReceiptRecorded", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "spaceId", - "type": "bytes32" - }, - { - "internalType": "string", - "name": "receiptId", - "type": "string" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "receiverAddress", - "type": "address" - } - ], - "name": "merkleTreeVerify", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "swapId", - "type": "bytes32" - }, - { - "internalType": "string", - "name": "receiptId", - "type": "string" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "receiverAddress", - "type": "address" - } - ], - "name": "swapToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "swapHashId", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "_report", - "type": "bytes" - }, - { - "internalType": "bytes32[]", - "name": "_rs", - "type": "bytes32[]" - }, - { - "internalType": "bytes32[]", - "name": "_ss", - "type": "bytes32[]" - }, - { - "internalType": "bytes32", - "name": "_rawVs", - "type": "bytes32" - } - ], - "name": "transmit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "swapHashId", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "bytecode": "0x60806040523480156200001157600080fd5b506040516200622438038062006224833981810160405281019062000037919062000217565b620000576200004b620000e160201b60201c565b620000e960201b60201c565b81600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050506200025e565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620001df82620001b2565b9050919050565b620001f181620001d2565b8114620001fd57600080fd5b50565b6000815190506200021181620001e6565b92915050565b60008060408385031215620002315762000230620001ad565b5b6000620002418582860162000200565b9250506020620002548582860162000200565b9150509250929050565b615fb6806200026e6000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80638a0bb6f911610097578063c045e88711610066578063c045e887146102d1578063cb2b48a5146102ed578063d954863c1461031d578063f2fde38b1461033957610100565b80638a0bb6f9146102375780638da5cb5b14610267578063a6fb97d114610285578063b33ff450146102a157610100565b80634c038c45116100d35780634c038c45146101b157806368591baa146101e1578063715018a6146101fd57806371d0c5ca1461020757610100565b806303b1ccdb146101055780632d0fc6b4146101215780633f19efbe14610151578063446f95b414610181575b600080fd5b61011f600480360381019061011a9190613691565b610355565b005b61013b60048036038101906101369190613719565b610cc9565b60405161014891906139aa565b60405180910390f35b61016b60048036038101906101669190613b60565b610ed3565b6040516101789190613c9a565b60405180910390f35b61019b60048036038101906101969190613d71565b61105a565b6040516101a89190613ddc565b60405180910390f35b6101cb60048036038101906101c69190613719565b6110d5565b6040516101d89190613e12565b60405180910390f35b6101fb60048036038101906101f69190613ed9565b6110f4565b005b6102056115ff565b005b610221600480360381019061021c9190613fb5565b611613565b60405161022e9190613ddc565b60405180910390f35b610251600480360381019061024c9190614015565b611684565b60405161025e9190614202565b60405180910390f35b61026f611a4e565b60405161027c9190614233565b60405180910390f35b61029f600480360381019061029a919061424e565b611a77565b005b6102bb60048036038101906102b69190613691565b611d9e565b6040516102c89190613ddc565b60405180910390f35b6102eb60048036038101906102e691906142f7565b612090565b005b6103076004803603810190610302919061438c565b612467565b6040516103149190613ddc565b60405180910390f35b6103376004803603810190610332919061424e565b612640565b005b610353600480360381019061034e91906143fb565b6129a7565b005b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ba906144ab565b60405180910390fd5b6000600360008781526020019081526020016000206004015490506000801b811415610424576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161041b90614517565b60405180910390fd5b60008311610467576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045e90614583565b60405180910390fd5b6000600360008881526020019081526020016000209050600061048d8388888888611d9e565b90506000600760008381526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610539576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610530906145ef565b60405180910390fd5b848160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600083600201805480602002602001604051908101604052809291908181526020016000905b828210156106a257838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff168152505081525050815260200190600101906105a2565b50505050905060005b815181101561091a5760008560020182815481106106cc576106cb61460f565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600560008e815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060006107d385858151811061076c5761076b61460f565b5b6020026020010151602001516000015167ffffffffffffffff166107c587878151811061079c5761079b61460f565b5b6020026020010151602001516020015167ffffffffffffffff168e612a2b90919063ffffffff16565b612a4190919063ffffffff16565b9050816000015481111561081c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108139061468a565b60405180910390fd5b610833818360000154612a5790919063ffffffff16565b82600001819055508273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8b836040518363ffffffff1660e01b81526004016108769291906146b9565b602060405180830381600087803b15801561089057600080fd5b505af11580156108a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c8919061470e565b507fb0c1e4d18ea737b756410ab0296768c15a87c12eeb368f360ecc5be61a11b4db8a84836040516108fc9392919061473b565b60405180910390a15050508080610912906147a1565b9150506106ab565b506000610a0d856002016000815481106109375761093661460f565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600360008e8152602001908152602001600020600101805461098a90614819565b80601f01602080910402602001604051908101604052809291908181526020018280546109b690614819565b8015610a035780601f106109d857610100808354040283529160200191610a03565b820191906000526020600020905b8154815290600101906020018083116109e657829003601f168201915b505050505061105a565b9050600860008281526020019081526020016000206040518060e0016040528087600201600081548110610a4457610a4361460f565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1681526020018a8152602001438152602001428152602001600360008f81526020019081526020016000206001018054610ae090614819565b80601f0160208091040260200160405190810160405280929190818152602001828054610b0c90614819565b8015610b595780601f10610b2e57610100808354040283529160200191610b59565b820191906000526020600020905b815481529060010190602001808311610b3c57829003601f168201915b505050505081526020018c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050815250908060018154018082558091505060019003906000526020600020906007020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020155606082015181600301556080820151816004015560a0820151816005019080519060200190610c9c929190613384565b5060c0820151816006019080519060200190610cb9929190613384565b5050505050505050505050505050565b610cd161340a565b600360008381526020019081526020016000206040518060a001604052908160008201548152602001600182018054610d0990614819565b80601f0160208091040260200160405190810160405280929190818152602001828054610d3590614819565b8015610d825780601f10610d5757610100808354040283529160200191610d82565b820191906000526020600020905b815481529060010190602001808311610d6557829003601f168201915b5050505050815260200160028201805480602002602001604051908101604052809291908181526020016000905b82821015610eb057838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250508152505081526020019060010190610db0565b505050508152602001600382015481526020016004820154815250509050919050565b606082829050845114610f1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f12906148bd565b60405180910390fd5b6000845167ffffffffffffffff811115610f3857610f376139cc565b5b604051908082528060200260200182016040528015610f665781602001602082028036833780820191505090505b50905060005b855181101561104e576000611002878381518110610f8d57610f8c61460f565b5b6020026020010151878785818110610fa857610fa761460f565b5b9050602002810190610fba91906148ec565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061105a565b9050600860008281526020019081526020016000208054905083838151811061102e5761102d61460f565b5b602002602001018181525050508080611046906147a1565b915050610f6c565b50809150509392505050565b6000600283836040516020016110719291906149d3565b60405160208183030381529060405260405161108d9190614a42565b602060405180830381855afa1580156110aa573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906110cd9190614a6e565b905092915050565b6000806006600084815260200190815260200160002054119050919050565b6000600360008a81526020019081526020016000209050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323c849858260030154336040518363ffffffff1660e01b815260040161116c929190614a9b565b60206040518083038186803b15801561118457600080fd5b505afa158015611198573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111bc919061470e565b6111fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f290614b10565b60405180910390fd5b60005b868690508110156113b7576000898960405161121b929190614b55565b60405180910390206040516020016112339190614bdb565b60405160208183030381529060405280519060200120905060006112b082601b8786602081106112665761126561460f565b5b1a60f81b60f81c6112779190614c0e565b8b8b8781811061128a5761128961460f565b5b905060200201358a8a888181106112a4576112a361460f565b5b90506020020135612a6d565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323c849858560030154836040518363ffffffff1660e01b8152600401611313929190614a9b565b60206040518083038186803b15801561132b57600080fd5b505afa15801561133f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611363919061470e565b6113a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139990614c91565b60405180910390fd5b505080806113af906147a1565b9150506111fe565b506000806114088a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050612a98565b915091506000600167ffffffffffffffff811115611429576114286139cc565b5b6040519080825280602002602001820160405280156114575781602001602082028036833780820191505090505b509050818160008151811061146f5761146e61460f565b5b60200260200101818152505060006006600084815260200190815260200160002054146114d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c890614cfd565b60405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637d9778368660040154846040518363ffffffff1660e01b8152600401611534929190614dcc565b602060405180830381600087803b15801561154e57600080fd5b505af1158015611562573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115869190614e11565b905061159c600182612abc90919063ffffffff16565b60066000858152602001908152602001600020819055507f6319bf84e3d2c97dd1991c07818c14950ceb6f48ce6d85f063be3c60905ea1b98d3386866040516115e89493929190614e3e565b60405180910390a150505050505050505050505050565b611607612ad2565b6116116000612b50565b565b6000806116648585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061105a565b905060046000828152602001908152602001600020549150509392505050565b606060006116d68787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061105a565b9050600860008281526020019081526020016000208054905083111580156116fe5750600084115b61173d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173490614ecf565b60405180910390fd5b600061176560016117578787612a5790919063ffffffff16565b612abc90919063ffffffff16565b90508067ffffffffffffffff811115611781576117806139cc565b5b6040519080825280602002602001820160405280156117ba57816020015b6117a7613442565b81526020019060019003908161179f5790505b50925060006001866117cc9190614eef565b90505b84811015611a42576008600084815260200190815260200160002081815481106117fc576117fb61460f565b5b90600052602060002090600702016040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820154815260200160038201548152602001600482015481526020016005820180546118ef90614819565b80601f016020809104026020016040519081016040528092919081815260200182805461191b90614819565b80156119685780601f1061193d57610100808354040283529160200191611968565b820191906000526020600020905b81548152906001019060200180831161194b57829003601f168201915b5050505050815260200160068201805461198190614819565b80601f01602080910402602001604051908101604052809291908181526020018280546119ad90614819565b80156119fa5780601f106119cf576101008083540402835291602001916119fa565b820191906000526020600020905b8154815290600101906020018083116119dd57829003601f168201915b505050505081525050848281518110611a1657611a1561460f565b5b60200260200101819052508080611a2c906147a1565b9150508080611a3a906147a1565b9150506117cf565b50505095945050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600360008581526020019081526020016000209050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639a96679e8260030154336040518363ffffffff1660e01b8152600401611aef929190614a9b565b60206040518083038186803b158015611b0757600080fd5b505afa158015611b1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b3f919061470e565b611b7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7590614f6f565b60405180910390fd5b611caf8382600201805480602002602001604051908101604052809291908181526020016000905b82821015611ca657838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250508152505081526020019060010190611ba6565b50505050612c14565b50611d16826005600087815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154612a5790919063ffffffff16565b6005600086815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550611d9833838573ffffffffffffffffffffffffffffffffffffffff16612ca09092919063ffffffff16565b50505050565b60006060806000611df488888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508787612467565b90506000611e1f60016006600085815260200190815260200160002054612a5790919063ffffffff16565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631b32d71a8b836040518363ffffffff1660e01b8152600401611e7e929190614f8f565b60006040518083038186803b158015611e9657600080fd5b505afa158015611eaa573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190611ed3919061513e565b909192509091508094508195505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631669b10e8b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fd2973ca8e866040518363ffffffff1660e01b8152600401611f7e929190614f8f565b60206040518083038186803b158015611f9657600080fd5b505afa158015611faa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fce9190614e11565b8588886040518663ffffffff1660e01b8152600401611ff195949392919061529b565b60206040518083038186803b15801561200957600080fd5b505afa15801561201d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612041919061470e565b612080576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161207790615348565b60405180910390fd5b8194505050505095945050505050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166376e2775583336040518363ffffffff1660e01b81526004016120ef929190614a9b565b60206040518083038186803b15801561210757600080fd5b505afa15801561211b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061213f919061470e565b905080612181576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161217890614f6f565b60405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632a99732a84600a6040518363ffffffff1660e01b81526004016121e19291906153ad565b602060405180830381600087803b1580156121fb57600080fd5b505af115801561220f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122339190614a6e565b905060008036604051612247929190614b55565b604051809103902090506000888860008181106122675761226661460f565b5b905060600201600001602081019061227f91906143fb565b905084600360008481526020019081526020016000206003018190555082600360008481526020019081526020016000206004018190555081600360008481526020019081526020016000206000018190555086866003600085815260200190815260200160002060010191906122f79291906134ab565b5060006123488289898080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061105a565b905082600460008381526020019081526020016000208190555060005b8a8a905081101561241d576123a48b8b838181106123865761238561460f565b5b90506060020160200180360381019061239f9190615457565b612d26565b600360008581526020019081526020016000206002018b8b838181106123cd576123cc61460f565b5b9050606002019080600181540180825580915050600190039060005260206000209060020201600090919091909150818161240891906156d0565b50508080612415906147a1565b915050612365565b507f909c724b9d08d0463115fc7fa6d2c8e51e6eafa867725be497bdb9a53a6cac4f83838a8a604051612453949392919061570b565b60405180910390a150505050505050505050565b60008060028560405160200161247d919061574b565b6040516020818303038152906040526040516124999190614a42565b602060405180830381855afa1580156124b6573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906124d99190614a6e565b905060006002856040516020016124f09190615783565b60405160208183030381529060405260405161250c9190614a42565b602060405180830381855afa158015612529573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061254c9190614a6e565b90506000600285604051602001612563919061579e565b60405160208183030381529060405260405161257f9190614a42565b602060405180830381855afa15801561259c573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906125bf9190614a6e565b905060028383836040516020016125d8939291906157b9565b6040516020818303038152906040526040516125f49190614a42565b602060405180830381855afa158015612611573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906126349190614a6e565b93505050509392505050565b6000600360008581526020019081526020016000209050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639a96679e8260030154336040518363ffffffff1660e01b81526004016126b8929190614a9b565b60206040518083038186803b1580156126d057600080fd5b505afa1580156126e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612708919061470e565b612747576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161273e90614f6f565b60405180910390fd5b6128788382600201805480602002602001604051908101604052809291908181526020016000905b8282101561286f57838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681525050815250508152602001906001019061276f565b50505050612c14565b6128b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128ae9061583c565b60405180910390fd5b6128e43330848673ffffffffffffffffffffffffffffffffffffffff16612d94909392919063ffffffff16565b61294a826005600087815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154612abc90919063ffffffff16565b6005600086815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555050505050565b6129af612ad2565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612a1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a16906158ce565b60405180910390fd5b612a2881612b50565b50565b60008183612a3991906158ee565b905092915050565b60008183612a4f9190615977565b905092915050565b60008183612a659190614eef565b905092915050565b6000806000612a7e87878787612e1d565b91509150612a8b81612f2a565b8192505050949350505050565b60008082806020019051810190612aaf91906159a8565b8092508193505050915091565b60008183612aca91906159e8565b905092915050565b612ada6130ff565b73ffffffffffffffffffffffffffffffffffffffff16612af8611a4e565b73ffffffffffffffffffffffffffffffffffffffff1614612b4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b4590615a8a565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080600090505b8251811015612c94578373ffffffffffffffffffffffffffffffffffffffff16838281518110612c4f57612c4e61460f565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff161415612c81576001915050612c9a565b8080612c8c906147a1565b915050612c1c565b50600090505b92915050565b612d218363a9059cbb60e01b8484604051602401612cbf9291906146b9565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613107565b505050565b6000816000015167ffffffffffffffff16118015612d5257506000816020015167ffffffffffffffff16115b612d91576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d8890615af6565b60405180910390fd5b50565b612e17846323b872dd60e01b858585604051602401612db59392919061473b565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613107565b50505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115612e58576000600391509150612f21565b601b8560ff1614158015612e705750601c8560ff1614155b15612e82576000600491509150612f21565b600060018787878760405160008152602001604052604051612ea79493929190615b25565b6020604051602081039080840390855afa158015612ec9573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612f1857600060019250925050612f21565b80600092509250505b94509492505050565b60006004811115612f3e57612f3d615b6a565b5b816004811115612f5157612f50615b6a565b5b1415612f5c576130fc565b60016004811115612f7057612f6f615b6a565b5b816004811115612f8357612f82615b6a565b5b1415612fc4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612fbb90615be5565b60405180910390fd5b60026004811115612fd857612fd7615b6a565b5b816004811115612feb57612fea615b6a565b5b141561302c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161302390615c51565b60405180910390fd5b600360048111156130405761303f615b6a565b5b81600481111561305357613052615b6a565b5b1415613094576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161308b90615ce3565b60405180910390fd5b6004808111156130a7576130a6615b6a565b5b8160048111156130ba576130b9615b6a565b5b14156130fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130f290615d75565b60405180910390fd5b5b50565b600033905090565b6000613169826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166131ce9092919063ffffffff16565b90506000815111156131c95780806020019051810190613189919061470e565b6131c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131bf90615e07565b60405180910390fd5b5b505050565b60606131dd84846000856131e6565b90509392505050565b60608247101561322b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161322290615e99565b60405180910390fd5b613234856132fa565b613273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161326a90615f05565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161329c9190614a42565b60006040518083038185875af1925050503d80600081146132d9576040519150601f19603f3d011682016040523d82523d6000602084013e6132de565b606091505b50915091506132ee82828661331d565b92505050949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6060831561332d5782905061337d565b6000835111156133405782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133749190615f5e565b60405180910390fd5b9392505050565b82805461339090614819565b90600052602060002090601f0160209004810192826133b257600085556133f9565b82601f106133cb57805160ff19168380011785556133f9565b828001600101855582156133f9579182015b828111156133f85782518255916020019190600101906133dd565b5b5090506134069190613531565b5090565b6040518060a0016040528060008019168152602001606081526020016060815260200160008019168152602001600080191681525090565b6040518060e00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160608152602001606081525090565b8280546134b790614819565b90600052602060002090601f0160209004810192826134d95760008555613520565b82601f106134f257803560ff1916838001178555613520565b82800160010185558215613520579182015b8281111561351f578235825591602001919060010190613504565b5b50905061352d9190613531565b5090565b5b8082111561354a576000816000905550600101613532565b5090565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b61357581613562565b811461358057600080fd5b50565b6000813590506135928161356c565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f8401126135bd576135bc613598565b5b8235905067ffffffffffffffff8111156135da576135d961359d565b5b6020830191508360018202830111156135f6576135f56135a2565b5b9250929050565b6000819050919050565b613610816135fd565b811461361b57600080fd5b50565b60008135905061362d81613607565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061365e82613633565b9050919050565b61366e81613653565b811461367957600080fd5b50565b60008135905061368b81613665565b92915050565b6000806000806000608086880312156136ad576136ac613558565b5b60006136bb88828901613583565b955050602086013567ffffffffffffffff8111156136dc576136db61355d565b5b6136e8888289016135a7565b945094505060406136fb8882890161361e565b925050606061370c8882890161367c565b9150509295509295909350565b60006020828403121561372f5761372e613558565b5b600061373d84828501613583565b91505092915050565b61374f81613562565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561378f578082015181840152602081019050613774565b8381111561379e576000848401525b50505050565b6000601f19601f8301169050919050565b60006137c082613755565b6137ca8185613760565b93506137da818560208601613771565b6137e3816137a4565b840191505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61382381613653565b82525050565b600067ffffffffffffffff82169050919050565b61384681613829565b82525050565b604082016000820151613862600085018261383d565b506020820151613875602085018261383d565b50505050565b606082016000820151613891600085018261381a565b5060208201516138a4602085018261384c565b50505050565b60006138b6838361387b565b60608301905092915050565b6000602082019050919050565b60006138da826137ee565b6138e481856137f9565b93506138ef8361380a565b8060005b8381101561392057815161390788826138aa565b9750613912836138c2565b9250506001810190506138f3565b5085935050505092915050565b600060a0830160008301516139456000860182613746565b506020830151848203602086015261395d82826137b5565b9150506040830151848203604086015261397782826138cf565b915050606083015161398c6060860182613746565b50608083015161399f6080860182613746565b508091505092915050565b600060208201905081810360008301526139c4818461392d565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613a04826137a4565b810181811067ffffffffffffffff82111715613a2357613a226139cc565b5b80604052505050565b6000613a3661354e565b9050613a4282826139fb565b919050565b600067ffffffffffffffff821115613a6257613a616139cc565b5b602082029050602081019050919050565b6000613a86613a8184613a47565b613a2c565b90508083825260208201905060208402830185811115613aa957613aa86135a2565b5b835b81811015613ad25780613abe888261367c565b845260208401935050602081019050613aab565b5050509392505050565b600082601f830112613af157613af0613598565b5b8135613b01848260208601613a73565b91505092915050565b60008083601f840112613b2057613b1f613598565b5b8235905067ffffffffffffffff811115613b3d57613b3c61359d565b5b602083019150836020820283011115613b5957613b586135a2565b5b9250929050565b600080600060408486031215613b7957613b78613558565b5b600084013567ffffffffffffffff811115613b9757613b9661355d565b5b613ba386828701613adc565b935050602084013567ffffffffffffffff811115613bc457613bc361355d565b5b613bd086828701613b0a565b92509250509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613c11816135fd565b82525050565b6000613c238383613c08565b60208301905092915050565b6000602082019050919050565b6000613c4782613bdc565b613c518185613be7565b9350613c5c83613bf8565b8060005b83811015613c8d578151613c748882613c17565b9750613c7f83613c2f565b925050600181019050613c60565b5085935050505092915050565b60006020820190508181036000830152613cb48184613c3c565b905092915050565b600080fd5b600067ffffffffffffffff821115613cdc57613cdb6139cc565b5b613ce5826137a4565b9050602081019050919050565b82818337600083830152505050565b6000613d14613d0f84613cc1565b613a2c565b905082815260208101848484011115613d3057613d2f613cbc565b5b613d3b848285613cf2565b509392505050565b600082601f830112613d5857613d57613598565b5b8135613d68848260208601613d01565b91505092915050565b60008060408385031215613d8857613d87613558565b5b6000613d968582860161367c565b925050602083013567ffffffffffffffff811115613db757613db661355d565b5b613dc385828601613d43565b9150509250929050565b613dd681613562565b82525050565b6000602082019050613df16000830184613dcd565b92915050565b60008115159050919050565b613e0c81613df7565b82525050565b6000602082019050613e276000830184613e03565b92915050565b60008083601f840112613e4357613e42613598565b5b8235905067ffffffffffffffff811115613e6057613e5f61359d565b5b602083019150836001820283011115613e7c57613e7b6135a2565b5b9250929050565b60008083601f840112613e9957613e98613598565b5b8235905067ffffffffffffffff811115613eb657613eb561359d565b5b602083019150836020820283011115613ed257613ed16135a2565b5b9250929050565b60008060008060008060008060a0898b031215613ef957613ef8613558565b5b6000613f078b828c01613583565b985050602089013567ffffffffffffffff811115613f2857613f2761355d565b5b613f348b828c01613e2d565b9750975050604089013567ffffffffffffffff811115613f5757613f5661355d565b5b613f638b828c01613e83565b9550955050606089013567ffffffffffffffff811115613f8657613f8561355d565b5b613f928b828c01613e83565b93509350506080613fa58b828c01613583565b9150509295985092959890939650565b600080600060408486031215613fce57613fcd613558565b5b6000613fdc8682870161367c565b935050602084013567ffffffffffffffff811115613ffd57613ffc61355d565b5b614009868287016135a7565b92509250509250925092565b60008060008060006080868803121561403157614030613558565b5b600061403f8882890161367c565b955050602086013567ffffffffffffffff8111156140605761405f61355d565b5b61406c888289016135a7565b9450945050604061407f8882890161361e565b92505060606140908882890161361e565b9150509295509295909350565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600060e0830160008301516140e1600086018261381a565b5060208301516140f4602086018261381a565b5060408301516141076040860182613c08565b50606083015161411a6060860182613c08565b50608083015161412d6080860182613c08565b5060a083015184820360a086015261414582826137b5565b91505060c083015184820360c086015261415f82826137b5565b9150508091505092915050565b600061417883836140c9565b905092915050565b6000602082019050919050565b60006141988261409d565b6141a281856140a8565b9350836020820285016141b4856140b9565b8060005b858110156141f057848403895281516141d1858261416c565b94506141dc83614180565b925060208a019950506001810190506141b8565b50829750879550505050505092915050565b6000602082019050818103600083015261421c818461418d565b905092915050565b61422d81613653565b82525050565b60006020820190506142486000830184614224565b92915050565b60008060006060848603121561426757614266613558565b5b600061427586828701613583565b93505060206142868682870161367c565b92505060406142978682870161361e565b9150509250925092565b60008083601f8401126142b7576142b6613598565b5b8235905067ffffffffffffffff8111156142d4576142d361359d565b5b6020830191508360608202830111156142f0576142ef6135a2565b5b9250929050565b60008060008060006060868803121561431357614312613558565b5b600086013567ffffffffffffffff8111156143315761433061355d565b5b61433d888289016142a1565b9550955050602086013567ffffffffffffffff8111156143605761435f61355d565b5b61436c888289016135a7565b9350935050604061437f88828901613583565b9150509295509295909350565b6000806000606084860312156143a5576143a4613558565b5b600084013567ffffffffffffffff8111156143c3576143c261355d565b5b6143cf86828701613d43565b93505060206143e08682870161361e565b92505060406143f18682870161367c565b9150509250925092565b60006020828403121561441157614410613558565b5b600061441f8482850161367c565b91505092915050565b600082825260208201905092915050565b7f6f6e6c7920726563656976657220686173207065726d697373696f6e20746f2060008201527f7377617020746f6b656e00000000000000000000000000000000000000000000602082015250565b6000614495602a83614428565b91506144a082614439565b604082019050919050565b600060208201905081810360008301526144c481614488565b9050919050565b7f746f6b656e20737761702070616972206e6f7420666f756e6400000000000000600082015250565b6000614501601983614428565b915061450c826144cb565b602082019050919050565b60006020820190508181036000830152614530816144f4565b9050919050565b7f696e76616c696420616d6f756e74000000000000000000000000000000000000600082015250565b600061456d600e83614428565b915061457882614537565b602082019050919050565b6000602082019050818103600083015261459c81614560565b9050919050565b7f616c726561647920636c61696d65640000000000000000000000000000000000600082015250565b60006145d9600f83614428565b91506145e4826145a3565b602082019050919050565b60006020820190508181036000830152614608816145cc565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f6465706f736974206e6f7420656e6f7567687400000000000000000000000000600082015250565b6000614674601383614428565b915061467f8261463e565b602082019050919050565b600060208201905081810360008301526146a381614667565b9050919050565b6146b3816135fd565b82525050565b60006040820190506146ce6000830185614224565b6146db60208301846146aa565b9392505050565b6146eb81613df7565b81146146f657600080fd5b50565b600081519050614708816146e2565b92915050565b60006020828403121561472457614723613558565b5b6000614732848285016146f9565b91505092915050565b60006060820190506147506000830186614224565b61475d6020830185614224565b61476a60408301846146aa565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006147ac826135fd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156147df576147de614772565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061483157607f821691505b60208210811415614845576148446147ea565b5b50919050565b7f496e76616c696420746f6b656e732f746172676574436861696e49647320696e60008201527f7075740000000000000000000000000000000000000000000000000000000000602082015250565b60006148a7602383614428565b91506148b28261484b565b604082019050919050565b600060208201905081810360008301526148d68161489a565b9050919050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112614909576149086148dd565b5b80840192508235915067ffffffffffffffff82111561492b5761492a6148e2565b5b602083019250600182023603831315614947576149466148e7565b5b509250929050565b60008160601b9050919050565b60006149678261494f565b9050919050565b60006149798261495c565b9050919050565b61499161498c82613653565b61496e565b82525050565b600081905092915050565b60006149ad82613755565b6149b78185614997565b93506149c7818560208601613771565b80840191505092915050565b60006149df8285614980565b6014820191506149ef82846149a2565b91508190509392505050565b600081519050919050565b600081905092915050565b6000614a1c826149fb565b614a268185614a06565b9350614a36818560208601613771565b80840191505092915050565b6000614a4e8284614a11565b915081905092915050565b600081519050614a688161356c565b92915050565b600060208284031215614a8457614a83613558565b5b6000614a9284828501614a59565b91505092915050565b6000604082019050614ab06000830185613dcd565b614abd6020830184614224565b9392505050565b7f4e6f207065726d697373696f6e20746f207472616e736d697400000000000000600082015250565b6000614afa601983614428565b9150614b0582614ac4565b602082019050919050565b60006020820190508181036000830152614b2981614aed565b9050919050565b6000614b3c8385614a06565b9350614b49838584613cf2565b82840190509392505050565b6000614b62828486614b30565b91508190509392505050565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600082015250565b6000614ba4601c83614997565b9150614baf82614b6e565b601c82019050919050565b6000819050919050565b614bd5614bd082613562565b614bba565b82525050565b6000614be682614b97565b9150614bf28284614bc4565b60208201915081905092915050565b600060ff82169050919050565b6000614c1982614c01565b9150614c2483614c01565b92508260ff03821115614c3a57614c39614772565b5b828201905092915050565b7f4e6f207065726d697373696f6e20746f207369676e0000000000000000000000600082015250565b6000614c7b601583614428565b9150614c8682614c45565b602082019050919050565b60006020820190508181036000830152614caa81614c6e565b9050919050565b7f616c7265616479207265636f7264656400000000000000000000000000000000600082015250565b6000614ce7601083614428565b9150614cf282614cb1565b602082019050919050565b60006020820190508181036000830152614d1681614cda565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000614d558383613746565b60208301905092915050565b6000602082019050919050565b6000614d7982614d1d565b614d838185614d28565b9350614d8e83614d39565b8060005b83811015614dbf578151614da68882614d49565b9750614db183614d61565b925050600181019050614d92565b5085935050505092915050565b6000604082019050614de16000830185613dcd565b8181036020830152614df38184614d6e565b90509392505050565b600081519050614e0b81613607565b92915050565b600060208284031215614e2757614e26613558565b5b6000614e3584828501614dfc565b91505092915050565b6000608082019050614e536000830187613dcd565b614e606020830186614224565b614e6d60408301856146aa565b614e7a6060830184613dcd565b95945050505050565b7f496e76616c696420696e70757400000000000000000000000000000000000000600082015250565b6000614eb9600d83614428565b9150614ec482614e83565b602082019050919050565b60006020820190508181036000830152614ee881614eac565b9050919050565b6000614efa826135fd565b9150614f05836135fd565b925082821015614f1857614f17614772565b5b828203905092915050565b7f4e6f207065726d697373696f6e2e000000000000000000000000000000000000600082015250565b6000614f59600e83614428565b9150614f6482614f23565b602082019050919050565b60006020820190508181036000830152614f8881614f4c565b9050919050565b6000604082019050614fa46000830185613dcd565b614fb160208301846146aa565b9392505050565b600067ffffffffffffffff821115614fd357614fd26139cc565b5b602082029050602081019050919050565b6000614ff7614ff284614fb8565b613a2c565b9050808382526020820190506020840283018581111561501a576150196135a2565b5b835b81811015615043578061502f8882614a59565b84526020840193505060208101905061501c565b5050509392505050565b600082601f83011261506257615061613598565b5b8151615072848260208601614fe4565b91505092915050565b600067ffffffffffffffff821115615096576150956139cc565b5b602082029050602081019050919050565b60006150ba6150b58461507b565b613a2c565b905080838252602082019050602084028301858111156150dd576150dc6135a2565b5b835b8181101561510657806150f288826146f9565b8452602084019350506020810190506150df565b5050509392505050565b600082601f83011261512557615124613598565b5b81516151358482602086016150a7565b91505092915050565b6000806000806080858703121561515857615157613558565b5b600061516687828801614dfc565b945050602061517787828801614dfc565b935050604085015167ffffffffffffffff8111156151985761519761355d565b5b6151a48782880161504d565b925050606085015167ffffffffffffffff8111156151c5576151c461355d565b5b6151d187828801615110565b91505092959194509250565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61521281613df7565b82525050565b60006152248383615209565b60208301905092915050565b6000602082019050919050565b6000615248826151dd565b61525281856151e8565b935061525d836151f9565b8060005b8381101561528e5781516152758882615218565b975061528083615230565b925050600181019050615261565b5085935050505092915050565b600060a0820190506152b06000830188613dcd565b6152bd60208301876146aa565b6152ca6040830186613dcd565b81810360608301526152dc8185614d6e565b905081810360808301526152f0818461523d565b90509695505050505050565b7f6661696c656420746f207377617020746f6b656e000000000000000000000000600082015250565b6000615332601483614428565b915061533d826152fc565b602082019050919050565b6000602082019050818103600083015261536181615325565b9050919050565b6000819050919050565b6000819050919050565b600061539761539261538d84615368565b615372565b6135fd565b9050919050565b6153a78161537c565b82525050565b60006040820190506153c26000830185613dcd565b6153cf602083018461539e565b9392505050565b600080fd5b6153e481613829565b81146153ef57600080fd5b50565b600081359050615401816153db565b92915050565b60006040828403121561541d5761541c6153d6565b5b6154276040613a2c565b90506000615437848285016153f2565b600083015250602061544b848285016153f2565b60208301525092915050565b60006040828403121561546d5761546c613558565b5b600061547b84828501615407565b91505092915050565b6000813561549181613665565b80915050919050565b60008160001b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff6154c78461549a565b9350801983169250808416831791505092915050565b60006154f86154f36154ee84613633565b615372565b613633565b9050919050565b600061550a826154dd565b9050919050565b600061551c826154ff565b9050919050565b6000819050919050565b61553682615511565b61554961554282615523565b83546154a7565b8255505050565b6000813561555d816153db565b80915050919050565b600067ffffffffffffffff61557a8461549a565b9350801983169250808416831791505092915050565b60006155ab6155a66155a184613829565b615372565b613829565b9050919050565b6000819050919050565b6155c582615590565b6155d86155d1826155b2565b8354615566565b8255505050565b60008160401b9050919050565b60006fffffffffffffffff0000000000000000615608846155df565b9350801983169250808416831791505092915050565b61562782615590565b61563a615633826155b2565b83546155ec565b8255505050565b60008101600083018061565381615550565b905061565f81846155bc565b50505060008101602083018061567481615550565b9050615680818461561e565b5050505050565b6156918282615641565b5050565b6000810160008301806156a781615484565b90506156b3818461552d565b5050506001810160208301806156c98184615687565b5050505050565b6156da8282615695565b5050565b60006156ea8385614428565b93506156f7838584613cf2565b615700836137a4565b840190509392505050565b60006060820190506157206000830187613dcd565b61572d6020830186614224565b81810360408301526157408184866156de565b905095945050505050565b600061575782846149a2565b915081905092915050565b6000819050919050565b61577d615778826135fd565b615762565b82525050565b600061578f828461576c565b60208201915081905092915050565b60006157aa8284614980565b60148201915081905092915050565b60006060820190506157ce6000830186613dcd565b6157db6020830185613dcd565b6157e86040830184613dcd565b949350505050565b7f496e76616c696420746f6b656e00000000000000000000000000000000000000600082015250565b6000615826600d83614428565b9150615831826157f0565b602082019050919050565b6000602082019050818103600083015261585581615819565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006158b8602683614428565b91506158c38261585c565b604082019050919050565b600060208201905081810360008301526158e7816158ab565b9050919050565b60006158f9826135fd565b9150615904836135fd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561593d5761593c614772565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000615982826135fd565b915061598d836135fd565b92508261599d5761599c615948565b5b828204905092915050565b600080604083850312156159bf576159be613558565b5b60006159cd85828601614dfc565b92505060206159de85828601614a59565b9150509250929050565b60006159f3826135fd565b91506159fe836135fd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115615a3357615a32614772565b5b828201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000615a74602083614428565b9150615a7f82615a3e565b602082019050919050565b60006020820190508181036000830152615aa381615a67565b9050919050565b7f696e76616c6964207377617020726174696f0000000000000000000000000000600082015250565b6000615ae0601283614428565b9150615aeb82615aaa565b602082019050919050565b60006020820190508181036000830152615b0f81615ad3565b9050919050565b615b1f81614c01565b82525050565b6000608082019050615b3a6000830187613dcd565b615b476020830186615b16565b615b546040830185613dcd565b615b616060830184613dcd565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000615bcf601883614428565b9150615bda82615b99565b602082019050919050565b60006020820190508181036000830152615bfe81615bc2565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000615c3b601f83614428565b9150615c4682615c05565b602082019050919050565b60006020820190508181036000830152615c6a81615c2e565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000615ccd602283614428565b9150615cd882615c71565b604082019050919050565b60006020820190508181036000830152615cfc81615cc0565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202776272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000615d5f602283614428565b9150615d6a82615d03565b604082019050919050565b60006020820190508181036000830152615d8e81615d52565b9050919050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b6000615df1602a83614428565b9150615dfc82615d95565b604082019050919050565b60006020820190508181036000830152615e2081615de4565b9050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b6000615e83602683614428565b9150615e8e82615e27565b604082019050919050565b60006020820190508181036000830152615eb281615e76565b9050919050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b6000615eef601d83614428565b9150615efa82615eb9565b602082019050919050565b60006020820190508181036000830152615f1e81615ee2565b9050919050565b6000615f3082613755565b615f3a8185614428565b9350615f4a818560208601613771565b615f53816137a4565b840191505092915050565b60006020820190508181036000830152615f788184615f25565b90509291505056fea2646970667358221220cd14309a537b6d34604d2907a8f5399d4dd61ba224a6fd4064d8f95c5359420864736f6c63430008090033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638a0bb6f911610097578063c045e88711610066578063c045e887146102d1578063cb2b48a5146102ed578063d954863c1461031d578063f2fde38b1461033957610100565b80638a0bb6f9146102375780638da5cb5b14610267578063a6fb97d114610285578063b33ff450146102a157610100565b80634c038c45116100d35780634c038c45146101b157806368591baa146101e1578063715018a6146101fd57806371d0c5ca1461020757610100565b806303b1ccdb146101055780632d0fc6b4146101215780633f19efbe14610151578063446f95b414610181575b600080fd5b61011f600480360381019061011a9190613691565b610355565b005b61013b60048036038101906101369190613719565b610cc9565b60405161014891906139aa565b60405180910390f35b61016b60048036038101906101669190613b60565b610ed3565b6040516101789190613c9a565b60405180910390f35b61019b60048036038101906101969190613d71565b61105a565b6040516101a89190613ddc565b60405180910390f35b6101cb60048036038101906101c69190613719565b6110d5565b6040516101d89190613e12565b60405180910390f35b6101fb60048036038101906101f69190613ed9565b6110f4565b005b6102056115ff565b005b610221600480360381019061021c9190613fb5565b611613565b60405161022e9190613ddc565b60405180910390f35b610251600480360381019061024c9190614015565b611684565b60405161025e9190614202565b60405180910390f35b61026f611a4e565b60405161027c9190614233565b60405180910390f35b61029f600480360381019061029a919061424e565b611a77565b005b6102bb60048036038101906102b69190613691565b611d9e565b6040516102c89190613ddc565b60405180910390f35b6102eb60048036038101906102e691906142f7565b612090565b005b6103076004803603810190610302919061438c565b612467565b6040516103149190613ddc565b60405180910390f35b6103376004803603810190610332919061424e565b612640565b005b610353600480360381019061034e91906143fb565b6129a7565b005b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ba906144ab565b60405180910390fd5b6000600360008781526020019081526020016000206004015490506000801b811415610424576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161041b90614517565b60405180910390fd5b60008311610467576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045e90614583565b60405180910390fd5b6000600360008881526020019081526020016000209050600061048d8388888888611d9e565b90506000600760008381526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610539576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610530906145ef565b60405180910390fd5b848160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600083600201805480602002602001604051908101604052809291908181526020016000905b828210156106a257838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff168152505081525050815260200190600101906105a2565b50505050905060005b815181101561091a5760008560020182815481106106cc576106cb61460f565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600560008e815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060006107d385858151811061076c5761076b61460f565b5b6020026020010151602001516000015167ffffffffffffffff166107c587878151811061079c5761079b61460f565b5b6020026020010151602001516020015167ffffffffffffffff168e612a2b90919063ffffffff16565b612a4190919063ffffffff16565b9050816000015481111561081c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108139061468a565b60405180910390fd5b610833818360000154612a5790919063ffffffff16565b82600001819055508273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8b836040518363ffffffff1660e01b81526004016108769291906146b9565b602060405180830381600087803b15801561089057600080fd5b505af11580156108a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c8919061470e565b507fb0c1e4d18ea737b756410ab0296768c15a87c12eeb368f360ecc5be61a11b4db8a84836040516108fc9392919061473b565b60405180910390a15050508080610912906147a1565b9150506106ab565b506000610a0d856002016000815481106109375761093661460f565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600360008e8152602001908152602001600020600101805461098a90614819565b80601f01602080910402602001604051908101604052809291908181526020018280546109b690614819565b8015610a035780601f106109d857610100808354040283529160200191610a03565b820191906000526020600020905b8154815290600101906020018083116109e657829003601f168201915b505050505061105a565b9050600860008281526020019081526020016000206040518060e0016040528087600201600081548110610a4457610a4361460f565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1681526020018a8152602001438152602001428152602001600360008f81526020019081526020016000206001018054610ae090614819565b80601f0160208091040260200160405190810160405280929190818152602001828054610b0c90614819565b8015610b595780601f10610b2e57610100808354040283529160200191610b59565b820191906000526020600020905b815481529060010190602001808311610b3c57829003601f168201915b505050505081526020018c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050815250908060018154018082558091505060019003906000526020600020906007020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020155606082015181600301556080820151816004015560a0820151816005019080519060200190610c9c929190613384565b5060c0820151816006019080519060200190610cb9929190613384565b5050505050505050505050505050565b610cd161340a565b600360008381526020019081526020016000206040518060a001604052908160008201548152602001600182018054610d0990614819565b80601f0160208091040260200160405190810160405280929190818152602001828054610d3590614819565b8015610d825780601f10610d5757610100808354040283529160200191610d82565b820191906000526020600020905b815481529060010190602001808311610d6557829003601f168201915b5050505050815260200160028201805480602002602001604051908101604052809291908181526020016000905b82821015610eb057838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250508152505081526020019060010190610db0565b505050508152602001600382015481526020016004820154815250509050919050565b606082829050845114610f1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f12906148bd565b60405180910390fd5b6000845167ffffffffffffffff811115610f3857610f376139cc565b5b604051908082528060200260200182016040528015610f665781602001602082028036833780820191505090505b50905060005b855181101561104e576000611002878381518110610f8d57610f8c61460f565b5b6020026020010151878785818110610fa857610fa761460f565b5b9050602002810190610fba91906148ec565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061105a565b9050600860008281526020019081526020016000208054905083838151811061102e5761102d61460f565b5b602002602001018181525050508080611046906147a1565b915050610f6c565b50809150509392505050565b6000600283836040516020016110719291906149d3565b60405160208183030381529060405260405161108d9190614a42565b602060405180830381855afa1580156110aa573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906110cd9190614a6e565b905092915050565b6000806006600084815260200190815260200160002054119050919050565b6000600360008a81526020019081526020016000209050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323c849858260030154336040518363ffffffff1660e01b815260040161116c929190614a9b565b60206040518083038186803b15801561118457600080fd5b505afa158015611198573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111bc919061470e565b6111fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f290614b10565b60405180910390fd5b60005b868690508110156113b7576000898960405161121b929190614b55565b60405180910390206040516020016112339190614bdb565b60405160208183030381529060405280519060200120905060006112b082601b8786602081106112665761126561460f565b5b1a60f81b60f81c6112779190614c0e565b8b8b8781811061128a5761128961460f565b5b905060200201358a8a888181106112a4576112a361460f565b5b90506020020135612a6d565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323c849858560030154836040518363ffffffff1660e01b8152600401611313929190614a9b565b60206040518083038186803b15801561132b57600080fd5b505afa15801561133f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611363919061470e565b6113a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161139990614c91565b60405180910390fd5b505080806113af906147a1565b9150506111fe565b506000806114088a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050612a98565b915091506000600167ffffffffffffffff811115611429576114286139cc565b5b6040519080825280602002602001820160405280156114575781602001602082028036833780820191505090505b509050818160008151811061146f5761146e61460f565b5b60200260200101818152505060006006600084815260200190815260200160002054146114d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c890614cfd565b60405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637d9778368660040154846040518363ffffffff1660e01b8152600401611534929190614dcc565b602060405180830381600087803b15801561154e57600080fd5b505af1158015611562573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115869190614e11565b905061159c600182612abc90919063ffffffff16565b60066000858152602001908152602001600020819055507f6319bf84e3d2c97dd1991c07818c14950ceb6f48ce6d85f063be3c60905ea1b98d3386866040516115e89493929190614e3e565b60405180910390a150505050505050505050505050565b611607612ad2565b6116116000612b50565b565b6000806116648585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061105a565b905060046000828152602001908152602001600020549150509392505050565b606060006116d68787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061105a565b9050600860008281526020019081526020016000208054905083111580156116fe5750600084115b61173d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173490614ecf565b60405180910390fd5b600061176560016117578787612a5790919063ffffffff16565b612abc90919063ffffffff16565b90508067ffffffffffffffff811115611781576117806139cc565b5b6040519080825280602002602001820160405280156117ba57816020015b6117a7613442565b81526020019060019003908161179f5790505b50925060006001866117cc9190614eef565b90505b84811015611a42576008600084815260200190815260200160002081815481106117fc576117fb61460f565b5b90600052602060002090600702016040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016002820154815260200160038201548152602001600482015481526020016005820180546118ef90614819565b80601f016020809104026020016040519081016040528092919081815260200182805461191b90614819565b80156119685780601f1061193d57610100808354040283529160200191611968565b820191906000526020600020905b81548152906001019060200180831161194b57829003601f168201915b5050505050815260200160068201805461198190614819565b80601f01602080910402602001604051908101604052809291908181526020018280546119ad90614819565b80156119fa5780601f106119cf576101008083540402835291602001916119fa565b820191906000526020600020905b8154815290600101906020018083116119dd57829003601f168201915b505050505081525050848281518110611a1657611a1561460f565b5b60200260200101819052508080611a2c906147a1565b9150508080611a3a906147a1565b9150506117cf565b50505095945050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600360008581526020019081526020016000209050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639a96679e8260030154336040518363ffffffff1660e01b8152600401611aef929190614a9b565b60206040518083038186803b158015611b0757600080fd5b505afa158015611b1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b3f919061470e565b611b7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7590614f6f565b60405180910390fd5b611caf8382600201805480602002602001604051908101604052809291908181526020016000905b82821015611ca657838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250508152505081526020019060010190611ba6565b50505050612c14565b50611d16826005600087815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154612a5790919063ffffffff16565b6005600086815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550611d9833838573ffffffffffffffffffffffffffffffffffffffff16612ca09092919063ffffffff16565b50505050565b60006060806000611df488888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508787612467565b90506000611e1f60016006600085815260200190815260200160002054612a5790919063ffffffff16565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631b32d71a8b836040518363ffffffff1660e01b8152600401611e7e929190614f8f565b60006040518083038186803b158015611e9657600080fd5b505afa158015611eaa573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190611ed3919061513e565b909192509091508094508195505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631669b10e8b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fd2973ca8e866040518363ffffffff1660e01b8152600401611f7e929190614f8f565b60206040518083038186803b158015611f9657600080fd5b505afa158015611faa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fce9190614e11565b8588886040518663ffffffff1660e01b8152600401611ff195949392919061529b565b60206040518083038186803b15801561200957600080fd5b505afa15801561201d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612041919061470e565b612080576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161207790615348565b60405180910390fd5b8194505050505095945050505050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166376e2775583336040518363ffffffff1660e01b81526004016120ef929190614a9b565b60206040518083038186803b15801561210757600080fd5b505afa15801561211b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061213f919061470e565b905080612181576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161217890614f6f565b60405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632a99732a84600a6040518363ffffffff1660e01b81526004016121e19291906153ad565b602060405180830381600087803b1580156121fb57600080fd5b505af115801561220f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122339190614a6e565b905060008036604051612247929190614b55565b604051809103902090506000888860008181106122675761226661460f565b5b905060600201600001602081019061227f91906143fb565b905084600360008481526020019081526020016000206003018190555082600360008481526020019081526020016000206004018190555081600360008481526020019081526020016000206000018190555086866003600085815260200190815260200160002060010191906122f79291906134ab565b5060006123488289898080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061105a565b905082600460008381526020019081526020016000208190555060005b8a8a905081101561241d576123a48b8b838181106123865761238561460f565b5b90506060020160200180360381019061239f9190615457565b612d26565b600360008581526020019081526020016000206002018b8b838181106123cd576123cc61460f565b5b9050606002019080600181540180825580915050600190039060005260206000209060020201600090919091909150818161240891906156d0565b50508080612415906147a1565b915050612365565b507f909c724b9d08d0463115fc7fa6d2c8e51e6eafa867725be497bdb9a53a6cac4f83838a8a604051612453949392919061570b565b60405180910390a150505050505050505050565b60008060028560405160200161247d919061574b565b6040516020818303038152906040526040516124999190614a42565b602060405180830381855afa1580156124b6573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906124d99190614a6e565b905060006002856040516020016124f09190615783565b60405160208183030381529060405260405161250c9190614a42565b602060405180830381855afa158015612529573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061254c9190614a6e565b90506000600285604051602001612563919061579e565b60405160208183030381529060405260405161257f9190614a42565b602060405180830381855afa15801561259c573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906125bf9190614a6e565b905060028383836040516020016125d8939291906157b9565b6040516020818303038152906040526040516125f49190614a42565b602060405180830381855afa158015612611573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906126349190614a6e565b93505050509392505050565b6000600360008581526020019081526020016000209050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639a96679e8260030154336040518363ffffffff1660e01b81526004016126b8929190614a9b565b60206040518083038186803b1580156126d057600080fd5b505afa1580156126e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612708919061470e565b612747576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161273e90614f6f565b60405180910390fd5b6128788382600201805480602002602001604051908101604052809291908181526020016000905b8282101561286f57838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681525050815250508152602001906001019061276f565b50505050612c14565b6128b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128ae9061583c565b60405180910390fd5b6128e43330848673ffffffffffffffffffffffffffffffffffffffff16612d94909392919063ffffffff16565b61294a826005600087815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154612abc90919063ffffffff16565b6005600086815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555050505050565b6129af612ad2565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612a1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a16906158ce565b60405180910390fd5b612a2881612b50565b50565b60008183612a3991906158ee565b905092915050565b60008183612a4f9190615977565b905092915050565b60008183612a659190614eef565b905092915050565b6000806000612a7e87878787612e1d565b91509150612a8b81612f2a565b8192505050949350505050565b60008082806020019051810190612aaf91906159a8565b8092508193505050915091565b60008183612aca91906159e8565b905092915050565b612ada6130ff565b73ffffffffffffffffffffffffffffffffffffffff16612af8611a4e565b73ffffffffffffffffffffffffffffffffffffffff1614612b4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b4590615a8a565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080600090505b8251811015612c94578373ffffffffffffffffffffffffffffffffffffffff16838281518110612c4f57612c4e61460f565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff161415612c81576001915050612c9a565b8080612c8c906147a1565b915050612c1c565b50600090505b92915050565b612d218363a9059cbb60e01b8484604051602401612cbf9291906146b9565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613107565b505050565b6000816000015167ffffffffffffffff16118015612d5257506000816020015167ffffffffffffffff16115b612d91576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d8890615af6565b60405180910390fd5b50565b612e17846323b872dd60e01b858585604051602401612db59392919061473b565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050613107565b50505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115612e58576000600391509150612f21565b601b8560ff1614158015612e705750601c8560ff1614155b15612e82576000600491509150612f21565b600060018787878760405160008152602001604052604051612ea79493929190615b25565b6020604051602081039080840390855afa158015612ec9573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612f1857600060019250925050612f21565b80600092509250505b94509492505050565b60006004811115612f3e57612f3d615b6a565b5b816004811115612f5157612f50615b6a565b5b1415612f5c576130fc565b60016004811115612f7057612f6f615b6a565b5b816004811115612f8357612f82615b6a565b5b1415612fc4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612fbb90615be5565b60405180910390fd5b60026004811115612fd857612fd7615b6a565b5b816004811115612feb57612fea615b6a565b5b141561302c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161302390615c51565b60405180910390fd5b600360048111156130405761303f615b6a565b5b81600481111561305357613052615b6a565b5b1415613094576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161308b90615ce3565b60405180910390fd5b6004808111156130a7576130a6615b6a565b5b8160048111156130ba576130b9615b6a565b5b14156130fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130f290615d75565b60405180910390fd5b5b50565b600033905090565b6000613169826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166131ce9092919063ffffffff16565b90506000815111156131c95780806020019051810190613189919061470e565b6131c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131bf90615e07565b60405180910390fd5b5b505050565b60606131dd84846000856131e6565b90509392505050565b60608247101561322b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161322290615e99565b60405180910390fd5b613234856132fa565b613273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161326a90615f05565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161329c9190614a42565b60006040518083038185875af1925050503d80600081146132d9576040519150601f19603f3d011682016040523d82523d6000602084013e6132de565b606091505b50915091506132ee82828661331d565b92505050949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6060831561332d5782905061337d565b6000835111156133405782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133749190615f5e565b60405180910390fd5b9392505050565b82805461339090614819565b90600052602060002090601f0160209004810192826133b257600085556133f9565b82601f106133cb57805160ff19168380011785556133f9565b828001600101855582156133f9579182015b828111156133f85782518255916020019190600101906133dd565b5b5090506134069190613531565b5090565b6040518060a0016040528060008019168152602001606081526020016060815260200160008019168152602001600080191681525090565b6040518060e00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160608152602001606081525090565b8280546134b790614819565b90600052602060002090601f0160209004810192826134d95760008555613520565b82601f106134f257803560ff1916838001178555613520565b82800160010185558215613520579182015b8281111561351f578235825591602001919060010190613504565b5b50905061352d9190613531565b5090565b5b8082111561354a576000816000905550600101613532565b5090565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b61357581613562565b811461358057600080fd5b50565b6000813590506135928161356c565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f8401126135bd576135bc613598565b5b8235905067ffffffffffffffff8111156135da576135d961359d565b5b6020830191508360018202830111156135f6576135f56135a2565b5b9250929050565b6000819050919050565b613610816135fd565b811461361b57600080fd5b50565b60008135905061362d81613607565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061365e82613633565b9050919050565b61366e81613653565b811461367957600080fd5b50565b60008135905061368b81613665565b92915050565b6000806000806000608086880312156136ad576136ac613558565b5b60006136bb88828901613583565b955050602086013567ffffffffffffffff8111156136dc576136db61355d565b5b6136e8888289016135a7565b945094505060406136fb8882890161361e565b925050606061370c8882890161367c565b9150509295509295909350565b60006020828403121561372f5761372e613558565b5b600061373d84828501613583565b91505092915050565b61374f81613562565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561378f578082015181840152602081019050613774565b8381111561379e576000848401525b50505050565b6000601f19601f8301169050919050565b60006137c082613755565b6137ca8185613760565b93506137da818560208601613771565b6137e3816137a4565b840191505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61382381613653565b82525050565b600067ffffffffffffffff82169050919050565b61384681613829565b82525050565b604082016000820151613862600085018261383d565b506020820151613875602085018261383d565b50505050565b606082016000820151613891600085018261381a565b5060208201516138a4602085018261384c565b50505050565b60006138b6838361387b565b60608301905092915050565b6000602082019050919050565b60006138da826137ee565b6138e481856137f9565b93506138ef8361380a565b8060005b8381101561392057815161390788826138aa565b9750613912836138c2565b9250506001810190506138f3565b5085935050505092915050565b600060a0830160008301516139456000860182613746565b506020830151848203602086015261395d82826137b5565b9150506040830151848203604086015261397782826138cf565b915050606083015161398c6060860182613746565b50608083015161399f6080860182613746565b508091505092915050565b600060208201905081810360008301526139c4818461392d565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613a04826137a4565b810181811067ffffffffffffffff82111715613a2357613a226139cc565b5b80604052505050565b6000613a3661354e565b9050613a4282826139fb565b919050565b600067ffffffffffffffff821115613a6257613a616139cc565b5b602082029050602081019050919050565b6000613a86613a8184613a47565b613a2c565b90508083825260208201905060208402830185811115613aa957613aa86135a2565b5b835b81811015613ad25780613abe888261367c565b845260208401935050602081019050613aab565b5050509392505050565b600082601f830112613af157613af0613598565b5b8135613b01848260208601613a73565b91505092915050565b60008083601f840112613b2057613b1f613598565b5b8235905067ffffffffffffffff811115613b3d57613b3c61359d565b5b602083019150836020820283011115613b5957613b586135a2565b5b9250929050565b600080600060408486031215613b7957613b78613558565b5b600084013567ffffffffffffffff811115613b9757613b9661355d565b5b613ba386828701613adc565b935050602084013567ffffffffffffffff811115613bc457613bc361355d565b5b613bd086828701613b0a565b92509250509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613c11816135fd565b82525050565b6000613c238383613c08565b60208301905092915050565b6000602082019050919050565b6000613c4782613bdc565b613c518185613be7565b9350613c5c83613bf8565b8060005b83811015613c8d578151613c748882613c17565b9750613c7f83613c2f565b925050600181019050613c60565b5085935050505092915050565b60006020820190508181036000830152613cb48184613c3c565b905092915050565b600080fd5b600067ffffffffffffffff821115613cdc57613cdb6139cc565b5b613ce5826137a4565b9050602081019050919050565b82818337600083830152505050565b6000613d14613d0f84613cc1565b613a2c565b905082815260208101848484011115613d3057613d2f613cbc565b5b613d3b848285613cf2565b509392505050565b600082601f830112613d5857613d57613598565b5b8135613d68848260208601613d01565b91505092915050565b60008060408385031215613d8857613d87613558565b5b6000613d968582860161367c565b925050602083013567ffffffffffffffff811115613db757613db661355d565b5b613dc385828601613d43565b9150509250929050565b613dd681613562565b82525050565b6000602082019050613df16000830184613dcd565b92915050565b60008115159050919050565b613e0c81613df7565b82525050565b6000602082019050613e276000830184613e03565b92915050565b60008083601f840112613e4357613e42613598565b5b8235905067ffffffffffffffff811115613e6057613e5f61359d565b5b602083019150836001820283011115613e7c57613e7b6135a2565b5b9250929050565b60008083601f840112613e9957613e98613598565b5b8235905067ffffffffffffffff811115613eb657613eb561359d565b5b602083019150836020820283011115613ed257613ed16135a2565b5b9250929050565b60008060008060008060008060a0898b031215613ef957613ef8613558565b5b6000613f078b828c01613583565b985050602089013567ffffffffffffffff811115613f2857613f2761355d565b5b613f348b828c01613e2d565b9750975050604089013567ffffffffffffffff811115613f5757613f5661355d565b5b613f638b828c01613e83565b9550955050606089013567ffffffffffffffff811115613f8657613f8561355d565b5b613f928b828c01613e83565b93509350506080613fa58b828c01613583565b9150509295985092959890939650565b600080600060408486031215613fce57613fcd613558565b5b6000613fdc8682870161367c565b935050602084013567ffffffffffffffff811115613ffd57613ffc61355d565b5b614009868287016135a7565b92509250509250925092565b60008060008060006080868803121561403157614030613558565b5b600061403f8882890161367c565b955050602086013567ffffffffffffffff8111156140605761405f61355d565b5b61406c888289016135a7565b9450945050604061407f8882890161361e565b92505060606140908882890161361e565b9150509295509295909350565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600060e0830160008301516140e1600086018261381a565b5060208301516140f4602086018261381a565b5060408301516141076040860182613c08565b50606083015161411a6060860182613c08565b50608083015161412d6080860182613c08565b5060a083015184820360a086015261414582826137b5565b91505060c083015184820360c086015261415f82826137b5565b9150508091505092915050565b600061417883836140c9565b905092915050565b6000602082019050919050565b60006141988261409d565b6141a281856140a8565b9350836020820285016141b4856140b9565b8060005b858110156141f057848403895281516141d1858261416c565b94506141dc83614180565b925060208a019950506001810190506141b8565b50829750879550505050505092915050565b6000602082019050818103600083015261421c818461418d565b905092915050565b61422d81613653565b82525050565b60006020820190506142486000830184614224565b92915050565b60008060006060848603121561426757614266613558565b5b600061427586828701613583565b93505060206142868682870161367c565b92505060406142978682870161361e565b9150509250925092565b60008083601f8401126142b7576142b6613598565b5b8235905067ffffffffffffffff8111156142d4576142d361359d565b5b6020830191508360608202830111156142f0576142ef6135a2565b5b9250929050565b60008060008060006060868803121561431357614312613558565b5b600086013567ffffffffffffffff8111156143315761433061355d565b5b61433d888289016142a1565b9550955050602086013567ffffffffffffffff8111156143605761435f61355d565b5b61436c888289016135a7565b9350935050604061437f88828901613583565b9150509295509295909350565b6000806000606084860312156143a5576143a4613558565b5b600084013567ffffffffffffffff8111156143c3576143c261355d565b5b6143cf86828701613d43565b93505060206143e08682870161361e565b92505060406143f18682870161367c565b9150509250925092565b60006020828403121561441157614410613558565b5b600061441f8482850161367c565b91505092915050565b600082825260208201905092915050565b7f6f6e6c7920726563656976657220686173207065726d697373696f6e20746f2060008201527f7377617020746f6b656e00000000000000000000000000000000000000000000602082015250565b6000614495602a83614428565b91506144a082614439565b604082019050919050565b600060208201905081810360008301526144c481614488565b9050919050565b7f746f6b656e20737761702070616972206e6f7420666f756e6400000000000000600082015250565b6000614501601983614428565b915061450c826144cb565b602082019050919050565b60006020820190508181036000830152614530816144f4565b9050919050565b7f696e76616c696420616d6f756e74000000000000000000000000000000000000600082015250565b600061456d600e83614428565b915061457882614537565b602082019050919050565b6000602082019050818103600083015261459c81614560565b9050919050565b7f616c726561647920636c61696d65640000000000000000000000000000000000600082015250565b60006145d9600f83614428565b91506145e4826145a3565b602082019050919050565b60006020820190508181036000830152614608816145cc565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f6465706f736974206e6f7420656e6f7567687400000000000000000000000000600082015250565b6000614674601383614428565b915061467f8261463e565b602082019050919050565b600060208201905081810360008301526146a381614667565b9050919050565b6146b3816135fd565b82525050565b60006040820190506146ce6000830185614224565b6146db60208301846146aa565b9392505050565b6146eb81613df7565b81146146f657600080fd5b50565b600081519050614708816146e2565b92915050565b60006020828403121561472457614723613558565b5b6000614732848285016146f9565b91505092915050565b60006060820190506147506000830186614224565b61475d6020830185614224565b61476a60408301846146aa565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006147ac826135fd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156147df576147de614772565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061483157607f821691505b60208210811415614845576148446147ea565b5b50919050565b7f496e76616c696420746f6b656e732f746172676574436861696e49647320696e60008201527f7075740000000000000000000000000000000000000000000000000000000000602082015250565b60006148a7602383614428565b91506148b28261484b565b604082019050919050565b600060208201905081810360008301526148d68161489a565b9050919050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112614909576149086148dd565b5b80840192508235915067ffffffffffffffff82111561492b5761492a6148e2565b5b602083019250600182023603831315614947576149466148e7565b5b509250929050565b60008160601b9050919050565b60006149678261494f565b9050919050565b60006149798261495c565b9050919050565b61499161498c82613653565b61496e565b82525050565b600081905092915050565b60006149ad82613755565b6149b78185614997565b93506149c7818560208601613771565b80840191505092915050565b60006149df8285614980565b6014820191506149ef82846149a2565b91508190509392505050565b600081519050919050565b600081905092915050565b6000614a1c826149fb565b614a268185614a06565b9350614a36818560208601613771565b80840191505092915050565b6000614a4e8284614a11565b915081905092915050565b600081519050614a688161356c565b92915050565b600060208284031215614a8457614a83613558565b5b6000614a9284828501614a59565b91505092915050565b6000604082019050614ab06000830185613dcd565b614abd6020830184614224565b9392505050565b7f4e6f207065726d697373696f6e20746f207472616e736d697400000000000000600082015250565b6000614afa601983614428565b9150614b0582614ac4565b602082019050919050565b60006020820190508181036000830152614b2981614aed565b9050919050565b6000614b3c8385614a06565b9350614b49838584613cf2565b82840190509392505050565b6000614b62828486614b30565b91508190509392505050565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600082015250565b6000614ba4601c83614997565b9150614baf82614b6e565b601c82019050919050565b6000819050919050565b614bd5614bd082613562565b614bba565b82525050565b6000614be682614b97565b9150614bf28284614bc4565b60208201915081905092915050565b600060ff82169050919050565b6000614c1982614c01565b9150614c2483614c01565b92508260ff03821115614c3a57614c39614772565b5b828201905092915050565b7f4e6f207065726d697373696f6e20746f207369676e0000000000000000000000600082015250565b6000614c7b601583614428565b9150614c8682614c45565b602082019050919050565b60006020820190508181036000830152614caa81614c6e565b9050919050565b7f616c7265616479207265636f7264656400000000000000000000000000000000600082015250565b6000614ce7601083614428565b9150614cf282614cb1565b602082019050919050565b60006020820190508181036000830152614d1681614cda565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000614d558383613746565b60208301905092915050565b6000602082019050919050565b6000614d7982614d1d565b614d838185614d28565b9350614d8e83614d39565b8060005b83811015614dbf578151614da68882614d49565b9750614db183614d61565b925050600181019050614d92565b5085935050505092915050565b6000604082019050614de16000830185613dcd565b8181036020830152614df38184614d6e565b90509392505050565b600081519050614e0b81613607565b92915050565b600060208284031215614e2757614e26613558565b5b6000614e3584828501614dfc565b91505092915050565b6000608082019050614e536000830187613dcd565b614e606020830186614224565b614e6d60408301856146aa565b614e7a6060830184613dcd565b95945050505050565b7f496e76616c696420696e70757400000000000000000000000000000000000000600082015250565b6000614eb9600d83614428565b9150614ec482614e83565b602082019050919050565b60006020820190508181036000830152614ee881614eac565b9050919050565b6000614efa826135fd565b9150614f05836135fd565b925082821015614f1857614f17614772565b5b828203905092915050565b7f4e6f207065726d697373696f6e2e000000000000000000000000000000000000600082015250565b6000614f59600e83614428565b9150614f6482614f23565b602082019050919050565b60006020820190508181036000830152614f8881614f4c565b9050919050565b6000604082019050614fa46000830185613dcd565b614fb160208301846146aa565b9392505050565b600067ffffffffffffffff821115614fd357614fd26139cc565b5b602082029050602081019050919050565b6000614ff7614ff284614fb8565b613a2c565b9050808382526020820190506020840283018581111561501a576150196135a2565b5b835b81811015615043578061502f8882614a59565b84526020840193505060208101905061501c565b5050509392505050565b600082601f83011261506257615061613598565b5b8151615072848260208601614fe4565b91505092915050565b600067ffffffffffffffff821115615096576150956139cc565b5b602082029050602081019050919050565b60006150ba6150b58461507b565b613a2c565b905080838252602082019050602084028301858111156150dd576150dc6135a2565b5b835b8181101561510657806150f288826146f9565b8452602084019350506020810190506150df565b5050509392505050565b600082601f83011261512557615124613598565b5b81516151358482602086016150a7565b91505092915050565b6000806000806080858703121561515857615157613558565b5b600061516687828801614dfc565b945050602061517787828801614dfc565b935050604085015167ffffffffffffffff8111156151985761519761355d565b5b6151a48782880161504d565b925050606085015167ffffffffffffffff8111156151c5576151c461355d565b5b6151d187828801615110565b91505092959194509250565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61521281613df7565b82525050565b60006152248383615209565b60208301905092915050565b6000602082019050919050565b6000615248826151dd565b61525281856151e8565b935061525d836151f9565b8060005b8381101561528e5781516152758882615218565b975061528083615230565b925050600181019050615261565b5085935050505092915050565b600060a0820190506152b06000830188613dcd565b6152bd60208301876146aa565b6152ca6040830186613dcd565b81810360608301526152dc8185614d6e565b905081810360808301526152f0818461523d565b90509695505050505050565b7f6661696c656420746f207377617020746f6b656e000000000000000000000000600082015250565b6000615332601483614428565b915061533d826152fc565b602082019050919050565b6000602082019050818103600083015261536181615325565b9050919050565b6000819050919050565b6000819050919050565b600061539761539261538d84615368565b615372565b6135fd565b9050919050565b6153a78161537c565b82525050565b60006040820190506153c26000830185613dcd565b6153cf602083018461539e565b9392505050565b600080fd5b6153e481613829565b81146153ef57600080fd5b50565b600081359050615401816153db565b92915050565b60006040828403121561541d5761541c6153d6565b5b6154276040613a2c565b90506000615437848285016153f2565b600083015250602061544b848285016153f2565b60208301525092915050565b60006040828403121561546d5761546c613558565b5b600061547b84828501615407565b91505092915050565b6000813561549181613665565b80915050919050565b60008160001b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff6154c78461549a565b9350801983169250808416831791505092915050565b60006154f86154f36154ee84613633565b615372565b613633565b9050919050565b600061550a826154dd565b9050919050565b600061551c826154ff565b9050919050565b6000819050919050565b61553682615511565b61554961554282615523565b83546154a7565b8255505050565b6000813561555d816153db565b80915050919050565b600067ffffffffffffffff61557a8461549a565b9350801983169250808416831791505092915050565b60006155ab6155a66155a184613829565b615372565b613829565b9050919050565b6000819050919050565b6155c582615590565b6155d86155d1826155b2565b8354615566565b8255505050565b60008160401b9050919050565b60006fffffffffffffffff0000000000000000615608846155df565b9350801983169250808416831791505092915050565b61562782615590565b61563a615633826155b2565b83546155ec565b8255505050565b60008101600083018061565381615550565b905061565f81846155bc565b50505060008101602083018061567481615550565b9050615680818461561e565b5050505050565b6156918282615641565b5050565b6000810160008301806156a781615484565b90506156b3818461552d565b5050506001810160208301806156c98184615687565b5050505050565b6156da8282615695565b5050565b60006156ea8385614428565b93506156f7838584613cf2565b615700836137a4565b840190509392505050565b60006060820190506157206000830187613dcd565b61572d6020830186614224565b81810360408301526157408184866156de565b905095945050505050565b600061575782846149a2565b915081905092915050565b6000819050919050565b61577d615778826135fd565b615762565b82525050565b600061578f828461576c565b60208201915081905092915050565b60006157aa8284614980565b60148201915081905092915050565b60006060820190506157ce6000830186613dcd565b6157db6020830185613dcd565b6157e86040830184613dcd565b949350505050565b7f496e76616c696420746f6b656e00000000000000000000000000000000000000600082015250565b6000615826600d83614428565b9150615831826157f0565b602082019050919050565b6000602082019050818103600083015261585581615819565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006158b8602683614428565b91506158c38261585c565b604082019050919050565b600060208201905081810360008301526158e7816158ab565b9050919050565b60006158f9826135fd565b9150615904836135fd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561593d5761593c614772565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000615982826135fd565b915061598d836135fd565b92508261599d5761599c615948565b5b828204905092915050565b600080604083850312156159bf576159be613558565b5b60006159cd85828601614dfc565b92505060206159de85828601614a59565b9150509250929050565b60006159f3826135fd565b91506159fe836135fd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115615a3357615a32614772565b5b828201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000615a74602083614428565b9150615a7f82615a3e565b602082019050919050565b60006020820190508181036000830152615aa381615a67565b9050919050565b7f696e76616c6964207377617020726174696f0000000000000000000000000000600082015250565b6000615ae0601283614428565b9150615aeb82615aaa565b602082019050919050565b60006020820190508181036000830152615b0f81615ad3565b9050919050565b615b1f81614c01565b82525050565b6000608082019050615b3a6000830187613dcd565b615b476020830186615b16565b615b546040830185613dcd565b615b616060830184613dcd565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000615bcf601883614428565b9150615bda82615b99565b602082019050919050565b60006020820190508181036000830152615bfe81615bc2565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000615c3b601f83614428565b9150615c4682615c05565b602082019050919050565b60006020820190508181036000830152615c6a81615c2e565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000615ccd602283614428565b9150615cd882615c71565b604082019050919050565b60006020820190508181036000830152615cfc81615cc0565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202776272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000615d5f602283614428565b9150615d6a82615d03565b604082019050919050565b60006020820190508181036000830152615d8e81615d52565b9050919050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b6000615df1602a83614428565b9150615dfc82615d95565b604082019050919050565b60006020820190508181036000830152615e2081615de4565b9050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b6000615e83602683614428565b9150615e8e82615e27565b604082019050919050565b60006020820190508181036000830152615eb281615e76565b9050919050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b6000615eef601d83614428565b9150615efa82615eb9565b602082019050919050565b60006020820190508181036000830152615f1e81615ee2565b9050919050565b6000615f3082613755565b615f3a8185614428565b9350615f4a818560208601613771565b615f53816137a4565b840191505092915050565b60006020820190508181036000830152615f788184615f25565b90509291505056fea2646970667358221220cd14309a537b6d34604d2907a8f5399d4dd61ba224a6fd4064d8f95c5359420864736f6c63430008090033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs index 8870bfec..fd2216b5 100644 --- a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs +++ b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs @@ -31,7 +31,7 @@ public class TransmitTransactionProvider : AbpRedisCache, ITransmitTransactionPr private readonly INethereumService _nethereumService; private readonly BlockConfirmationOptions _blockConfirmationOptions; private readonly AElfChainAliasOptions _aelfChainAliasOption; - public EthereumChainAliasOptions _ethereumAElfChainAliasOptions; + private readonly EthereumChainAliasOptions _ethereumAElfChainAliasOptions; public ILogger Logger { get; set; } private const string TransmitSendingQueue = "TransmitSendingQueue"; @@ -88,9 +88,9 @@ public async Task SendByLibAsync(string chainId, string libHash, long libHeight) break; } - Logger.LogError($"Send Transmit transaction. TxId: {sendResult}"); item.TransactionId = sendResult; await EnqueueAsync(GetQueueName(TransmitCheckingQueue,item.ChainId), item); + Logger.LogInformation($"Send Transmit transaction. TxId: {sendResult}"); } } @@ -130,6 +130,8 @@ public async Task UpdateQueueAsync(string chainId) await DequeueAsync(GetQueueName(TransmitCheckingQueue,chainId)); item = await GetFirstItemAsync(GetQueueName(TransmitCheckingQueue,chainId)); + Logger.LogInformation($"Transmit transaction finished. TxId: {item.TransactionId}"); + } } diff --git a/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs index 3bbbc133..14d94fd4 100644 --- a/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs +++ b/src/AElf.EventHandler/Workers/ReceiptSyncWorker.cs @@ -1,20 +1,6 @@ -using System.Collections.Generic; -using System.Linq; -using System.Numerics; using System.Threading.Tasks; -using AElf.Client.Bridge; -using AElf.Client.Core.Options; -using AElf.Client.MerkleTreeContract; -using AElf.Client.Oracle; -using AElf.Contracts.MerkleTreeContract; -using AElf.Contracts.Oracle; -using AElf.Nethereum.Bridge; -using AElf.Nethereum.Core; -using AElf.Types; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using Nethereum.RPC.Eth.Blocks; using Volo.Abp.BackgroundWorkers; using Volo.Abp.Threading; diff --git a/src/AElf.PriceWorker/PriceSyncOptions.cs b/src/AElf.PriceWorker/PriceSyncOptions.cs index ecf85b8b..9a59fa72 100644 --- a/src/AElf.PriceWorker/PriceSyncOptions.cs +++ b/src/AElf.PriceWorker/PriceSyncOptions.cs @@ -11,5 +11,6 @@ public class PriceSyncOptions public class ChainItem { public string ChainId { get; set; } + public string ChainType { get; set; } public string NativeToken { get; set; } } \ No newline at end of file diff --git a/src/AElf.PriceWorker/PriceSyncWorker.cs b/src/AElf.PriceWorker/PriceSyncWorker.cs index e6c2cd26..f7ac52df 100644 --- a/src/AElf.PriceWorker/PriceSyncWorker.cs +++ b/src/AElf.PriceWorker/PriceSyncWorker.cs @@ -6,6 +6,7 @@ using AElf.TokenPrice; using Google.Protobuf.WellKnownTypes; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Volo.Abp.BackgroundWorkers; using Volo.Abp.Threading; @@ -34,6 +35,7 @@ public PriceSyncWorker(AbpAsyncTimer timer, IServiceScopeFactory serviceScopeFac protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) { + Logger.LogInformation($"================"); var setGasPriceInput = new SetGasPriceInput(); var setPriceRatioInput = new SetPriceRatioInput(); @@ -41,7 +43,7 @@ protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext worker foreach (var item in _priceSyncOptions.SourceChains) { - var gasFee = await _blockchainTransactionFeeService.GetTransactionFeeAsync(item.ChainId); + var gasFee = await _blockchainTransactionFeeService.GetTransactionFeeAsync(item.ChainType); var feeWei = (long)(gasFee.Fee * (decimal)Math.Pow(10, 9)); setGasPriceInput.GasPriceList.Add(new GasPrice { @@ -57,30 +59,6 @@ protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext worker PriceRatio_ = ratio }); } - // - // setGasPriceInput.GasPriceList.Add(new GasPrice - // { - // ChainId = "Ethereum", - // GasPrice_ = 56120000000 - // }); - // - // setGasPriceInput.GasPriceList.Add(new GasPrice - // { - // ChainId = "BSC", - // GasPrice_ = 16120000000 - // }); - // - // setPriceRatioInput.Value.Add(new PriceRatio - // { - // TargetChainId = "Ethereum", - // PriceRatio_ = 135475890000 - // }); - // - // setPriceRatioInput.Value.Add(new PriceRatio - // { - // TargetChainId = "BSC", - // PriceRatio_ = 2475890000 - // }); foreach (var item in _priceSyncOptions.TargetChains) { From bcd2f310db87dfd6591a418e0f3ddd4dc5073b9c Mon Sep 17 00:00:00 2001 From: zhxymh Date: Tue, 30 Aug 2022 19:27:59 +0800 Subject: [PATCH 40/66] feat: update abi --- .../ContractBuild/BridgeOutAbi.json | 609 ++++++++++++++++++ 1 file changed, 609 insertions(+) create mode 100644 src/AElf.EventHandler/ContractBuild/BridgeOutAbi.json diff --git a/src/AElf.EventHandler/ContractBuild/BridgeOutAbi.json b/src/AElf.EventHandler/ContractBuild/BridgeOutAbi.json new file mode 100644 index 00000000..329dec98 --- /dev/null +++ b/src/AElf.EventHandler/ContractBuild/BridgeOutAbi.json @@ -0,0 +1,609 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "BridgeOut", + "sourceName": "contracts/BridgeOut.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_merkleTree", + "type": "address" + }, + { + "internalType": "address", + "name": "_regiment", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "swapId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "transmiter", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "receiptIndex", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "receiptHash", + "type": "bytes32" + } + ], + "name": "NewTransmission", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "swapId", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "string", + "name": "chainId", + "type": "string" + } + ], + "name": "SwapPairAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "receiveAddress", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "TokenSwapEvent", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "string", + "name": "chainId", + "type": "string" + } + ], + "name": "_generateTokenKey", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "_receiptId", + "type": "string" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_receiverAddress", + "type": "address" + } + ], + "name": "computeLeafHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "_leafHash", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint64", + "name": "originShare", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "targetShare", + "type": "uint64" + } + ], + "internalType": "struct BridgeOut.SwapRatio", + "name": "swapRatio", + "type": "tuple" + } + ], + "internalType": "struct BridgeOut.SwapTargetToken[]", + "name": "targetTokens", + "type": "tuple[]" + }, + { + "internalType": "string", + "name": "fromChainId", + "type": "string" + }, + { + "internalType": "bytes32", + "name": "regimentId", + "type": "bytes32" + } + ], + "name": "createSwap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "swapHashId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "tokens", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amounts", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "string[]", + "name": "fromChainIds", + "type": "string[]" + } + ], + "name": "getReceiveReceiptIndex", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "string", + "name": "fromChainId", + "type": "string" + }, + { + "internalType": "uint256", + "name": "fromIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endIndex", + "type": "uint256" + } + ], + "name": "getReceivedReceiptInfos", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + }, + { + "internalType": "address", + "name": "targetAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockHeight", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "blockTime", + "type": "uint256" + }, + { + "internalType": "string", + "name": "fromChainId", + "type": "string" + }, + { + "internalType": "string", + "name": "receiptId", + "type": "string" + } + ], + "internalType": "struct BridgeOut.ReceivedReceipt[]", + "name": "_receipts", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "string", + "name": "fromChainId", + "type": "string" + } + ], + "name": "getSwapId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "swapId", + "type": "bytes32" + } + ], + "name": "getSwapInfo", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "swapId", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "fromChainId", + "type": "string" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint64", + "name": "originShare", + "type": "uint64" + }, + { + "internalType": "uint64", + "name": "targetShare", + "type": "uint64" + } + ], + "internalType": "struct BridgeOut.SwapRatio", + "name": "swapRatio", + "type": "tuple" + } + ], + "internalType": "struct BridgeOut.SwapTargetToken[]", + "name": "swapTargetTokenList", + "type": "tuple[]" + }, + { + "internalType": "bytes32", + "name": "regimentId", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "spaceId", + "type": "bytes32" + } + ], + "internalType": "struct BridgeOut.SwapInfo", + "name": "swapInfo", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "receiptHash", + "type": "bytes32" + } + ], + "name": "isReceiptRecorded", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "spaceId", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "receiptId", + "type": "string" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiverAddress", + "type": "address" + } + ], + "name": "merkleTreeVerify", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "swapId", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "receiptId", + "type": "string" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiverAddress", + "type": "address" + } + ], + "name": "swapToken", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "swapHashId", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "_report", + "type": "bytes" + }, + { + "internalType": "bytes32[]", + "name": "_rs", + "type": "bytes32[]" + }, + { + "internalType": "bytes32[]", + "name": "_ss", + "type": "bytes32[]" + }, + { + "internalType": "bytes32", + "name": "_rawVs", + "type": "bytes32" + } + ], + "name": "transmit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "swapHashId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x60806040523480156200001157600080fd5b5060405162005e7a38038062005e7a833981810160405281019062000037919062000217565b620000576200004b620000e160201b60201c565b620000e960201b60201c565b81600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050506200025e565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620001df82620001b2565b9050919050565b620001f181620001d2565b8114620001fd57600080fd5b50565b6000815190506200021181620001e6565b92915050565b60008060408385031215620002315762000230620001ad565b5b6000620002418582860162000200565b9250506020620002548582860162000200565b9150509250929050565b615c0c806200026e6000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80638a0bb6f911610097578063c045e88711610066578063c045e887146102d1578063cb2b48a5146102ed578063d954863c1461031d578063f2fde38b1461033957610100565b80638a0bb6f9146102375780638da5cb5b14610267578063a6fb97d114610285578063b33ff450146102a157610100565b80634c038c45116100d35780634c038c45146101b157806368591baa146101e1578063715018a6146101fd57806371d0c5ca1461020757610100565b806303b1ccdb146101055780632d0fc6b4146101215780633f19efbe14610151578063446f95b414610181575b600080fd5b61011f600480360381019061011a9190613512565b610355565b005b61013b6004803603810190610136919061359a565b610d0f565b604051610148919061382b565b60405180910390f35b61016b600480360381019061016691906139e1565b610f19565b6040516101789190613b1b565b60405180910390f35b61019b60048036038101906101969190613bf2565b6110a0565b6040516101a89190613c5d565b60405180910390f35b6101cb60048036038101906101c6919061359a565b61111b565b6040516101d89190613c93565b60405180910390f35b6101fb60048036038101906101f69190613d5a565b61113a565b005b610205611662565b005b610221600480360381019061021c9190613e36565b611676565b60405161022e9190613c5d565b60405180910390f35b610251600480360381019061024c9190613e96565b6116e7565b60405161025e9190614083565b60405180910390f35b61026f611aab565b60405161027c91906140b4565b60405180910390f35b61029f600480360381019061029a91906140cf565b611ad4565b005b6102bb60048036038101906102b69190613512565b611dfb565b6040516102c89190613c5d565b60405180910390f35b6102eb60048036038101906102e69190614178565b6120ed565b005b6103076004803603810190610302919061420d565b61252d565b6040516103149190613c5d565b60405180910390f35b610337600480360381019061033291906140cf565b612706565b005b610353600480360381019061034e919061427c565b612a6d565b005b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ba9061432c565b60405180910390fd5b6000600560008781526020019081526020016000206004015490506000801b811415610424576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161041b90614398565b60405180910390fd5b60008311610467576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045e90614404565b60405180910390fd5b6000600560008881526020019081526020016000209050600061048d8388888888611dfb565b90506000600960008381526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610539576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161053090614470565b60405180910390fd5b848160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600083600201805480602002602001604051908101604052809291908181526020016000905b828210156106a257838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff168152505081525050815260200190600101906105a2565b50505050905060005b81518110156109605760008560020182815481106106cc576106cb614490565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600760008e815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060006107d385858151811061076c5761076b614490565b5b6020026020010151602001516000015167ffffffffffffffff166107c587878151811061079c5761079b614490565b5b6020026020010151602001516020015167ffffffffffffffff168e612af190919063ffffffff16565b612b0790919063ffffffff16565b9050816000015481111561081c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108139061450b565b60405180910390fd5b610833818360000154612b1d90919063ffffffff16565b82600001819055508273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8b836040518363ffffffff1660e01b815260040161087692919061453a565b602060405180830381600087803b15801561089057600080fd5b505af11580156108a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c8919061458f565b50808660010160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fb0c1e4d18ea737b756410ab0296768c15a87c12eeb368f360ecc5be61a11b4db8a8483604051610942939291906145bc565b60405180910390a1505050808061095890614622565b9150506106ab565b506000610a538560020160008154811061097d5761097c614490565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560008e815260200190815260200160002060010180546109d09061469a565b80601f01602080910402602001604051908101604052809291908181526020018280546109fc9061469a565b8015610a495780601f10610a1e57610100808354040283529160200191610a49565b820191906000526020600020905b815481529060010190602001808311610a2c57829003601f168201915b50505050506110a0565b9050600a60008281526020019081526020016000206040518060e0016040528087600201600081548110610a8a57610a89614490565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1681526020018a8152602001438152602001428152602001600560008f81526020019081526020016000206001018054610b269061469a565b80601f0160208091040260200160405190810160405280929190818152602001828054610b529061469a565b8015610b9f5780601f10610b7457610100808354040283529160200191610b9f565b820191906000526020600020905b815481529060010190602001808311610b8257829003601f168201915b505050505081526020018c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050815250908060018154018082558091505060019003906000526020600020906007020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020155606082015181600301556080820151816004015560a0820151816005019080519060200190610ce2929190613205565b5060c0820151816006019080519060200190610cff929190613205565b5050505050505050505050505050565b610d1761328b565b600560008381526020019081526020016000206040518060a001604052908160008201548152602001600182018054610d4f9061469a565b80601f0160208091040260200160405190810160405280929190818152602001828054610d7b9061469a565b8015610dc85780601f10610d9d57610100808354040283529160200191610dc8565b820191906000526020600020905b815481529060010190602001808311610dab57829003601f168201915b5050505050815260200160028201805480602002602001604051908101604052809291908181526020016000905b82821015610ef657838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250508152505081526020019060010190610df6565b505050508152602001600382015481526020016004820154815250509050919050565b606082829050845114610f61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f589061473e565b60405180910390fd5b6000845167ffffffffffffffff811115610f7e57610f7d61384d565b5b604051908082528060200260200182016040528015610fac5781602001602082028036833780820191505090505b50905060005b8551811015611094576000611048878381518110610fd357610fd2614490565b5b6020026020010151878785818110610fee57610fed614490565b5b9050602002810190611000919061476d565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506110a0565b9050600a60008281526020019081526020016000208054905083838151811061107457611073614490565b5b60200260200101818152505050808061108c90614622565b915050610fb2565b50809150509392505050565b6000600283836040516020016110b7929190614854565b6040516020818303038152906040526040516110d391906148c3565b602060405180830381855afa1580156110f0573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061111391906148ef565b905092915050565b6000806008600084815260200190815260200160002054119050919050565b6000600560008a81526020019081526020016000209050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323c849858260030154336040518363ffffffff1660e01b81526004016111b292919061491c565b60206040518083038186803b1580156111ca57600080fd5b505afa1580156111de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611202919061458f565b611241576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123890614991565b60405180910390fd5b600088886040516112539291906149d6565b6040518091039020905060005b87879050811015611419576000600183601b87856020811061128557611284614490565b5b1a60f81b60f81c61129691906149fc565b8b8b868181106112a9576112a8614490565b5b905060200201358a8a878181106112c3576112c2614490565b5b90506020020135604051600081526020016040526040516112e79493929190614a42565b6020604051602081039080840390855afa158015611309573d6000803e3d6000fd5b505050602060405103519050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323c849858560030154836040518363ffffffff1660e01b815260040161137692919061491c565b60206040518083038186803b15801561138e57600080fd5b505afa1580156113a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c6919061458f565b611405576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113fc90614ad3565b60405180910390fd5b50808061141190614622565b915050611260565b5060008061146a8b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050612b33565b915091506000600167ffffffffffffffff81111561148b5761148a61384d565b5b6040519080825280602002602001820160405280156114b95781602001602082028036833780820191505090505b50905081816000815181106114d1576114d0614490565b5b6020026020010181815250506000600860008481526020019081526020016000205414611533576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152a90614b3f565b60405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637d9778368760040154846040518363ffffffff1660e01b8152600401611596929190614c0e565b602060405180830381600087803b1580156115b057600080fd5b505af11580156115c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e89190614c53565b90506115fe600182612b5e90919063ffffffff16565b60086000858152602001908152602001600020819055507f6319bf84e3d2c97dd1991c07818c14950ceb6f48ce6d85f063be3c60905ea1b98e33868660405161164a9493929190614c80565b60405180910390a15050505050505050505050505050565b61166a612b74565b6116746000612bf2565b565b6000806116c78585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506110a0565b905060066000828152602001908152602001600020549150509392505050565b606060006117398787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506110a0565b9050600a60008281526020019081526020016000208054905083111580156117615750600084115b6117a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161179790614d11565b60405180910390fd5b60006117c860016117ba8787612b1d90919063ffffffff16565b612b5e90919063ffffffff16565b90508067ffffffffffffffff8111156117e4576117e361384d565b5b60405190808252806020026020018201604052801561181d57816020015b61180a6132c3565b8152602001906001900390816118025790505b50925060005b81811015611a9f57600a60008481526020019081526020016000206001878361184c9190614d31565b6118569190614d87565b8154811061186757611866614490565b5b90600052602060002090600702016040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160028201548152602001600382015481526020016004820154815260200160058201805461195a9061469a565b80601f01602080910402602001604051908101604052809291908181526020018280546119869061469a565b80156119d35780601f106119a8576101008083540402835291602001916119d3565b820191906000526020600020905b8154815290600101906020018083116119b657829003601f168201915b505050505081526020016006820180546119ec9061469a565b80601f0160208091040260200160405190810160405280929190818152602001828054611a189061469a565b8015611a655780601f10611a3a57610100808354040283529160200191611a65565b820191906000526020600020905b815481529060010190602001808311611a4857829003601f168201915b505050505081525050848281518110611a8157611a80614490565b5b60200260200101819052508080611a9790614622565b915050611823565b50505095945050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600560008581526020019081526020016000209050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639a96679e8260030154336040518363ffffffff1660e01b8152600401611b4c92919061491c565b60206040518083038186803b158015611b6457600080fd5b505afa158015611b78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9c919061458f565b611bdb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bd290614e07565b60405180910390fd5b611d0c8382600201805480602002602001604051908101604052809291908181526020016000905b82821015611d0357838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250508152505081526020019060010190611c03565b50505050612cb6565b50611d73826007600087815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154612b1d90919063ffffffff16565b6007600086815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550611df533838573ffffffffffffffffffffffffffffffffffffffff16612d429092919063ffffffff16565b50505050565b60006060806000611e5188888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050878761252d565b90506000611e7c60016008600085815260200190815260200160002054612b1d90919063ffffffff16565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631b32d71a8b836040518363ffffffff1660e01b8152600401611edb929190614e27565b60006040518083038186803b158015611ef357600080fd5b505afa158015611f07573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190611f309190614fd6565b909192509091508094508195505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631669b10e8b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fd2973ca8e866040518363ffffffff1660e01b8152600401611fdb929190614e27565b60206040518083038186803b158015611ff357600080fd5b505afa158015612007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061202b9190614c53565b8588886040518663ffffffff1660e01b815260040161204e959493929190615133565b60206040518083038186803b15801561206657600080fd5b505afa15801561207a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209e919061458f565b6120dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d4906151e0565b60405180910390fd5b8194505050505095945050505050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166376e2775583336040518363ffffffff1660e01b815260040161214c92919061491c565b60206040518083038186803b15801561216457600080fd5b505afa158015612178573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219c919061458f565b9050806121de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d590614e07565b60405180910390fd5b6000868660008181106121f4576121f3614490565b5b905060600201600001602081019061220c919061427c565b9050600061225e8287878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506110a0565b9050612274816003612dc890919063ffffffff16565b156122b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122ab9061524c565b60405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632a99732a86600a6040518363ffffffff1660e01b81526004016123149291906152b1565b602060405180830381600087803b15801561232e57600080fd5b505af1158015612342573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061236691906148ef565b90506000803660405161237a9291906149d6565b6040518091039020905085600560008381526020019081526020016000206003018190555081600560008381526020019081526020016000206004018190555080600560008381526020019081526020016000206000018190555087876005600084815260200190815260200160002060010191906123fa92919061332c565b5061240f836003612ddf90919063ffffffff16565b5080600660008581526020019081526020016000208190555060005b8a8a90508110156124e35761246a8b8b8381811061244c5761244b614490565b5b905060600201602001803603810190612465919061535b565b612df6565b600560008381526020019081526020016000206002018b8b8381811061249357612492614490565b5b905060600201908060018154018082558091505060019003906000526020600020906002020160009091909190915081816124ce91906155d4565b505080806124db90614622565b91505061242b565b507f909c724b9d08d0463115fc7fa6d2c8e51e6eafa867725be497bdb9a53a6cac4f81858a8a604051612519949392919061560f565b60405180910390a150505050505050505050565b600080600285604051602001612543919061564f565b60405160208183030381529060405260405161255f91906148c3565b602060405180830381855afa15801561257c573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061259f91906148ef565b905060006002856040516020016125b69190615687565b6040516020818303038152906040526040516125d291906148c3565b602060405180830381855afa1580156125ef573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061261291906148ef565b9050600060028560405160200161262991906156a2565b60405160208183030381529060405260405161264591906148c3565b602060405180830381855afa158015612662573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061268591906148ef565b9050600283838360405160200161269e939291906156bd565b6040516020818303038152906040526040516126ba91906148c3565b602060405180830381855afa1580156126d7573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906126fa91906148ef565b93505050509392505050565b6000600560008581526020019081526020016000209050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639a96679e8260030154336040518363ffffffff1660e01b815260040161277e92919061491c565b60206040518083038186803b15801561279657600080fd5b505afa1580156127aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127ce919061458f565b61280d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161280490614e07565b60405180910390fd5b61293e8382600201805480602002602001604051908101604052809291908181526020016000905b8282101561293557838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250508152505081526020019060010190612835565b50505050612cb6565b61297d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161297490615740565b60405180910390fd5b6129aa3330848673ffffffffffffffffffffffffffffffffffffffff16612e64909392919063ffffffff16565b612a10826007600087815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154612b5e90919063ffffffff16565b6007600086815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555050505050565b612a75612b74565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612ae5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612adc906157d2565b60405180910390fd5b612aee81612bf2565b50565b60008183612aff91906157f2565b905092915050565b60008183612b15919061587b565b905092915050565b60008183612b2b9190614d87565b905092915050565b60008082806020019051810190612b4a91906158ac565b909192509091508092508193505050915091565b60008183612b6c9190614d31565b905092915050565b612b7c612eed565b73ffffffffffffffffffffffffffffffffffffffff16612b9a611aab565b73ffffffffffffffffffffffffffffffffffffffff1614612bf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612be79061595f565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080600090505b8251811015612d36578373ffffffffffffffffffffffffffffffffffffffff16838281518110612cf157612cf0614490565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff161415612d23576001915050612d3c565b8080612d2e90614622565b915050612cbe565b50600090505b92915050565b612dc38363a9059cbb60e01b8484604051602401612d6192919061453a565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612ef5565b505050565b6000612dd78360000183612fbc565b905092915050565b6000612dee8360000183612fdf565b905092915050565b6000816000015167ffffffffffffffff16118015612e2257506000816020015167ffffffffffffffff16115b612e61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e58906159cb565b60405180910390fd5b50565b612ee7846323b872dd60e01b858585604051602401612e85939291906145bc565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612ef5565b50505050565b600033905090565b6000612f57826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661304f9092919063ffffffff16565b9050600081511115612fb75780806020019051810190612f77919061458f565b612fb6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612fad90615a5d565b60405180910390fd5b5b505050565b600080836001016000848152602001908152602001600020541415905092915050565b6000612feb8383612fbc565b613044578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050613049565b600090505b92915050565b606061305e8484600085613067565b90509392505050565b6060824710156130ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130a390615aef565b60405180910390fd5b6130b58561317b565b6130f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130eb90615b5b565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161311d91906148c3565b60006040518083038185875af1925050503d806000811461315a576040519150601f19603f3d011682016040523d82523d6000602084013e61315f565b606091505b509150915061316f82828661319e565b92505050949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b606083156131ae578290506131fe565b6000835111156131c15782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131f59190615bb4565b60405180910390fd5b9392505050565b8280546132119061469a565b90600052602060002090601f016020900481019282613233576000855561327a565b82601f1061324c57805160ff191683800117855561327a565b8280016001018555821561327a579182015b8281111561327957825182559160200191906001019061325e565b5b50905061328791906133b2565b5090565b6040518060a0016040528060008019168152602001606081526020016060815260200160008019168152602001600080191681525090565b6040518060e00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160608152602001606081525090565b8280546133389061469a565b90600052602060002090601f01602090048101928261335a57600085556133a1565b82601f1061337357803560ff19168380011785556133a1565b828001600101855582156133a1579182015b828111156133a0578235825591602001919060010190613385565b5b5090506133ae91906133b2565b5090565b5b808211156133cb5760008160009055506001016133b3565b5090565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b6133f6816133e3565b811461340157600080fd5b50565b600081359050613413816133ed565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f84011261343e5761343d613419565b5b8235905067ffffffffffffffff81111561345b5761345a61341e565b5b60208301915083600182028301111561347757613476613423565b5b9250929050565b6000819050919050565b6134918161347e565b811461349c57600080fd5b50565b6000813590506134ae81613488565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006134df826134b4565b9050919050565b6134ef816134d4565b81146134fa57600080fd5b50565b60008135905061350c816134e6565b92915050565b60008060008060006080868803121561352e5761352d6133d9565b5b600061353c88828901613404565b955050602086013567ffffffffffffffff81111561355d5761355c6133de565b5b61356988828901613428565b9450945050604061357c8882890161349f565b925050606061358d888289016134fd565b9150509295509295909350565b6000602082840312156135b0576135af6133d9565b5b60006135be84828501613404565b91505092915050565b6135d0816133e3565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b838110156136105780820151818401526020810190506135f5565b8381111561361f576000848401525b50505050565b6000601f19601f8301169050919050565b6000613641826135d6565b61364b81856135e1565b935061365b8185602086016135f2565b61366481613625565b840191505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6136a4816134d4565b82525050565b600067ffffffffffffffff82169050919050565b6136c7816136aa565b82525050565b6040820160008201516136e360008501826136be565b5060208201516136f660208501826136be565b50505050565b606082016000820151613712600085018261369b565b50602082015161372560208501826136cd565b50505050565b600061373783836136fc565b60608301905092915050565b6000602082019050919050565b600061375b8261366f565b613765818561367a565b93506137708361368b565b8060005b838110156137a1578151613788888261372b565b975061379383613743565b925050600181019050613774565b5085935050505092915050565b600060a0830160008301516137c660008601826135c7565b50602083015184820360208601526137de8282613636565b915050604083015184820360408601526137f88282613750565b915050606083015161380d60608601826135c7565b50608083015161382060808601826135c7565b508091505092915050565b6000602082019050818103600083015261384581846137ae565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61388582613625565b810181811067ffffffffffffffff821117156138a4576138a361384d565b5b80604052505050565b60006138b76133cf565b90506138c3828261387c565b919050565b600067ffffffffffffffff8211156138e3576138e261384d565b5b602082029050602081019050919050565b6000613907613902846138c8565b6138ad565b9050808382526020820190506020840283018581111561392a57613929613423565b5b835b81811015613953578061393f88826134fd565b84526020840193505060208101905061392c565b5050509392505050565b600082601f83011261397257613971613419565b5b81356139828482602086016138f4565b91505092915050565b60008083601f8401126139a1576139a0613419565b5b8235905067ffffffffffffffff8111156139be576139bd61341e565b5b6020830191508360208202830111156139da576139d9613423565b5b9250929050565b6000806000604084860312156139fa576139f96133d9565b5b600084013567ffffffffffffffff811115613a1857613a176133de565b5b613a248682870161395d565b935050602084013567ffffffffffffffff811115613a4557613a446133de565b5b613a518682870161398b565b92509250509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613a928161347e565b82525050565b6000613aa48383613a89565b60208301905092915050565b6000602082019050919050565b6000613ac882613a5d565b613ad28185613a68565b9350613add83613a79565b8060005b83811015613b0e578151613af58882613a98565b9750613b0083613ab0565b925050600181019050613ae1565b5085935050505092915050565b60006020820190508181036000830152613b358184613abd565b905092915050565b600080fd5b600067ffffffffffffffff821115613b5d57613b5c61384d565b5b613b6682613625565b9050602081019050919050565b82818337600083830152505050565b6000613b95613b9084613b42565b6138ad565b905082815260208101848484011115613bb157613bb0613b3d565b5b613bbc848285613b73565b509392505050565b600082601f830112613bd957613bd8613419565b5b8135613be9848260208601613b82565b91505092915050565b60008060408385031215613c0957613c086133d9565b5b6000613c17858286016134fd565b925050602083013567ffffffffffffffff811115613c3857613c376133de565b5b613c4485828601613bc4565b9150509250929050565b613c57816133e3565b82525050565b6000602082019050613c726000830184613c4e565b92915050565b60008115159050919050565b613c8d81613c78565b82525050565b6000602082019050613ca86000830184613c84565b92915050565b60008083601f840112613cc457613cc3613419565b5b8235905067ffffffffffffffff811115613ce157613ce061341e565b5b602083019150836001820283011115613cfd57613cfc613423565b5b9250929050565b60008083601f840112613d1a57613d19613419565b5b8235905067ffffffffffffffff811115613d3757613d3661341e565b5b602083019150836020820283011115613d5357613d52613423565b5b9250929050565b60008060008060008060008060a0898b031215613d7a57613d796133d9565b5b6000613d888b828c01613404565b985050602089013567ffffffffffffffff811115613da957613da86133de565b5b613db58b828c01613cae565b9750975050604089013567ffffffffffffffff811115613dd857613dd76133de565b5b613de48b828c01613d04565b9550955050606089013567ffffffffffffffff811115613e0757613e066133de565b5b613e138b828c01613d04565b93509350506080613e268b828c01613404565b9150509295985092959890939650565b600080600060408486031215613e4f57613e4e6133d9565b5b6000613e5d868287016134fd565b935050602084013567ffffffffffffffff811115613e7e57613e7d6133de565b5b613e8a86828701613428565b92509250509250925092565b600080600080600060808688031215613eb257613eb16133d9565b5b6000613ec0888289016134fd565b955050602086013567ffffffffffffffff811115613ee157613ee06133de565b5b613eed88828901613428565b94509450506040613f008882890161349f565b9250506060613f118882890161349f565b9150509295509295909350565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600060e083016000830151613f62600086018261369b565b506020830151613f75602086018261369b565b506040830151613f886040860182613a89565b506060830151613f9b6060860182613a89565b506080830151613fae6080860182613a89565b5060a083015184820360a0860152613fc68282613636565b91505060c083015184820360c0860152613fe08282613636565b9150508091505092915050565b6000613ff98383613f4a565b905092915050565b6000602082019050919050565b600061401982613f1e565b6140238185613f29565b93508360208202850161403585613f3a565b8060005b8581101561407157848403895281516140528582613fed565b945061405d83614001565b925060208a01995050600181019050614039565b50829750879550505050505092915050565b6000602082019050818103600083015261409d818461400e565b905092915050565b6140ae816134d4565b82525050565b60006020820190506140c960008301846140a5565b92915050565b6000806000606084860312156140e8576140e76133d9565b5b60006140f686828701613404565b9350506020614107868287016134fd565b92505060406141188682870161349f565b9150509250925092565b60008083601f84011261413857614137613419565b5b8235905067ffffffffffffffff8111156141555761415461341e565b5b60208301915083606082028301111561417157614170613423565b5b9250929050565b600080600080600060608688031215614194576141936133d9565b5b600086013567ffffffffffffffff8111156141b2576141b16133de565b5b6141be88828901614122565b9550955050602086013567ffffffffffffffff8111156141e1576141e06133de565b5b6141ed88828901613428565b9350935050604061420088828901613404565b9150509295509295909350565b600080600060608486031215614226576142256133d9565b5b600084013567ffffffffffffffff811115614244576142436133de565b5b61425086828701613bc4565b93505060206142618682870161349f565b9250506040614272868287016134fd565b9150509250925092565b600060208284031215614292576142916133d9565b5b60006142a0848285016134fd565b91505092915050565b600082825260208201905092915050565b7f6f6e6c7920726563656976657220686173207065726d697373696f6e20746f2060008201527f7377617020746f6b656e00000000000000000000000000000000000000000000602082015250565b6000614316602a836142a9565b9150614321826142ba565b604082019050919050565b6000602082019050818103600083015261434581614309565b9050919050565b7f746f6b656e20737761702070616972206e6f7420666f756e6400000000000000600082015250565b60006143826019836142a9565b915061438d8261434c565b602082019050919050565b600060208201905081810360008301526143b181614375565b9050919050565b7f696e76616c696420616d6f756e74000000000000000000000000000000000000600082015250565b60006143ee600e836142a9565b91506143f9826143b8565b602082019050919050565b6000602082019050818103600083015261441d816143e1565b9050919050565b7f616c726561647920636c61696d65640000000000000000000000000000000000600082015250565b600061445a600f836142a9565b915061446582614424565b602082019050919050565b600060208201905081810360008301526144898161444d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f6465706f736974206e6f7420656e6f7567687400000000000000000000000000600082015250565b60006144f56013836142a9565b9150614500826144bf565b602082019050919050565b60006020820190508181036000830152614524816144e8565b9050919050565b6145348161347e565b82525050565b600060408201905061454f60008301856140a5565b61455c602083018461452b565b9392505050565b61456c81613c78565b811461457757600080fd5b50565b60008151905061458981614563565b92915050565b6000602082840312156145a5576145a46133d9565b5b60006145b38482850161457a565b91505092915050565b60006060820190506145d160008301866140a5565b6145de60208301856140a5565b6145eb604083018461452b565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061462d8261347e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156146605761465f6145f3565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806146b257607f821691505b602082108114156146c6576146c561466b565b5b50919050565b7f496e76616c696420746f6b656e732f66726f6d436861696e49647320696e707560008201527f7400000000000000000000000000000000000000000000000000000000000000602082015250565b60006147286021836142a9565b9150614733826146cc565b604082019050919050565b600060208201905081810360008301526147578161471b565b9050919050565b600080fd5b600080fd5b600080fd5b6000808335600160200384360303811261478a5761478961475e565b5b80840192508235915067ffffffffffffffff8211156147ac576147ab614763565b5b6020830192506001820236038313156147c8576147c7614768565b5b509250929050565b60008160601b9050919050565b60006147e8826147d0565b9050919050565b60006147fa826147dd565b9050919050565b61481261480d826134d4565b6147ef565b82525050565b600081905092915050565b600061482e826135d6565b6148388185614818565b93506148488185602086016135f2565b80840191505092915050565b60006148608285614801565b6014820191506148708284614823565b91508190509392505050565b600081519050919050565b600081905092915050565b600061489d8261487c565b6148a78185614887565b93506148b78185602086016135f2565b80840191505092915050565b60006148cf8284614892565b915081905092915050565b6000815190506148e9816133ed565b92915050565b600060208284031215614905576149046133d9565b5b6000614913848285016148da565b91505092915050565b60006040820190506149316000830185613c4e565b61493e60208301846140a5565b9392505050565b7f4e6f207065726d697373696f6e20746f207472616e736d697400000000000000600082015250565b600061497b6019836142a9565b915061498682614945565b602082019050919050565b600060208201905081810360008301526149aa8161496e565b9050919050565b60006149bd8385614887565b93506149ca838584613b73565b82840190509392505050565b60006149e38284866149b1565b91508190509392505050565b600060ff82169050919050565b6000614a07826149ef565b9150614a12836149ef565b92508260ff03821115614a2857614a276145f3565b5b828201905092915050565b614a3c816149ef565b82525050565b6000608082019050614a576000830187613c4e565b614a646020830186614a33565b614a716040830185613c4e565b614a7e6060830184613c4e565b95945050505050565b7f4e6f207065726d697373696f6e20746f207369676e0000000000000000000000600082015250565b6000614abd6015836142a9565b9150614ac882614a87565b602082019050919050565b60006020820190508181036000830152614aec81614ab0565b9050919050565b7f616c7265616479207265636f7264656400000000000000000000000000000000600082015250565b6000614b296010836142a9565b9150614b3482614af3565b602082019050919050565b60006020820190508181036000830152614b5881614b1c565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000614b9783836135c7565b60208301905092915050565b6000602082019050919050565b6000614bbb82614b5f565b614bc58185614b6a565b9350614bd083614b7b565b8060005b83811015614c01578151614be88882614b8b565b9750614bf383614ba3565b925050600181019050614bd4565b5085935050505092915050565b6000604082019050614c236000830185613c4e565b8181036020830152614c358184614bb0565b90509392505050565b600081519050614c4d81613488565b92915050565b600060208284031215614c6957614c686133d9565b5b6000614c7784828501614c3e565b91505092915050565b6000608082019050614c956000830187613c4e565b614ca260208301866140a5565b614caf604083018561452b565b614cbc6060830184613c4e565b95945050505050565b7f496e76616c696420696e70757400000000000000000000000000000000000000600082015250565b6000614cfb600d836142a9565b9150614d0682614cc5565b602082019050919050565b60006020820190508181036000830152614d2a81614cee565b9050919050565b6000614d3c8261347e565b9150614d478361347e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614d7c57614d7b6145f3565b5b828201905092915050565b6000614d928261347e565b9150614d9d8361347e565b925082821015614db057614daf6145f3565b5b828203905092915050565b7f4e6f207065726d697373696f6e00000000000000000000000000000000000000600082015250565b6000614df1600d836142a9565b9150614dfc82614dbb565b602082019050919050565b60006020820190508181036000830152614e2081614de4565b9050919050565b6000604082019050614e3c6000830185613c4e565b614e49602083018461452b565b9392505050565b600067ffffffffffffffff821115614e6b57614e6a61384d565b5b602082029050602081019050919050565b6000614e8f614e8a84614e50565b6138ad565b90508083825260208201905060208402830185811115614eb257614eb1613423565b5b835b81811015614edb5780614ec788826148da565b845260208401935050602081019050614eb4565b5050509392505050565b600082601f830112614efa57614ef9613419565b5b8151614f0a848260208601614e7c565b91505092915050565b600067ffffffffffffffff821115614f2e57614f2d61384d565b5b602082029050602081019050919050565b6000614f52614f4d84614f13565b6138ad565b90508083825260208201905060208402830185811115614f7557614f74613423565b5b835b81811015614f9e5780614f8a888261457a565b845260208401935050602081019050614f77565b5050509392505050565b600082601f830112614fbd57614fbc613419565b5b8151614fcd848260208601614f3f565b91505092915050565b60008060008060808587031215614ff057614fef6133d9565b5b6000614ffe87828801614c3e565b945050602061500f87828801614c3e565b935050604085015167ffffffffffffffff8111156150305761502f6133de565b5b61503c87828801614ee5565b925050606085015167ffffffffffffffff81111561505d5761505c6133de565b5b61506987828801614fa8565b91505092959194509250565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6150aa81613c78565b82525050565b60006150bc83836150a1565b60208301905092915050565b6000602082019050919050565b60006150e082615075565b6150ea8185615080565b93506150f583615091565b8060005b8381101561512657815161510d88826150b0565b9750615118836150c8565b9250506001810190506150f9565b5085935050505092915050565b600060a0820190506151486000830188613c4e565b615155602083018761452b565b6151626040830186613c4e565b81810360608301526151748185614bb0565b9050818103608083015261518881846150d5565b90509695505050505050565b7f6661696c656420746f207377617020746f6b656e000000000000000000000000600082015250565b60006151ca6014836142a9565b91506151d582615194565b602082019050919050565b600060208201905081810360008301526151f9816151bd565b9050919050565b7f54617267657420746f6b656e20616c7265616479206578697374000000000000600082015250565b6000615236601a836142a9565b915061524182615200565b602082019050919050565b6000602082019050818103600083015261526581615229565b9050919050565b6000819050919050565b6000819050919050565b600061529b6152966152918461526c565b615276565b61347e565b9050919050565b6152ab81615280565b82525050565b60006040820190506152c66000830185613c4e565b6152d360208301846152a2565b9392505050565b600080fd5b6152e8816136aa565b81146152f357600080fd5b50565b600081359050615305816152df565b92915050565b600060408284031215615321576153206152da565b5b61532b60406138ad565b9050600061533b848285016152f6565b600083015250602061534f848285016152f6565b60208301525092915050565b600060408284031215615371576153706133d9565b5b600061537f8482850161530b565b91505092915050565b60008135615395816134e6565b80915050919050565b60008160001b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff6153cb8461539e565b9350801983169250808416831791505092915050565b60006153fc6153f76153f2846134b4565b615276565b6134b4565b9050919050565b600061540e826153e1565b9050919050565b600061542082615403565b9050919050565b6000819050919050565b61543a82615415565b61544d61544682615427565b83546153ab565b8255505050565b60008135615461816152df565b80915050919050565b600067ffffffffffffffff61547e8461539e565b9350801983169250808416831791505092915050565b60006154af6154aa6154a5846136aa565b615276565b6136aa565b9050919050565b6000819050919050565b6154c982615494565b6154dc6154d5826154b6565b835461546a565b8255505050565b60008160401b9050919050565b60006fffffffffffffffff000000000000000061550c846154e3565b9350801983169250808416831791505092915050565b61552b82615494565b61553e615537826154b6565b83546154f0565b8255505050565b60008101600083018061555781615454565b905061556381846154c0565b50505060008101602083018061557881615454565b90506155848184615522565b5050505050565b6155958282615545565b5050565b6000810160008301806155ab81615388565b90506155b78184615431565b5050506001810160208301806155cd818461558b565b5050505050565b6155de8282615599565b5050565b60006155ee83856142a9565b93506155fb838584613b73565b61560483613625565b840190509392505050565b60006060820190506156246000830187613c4e565b61563160208301866140a5565b81810360408301526156448184866155e2565b905095945050505050565b600061565b8284614823565b915081905092915050565b6000819050919050565b61568161567c8261347e565b615666565b82525050565b60006156938284615670565b60208201915081905092915050565b60006156ae8284614801565b60148201915081905092915050565b60006060820190506156d26000830186613c4e565b6156df6020830185613c4e565b6156ec6040830184613c4e565b949350505050565b7f496e76616c696420746f6b656e00000000000000000000000000000000000000600082015250565b600061572a600d836142a9565b9150615735826156f4565b602082019050919050565b600060208201905081810360008301526157598161571d565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006157bc6026836142a9565b91506157c782615760565b604082019050919050565b600060208201905081810360008301526157eb816157af565b9050919050565b60006157fd8261347e565b91506158088361347e565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615615841576158406145f3565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006158868261347e565b91506158918361347e565b9250826158a1576158a061584c565b5b828204905092915050565b600080600080608085870312156158c6576158c56133d9565b5b60006158d487828801614c3e565b94505060206158e587828801614c3e565b93505060406158f687828801614c3e565b9250506060615907878288016148da565b91505092959194509250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006159496020836142a9565b915061595482615913565b602082019050919050565b600060208201905081810360008301526159788161593c565b9050919050565b7f696e76616c6964207377617020726174696f0000000000000000000000000000600082015250565b60006159b56012836142a9565b91506159c08261597f565b602082019050919050565b600060208201905081810360008301526159e4816159a8565b9050919050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b6000615a47602a836142a9565b9150615a52826159eb565b604082019050919050565b60006020820190508181036000830152615a7681615a3a565b9050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b6000615ad96026836142a9565b9150615ae482615a7d565b604082019050919050565b60006020820190508181036000830152615b0881615acc565b9050919050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b6000615b45601d836142a9565b9150615b5082615b0f565b602082019050919050565b60006020820190508181036000830152615b7481615b38565b9050919050565b6000615b86826135d6565b615b9081856142a9565b9350615ba08185602086016135f2565b615ba981613625565b840191505092915050565b60006020820190508181036000830152615bce8184615b7b565b90509291505056fea264697066735822122027994878bc0796324bd5651e387b07610e125535c1f39fcdb2ffab52eba39b4964736f6c63430008090033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638a0bb6f911610097578063c045e88711610066578063c045e887146102d1578063cb2b48a5146102ed578063d954863c1461031d578063f2fde38b1461033957610100565b80638a0bb6f9146102375780638da5cb5b14610267578063a6fb97d114610285578063b33ff450146102a157610100565b80634c038c45116100d35780634c038c45146101b157806368591baa146101e1578063715018a6146101fd57806371d0c5ca1461020757610100565b806303b1ccdb146101055780632d0fc6b4146101215780633f19efbe14610151578063446f95b414610181575b600080fd5b61011f600480360381019061011a9190613512565b610355565b005b61013b6004803603810190610136919061359a565b610d0f565b604051610148919061382b565b60405180910390f35b61016b600480360381019061016691906139e1565b610f19565b6040516101789190613b1b565b60405180910390f35b61019b60048036038101906101969190613bf2565b6110a0565b6040516101a89190613c5d565b60405180910390f35b6101cb60048036038101906101c6919061359a565b61111b565b6040516101d89190613c93565b60405180910390f35b6101fb60048036038101906101f69190613d5a565b61113a565b005b610205611662565b005b610221600480360381019061021c9190613e36565b611676565b60405161022e9190613c5d565b60405180910390f35b610251600480360381019061024c9190613e96565b6116e7565b60405161025e9190614083565b60405180910390f35b61026f611aab565b60405161027c91906140b4565b60405180910390f35b61029f600480360381019061029a91906140cf565b611ad4565b005b6102bb60048036038101906102b69190613512565b611dfb565b6040516102c89190613c5d565b60405180910390f35b6102eb60048036038101906102e69190614178565b6120ed565b005b6103076004803603810190610302919061420d565b61252d565b6040516103149190613c5d565b60405180910390f35b610337600480360381019061033291906140cf565b612706565b005b610353600480360381019061034e919061427c565b612a6d565b005b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ba9061432c565b60405180910390fd5b6000600560008781526020019081526020016000206004015490506000801b811415610424576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161041b90614398565b60405180910390fd5b60008311610467576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045e90614404565b60405180910390fd5b6000600560008881526020019081526020016000209050600061048d8388888888611dfb565b90506000600960008381526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610539576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161053090614470565b60405180910390fd5b848160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600083600201805480602002602001604051908101604052809291908181526020016000905b828210156106a257838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff168152505081525050815260200190600101906105a2565b50505050905060005b81518110156109605760008560020182815481106106cc576106cb614490565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600760008e815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060006107d385858151811061076c5761076b614490565b5b6020026020010151602001516000015167ffffffffffffffff166107c587878151811061079c5761079b614490565b5b6020026020010151602001516020015167ffffffffffffffff168e612af190919063ffffffff16565b612b0790919063ffffffff16565b9050816000015481111561081c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108139061450b565b60405180910390fd5b610833818360000154612b1d90919063ffffffff16565b82600001819055508273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8b836040518363ffffffff1660e01b815260040161087692919061453a565b602060405180830381600087803b15801561089057600080fd5b505af11580156108a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c8919061458f565b50808660010160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fb0c1e4d18ea737b756410ab0296768c15a87c12eeb368f360ecc5be61a11b4db8a8483604051610942939291906145bc565b60405180910390a1505050808061095890614622565b9150506106ab565b506000610a538560020160008154811061097d5761097c614490565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560008e815260200190815260200160002060010180546109d09061469a565b80601f01602080910402602001604051908101604052809291908181526020018280546109fc9061469a565b8015610a495780601f10610a1e57610100808354040283529160200191610a49565b820191906000526020600020905b815481529060010190602001808311610a2c57829003601f168201915b50505050506110a0565b9050600a60008281526020019081526020016000206040518060e0016040528087600201600081548110610a8a57610a89614490565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1681526020018a8152602001438152602001428152602001600560008f81526020019081526020016000206001018054610b269061469a565b80601f0160208091040260200160405190810160405280929190818152602001828054610b529061469a565b8015610b9f5780601f10610b7457610100808354040283529160200191610b9f565b820191906000526020600020905b815481529060010190602001808311610b8257829003601f168201915b505050505081526020018c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050815250908060018154018082558091505060019003906000526020600020906007020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020155606082015181600301556080820151816004015560a0820151816005019080519060200190610ce2929190613205565b5060c0820151816006019080519060200190610cff929190613205565b5050505050505050505050505050565b610d1761328b565b600560008381526020019081526020016000206040518060a001604052908160008201548152602001600182018054610d4f9061469a565b80601f0160208091040260200160405190810160405280929190818152602001828054610d7b9061469a565b8015610dc85780601f10610d9d57610100808354040283529160200191610dc8565b820191906000526020600020905b815481529060010190602001808311610dab57829003601f168201915b5050505050815260200160028201805480602002602001604051908101604052809291908181526020016000905b82821015610ef657838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250508152505081526020019060010190610df6565b505050508152602001600382015481526020016004820154815250509050919050565b606082829050845114610f61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f589061473e565b60405180910390fd5b6000845167ffffffffffffffff811115610f7e57610f7d61384d565b5b604051908082528060200260200182016040528015610fac5781602001602082028036833780820191505090505b50905060005b8551811015611094576000611048878381518110610fd357610fd2614490565b5b6020026020010151878785818110610fee57610fed614490565b5b9050602002810190611000919061476d565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506110a0565b9050600a60008281526020019081526020016000208054905083838151811061107457611073614490565b5b60200260200101818152505050808061108c90614622565b915050610fb2565b50809150509392505050565b6000600283836040516020016110b7929190614854565b6040516020818303038152906040526040516110d391906148c3565b602060405180830381855afa1580156110f0573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061111391906148ef565b905092915050565b6000806008600084815260200190815260200160002054119050919050565b6000600560008a81526020019081526020016000209050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323c849858260030154336040518363ffffffff1660e01b81526004016111b292919061491c565b60206040518083038186803b1580156111ca57600080fd5b505afa1580156111de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611202919061458f565b611241576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123890614991565b60405180910390fd5b600088886040516112539291906149d6565b6040518091039020905060005b87879050811015611419576000600183601b87856020811061128557611284614490565b5b1a60f81b60f81c61129691906149fc565b8b8b868181106112a9576112a8614490565b5b905060200201358a8a878181106112c3576112c2614490565b5b90506020020135604051600081526020016040526040516112e79493929190614a42565b6020604051602081039080840390855afa158015611309573d6000803e3d6000fd5b505050602060405103519050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323c849858560030154836040518363ffffffff1660e01b815260040161137692919061491c565b60206040518083038186803b15801561138e57600080fd5b505afa1580156113a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c6919061458f565b611405576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113fc90614ad3565b60405180910390fd5b50808061141190614622565b915050611260565b5060008061146a8b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050612b33565b915091506000600167ffffffffffffffff81111561148b5761148a61384d565b5b6040519080825280602002602001820160405280156114b95781602001602082028036833780820191505090505b50905081816000815181106114d1576114d0614490565b5b6020026020010181815250506000600860008481526020019081526020016000205414611533576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152a90614b3f565b60405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637d9778368760040154846040518363ffffffff1660e01b8152600401611596929190614c0e565b602060405180830381600087803b1580156115b057600080fd5b505af11580156115c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e89190614c53565b90506115fe600182612b5e90919063ffffffff16565b60086000858152602001908152602001600020819055507f6319bf84e3d2c97dd1991c07818c14950ceb6f48ce6d85f063be3c60905ea1b98e33868660405161164a9493929190614c80565b60405180910390a15050505050505050505050505050565b61166a612b74565b6116746000612bf2565b565b6000806116c78585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506110a0565b905060066000828152602001908152602001600020549150509392505050565b606060006117398787878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506110a0565b9050600a60008281526020019081526020016000208054905083111580156117615750600084115b6117a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161179790614d11565b60405180910390fd5b60006117c860016117ba8787612b1d90919063ffffffff16565b612b5e90919063ffffffff16565b90508067ffffffffffffffff8111156117e4576117e361384d565b5b60405190808252806020026020018201604052801561181d57816020015b61180a6132c3565b8152602001906001900390816118025790505b50925060005b81811015611a9f57600a60008481526020019081526020016000206001878361184c9190614d31565b6118569190614d87565b8154811061186757611866614490565b5b90600052602060002090600702016040518060e00160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160028201548152602001600382015481526020016004820154815260200160058201805461195a9061469a565b80601f01602080910402602001604051908101604052809291908181526020018280546119869061469a565b80156119d35780601f106119a8576101008083540402835291602001916119d3565b820191906000526020600020905b8154815290600101906020018083116119b657829003601f168201915b505050505081526020016006820180546119ec9061469a565b80601f0160208091040260200160405190810160405280929190818152602001828054611a189061469a565b8015611a655780601f10611a3a57610100808354040283529160200191611a65565b820191906000526020600020905b815481529060010190602001808311611a4857829003601f168201915b505050505081525050848281518110611a8157611a80614490565b5b60200260200101819052508080611a9790614622565b915050611823565b50505095945050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600560008581526020019081526020016000209050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639a96679e8260030154336040518363ffffffff1660e01b8152600401611b4c92919061491c565b60206040518083038186803b158015611b6457600080fd5b505afa158015611b78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b9c919061458f565b611bdb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bd290614e07565b60405180910390fd5b611d0c8382600201805480602002602001604051908101604052809291908181526020016000905b82821015611d0357838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250508152505081526020019060010190611c03565b50505050612cb6565b50611d73826007600087815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154612b1d90919063ffffffff16565b6007600086815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550611df533838573ffffffffffffffffffffffffffffffffffffffff16612d429092919063ffffffff16565b50505050565b60006060806000611e5188888080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050878761252d565b90506000611e7c60016008600085815260200190815260200160002054612b1d90919063ffffffff16565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631b32d71a8b836040518363ffffffff1660e01b8152600401611edb929190614e27565b60006040518083038186803b158015611ef357600080fd5b505afa158015611f07573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250810190611f309190614fd6565b909192509091508094508195505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631669b10e8b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fd2973ca8e866040518363ffffffff1660e01b8152600401611fdb929190614e27565b60206040518083038186803b158015611ff357600080fd5b505afa158015612007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061202b9190614c53565b8588886040518663ffffffff1660e01b815260040161204e959493929190615133565b60206040518083038186803b15801561206657600080fd5b505afa15801561207a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209e919061458f565b6120dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d4906151e0565b60405180910390fd5b8194505050505095945050505050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166376e2775583336040518363ffffffff1660e01b815260040161214c92919061491c565b60206040518083038186803b15801561216457600080fd5b505afa158015612178573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219c919061458f565b9050806121de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d590614e07565b60405180910390fd5b6000868660008181106121f4576121f3614490565b5b905060600201600001602081019061220c919061427c565b9050600061225e8287878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506110a0565b9050612274816003612dc890919063ffffffff16565b156122b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122ab9061524c565b60405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632a99732a86600a6040518363ffffffff1660e01b81526004016123149291906152b1565b602060405180830381600087803b15801561232e57600080fd5b505af1158015612342573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061236691906148ef565b90506000803660405161237a9291906149d6565b6040518091039020905085600560008381526020019081526020016000206003018190555081600560008381526020019081526020016000206004018190555080600560008381526020019081526020016000206000018190555087876005600084815260200190815260200160002060010191906123fa92919061332c565b5061240f836003612ddf90919063ffffffff16565b5080600660008581526020019081526020016000208190555060005b8a8a90508110156124e35761246a8b8b8381811061244c5761244b614490565b5b905060600201602001803603810190612465919061535b565b612df6565b600560008381526020019081526020016000206002018b8b8381811061249357612492614490565b5b905060600201908060018154018082558091505060019003906000526020600020906002020160009091909190915081816124ce91906155d4565b505080806124db90614622565b91505061242b565b507f909c724b9d08d0463115fc7fa6d2c8e51e6eafa867725be497bdb9a53a6cac4f81858a8a604051612519949392919061560f565b60405180910390a150505050505050505050565b600080600285604051602001612543919061564f565b60405160208183030381529060405260405161255f91906148c3565b602060405180830381855afa15801561257c573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061259f91906148ef565b905060006002856040516020016125b69190615687565b6040516020818303038152906040526040516125d291906148c3565b602060405180830381855afa1580156125ef573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061261291906148ef565b9050600060028560405160200161262991906156a2565b60405160208183030381529060405260405161264591906148c3565b602060405180830381855afa158015612662573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061268591906148ef565b9050600283838360405160200161269e939291906156bd565b6040516020818303038152906040526040516126ba91906148c3565b602060405180830381855afa1580156126d7573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906126fa91906148ef565b93505050509392505050565b6000600560008581526020019081526020016000209050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639a96679e8260030154336040518363ffffffff1660e01b815260040161277e92919061491c565b60206040518083038186803b15801561279657600080fd5b505afa1580156127aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127ce919061458f565b61280d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161280490614e07565b60405180910390fd5b61293e8382600201805480602002602001604051908101604052809291908181526020016000905b8282101561293557838290600052602060002090600202016040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182016040518060400160405290816000820160009054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160089054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250508152505081526020019060010190612835565b50505050612cb6565b61297d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161297490615740565b60405180910390fd5b6129aa3330848673ffffffffffffffffffffffffffffffffffffffff16612e64909392919063ffffffff16565b612a10826007600087815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154612b5e90919063ffffffff16565b6007600086815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555050505050565b612a75612b74565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612ae5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612adc906157d2565b60405180910390fd5b612aee81612bf2565b50565b60008183612aff91906157f2565b905092915050565b60008183612b15919061587b565b905092915050565b60008183612b2b9190614d87565b905092915050565b60008082806020019051810190612b4a91906158ac565b909192509091508092508193505050915091565b60008183612b6c9190614d31565b905092915050565b612b7c612eed565b73ffffffffffffffffffffffffffffffffffffffff16612b9a611aab565b73ffffffffffffffffffffffffffffffffffffffff1614612bf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612be79061595f565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080600090505b8251811015612d36578373ffffffffffffffffffffffffffffffffffffffff16838281518110612cf157612cf0614490565b5b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff161415612d23576001915050612d3c565b8080612d2e90614622565b915050612cbe565b50600090505b92915050565b612dc38363a9059cbb60e01b8484604051602401612d6192919061453a565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612ef5565b505050565b6000612dd78360000183612fbc565b905092915050565b6000612dee8360000183612fdf565b905092915050565b6000816000015167ffffffffffffffff16118015612e2257506000816020015167ffffffffffffffff16115b612e61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e58906159cb565b60405180910390fd5b50565b612ee7846323b872dd60e01b858585604051602401612e85939291906145bc565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612ef5565b50505050565b600033905090565b6000612f57826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661304f9092919063ffffffff16565b9050600081511115612fb75780806020019051810190612f77919061458f565b612fb6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612fad90615a5d565b60405180910390fd5b5b505050565b600080836001016000848152602001908152602001600020541415905092915050565b6000612feb8383612fbc565b613044578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050613049565b600090505b92915050565b606061305e8484600085613067565b90509392505050565b6060824710156130ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130a390615aef565b60405180910390fd5b6130b58561317b565b6130f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130eb90615b5b565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161311d91906148c3565b60006040518083038185875af1925050503d806000811461315a576040519150601f19603f3d011682016040523d82523d6000602084013e61315f565b606091505b509150915061316f82828661319e565b92505050949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b606083156131ae578290506131fe565b6000835111156131c15782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131f59190615bb4565b60405180910390fd5b9392505050565b8280546132119061469a565b90600052602060002090601f016020900481019282613233576000855561327a565b82601f1061324c57805160ff191683800117855561327a565b8280016001018555821561327a579182015b8281111561327957825182559160200191906001019061325e565b5b50905061328791906133b2565b5090565b6040518060a0016040528060008019168152602001606081526020016060815260200160008019168152602001600080191681525090565b6040518060e00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160608152602001606081525090565b8280546133389061469a565b90600052602060002090601f01602090048101928261335a57600085556133a1565b82601f1061337357803560ff19168380011785556133a1565b828001600101855582156133a1579182015b828111156133a0578235825591602001919060010190613385565b5b5090506133ae91906133b2565b5090565b5b808211156133cb5760008160009055506001016133b3565b5090565b6000604051905090565b600080fd5b600080fd5b6000819050919050565b6133f6816133e3565b811461340157600080fd5b50565b600081359050613413816133ed565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f84011261343e5761343d613419565b5b8235905067ffffffffffffffff81111561345b5761345a61341e565b5b60208301915083600182028301111561347757613476613423565b5b9250929050565b6000819050919050565b6134918161347e565b811461349c57600080fd5b50565b6000813590506134ae81613488565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006134df826134b4565b9050919050565b6134ef816134d4565b81146134fa57600080fd5b50565b60008135905061350c816134e6565b92915050565b60008060008060006080868803121561352e5761352d6133d9565b5b600061353c88828901613404565b955050602086013567ffffffffffffffff81111561355d5761355c6133de565b5b61356988828901613428565b9450945050604061357c8882890161349f565b925050606061358d888289016134fd565b9150509295509295909350565b6000602082840312156135b0576135af6133d9565b5b60006135be84828501613404565b91505092915050565b6135d0816133e3565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b838110156136105780820151818401526020810190506135f5565b8381111561361f576000848401525b50505050565b6000601f19601f8301169050919050565b6000613641826135d6565b61364b81856135e1565b935061365b8185602086016135f2565b61366481613625565b840191505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6136a4816134d4565b82525050565b600067ffffffffffffffff82169050919050565b6136c7816136aa565b82525050565b6040820160008201516136e360008501826136be565b5060208201516136f660208501826136be565b50505050565b606082016000820151613712600085018261369b565b50602082015161372560208501826136cd565b50505050565b600061373783836136fc565b60608301905092915050565b6000602082019050919050565b600061375b8261366f565b613765818561367a565b93506137708361368b565b8060005b838110156137a1578151613788888261372b565b975061379383613743565b925050600181019050613774565b5085935050505092915050565b600060a0830160008301516137c660008601826135c7565b50602083015184820360208601526137de8282613636565b915050604083015184820360408601526137f88282613750565b915050606083015161380d60608601826135c7565b50608083015161382060808601826135c7565b508091505092915050565b6000602082019050818103600083015261384581846137ae565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61388582613625565b810181811067ffffffffffffffff821117156138a4576138a361384d565b5b80604052505050565b60006138b76133cf565b90506138c3828261387c565b919050565b600067ffffffffffffffff8211156138e3576138e261384d565b5b602082029050602081019050919050565b6000613907613902846138c8565b6138ad565b9050808382526020820190506020840283018581111561392a57613929613423565b5b835b81811015613953578061393f88826134fd565b84526020840193505060208101905061392c565b5050509392505050565b600082601f83011261397257613971613419565b5b81356139828482602086016138f4565b91505092915050565b60008083601f8401126139a1576139a0613419565b5b8235905067ffffffffffffffff8111156139be576139bd61341e565b5b6020830191508360208202830111156139da576139d9613423565b5b9250929050565b6000806000604084860312156139fa576139f96133d9565b5b600084013567ffffffffffffffff811115613a1857613a176133de565b5b613a248682870161395d565b935050602084013567ffffffffffffffff811115613a4557613a446133de565b5b613a518682870161398b565b92509250509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613a928161347e565b82525050565b6000613aa48383613a89565b60208301905092915050565b6000602082019050919050565b6000613ac882613a5d565b613ad28185613a68565b9350613add83613a79565b8060005b83811015613b0e578151613af58882613a98565b9750613b0083613ab0565b925050600181019050613ae1565b5085935050505092915050565b60006020820190508181036000830152613b358184613abd565b905092915050565b600080fd5b600067ffffffffffffffff821115613b5d57613b5c61384d565b5b613b6682613625565b9050602081019050919050565b82818337600083830152505050565b6000613b95613b9084613b42565b6138ad565b905082815260208101848484011115613bb157613bb0613b3d565b5b613bbc848285613b73565b509392505050565b600082601f830112613bd957613bd8613419565b5b8135613be9848260208601613b82565b91505092915050565b60008060408385031215613c0957613c086133d9565b5b6000613c17858286016134fd565b925050602083013567ffffffffffffffff811115613c3857613c376133de565b5b613c4485828601613bc4565b9150509250929050565b613c57816133e3565b82525050565b6000602082019050613c726000830184613c4e565b92915050565b60008115159050919050565b613c8d81613c78565b82525050565b6000602082019050613ca86000830184613c84565b92915050565b60008083601f840112613cc457613cc3613419565b5b8235905067ffffffffffffffff811115613ce157613ce061341e565b5b602083019150836001820283011115613cfd57613cfc613423565b5b9250929050565b60008083601f840112613d1a57613d19613419565b5b8235905067ffffffffffffffff811115613d3757613d3661341e565b5b602083019150836020820283011115613d5357613d52613423565b5b9250929050565b60008060008060008060008060a0898b031215613d7a57613d796133d9565b5b6000613d888b828c01613404565b985050602089013567ffffffffffffffff811115613da957613da86133de565b5b613db58b828c01613cae565b9750975050604089013567ffffffffffffffff811115613dd857613dd76133de565b5b613de48b828c01613d04565b9550955050606089013567ffffffffffffffff811115613e0757613e066133de565b5b613e138b828c01613d04565b93509350506080613e268b828c01613404565b9150509295985092959890939650565b600080600060408486031215613e4f57613e4e6133d9565b5b6000613e5d868287016134fd565b935050602084013567ffffffffffffffff811115613e7e57613e7d6133de565b5b613e8a86828701613428565b92509250509250925092565b600080600080600060808688031215613eb257613eb16133d9565b5b6000613ec0888289016134fd565b955050602086013567ffffffffffffffff811115613ee157613ee06133de565b5b613eed88828901613428565b94509450506040613f008882890161349f565b9250506060613f118882890161349f565b9150509295509295909350565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600060e083016000830151613f62600086018261369b565b506020830151613f75602086018261369b565b506040830151613f886040860182613a89565b506060830151613f9b6060860182613a89565b506080830151613fae6080860182613a89565b5060a083015184820360a0860152613fc68282613636565b91505060c083015184820360c0860152613fe08282613636565b9150508091505092915050565b6000613ff98383613f4a565b905092915050565b6000602082019050919050565b600061401982613f1e565b6140238185613f29565b93508360208202850161403585613f3a565b8060005b8581101561407157848403895281516140528582613fed565b945061405d83614001565b925060208a01995050600181019050614039565b50829750879550505050505092915050565b6000602082019050818103600083015261409d818461400e565b905092915050565b6140ae816134d4565b82525050565b60006020820190506140c960008301846140a5565b92915050565b6000806000606084860312156140e8576140e76133d9565b5b60006140f686828701613404565b9350506020614107868287016134fd565b92505060406141188682870161349f565b9150509250925092565b60008083601f84011261413857614137613419565b5b8235905067ffffffffffffffff8111156141555761415461341e565b5b60208301915083606082028301111561417157614170613423565b5b9250929050565b600080600080600060608688031215614194576141936133d9565b5b600086013567ffffffffffffffff8111156141b2576141b16133de565b5b6141be88828901614122565b9550955050602086013567ffffffffffffffff8111156141e1576141e06133de565b5b6141ed88828901613428565b9350935050604061420088828901613404565b9150509295509295909350565b600080600060608486031215614226576142256133d9565b5b600084013567ffffffffffffffff811115614244576142436133de565b5b61425086828701613bc4565b93505060206142618682870161349f565b9250506040614272868287016134fd565b9150509250925092565b600060208284031215614292576142916133d9565b5b60006142a0848285016134fd565b91505092915050565b600082825260208201905092915050565b7f6f6e6c7920726563656976657220686173207065726d697373696f6e20746f2060008201527f7377617020746f6b656e00000000000000000000000000000000000000000000602082015250565b6000614316602a836142a9565b9150614321826142ba565b604082019050919050565b6000602082019050818103600083015261434581614309565b9050919050565b7f746f6b656e20737761702070616972206e6f7420666f756e6400000000000000600082015250565b60006143826019836142a9565b915061438d8261434c565b602082019050919050565b600060208201905081810360008301526143b181614375565b9050919050565b7f696e76616c696420616d6f756e74000000000000000000000000000000000000600082015250565b60006143ee600e836142a9565b91506143f9826143b8565b602082019050919050565b6000602082019050818103600083015261441d816143e1565b9050919050565b7f616c726561647920636c61696d65640000000000000000000000000000000000600082015250565b600061445a600f836142a9565b915061446582614424565b602082019050919050565b600060208201905081810360008301526144898161444d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f6465706f736974206e6f7420656e6f7567687400000000000000000000000000600082015250565b60006144f56013836142a9565b9150614500826144bf565b602082019050919050565b60006020820190508181036000830152614524816144e8565b9050919050565b6145348161347e565b82525050565b600060408201905061454f60008301856140a5565b61455c602083018461452b565b9392505050565b61456c81613c78565b811461457757600080fd5b50565b60008151905061458981614563565b92915050565b6000602082840312156145a5576145a46133d9565b5b60006145b38482850161457a565b91505092915050565b60006060820190506145d160008301866140a5565b6145de60208301856140a5565b6145eb604083018461452b565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061462d8261347e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156146605761465f6145f3565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806146b257607f821691505b602082108114156146c6576146c561466b565b5b50919050565b7f496e76616c696420746f6b656e732f66726f6d436861696e49647320696e707560008201527f7400000000000000000000000000000000000000000000000000000000000000602082015250565b60006147286021836142a9565b9150614733826146cc565b604082019050919050565b600060208201905081810360008301526147578161471b565b9050919050565b600080fd5b600080fd5b600080fd5b6000808335600160200384360303811261478a5761478961475e565b5b80840192508235915067ffffffffffffffff8211156147ac576147ab614763565b5b6020830192506001820236038313156147c8576147c7614768565b5b509250929050565b60008160601b9050919050565b60006147e8826147d0565b9050919050565b60006147fa826147dd565b9050919050565b61481261480d826134d4565b6147ef565b82525050565b600081905092915050565b600061482e826135d6565b6148388185614818565b93506148488185602086016135f2565b80840191505092915050565b60006148608285614801565b6014820191506148708284614823565b91508190509392505050565b600081519050919050565b600081905092915050565b600061489d8261487c565b6148a78185614887565b93506148b78185602086016135f2565b80840191505092915050565b60006148cf8284614892565b915081905092915050565b6000815190506148e9816133ed565b92915050565b600060208284031215614905576149046133d9565b5b6000614913848285016148da565b91505092915050565b60006040820190506149316000830185613c4e565b61493e60208301846140a5565b9392505050565b7f4e6f207065726d697373696f6e20746f207472616e736d697400000000000000600082015250565b600061497b6019836142a9565b915061498682614945565b602082019050919050565b600060208201905081810360008301526149aa8161496e565b9050919050565b60006149bd8385614887565b93506149ca838584613b73565b82840190509392505050565b60006149e38284866149b1565b91508190509392505050565b600060ff82169050919050565b6000614a07826149ef565b9150614a12836149ef565b92508260ff03821115614a2857614a276145f3565b5b828201905092915050565b614a3c816149ef565b82525050565b6000608082019050614a576000830187613c4e565b614a646020830186614a33565b614a716040830185613c4e565b614a7e6060830184613c4e565b95945050505050565b7f4e6f207065726d697373696f6e20746f207369676e0000000000000000000000600082015250565b6000614abd6015836142a9565b9150614ac882614a87565b602082019050919050565b60006020820190508181036000830152614aec81614ab0565b9050919050565b7f616c7265616479207265636f7264656400000000000000000000000000000000600082015250565b6000614b296010836142a9565b9150614b3482614af3565b602082019050919050565b60006020820190508181036000830152614b5881614b1c565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000614b9783836135c7565b60208301905092915050565b6000602082019050919050565b6000614bbb82614b5f565b614bc58185614b6a565b9350614bd083614b7b565b8060005b83811015614c01578151614be88882614b8b565b9750614bf383614ba3565b925050600181019050614bd4565b5085935050505092915050565b6000604082019050614c236000830185613c4e565b8181036020830152614c358184614bb0565b90509392505050565b600081519050614c4d81613488565b92915050565b600060208284031215614c6957614c686133d9565b5b6000614c7784828501614c3e565b91505092915050565b6000608082019050614c956000830187613c4e565b614ca260208301866140a5565b614caf604083018561452b565b614cbc6060830184613c4e565b95945050505050565b7f496e76616c696420696e70757400000000000000000000000000000000000000600082015250565b6000614cfb600d836142a9565b9150614d0682614cc5565b602082019050919050565b60006020820190508181036000830152614d2a81614cee565b9050919050565b6000614d3c8261347e565b9150614d478361347e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614d7c57614d7b6145f3565b5b828201905092915050565b6000614d928261347e565b9150614d9d8361347e565b925082821015614db057614daf6145f3565b5b828203905092915050565b7f4e6f207065726d697373696f6e00000000000000000000000000000000000000600082015250565b6000614df1600d836142a9565b9150614dfc82614dbb565b602082019050919050565b60006020820190508181036000830152614e2081614de4565b9050919050565b6000604082019050614e3c6000830185613c4e565b614e49602083018461452b565b9392505050565b600067ffffffffffffffff821115614e6b57614e6a61384d565b5b602082029050602081019050919050565b6000614e8f614e8a84614e50565b6138ad565b90508083825260208201905060208402830185811115614eb257614eb1613423565b5b835b81811015614edb5780614ec788826148da565b845260208401935050602081019050614eb4565b5050509392505050565b600082601f830112614efa57614ef9613419565b5b8151614f0a848260208601614e7c565b91505092915050565b600067ffffffffffffffff821115614f2e57614f2d61384d565b5b602082029050602081019050919050565b6000614f52614f4d84614f13565b6138ad565b90508083825260208201905060208402830185811115614f7557614f74613423565b5b835b81811015614f9e5780614f8a888261457a565b845260208401935050602081019050614f77565b5050509392505050565b600082601f830112614fbd57614fbc613419565b5b8151614fcd848260208601614f3f565b91505092915050565b60008060008060808587031215614ff057614fef6133d9565b5b6000614ffe87828801614c3e565b945050602061500f87828801614c3e565b935050604085015167ffffffffffffffff8111156150305761502f6133de565b5b61503c87828801614ee5565b925050606085015167ffffffffffffffff81111561505d5761505c6133de565b5b61506987828801614fa8565b91505092959194509250565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6150aa81613c78565b82525050565b60006150bc83836150a1565b60208301905092915050565b6000602082019050919050565b60006150e082615075565b6150ea8185615080565b93506150f583615091565b8060005b8381101561512657815161510d88826150b0565b9750615118836150c8565b9250506001810190506150f9565b5085935050505092915050565b600060a0820190506151486000830188613c4e565b615155602083018761452b565b6151626040830186613c4e565b81810360608301526151748185614bb0565b9050818103608083015261518881846150d5565b90509695505050505050565b7f6661696c656420746f207377617020746f6b656e000000000000000000000000600082015250565b60006151ca6014836142a9565b91506151d582615194565b602082019050919050565b600060208201905081810360008301526151f9816151bd565b9050919050565b7f54617267657420746f6b656e20616c7265616479206578697374000000000000600082015250565b6000615236601a836142a9565b915061524182615200565b602082019050919050565b6000602082019050818103600083015261526581615229565b9050919050565b6000819050919050565b6000819050919050565b600061529b6152966152918461526c565b615276565b61347e565b9050919050565b6152ab81615280565b82525050565b60006040820190506152c66000830185613c4e565b6152d360208301846152a2565b9392505050565b600080fd5b6152e8816136aa565b81146152f357600080fd5b50565b600081359050615305816152df565b92915050565b600060408284031215615321576153206152da565b5b61532b60406138ad565b9050600061533b848285016152f6565b600083015250602061534f848285016152f6565b60208301525092915050565b600060408284031215615371576153706133d9565b5b600061537f8482850161530b565b91505092915050565b60008135615395816134e6565b80915050919050565b60008160001b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff6153cb8461539e565b9350801983169250808416831791505092915050565b60006153fc6153f76153f2846134b4565b615276565b6134b4565b9050919050565b600061540e826153e1565b9050919050565b600061542082615403565b9050919050565b6000819050919050565b61543a82615415565b61544d61544682615427565b83546153ab565b8255505050565b60008135615461816152df565b80915050919050565b600067ffffffffffffffff61547e8461539e565b9350801983169250808416831791505092915050565b60006154af6154aa6154a5846136aa565b615276565b6136aa565b9050919050565b6000819050919050565b6154c982615494565b6154dc6154d5826154b6565b835461546a565b8255505050565b60008160401b9050919050565b60006fffffffffffffffff000000000000000061550c846154e3565b9350801983169250808416831791505092915050565b61552b82615494565b61553e615537826154b6565b83546154f0565b8255505050565b60008101600083018061555781615454565b905061556381846154c0565b50505060008101602083018061557881615454565b90506155848184615522565b5050505050565b6155958282615545565b5050565b6000810160008301806155ab81615388565b90506155b78184615431565b5050506001810160208301806155cd818461558b565b5050505050565b6155de8282615599565b5050565b60006155ee83856142a9565b93506155fb838584613b73565b61560483613625565b840190509392505050565b60006060820190506156246000830187613c4e565b61563160208301866140a5565b81810360408301526156448184866155e2565b905095945050505050565b600061565b8284614823565b915081905092915050565b6000819050919050565b61568161567c8261347e565b615666565b82525050565b60006156938284615670565b60208201915081905092915050565b60006156ae8284614801565b60148201915081905092915050565b60006060820190506156d26000830186613c4e565b6156df6020830185613c4e565b6156ec6040830184613c4e565b949350505050565b7f496e76616c696420746f6b656e00000000000000000000000000000000000000600082015250565b600061572a600d836142a9565b9150615735826156f4565b602082019050919050565b600060208201905081810360008301526157598161571d565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006157bc6026836142a9565b91506157c782615760565b604082019050919050565b600060208201905081810360008301526157eb816157af565b9050919050565b60006157fd8261347e565b91506158088361347e565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615615841576158406145f3565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006158868261347e565b91506158918361347e565b9250826158a1576158a061584c565b5b828204905092915050565b600080600080608085870312156158c6576158c56133d9565b5b60006158d487828801614c3e565b94505060206158e587828801614c3e565b93505060406158f687828801614c3e565b9250506060615907878288016148da565b91505092959194509250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006159496020836142a9565b915061595482615913565b602082019050919050565b600060208201905081810360008301526159788161593c565b9050919050565b7f696e76616c6964207377617020726174696f0000000000000000000000000000600082015250565b60006159b56012836142a9565b91506159c08261597f565b602082019050919050565b600060208201905081810360008301526159e4816159a8565b9050919050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b6000615a47602a836142a9565b9150615a52826159eb565b604082019050919050565b60006020820190508181036000830152615a7681615a3a565b9050919050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b6000615ad96026836142a9565b9150615ae482615a7d565b604082019050919050565b60006020820190508181036000830152615b0881615acc565b9050919050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b6000615b45601d836142a9565b9150615b5082615b0f565b602082019050919050565b60006020820190508181036000830152615b7481615b38565b9050919050565b6000615b86826135d6565b615b9081856142a9565b9350615ba08185602086016135f2565b615ba981613625565b840191505092915050565b60006020820190508181036000830152615bce8184615b7b565b90509291505056fea264697066735822122027994878bc0796324bd5651e387b07610e125535c1f39fcdb2ffab52eba39b4964736f6c63430008090033", + "linkReferences": {}, + "deployedLinkReferences": {} +} From 30c1c4bf1951b9a2fcbe107435591f609827e948 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Thu, 1 Sep 2022 14:12:27 +0800 Subject: [PATCH 41/66] fix: improve gas fee --- .../IBridgeOutService.cs | 4 ++- .../Providers/ITransmitTransactionProvider.cs | 35 ++++++++++++------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs index 51d227d8..a7eeb4d0 100644 --- a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs +++ b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs @@ -1,4 +1,5 @@ -using AElf.Nethereum.Core; +using System.Numerics; +using AElf.Nethereum.Core; using Nethereum.RPC.Eth.DTOs; using Volo.Abp.DependencyInjection; @@ -19,6 +20,7 @@ public async Task TransmitAsync(string chainId, string contractAddress, var setValueFunction = GetFunction(chainId, contractAddress, "transmit"); var sender = GetAccount().Address; var gas = await setValueFunction.EstimateGasAsync(sender, null, null, swapHashId, report, rs, ss, rawVs); + gas.Value += BigInteger.Divide(gas.Value, new BigInteger(20)); var transactionResult = await setValueFunction.SendTransactionAsync(sender, gas, null, null, swapHashId, report, rs, ss, rawVs); diff --git a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs index fd2216b5..7476343d 100644 --- a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs +++ b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs @@ -1,3 +1,4 @@ +using System; using System.Threading.Tasks; using AElf.Client.Core; using AElf.Client.Core.Options; @@ -79,18 +80,28 @@ public async Task SendByLibAsync(string chainId, string libHash, long libHeight) } else { - var sendResult = await _bridgeOutService.TransmitAsync(item.TargetChainId, - item.TargetContractAddress,item.SwapHashId, - item.Report, item.Rs, item.Ss, item.RawVs); - if (string.IsNullOrWhiteSpace(sendResult)) + try { - Logger.LogError("Failed to transmit."); - break; + var sendResult = await _bridgeOutService.TransmitAsync(item.TargetChainId, + item.TargetContractAddress,item.SwapHashId, + item.Report, item.Rs, item.Ss, item.RawVs); + if (string.IsNullOrWhiteSpace(sendResult)) + { + Logger.LogError("Failed to transmit."); + break; + } + + item.TransactionId = sendResult; + await EnqueueAsync(GetQueueName(TransmitCheckingQueue,item.ChainId), item); + Logger.LogInformation($"Send Transmit transaction. TxId: {sendResult}"); } - - item.TransactionId = sendResult; - await EnqueueAsync(GetQueueName(TransmitCheckingQueue,item.ChainId), item); - Logger.LogInformation($"Send Transmit transaction. TxId: {sendResult}"); + catch (Exception e) + { + Logger.LogError($"Send Transmit transaction Failed. Message: {e.Message}", e); + item.RetryTimes += 1; + await EnqueueAsync(GetQueueName(TransmitSendingQueue, item.ChainId), item); + } + } } @@ -107,7 +118,7 @@ public async Task UpdateQueueAsync(string chainId) var ethAlias = _ethereumAElfChainAliasOptions.Mapping[item.TargetChainId]; var receipt = await _nethereumService.GetTransactionReceiptAsync(ethAlias, item.TransactionId); - if (receipt.Status.Value != 1) + if (receipt == null || receipt.Status == null || receipt.Status.Value != 1) { Logger.LogError($"Transmit transaction failed. Chain: {item.TargetChainId}, TxId: {item.TransactionId}"); item.RetryTimes += 1; @@ -129,9 +140,9 @@ public async Task UpdateQueueAsync(string chainId) } await DequeueAsync(GetQueueName(TransmitCheckingQueue,chainId)); - item = await GetFirstItemAsync(GetQueueName(TransmitCheckingQueue,chainId)); Logger.LogInformation($"Transmit transaction finished. TxId: {item.TransactionId}"); + item = await GetFirstItemAsync(GetQueueName(TransmitCheckingQueue,chainId)); } } From 6c6286330bae15a0626646768142efa3de467910 Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Fri, 2 Sep 2022 18:45:46 +0800 Subject: [PATCH 42/66] fix: get token index out of range. --- .../ReportConfirmedLogEventProcessor.cs | 2 + .../ReportProposedLogEventProcessor.cs | 2 + .../Providers/IReceiptProvider.cs | 7 +- src/AElf.EventHandler/appsettings.json | 169 ++++++++++++++---- 4 files changed, 146 insertions(+), 34 deletions(-) diff --git a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs index 888a0b2a..6f79ecda 100644 --- a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs @@ -56,6 +56,8 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) var targetChainId = reportConfirmed.TargetChainId; var ethereumContractAddress = reportConfirmed.Token; var roundId = reportConfirmed.RoundId; + + //TODO:check permission await _signaturesRecoverableInfoProvider.SetSignatureAsync(chainId, ethereumContractAddress, roundId, reportConfirmed.Signature); if (reportConfirmed.IsAllNodeConfirmed) diff --git a/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs index fe3a20dd..f2ecb7b2 100644 --- a/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportProposedLogEventProcessor.cs @@ -43,6 +43,8 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) reportProposed.MergeFrom(logEvent); _logger.LogInformation($"New report: {reportProposed}"); + + //TODO:Check permission var chainId = ChainIdProvider.GetChainId(context.ChainId); var privateKey = _accountProvider.GetPrivateKey(_aelfClientConfigOptions.AccountAlias); diff --git a/src/AElf.EventHandler/Providers/IReceiptProvider.cs b/src/AElf.EventHandler/Providers/IReceiptProvider.cs index efa8fc69..332afd00 100644 --- a/src/AElf.EventHandler/Providers/IReceiptProvider.cs +++ b/src/AElf.EventHandler/Providers/IReceiptProvider.cs @@ -68,7 +68,7 @@ public async Task ExecuteAsync() { var bridgeItemsMap = new Dictionary<(string, string), List>(); var sendQueryList = new Dictionary(); - var tokenIndex = new Dictionary(); + var tokenIndex = new Dictionary<(string,string), BigInteger>(); foreach (var bridgeItem in _bridgeOptions.BridgesIn) { var key = (bridgeItem.ChainId, bridgeItem.EthereumBridgeInContractAddress); @@ -85,11 +85,12 @@ public async Task ExecuteAsync() { var tokenList = item.Select(i => i.OriginToken).ToList(); var targetChainIdList = item.Select(i => i.TargetChainId).ToList(); + var tokenAndChainIdList = item.Select(i => (i.TargetChainId, i.OriginToken)).ToList(); var sendReceiptIndexDto = await _bridgeInService.GetTransferReceiptIndexAsync(aliasAddress.Item1, aliasAddress.Item2, tokenList, targetChainIdList); for (var i = 0; i < tokenList.Count; i++) { - tokenIndex[tokenList[i]] = sendReceiptIndexDto.Indexes[i]; + tokenIndex[tokenAndChainIdList[i]] = sendReceiptIndexDto.Indexes[i]; sendQueryList[item[i].SwapId] = item[i]; } } @@ -97,7 +98,7 @@ public async Task ExecuteAsync() foreach (var (swapId, item) in sendQueryList) { var targetChainId = _bridgeOptions.BridgesIn.Single(i => i.SwapId == swapId).TargetChainId; - await SendQueryAsync(targetChainId, item, tokenIndex[item.OriginToken]); + await SendQueryAsync(targetChainId, item, tokenIndex[(item.TargetChainId,item.OriginToken)]); } } private async Task SendQueryAsync(string chainId, BridgeItemIn bridgeItem, BigInteger tokenIndex) diff --git a/src/AElf.EventHandler/appsettings.json b/src/AElf.EventHandler/appsettings.json index 78d8fed9..3184d470 100644 --- a/src/AElf.EventHandler/appsettings.json +++ b/src/AElf.EventHandler/appsettings.json @@ -7,23 +7,30 @@ } }, "Redis": { - "Configuration": "127.0.0.1" + "Configuration": "192.168.67.39,defaultDatabase=3" }, "MessageQueue": { "Enable": true, "HostName": "192.168.67.52", "Uri": "amqp://192.168.67.52:5672", "Port": "5672", - "ClientName": "AElf-Oracle-Client", - "ExchangeName": "AElfCrossChain", - "UserName": "guest", - "Password": "guest" + "ClientName": "AElf-Oracle-Client-1", + "ExchangeName": "AElf-CrossChain-Test", + "UserName": "admin", + "Password": "123456" }, "AElfClient": { "ClientConfigList": [ { - "Alias": "AELF-Test", - "Endpoint": "http://192.168.67.47:8000", + "Alias": "AELF-Main-Test", + "Endpoint": "http://192.168.66.191:8000", + "UserName": "", + "Password": "", + "Timeout": 100 + }, + { + "Alias": "AELF-Side-Test", + "Endpoint": "http://192.168.66.230:8000", "UserName": "", "Password": "", "Timeout": 100 @@ -34,27 +41,32 @@ "KeyDirectory": "", "AccountConfigList": [ { - "Alias": "bp", - "PrivateKey": "8d1d8002802dd6fcd80ae9f5c5c6e4914a1120427c2108c5334353ffc270497b" + "Alias": "Oracle-1", + "PrivateKey": "268866d175fbdae3efc081d0ecbaee43110cf37c83b9cd805e75b233e7629d95" } ] }, "AElfClientConfig": { - "ClientAlias": "AELF-Test", + "ClientAlias": "AELF-Main-Test", "MainChainClientAlias": "TestNetMainChain", "SideChainClientAlias": "TestNetSideChain2", - "AccountAlias": "bp" + "AccountAlias": "Oracle-1" }, "AElfChainAlias": { "Mapping": { - "MainChain_AELF": "AELF-Test" + "MainChain_AELF": "AELF-Main-Test", + "SideChain_tDVV": "AELF-Side-Test" } }, "EthereumClient": { "ClientConfigList": [ { "Alias": "Kovan", - "Url": "https://kovan.infura.io/v3/ed046cb3d9a84513a7d90690ebc7f2ac" + "Url": "https://kovan.infura.io/v3/4c41b8476e874c178c633ff442a27a1b" + }, + { + "Alias": "BSCTest", + "Url": "https://data-seed-prebsc-1-s1.binance.org:8545" } ] }, @@ -63,7 +75,7 @@ "AccountConfigList": [ { "Alias": "eth", - "PrivateKey": "8d1d8002802dd6fcd80ae9f5c5c6e4914a1120427c2108c5334353ffc270497b" + "PrivateKey": "268866d175fbdae3efc081d0ecbaee43110cf37c83b9cd805e75b233e7629d95" } ] }, @@ -73,20 +85,30 @@ "EthereumChainAlias": { "Mapping": { "Ethereum": "Ethereum", - "Kovan" : "Kovan" + "Kovan": "Kovan", + "BSCTest": "BSCTest" } }, "AElfContract": { "ContractDirectory": "", "ContractAddressList": { "MainChain_AELF": { - "MerkleTreeContract": "SsSqZWLf7Dk9NWyWyvDwuuY5nzn5n99jiscKZgRPaajZP5p8y", - "BridgeContract": "225ajURvev5rgX8HnMJ8GjbPnRxUrCHoD7HUjhWQqewEJ5GAv1", - "OracleContract": "xsnQafDAhNTeYcooptETqWnYBksFGGXxfcQyJJ5tmu6Ak9ZZt", - "ReportContract": "GwsSp1MZPmkMvXdbfSCDydHhZtDpvqkFpmPvStYho288fb7QZ", - "StringAggregatorContract": "2M24EKAecggCnttZ9DUUMCXi4xC67rozA87kFgid9qEwRUMHTs", - "RegimentContract": "2nyC8hqq3pGnRu8gJzCsTaxXB6snfGxmL2viimKXgEfYWGtjEh", + "MerkleTreeContract": "2NxwCPAGJr4knVdmwhb1cK7CkZw5sMJkRDLnT7E2GoDP2dy5iZ", + "BridgeContract": "2RHf2fxsnEaM3wb6N1yGqPupNZbcCY98LgWbGSFWmWzgEs5Sjo", + "OracleContract": "2LUmicHyH4RXrMjG4beDwuDsiWJESyLkgkwPdGTR8kahRzq5XS", + "ReportContract": "2WHXRoLRjbUTDQsuqR5CntygVfnDb125qdJkudev4kVNbLhTdG", + "StringAggregatorContract": "xsnQafDAhNTeYcooptETqWnYBksFGGXxfcQyJJ5tmu6Ak9ZZt", + "RegimentContract": "sr4zX6E7yVVL7HevExVcWv2ru3HSZakhsJMXfzxzfpnXofnZw", "ConsensusContract": "pGa4e5hNGsgkfjEGm72TEvbF7aRDqKBd4LuXtab4ucMbXLcgJ" + }, + "SideChain_tDVV": { + "MerkleTreeContract": "2YkKkNZKCcsfUsGwCfJ6wyTx5NYLgpCg1stBuRT4z5ep3psXNG", + "BridgeContract": "2AsEepqiFCRDnepVheYYN5LK7nvM2kUoXgk2zLKu1Zneh8fwmF", + "OracleContract": "RXcxgSXuagn8RrvhQAV81Z652EEYSwR6JLnqHYJ5UVpEptW8Y", + "ReportContract": "2wRDbyVF28VBQoSPgdSEFaL4x7CaXz8TCBujYhgWc9qTMxBE3n", + "StringAggregatorContract": "2F5McxHg7fAqVjDX97v79j4drsMq442rArChpBii8TWuRb8ZnK", + "RegimentContract": "2onFLTnPEiZrXGomzJ8g74cBre2cJuHrn1yBJF3P6Xu9K5Gbth", + "ConsensusContract": "BNPFPPwQ3DE9rwxzdY61Q2utU9FZx9KYUnrYHQqCR6N4LLhUE" } } }, @@ -101,22 +123,67 @@ } }, "Oracle": { - "ObserverAssociationAddressList": ["Taikh8VFhM3qbrkC2hd5SzXFsas72gu31SbMZWmgopehdMVQE"] + "ObserverAssociationAddressList": ["RdJeA3VdAzrD12AsBNFzbdUwAqs5DzkDK4N7QLT6pc55SdrNy","2QXz8kd6hGf8PxDzia3tD7PzXboajkSvn2GE9G2XctMi3sdtJT"] }, "Bridge": { "IsSendQuery": true, "IsTransmitter": true, "QueryPayment": 0, - "AccountAddress":"ZrAFaqdr79MWYkxA49Hp2LUdSVHdP6fJh3kDw4jmgC7HTgrni", + "AccountAddress":"", "BridgesIn": [ { "chainId": "Kovan", "TargetChainId": "MainChain_AELF", "OriginToken": "0xb085f10C869022E8588825f901a54C1ACeb13A07", - "EthereumBridgeInContractAddress": "0x40536e47BA0541d5940B29b0423652b797d7FdcA", - "SwapId": "ad7af9718a9822d4ac878d62fe5209885dc567ab12d96220732c97a79322ebab", - "MaximumLeafCount": 1024, - "QueryToAddress": "Taikh8VFhM3qbrkC2hd5SzXFsas72gu31SbMZWmgopehdMVQE" + "EthereumBridgeInContractAddress": "0x164322657FC57EA95CAc4bF6623E53CA0f952E11", + "SwapId": "c70ded97ae810984aa4dbd317e5574fc12b6ff4cae4b7052757d8a71f0aae523", + "MaximumLeafCount": 128, + "QueryToAddress": "RdJeA3VdAzrD12AsBNFzbdUwAqs5DzkDK4N7QLT6pc55SdrNy" + }, + { + "chainId": "Kovan", + "TargetChainId": "MainChain_AELF", + "OriginToken": "0xA050886815CFc52a24B9C4aD044ca199990B6690", + "EthereumBridgeInContractAddress": "0x164322657FC57EA95CAc4bF6623E53CA0f952E11", + "SwapId": "701ddb40246506fd48cc7a28ba453303b8e43f7d140bcf7d9cbea14fe05e528d", + "MaximumLeafCount": 128, + "QueryToAddress": "RdJeA3VdAzrD12AsBNFzbdUwAqs5DzkDK4N7QLT6pc55SdrNy" + }, + { + "chainId": "Kovan", + "TargetChainId": "MainChain_AELF", + "OriginToken": "0x53e8d0c17e258c7adc446b4e160a2000816f00d9", + "EthereumBridgeInContractAddress": "0x164322657FC57EA95CAc4bF6623E53CA0f952E11", + "SwapId": "0d0a485dc471662372bda4944dd444004db1598b3031546039a353259df8cff2", + "MaximumLeafCount": 128, + "QueryToAddress": "RdJeA3VdAzrD12AsBNFzbdUwAqs5DzkDK4N7QLT6pc55SdrNy" + }, + { + "chainId": "Kovan", + "TargetChainId": "SideChain_tDVV", + "OriginToken": "0xb085f10C869022E8588825f901a54C1ACeb13A07", + "EthereumBridgeInContractAddress": "0x164322657FC57EA95CAc4bF6623E53CA0f952E11", + "SwapId": "1db5c7ac518f8856dc782fbda38e8df2be710fc9430519f306b8466c50d1b978", + "MaximumLeafCount": 128, + "QueryToAddress": "2QXz8kd6hGf8PxDzia3tD7PzXboajkSvn2GE9G2XctMi3sdtJT" + }, + { + "chainId": "Kovan", + "TargetChainId": "SideChain_tDVV", + "OriginToken": "0xA050886815CFc52a24B9C4aD044ca199990B6690", + "EthereumBridgeInContractAddress": "0x164322657FC57EA95CAc4bF6623E53CA0f952E11", + "SwapId": "22601b16cf12a88b1a228b2051ba28a4e7ec7772c398a81d051d801711f1bc3c", + "MaximumLeafCount": 128, + "QueryToAddress": "2QXz8kd6hGf8PxDzia3tD7PzXboajkSvn2GE9G2XctMi3sdtJT" + }, + { + "chainId": "Kovan", + "TargetChainId": "SideChain_tDVV", + "OriginToken": "0x53e8d0c17e258c7adc446b4e160a2000816f00d9", + "EthereumBridgeInContractAddress": "0x164322657FC57EA95CAc4bF6623E53CA0f952E11", + "SwapId": "c46c672d57b708a50d82d18be3c3cbdfe6fdf417ef13d95fbdeb804f30fc478a", + "MaximumLeafCount": 128, + "QueryToAddress": "2QXz8kd6hGf8PxDzia3tD7PzXboajkSvn2GE9G2XctMi3sdtJT" } ], "BridgesOut": [ @@ -124,9 +191,49 @@ "chainId": "MainChain_AElf", "TargetChainId": "Kovan", "OriginToken": "ELF", - "QueryToAddress": "Taikh8VFhM3qbrkC2hd5SzXFsas72gu31SbMZWmgopehdMVQE", - "EthereumSwapId": "0x8cbe63c7458bef338d7da2008521616897109cf1427c1450ec6cb47a5a7df5e6", - "EthereumBridgeOutContractAddress": "0x2b8e182ac87d123237f8e28e4DDe8a2b050a1c96" + "QueryToAddress": "RdJeA3VdAzrD12AsBNFzbdUwAqs5DzkDK4N7QLT6pc55SdrNy", + "EthereumSwapId": "0xD9E579BC76EB76E2BCCD32BA34419B5493D236E7D659E7726B124D6E70A42427", + "EthereumBridgeOutContractAddress": "0x26a44A0383F15f7f83D84eb95c4b7762d8de995A" + }, + { + "chainId": "MainChain_AElf", + "TargetChainId": "Kovan", + "OriginToken": "USDT", + "QueryToAddress": "RdJeA3VdAzrD12AsBNFzbdUwAqs5DzkDK4N7QLT6pc55SdrNy", + "EthereumSwapId": "0xE842DB49D684DD1D94BA7920D0F6429D5B3ECEF0C09DD9B8477FFCF1CDD2FD0E", + "EthereumBridgeOutContractAddress": "0x26a44A0383F15f7f83D84eb95c4b7762d8de995A" + }, + { + "chainId": "MainChain_AElf", + "TargetChainId": "Kovan", + "OriginToken": "ETH", + "QueryToAddress": "RdJeA3VdAzrD12AsBNFzbdUwAqs5DzkDK4N7QLT6pc55SdrNy", + "EthereumSwapId": "0x32C4F09BEAF5A160EA0EEB18996F69647B57B6EC98C1DBB9CED1D6D6873EA4EF", + "EthereumBridgeOutContractAddress": "0x26a44A0383F15f7f83D84eb95c4b7762d8de995A" + }, + { + "chainId": "SideChain_tDVV", + "TargetChainId": "Kovan", + "OriginToken": "ELF", + "QueryToAddress": "2QXz8kd6hGf8PxDzia3tD7PzXboajkSvn2GE9G2XctMi3sdtJT", + "EthereumSwapId": "0xFC372251575E57610061466B0628B3EDDA34736ADC4B5C631E635AFAE9BE0DE1", + "EthereumBridgeOutContractAddress": "0x26a44A0383F15f7f83D84eb95c4b7762d8de995A" + }, + { + "chainId": "SideChain_tDVV", + "TargetChainId": "Kovan", + "OriginToken": "USDT", + "QueryToAddress": "2QXz8kd6hGf8PxDzia3tD7PzXboajkSvn2GE9G2XctMi3sdtJT", + "EthereumSwapId": "0xD257B15EDF0ECE53BEBFD1392DC1EE0B4C930AA090973C04279285412C5BEA72", + "EthereumBridgeOutContractAddress": "0x26a44A0383F15f7f83D84eb95c4b7762d8de995A" + }, + { + "chainId": "SideChain_tDVV", + "TargetChainId": "Kovan", + "OriginToken": "ETH", + "QueryToAddress": "2QXz8kd6hGf8PxDzia3tD7PzXboajkSvn2GE9G2XctMi3sdtJT", + "EthereumSwapId": "0x6C20AC269DB2AB2AFCED73D918F51B6A6B99692E228636E1A891F87281379E8B", + "EthereumBridgeOutContractAddress": "0x26a44A0383F15f7f83D84eb95c4b7762d8de995A" } ] }, @@ -134,7 +241,7 @@ "ConfirmationCount": { "Ethereum": 12, "Kovan": 12, - "bsc": 100 + "BSCTest": 100 } }, "ChainIdMapping": { From 2d1cdcb1be8cc47f5960e6fd23788a986f0590ff Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Mon, 5 Sep 2022 11:26:32 +0800 Subject: [PATCH 43/66] fix: add log info. --- .../QueryCreatedLogEventProcessor.cs | 3 +- .../Providers/IReceiptProvider.cs | 73 ++++++++++++------- 2 files changed, 47 insertions(+), 29 deletions(-) diff --git a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs index 569e4792..558d0b19 100644 --- a/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/QueryCreatedLogEventProcessor.cs @@ -58,8 +58,9 @@ public override async Task ProcessAsync(LogEvent logEvent, EventContext context) queryCreated.QueryInfo.Options.ToList()); if (string.IsNullOrEmpty(data)) { + var swapId = queryCreated.QueryInfo.Title.Split("_").Last(); _logger.LogError(queryCreated.QueryInfo.Title == "record_receipts" - ? "Failed to record receipts from eth to aelf." + ? $"Failed to record receipts. Swap Id :{swapId}" : $"Failed to response to query {queryCreated.QueryId}."); return; diff --git a/src/AElf.EventHandler/Providers/IReceiptProvider.cs b/src/AElf.EventHandler/Providers/IReceiptProvider.cs index 332afd00..5d56b42a 100644 --- a/src/AElf.EventHandler/Providers/IReceiptProvider.cs +++ b/src/AElf.EventHandler/Providers/IReceiptProvider.cs @@ -38,7 +38,7 @@ public class ReceiptProvider : IReceiptProvider, ITransientDependency private readonly ILogger _logger; private readonly AElfContractOptions _contractOptions; private readonly BlockConfirmationOptions _blockConfirmationOptions; - + public ReceiptProvider( IOptionsSnapshot bridgeOptions, IOptionsSnapshot aelfChainAliasOption, @@ -64,11 +64,12 @@ public ReceiptProvider( _contractOptions = contractOptions.Value; _blockConfirmationOptions = blockConfirmation.Value; } + public async Task ExecuteAsync() { var bridgeItemsMap = new Dictionary<(string, string), List>(); var sendQueryList = new Dictionary(); - var tokenIndex = new Dictionary<(string,string), BigInteger>(); + var tokenIndex = new Dictionary<(string, string), BigInteger>(); foreach (var bridgeItem in _bridgeOptions.BridgesIn) { var key = (bridgeItem.ChainId, bridgeItem.EthereumBridgeInContractAddress); @@ -76,9 +77,9 @@ public async Task ExecuteAsync() { items = new List(); } + items.Add(bridgeItem); bridgeItemsMap[key] = items; - } foreach (var (aliasAddress, item) in bridgeItemsMap) @@ -98,13 +99,14 @@ public async Task ExecuteAsync() foreach (var (swapId, item) in sendQueryList) { var targetChainId = _bridgeOptions.BridgesIn.Single(i => i.SwapId == swapId).TargetChainId; - await SendQueryAsync(targetChainId, item, tokenIndex[(item.TargetChainId,item.OriginToken)]); + await SendQueryAsync(targetChainId, item, tokenIndex[(item.TargetChainId, item.OriginToken)]); } } + private async Task SendQueryAsync(string chainId, BridgeItemIn bridgeItem, BigInteger tokenIndex) { var swapId = bridgeItem.SwapId; - + var spaceId = await _bridgeContractService.GetSpaceIdBySwapIdAsync(chainId, Hash.LoadFromHex(swapId)); var lastRecordedLeafIndex = (await _merkleTreeContractService.GetLastLeafIndexAsync( chainId, new GetLastLeafIndexInput @@ -116,34 +118,39 @@ private async Task SendQueryAsync(string chainId, BridgeItemIn bridgeItem, BigIn _logger.LogInformation($"Space of id {spaceId} is not created. "); return; } + var nextTokenIndex = lastRecordedLeafIndex == 0 ? 1 : lastRecordedLeafIndex + 2; if (_latestQueriedReceiptCountProvider.Get(swapId) == 0) { - _latestQueriedReceiptCountProvider.Set(swapId,nextTokenIndex); + _latestQueriedReceiptCountProvider.Set(swapId, nextTokenIndex); } - + var nextRoundStartTokenIndex = _latestQueriedReceiptCountProvider.Get(swapId); - _logger.LogInformation($"Next round to query should begin with tokenIndex:{nextRoundStartTokenIndex}"); + _logger.LogInformation( + $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Next round to query should begin with tokenIndex:{nextRoundStartTokenIndex}"); - _logger.LogInformation($"Last recorded leaf index : {lastRecordedLeafIndex}."); + _logger.LogInformation( + $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Last recorded leaf index : {lastRecordedLeafIndex}."); var ifMatchIndex = nextRoundStartTokenIndex == 1 ? 1 : nextTokenIndex - 1; - if (ifMatchIndex != lastRecordedLeafIndex+1) + if (ifMatchIndex != lastRecordedLeafIndex + 1) { - _logger.LogInformation($"Inccorect leaf index. Last recorded leaf index:{lastRecordedLeafIndex};Last recorded receipt index:{lastRecordedLeafIndex+1};Should begin token index:{nextRoundStartTokenIndex}."); + _logger.LogInformation( + $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Inccorect leaf index. Last recorded leaf index:{lastRecordedLeafIndex};Last recorded receipt index:{lastRecordedLeafIndex + 1};Should begin token index:{nextRoundStartTokenIndex}."); return; } - + if (tokenIndex < nextRoundStartTokenIndex) { return; } - var notRecordTokenNumber = tokenIndex - nextRoundStartTokenIndex + 1; + + var notRecordTokenNumber = tokenIndex - nextRoundStartTokenIndex + 1; if (notRecordTokenNumber > 0) { var blockNumber = await _nethereumService.GetBlockNumberAsync(bridgeItem.ChainId); var getReceiptInfos = await _bridgeInService.GetSendReceiptInfosAsync(bridgeItem.ChainId, bridgeItem.EthereumBridgeInContractAddress, bridgeItem.OriginToken, bridgeItem.TargetChainId, - nextRoundStartTokenIndex,(long)tokenIndex); + nextRoundStartTokenIndex, (long) tokenIndex); var lastTokenIndexConfirm = nextRoundStartTokenIndex - 1; string receiptIdHash = null; for (var i = 0; i < notRecordTokenNumber; i++) @@ -153,28 +160,37 @@ private async Task SendQueryAsync(string chainId, BridgeItemIn bridgeItem, BigIn var blockConfirmationCount = _blockConfirmationOptions.ConfirmationCount[bridgeItem.ChainId]; if (blockNumber - blockHeight > blockConfirmationCount) { - lastTokenIndexConfirm = (i+nextRoundStartTokenIndex); + lastTokenIndexConfirm = (i + nextRoundStartTokenIndex); continue; } + break; } - _logger.LogInformation($"Last confirmed token index:{lastTokenIndexConfirm}"); - - _logger.LogInformation($"Token hash in receipt id:{receiptIdHash}"); + + _logger.LogInformation( + $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Last confirmed token index:{lastTokenIndexConfirm}"); + + _logger.LogInformation( + $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Token hash in receipt id:{receiptIdHash}"); if (lastTokenIndexConfirm - nextRoundStartTokenIndex >= 0) { - _logger.LogInformation($"Start to query token : from receipt index {nextRoundStartTokenIndex},end receipt index {lastTokenIndexConfirm}"); + _logger.LogInformation( + $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Start to query token : from receipt index {nextRoundStartTokenIndex},end receipt index {lastTokenIndexConfirm}"); var queryInput = new QueryInput { Payment = _bridgeOptions.QueryPayment, QueryInfo = new QueryInfo { Title = $"record_receipts_{swapId}", - Options = {$"{receiptIdHash}.{nextRoundStartTokenIndex}", $"{receiptIdHash}.{lastTokenIndexConfirm}"} + Options = + { + $"{receiptIdHash}.{nextRoundStartTokenIndex}", $"{receiptIdHash}.{lastTokenIndexConfirm}" + } }, - AggregatorContractAddress = _contractOptions.ContractAddressList[chainId]["StringAggregatorContract"].ConvertAddress(), - AggregateThreshold = 1, + AggregatorContractAddress = + _contractOptions.ContractAddressList[chainId]["StringAggregatorContract"].ConvertAddress(), + //AggregateThreshold = 1, CallbackInfo = new CallbackInfo { ContractAddress = @@ -187,15 +203,16 @@ private async Task SendQueryAsync(string chainId, BridgeItemIn bridgeItem, BigIn } }; - _logger.LogInformation($"About to send Query transaction for token swapping, QueryInput: {queryInput}"); - _latestQueriedReceiptCountProvider.Set(swapId, lastTokenIndexConfirm + 1); + _logger.LogInformation( + $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} About to send Query transaction for token swapping, QueryInput: {queryInput}"); + _latestQueriedReceiptCountProvider.Set(swapId, lastTokenIndexConfirm + 1); var sendTxResult = await _oracleService.QueryAsync(chainId, queryInput); - _logger.LogInformation($"Query transaction id : {sendTxResult.TransactionResult.TransactionId}"); - _logger.LogInformation( - $"Next token index should start with tokenindex:{_latestQueriedReceiptCountProvider.Get(swapId)}"); + $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Query transaction id : {sendTxResult.TransactionResult.TransactionId}"); + + _logger.LogInformation( + $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Next token index should start with tokenindex:{_latestQueriedReceiptCountProvider.Get(swapId)}"); } - } } } \ No newline at end of file From 5f709a240f91d4d5b316b7831f0b92a972c136b2 Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Mon, 5 Sep 2022 12:04:35 +0800 Subject: [PATCH 44/66] fix: merkle tree last leaf index. --- .../Providers/IReceiptProvider.cs | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/AElf.EventHandler/Providers/IReceiptProvider.cs b/src/AElf.EventHandler/Providers/IReceiptProvider.cs index 5d56b42a..f29661c4 100644 --- a/src/AElf.EventHandler/Providers/IReceiptProvider.cs +++ b/src/AElf.EventHandler/Providers/IReceiptProvider.cs @@ -119,25 +119,19 @@ private async Task SendQueryAsync(string chainId, BridgeItemIn bridgeItem, BigIn return; } - var nextTokenIndex = lastRecordedLeafIndex == 0 ? 1 : lastRecordedLeafIndex + 2; + var nextTokenIndex = lastRecordedLeafIndex == -2 ? 1 : lastRecordedLeafIndex + 2; if (_latestQueriedReceiptCountProvider.Get(swapId) == 0) { _latestQueriedReceiptCountProvider.Set(swapId, nextTokenIndex); } - - var nextRoundStartTokenIndex = _latestQueriedReceiptCountProvider.Get(swapId); + _logger.LogInformation( - $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Next round to query should begin with tokenIndex:{nextRoundStartTokenIndex}"); + $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Last recorded leaf index : {lastRecordedLeafIndex}."); + var nextRoundStartTokenIndex = _latestQueriedReceiptCountProvider.Get(swapId); _logger.LogInformation( - $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Last recorded leaf index : {lastRecordedLeafIndex}."); - var ifMatchIndex = nextRoundStartTokenIndex == 1 ? 1 : nextTokenIndex - 1; - if (ifMatchIndex != lastRecordedLeafIndex + 1) - { - _logger.LogInformation( - $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Inccorect leaf index. Last recorded leaf index:{lastRecordedLeafIndex};Last recorded receipt index:{lastRecordedLeafIndex + 1};Should begin token index:{nextRoundStartTokenIndex}."); - return; - } + $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Next round to query should begin with receipt Index:{nextRoundStartTokenIndex}"); + if (tokenIndex < nextRoundStartTokenIndex) { @@ -168,7 +162,7 @@ private async Task SendQueryAsync(string chainId, BridgeItemIn bridgeItem, BigIn } _logger.LogInformation( - $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Last confirmed token index:{lastTokenIndexConfirm}"); + $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Last confirmed receipt index:{lastTokenIndexConfirm}"); _logger.LogInformation( $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Token hash in receipt id:{receiptIdHash}"); @@ -211,7 +205,7 @@ private async Task SendQueryAsync(string chainId, BridgeItemIn bridgeItem, BigIn $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Query transaction id : {sendTxResult.TransactionResult.TransactionId}"); _logger.LogInformation( - $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Next token index should start with tokenindex:{_latestQueriedReceiptCountProvider.Get(swapId)}"); + $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Next receipt index should start with: {_latestQueriedReceiptCountProvider.Get(swapId)}"); } } } From e830b513fa5ec5cf34a6fb538dfc6504dbcdaf33 Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Mon, 5 Sep 2022 12:05:29 +0800 Subject: [PATCH 45/66] appsettings.json --- src/AElf.EventHandler/appsettings.json | 168 ++++++------------------- 1 file changed, 39 insertions(+), 129 deletions(-) diff --git a/src/AElf.EventHandler/appsettings.json b/src/AElf.EventHandler/appsettings.json index 3184d470..ed10021a 100644 --- a/src/AElf.EventHandler/appsettings.json +++ b/src/AElf.EventHandler/appsettings.json @@ -7,30 +7,23 @@ } }, "Redis": { - "Configuration": "192.168.67.39,defaultDatabase=3" + "Configuration": "127.0.0.1" }, "MessageQueue": { "Enable": true, "HostName": "192.168.67.52", "Uri": "amqp://192.168.67.52:5672", "Port": "5672", - "ClientName": "AElf-Oracle-Client-1", - "ExchangeName": "AElf-CrossChain-Test", - "UserName": "admin", - "Password": "123456" + "ClientName": "AElf-Oracle-Client", + "ExchangeName": "AElfCrossChain", + "UserName": "guest", + "Password": "guest" }, "AElfClient": { "ClientConfigList": [ { - "Alias": "AELF-Main-Test", - "Endpoint": "http://192.168.66.191:8000", - "UserName": "", - "Password": "", - "Timeout": 100 - }, - { - "Alias": "AELF-Side-Test", - "Endpoint": "http://192.168.66.230:8000", + "Alias": "AELF-Test", + "Endpoint": "http://192.168.67.47:8000", "UserName": "", "Password": "", "Timeout": 100 @@ -41,32 +34,27 @@ "KeyDirectory": "", "AccountConfigList": [ { - "Alias": "Oracle-1", - "PrivateKey": "268866d175fbdae3efc081d0ecbaee43110cf37c83b9cd805e75b233e7629d95" + "Alias": "bp", + "PrivateKey": "8d1d8002802dd6fcd80ae9f5c5c6e4914a1120427c2108c5334353ffc270497b" } ] }, "AElfClientConfig": { - "ClientAlias": "AELF-Main-Test", + "ClientAlias": "AELF-Test", "MainChainClientAlias": "TestNetMainChain", "SideChainClientAlias": "TestNetSideChain2", - "AccountAlias": "Oracle-1" + "AccountAlias": "bp" }, "AElfChainAlias": { "Mapping": { - "MainChain_AELF": "AELF-Main-Test", - "SideChain_tDVV": "AELF-Side-Test" + "MainChain_AELF": "AELF-Test" } }, "EthereumClient": { "ClientConfigList": [ { "Alias": "Kovan", - "Url": "https://kovan.infura.io/v3/4c41b8476e874c178c633ff442a27a1b" - }, - { - "Alias": "BSCTest", - "Url": "https://data-seed-prebsc-1-s1.binance.org:8545" + "Url": "https://kovan.infura.io/v3/ed046cb3d9a84513a7d90690ebc7f2ac" } ] }, @@ -75,7 +63,7 @@ "AccountConfigList": [ { "Alias": "eth", - "PrivateKey": "268866d175fbdae3efc081d0ecbaee43110cf37c83b9cd805e75b233e7629d95" + "PrivateKey": "8d1d8002802dd6fcd80ae9f5c5c6e4914a1120427c2108c5334353ffc270497b" } ] }, @@ -85,30 +73,20 @@ "EthereumChainAlias": { "Mapping": { "Ethereum": "Ethereum", - "Kovan": "Kovan", - "BSCTest": "BSCTest" + "Kovan" : "Kovan" } }, "AElfContract": { "ContractDirectory": "", "ContractAddressList": { "MainChain_AELF": { - "MerkleTreeContract": "2NxwCPAGJr4knVdmwhb1cK7CkZw5sMJkRDLnT7E2GoDP2dy5iZ", - "BridgeContract": "2RHf2fxsnEaM3wb6N1yGqPupNZbcCY98LgWbGSFWmWzgEs5Sjo", - "OracleContract": "2LUmicHyH4RXrMjG4beDwuDsiWJESyLkgkwPdGTR8kahRzq5XS", - "ReportContract": "2WHXRoLRjbUTDQsuqR5CntygVfnDb125qdJkudev4kVNbLhTdG", - "StringAggregatorContract": "xsnQafDAhNTeYcooptETqWnYBksFGGXxfcQyJJ5tmu6Ak9ZZt", - "RegimentContract": "sr4zX6E7yVVL7HevExVcWv2ru3HSZakhsJMXfzxzfpnXofnZw", + "MerkleTreeContract": "SsSqZWLf7Dk9NWyWyvDwuuY5nzn5n99jiscKZgRPaajZP5p8y", + "BridgeContract": "225ajURvev5rgX8HnMJ8GjbPnRxUrCHoD7HUjhWQqewEJ5GAv1", + "OracleContract": "xsnQafDAhNTeYcooptETqWnYBksFGGXxfcQyJJ5tmu6Ak9ZZt", + "ReportContract": "GwsSp1MZPmkMvXdbfSCDydHhZtDpvqkFpmPvStYho288fb7QZ", + "StringAggregatorContract": "2M24EKAecggCnttZ9DUUMCXi4xC67rozA87kFgid9qEwRUMHTs", + "RegimentContract": "2nyC8hqq3pGnRu8gJzCsTaxXB6snfGxmL2viimKXgEfYWGtjEh", "ConsensusContract": "pGa4e5hNGsgkfjEGm72TEvbF7aRDqKBd4LuXtab4ucMbXLcgJ" - }, - "SideChain_tDVV": { - "MerkleTreeContract": "2YkKkNZKCcsfUsGwCfJ6wyTx5NYLgpCg1stBuRT4z5ep3psXNG", - "BridgeContract": "2AsEepqiFCRDnepVheYYN5LK7nvM2kUoXgk2zLKu1Zneh8fwmF", - "OracleContract": "RXcxgSXuagn8RrvhQAV81Z652EEYSwR6JLnqHYJ5UVpEptW8Y", - "ReportContract": "2wRDbyVF28VBQoSPgdSEFaL4x7CaXz8TCBujYhgWc9qTMxBE3n", - "StringAggregatorContract": "2F5McxHg7fAqVjDX97v79j4drsMq442rArChpBii8TWuRb8ZnK", - "RegimentContract": "2onFLTnPEiZrXGomzJ8g74cBre2cJuHrn1yBJF3P6Xu9K5Gbth", - "ConsensusContract": "BNPFPPwQ3DE9rwxzdY61Q2utU9FZx9KYUnrYHQqCR6N4LLhUE" } } }, @@ -123,67 +101,31 @@ } }, "Oracle": { - "ObserverAssociationAddressList": ["RdJeA3VdAzrD12AsBNFzbdUwAqs5DzkDK4N7QLT6pc55SdrNy","2QXz8kd6hGf8PxDzia3tD7PzXboajkSvn2GE9G2XctMi3sdtJT"] + "ObserverAssociationAddressList": ["Taikh8VFhM3qbrkC2hd5SzXFsas72gu31SbMZWmgopehdMVQE"] }, "Bridge": { "IsSendQuery": true, "IsTransmitter": true, "QueryPayment": 0, - "AccountAddress":"", + "AccountAddress":"ZrAFaqdr79MWYkxA49Hp2LUdSVHdP6fJh3kDw4jmgC7HTgrni", "BridgesIn": [ { "chainId": "Kovan", "TargetChainId": "MainChain_AELF", "OriginToken": "0xb085f10C869022E8588825f901a54C1ACeb13A07", - "EthereumBridgeInContractAddress": "0x164322657FC57EA95CAc4bF6623E53CA0f952E11", - "SwapId": "c70ded97ae810984aa4dbd317e5574fc12b6ff4cae4b7052757d8a71f0aae523", - "MaximumLeafCount": 128, - "QueryToAddress": "RdJeA3VdAzrD12AsBNFzbdUwAqs5DzkDK4N7QLT6pc55SdrNy" + "EthereumBridgeInContractAddress": "0x40536e47BA0541d5940B29b0423652b797d7FdcA", + "SwapId": "e1bc1ea8232404fd28e5125eae5f7f31294d340765bdbb42e27b838d641d58e3", + "MaximumLeafCount": 1024, + "QueryToAddress": "Taikh8VFhM3qbrkC2hd5SzXFsas72gu31SbMZWmgopehdMVQE" }, { "chainId": "Kovan", "TargetChainId": "MainChain_AELF", - "OriginToken": "0xA050886815CFc52a24B9C4aD044ca199990B6690", - "EthereumBridgeInContractAddress": "0x164322657FC57EA95CAc4bF6623E53CA0f952E11", - "SwapId": "701ddb40246506fd48cc7a28ba453303b8e43f7d140bcf7d9cbea14fe05e528d", - "MaximumLeafCount": 128, - "QueryToAddress": "RdJeA3VdAzrD12AsBNFzbdUwAqs5DzkDK4N7QLT6pc55SdrNy" - }, - { - "chainId": "Kovan", - "TargetChainId": "MainChain_AELF", - "OriginToken": "0x53e8d0c17e258c7adc446b4e160a2000816f00d9", - "EthereumBridgeInContractAddress": "0x164322657FC57EA95CAc4bF6623E53CA0f952E11", - "SwapId": "0d0a485dc471662372bda4944dd444004db1598b3031546039a353259df8cff2", - "MaximumLeafCount": 128, - "QueryToAddress": "RdJeA3VdAzrD12AsBNFzbdUwAqs5DzkDK4N7QLT6pc55SdrNy" - }, - { - "chainId": "Kovan", - "TargetChainId": "SideChain_tDVV", - "OriginToken": "0xb085f10C869022E8588825f901a54C1ACeb13A07", - "EthereumBridgeInContractAddress": "0x164322657FC57EA95CAc4bF6623E53CA0f952E11", - "SwapId": "1db5c7ac518f8856dc782fbda38e8df2be710fc9430519f306b8466c50d1b978", - "MaximumLeafCount": 128, - "QueryToAddress": "2QXz8kd6hGf8PxDzia3tD7PzXboajkSvn2GE9G2XctMi3sdtJT" - }, - { - "chainId": "Kovan", - "TargetChainId": "SideChain_tDVV", - "OriginToken": "0xA050886815CFc52a24B9C4aD044ca199990B6690", - "EthereumBridgeInContractAddress": "0x164322657FC57EA95CAc4bF6623E53CA0f952E11", - "SwapId": "22601b16cf12a88b1a228b2051ba28a4e7ec7772c398a81d051d801711f1bc3c", - "MaximumLeafCount": 128, - "QueryToAddress": "2QXz8kd6hGf8PxDzia3tD7PzXboajkSvn2GE9G2XctMi3sdtJT" - }, - { - "chainId": "Kovan", - "TargetChainId": "SideChain_tDVV", - "OriginToken": "0x53e8d0c17e258c7adc446b4e160a2000816f00d9", - "EthereumBridgeInContractAddress": "0x164322657FC57EA95CAc4bF6623E53CA0f952E11", - "SwapId": "c46c672d57b708a50d82d18be3c3cbdfe6fdf417ef13d95fbdeb804f30fc478a", - "MaximumLeafCount": 128, - "QueryToAddress": "2QXz8kd6hGf8PxDzia3tD7PzXboajkSvn2GE9G2XctMi3sdtJT" + "OriginToken": "0xF3449563d308F38Cb33cd438Dec652b4222329B0", + "EthereumBridgeInContractAddress": "0x40536e47BA0541d5940B29b0423652b797d7FdcA", + "SwapId": "4d1e49ba6df2ed3692252e24153773e87ca7c44d11ade34b4a32e73a155e7a38", + "MaximumLeafCount": 1024, + "QueryToAddress": "Taikh8VFhM3qbrkC2hd5SzXFsas72gu31SbMZWmgopehdMVQE" } ], "BridgesOut": [ @@ -191,49 +133,17 @@ "chainId": "MainChain_AElf", "TargetChainId": "Kovan", "OriginToken": "ELF", - "QueryToAddress": "RdJeA3VdAzrD12AsBNFzbdUwAqs5DzkDK4N7QLT6pc55SdrNy", - "EthereumSwapId": "0xD9E579BC76EB76E2BCCD32BA34419B5493D236E7D659E7726B124D6E70A42427", - "EthereumBridgeOutContractAddress": "0x26a44A0383F15f7f83D84eb95c4b7762d8de995A" + "QueryToAddress": "Taikh8VFhM3qbrkC2hd5SzXFsas72gu31SbMZWmgopehdMVQE", + "EthereumSwapId": "0x8cbe63c7458bef338d7da2008521616897109cf1427c1450ec6cb47a5a7df5e6", + "EthereumBridgeOutContractAddress": "0x2b8e182ac87d123237f8e28e4DDe8a2b050a1c96" }, { "chainId": "MainChain_AElf", "TargetChainId": "Kovan", "OriginToken": "USDT", - "QueryToAddress": "RdJeA3VdAzrD12AsBNFzbdUwAqs5DzkDK4N7QLT6pc55SdrNy", - "EthereumSwapId": "0xE842DB49D684DD1D94BA7920D0F6429D5B3ECEF0C09DD9B8477FFCF1CDD2FD0E", - "EthereumBridgeOutContractAddress": "0x26a44A0383F15f7f83D84eb95c4b7762d8de995A" - }, - { - "chainId": "MainChain_AElf", - "TargetChainId": "Kovan", - "OriginToken": "ETH", - "QueryToAddress": "RdJeA3VdAzrD12AsBNFzbdUwAqs5DzkDK4N7QLT6pc55SdrNy", - "EthereumSwapId": "0x32C4F09BEAF5A160EA0EEB18996F69647B57B6EC98C1DBB9CED1D6D6873EA4EF", - "EthereumBridgeOutContractAddress": "0x26a44A0383F15f7f83D84eb95c4b7762d8de995A" - }, - { - "chainId": "SideChain_tDVV", - "TargetChainId": "Kovan", - "OriginToken": "ELF", - "QueryToAddress": "2QXz8kd6hGf8PxDzia3tD7PzXboajkSvn2GE9G2XctMi3sdtJT", - "EthereumSwapId": "0xFC372251575E57610061466B0628B3EDDA34736ADC4B5C631E635AFAE9BE0DE1", - "EthereumBridgeOutContractAddress": "0x26a44A0383F15f7f83D84eb95c4b7762d8de995A" - }, - { - "chainId": "SideChain_tDVV", - "TargetChainId": "Kovan", - "OriginToken": "USDT", - "QueryToAddress": "2QXz8kd6hGf8PxDzia3tD7PzXboajkSvn2GE9G2XctMi3sdtJT", - "EthereumSwapId": "0xD257B15EDF0ECE53BEBFD1392DC1EE0B4C930AA090973C04279285412C5BEA72", - "EthereumBridgeOutContractAddress": "0x26a44A0383F15f7f83D84eb95c4b7762d8de995A" - }, - { - "chainId": "SideChain_tDVV", - "TargetChainId": "Kovan", - "OriginToken": "ETH", - "QueryToAddress": "2QXz8kd6hGf8PxDzia3tD7PzXboajkSvn2GE9G2XctMi3sdtJT", - "EthereumSwapId": "0x6C20AC269DB2AB2AFCED73D918F51B6A6B99692E228636E1A891F87281379E8B", - "EthereumBridgeOutContractAddress": "0x26a44A0383F15f7f83D84eb95c4b7762d8de995A" + "QueryToAddress": "Taikh8VFhM3qbrkC2hd5SzXFsas72gu31SbMZWmgopehdMVQE", + "EthereumSwapId": "0x0fe09fbb4297950982d006e83db882d9e733cb5a5f51fb5e8ed54a3825ba591d", + "EthereumBridgeOutContractAddress": "0x2b8e182ac87d123237f8e28e4DDe8a2b050a1c96" } ] }, @@ -241,7 +151,7 @@ "ConfirmationCount": { "Ethereum": 12, "Kovan": 12, - "BSCTest": 100 + "bsc": 100 } }, "ChainIdMapping": { From 62afc931207f47dfc5503d0c6acc8390e8a72dc7 Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Mon, 5 Sep 2022 12:16:51 +0800 Subject: [PATCH 46/66] fix: space is null - last leaf index = -1 --- src/AElf.EventHandler/Providers/IReceiptProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AElf.EventHandler/Providers/IReceiptProvider.cs b/src/AElf.EventHandler/Providers/IReceiptProvider.cs index f29661c4..f3151ad6 100644 --- a/src/AElf.EventHandler/Providers/IReceiptProvider.cs +++ b/src/AElf.EventHandler/Providers/IReceiptProvider.cs @@ -113,7 +113,7 @@ private async Task SendQueryAsync(string chainId, BridgeItemIn bridgeItem, BigIn { SpaceId = spaceId })).Value; - if (lastRecordedLeafIndex == -2) + if (lastRecordedLeafIndex == -1) { _logger.LogInformation($"Space of id {spaceId} is not created. "); return; From 3c76f8849bf8be88baa79da1dc58a6a9ced64061 Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Mon, 5 Sep 2022 15:22:38 +0800 Subject: [PATCH 47/66] fix: add from chainId when getting ethereum swapId. --- .../Processors/ReportConfirmedLogEventProcessor.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs index 6f79ecda..cb705799 100644 --- a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs @@ -83,10 +83,11 @@ await _signaturesRecoverableInfoProvider.GetSignatureAsync(chainId, RoundId = roundId })).Observations.Value.First().Key; var receiptIdTokenHash = receiptId.Split(".").First(); - var symbol = (await _bridgeService.GetReceiptIdInfoAsync(chainId, - Hash.LoadFromHex(receiptIdTokenHash))).Symbol; + var receiptIdInfo = await _bridgeService.GetReceiptIdInfoAsync(chainId, + Hash.LoadFromHex(receiptIdTokenHash)); + var ethereumSwapId = - (_bridgeOptions.BridgesOut.Single(i => i.TargetChainId == targetChainId && i.OriginToken == symbol)) + (_bridgeOptions.BridgesOut.Single(i => i.TargetChainId == targetChainId && i.OriginToken == receiptIdInfo.Symbol && i.ChainId == ChainIdProvider.GetChainId(context.ChainId))) .EthereumSwapId; var (swapHashId, reportBytes, rs, ss, vs) = From 329714c0fdb3225c5b3a7a5bcdb1f6c88388fa45 Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Mon, 5 Sep 2022 16:02:40 +0800 Subject: [PATCH 48/66] fix: add transmit log. --- .../ReportConfirmedLogEventProcessor.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs index cb705799..c7c70a82 100644 --- a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs @@ -95,7 +95,23 @@ await _signaturesRecoverableInfoProvider.GetSignatureAsync(chainId, _logger.LogInformation( $"Try to transmit data, TargetChainId: {reportConfirmed.TargetChainId} Address: {ethereumContractAddress} RoundId: {reportConfirmed.RoundId}"); - + + for (var i = 0; i< rs.Length;i++) + { + _logger.LogInformation( + $"From chainId:{chainId}" + + $"TargetContractAddress:{ethereumContractAddress}" + + $"TargetChainId:{reportConfirmed.TargetChainId}" + + $"Report:{reportBytes.ToHex()}" + + $"Rs[{i}]:{rs[i].ToHex()}" + + $"Ss[{i}]:{ss[i].ToHex()}" + + $"RawVs:{vs.ToHex()}" + + $"SwapHashId:{swapHashId}" + + $"BlockHash:{context.BlockHash}" + + $"BlockHeight:{context.BlockNumber}" + ); + } + await _transmitTransactionProvider.EnqueueAsync(new SendTransmitArgs { ChainId = chainId, @@ -109,6 +125,7 @@ await _transmitTransactionProvider.EnqueueAsync(new SendTransmitArgs BlockHash = context.BlockHash, BlockHeight = context.BlockNumber }); + await _signaturesRecoverableInfoProvider.RemoveSignatureAsync(chainId, ethereumContractAddress, roundId); From db17a7f91f0d59bff3fde98e8b21ddad15b7bfea Mon Sep 17 00:00:00 2001 From: zhxymh Date: Mon, 5 Sep 2022 16:30:50 +0800 Subject: [PATCH 49/66] feat: add resend api --- .../Providers/ITransmitTransactionProvider.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs index 7476343d..5bb80d49 100644 --- a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs +++ b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs @@ -22,6 +22,7 @@ public interface ITransmitTransactionProvider Task EnqueueAsync(SendTransmitArgs args); Task SendByLibAsync(string chainId, string libHash, long libHeight); Task UpdateQueueAsync(string chainId); + Task ReSendFailedJobAsync(string chainId); } public class TransmitTransactionProvider : AbpRedisCache, ITransmitTransactionProvider, ISingletonDependency @@ -146,6 +147,18 @@ public async Task UpdateQueueAsync(string chainId) } } + public async Task ReSendFailedJobAsync(string chainId) + { + var item = await GetFirstItemAsync(GetQueueName(TransmitFailedQueue,chainId)); + while (item != null) + { + await EnqueueAsync(item); + await DequeueAsync(GetQueueName(TransmitFailedQueue, chainId)); + + item = await GetFirstItemAsync(GetQueueName(TransmitFailedQueue,chainId)); + } + } + private string GetQueueName(string queue, string chainId) { return $"{queue}-{chainId}"; From e26a91239396755a4be0b41b5310af01f74573e6 Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Tue, 13 Sep 2022 17:50:15 +0800 Subject: [PATCH 50/66] fix: fix query receipt index. Add time control to clean cache. --- .../ReportConfirmedLogEventProcessor.cs | 2 +- .../ILatestQueriedReceiptCountProvider.cs | 4 ++- .../Providers/IReceiptProvider.cs | 14 +++++--- .../LatestQueriedReceiptCountProvider.cs | 36 ++++++++++++++++--- 4 files changed, 45 insertions(+), 11 deletions(-) diff --git a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs index c7c70a82..32331913 100644 --- a/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs +++ b/src/AElf.EventHandler/Processors/ReportConfirmedLogEventProcessor.cs @@ -106,7 +106,7 @@ await _signaturesRecoverableInfoProvider.GetSignatureAsync(chainId, $"Rs[{i}]:{rs[i].ToHex()}" + $"Ss[{i}]:{ss[i].ToHex()}" + $"RawVs:{vs.ToHex()}" + - $"SwapHashId:{swapHashId}" + + $"SwapHashId:{swapHashId.ToHex()}" + $"BlockHash:{context.BlockHash}" + $"BlockHeight:{context.BlockNumber}" ); diff --git a/src/AElf.EventHandler/Providers/ILatestQueriedReceiptCountProvider.cs b/src/AElf.EventHandler/Providers/ILatestQueriedReceiptCountProvider.cs index 9222062e..0d6758d0 100644 --- a/src/AElf.EventHandler/Providers/ILatestQueriedReceiptCountProvider.cs +++ b/src/AElf.EventHandler/Providers/ILatestQueriedReceiptCountProvider.cs @@ -1,7 +1,9 @@ +using System; + namespace AElf.EventHandler; public interface ILatestQueriedReceiptCountProvider { long Get(string swapId); - void Set(string swapId, long count); + void Set(DateTime time,string swapId, long count); } \ No newline at end of file diff --git a/src/AElf.EventHandler/Providers/IReceiptProvider.cs b/src/AElf.EventHandler/Providers/IReceiptProvider.cs index f3151ad6..ff7c7c5c 100644 --- a/src/AElf.EventHandler/Providers/IReceiptProvider.cs +++ b/src/AElf.EventHandler/Providers/IReceiptProvider.cs @@ -122,9 +122,16 @@ private async Task SendQueryAsync(string chainId, BridgeItemIn bridgeItem, BigIn var nextTokenIndex = lastRecordedLeafIndex == -2 ? 1 : lastRecordedLeafIndex + 2; if (_latestQueriedReceiptCountProvider.Get(swapId) == 0) { - _latestQueriedReceiptCountProvider.Set(swapId, nextTokenIndex); + _latestQueriedReceiptCountProvider.Set(DateTime.UtcNow, swapId, nextTokenIndex); } - + else if (_latestQueriedReceiptCountProvider.Get(swapId) != nextTokenIndex) + { + var receiptIndexNow = _latestQueriedReceiptCountProvider.Get(swapId); + _logger.LogInformation( + $"Latest queried receipt index : {receiptIndexNow}, Last recorded leaf index : {nextTokenIndex}, Wait."); + return; + } + _logger.LogInformation( $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Last recorded leaf index : {lastRecordedLeafIndex}."); @@ -184,7 +191,6 @@ private async Task SendQueryAsync(string chainId, BridgeItemIn bridgeItem, BigIn }, AggregatorContractAddress = _contractOptions.ContractAddressList[chainId]["StringAggregatorContract"].ConvertAddress(), - //AggregateThreshold = 1, CallbackInfo = new CallbackInfo { ContractAddress = @@ -199,7 +205,7 @@ private async Task SendQueryAsync(string chainId, BridgeItemIn bridgeItem, BigIn _logger.LogInformation( $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} About to send Query transaction for token swapping, QueryInput: {queryInput}"); - _latestQueriedReceiptCountProvider.Set(swapId, lastTokenIndexConfirm + 1); + _latestQueriedReceiptCountProvider.Set(DateTime.UtcNow, swapId, lastTokenIndexConfirm + 1); var sendTxResult = await _oracleService.QueryAsync(chainId, queryInput); _logger.LogInformation( $"{bridgeItem.ChainId}-{bridgeItem.TargetChainId}-{bridgeItem.OriginToken} Query transaction id : {sendTxResult.TransactionResult.TransactionId}"); diff --git a/src/AElf.EventHandler/Providers/LatestQueriedReceiptCountProvider.cs b/src/AElf.EventHandler/Providers/LatestQueriedReceiptCountProvider.cs index ff38747c..0ef0a5a6 100644 --- a/src/AElf.EventHandler/Providers/LatestQueriedReceiptCountProvider.cs +++ b/src/AElf.EventHandler/Providers/LatestQueriedReceiptCountProvider.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using Volo.Abp.DependencyInjection; @@ -5,17 +6,42 @@ namespace AElf.EventHandler; public class LatestQueriedReceiptCountProvider : ILatestQueriedReceiptCountProvider, ISingletonDependency { - private readonly Dictionary _count = new Dictionary(); + private readonly Dictionary _count = new Dictionary(); public long Get(string symbol) { - if (_count.ContainsKey(symbol)) return _count[symbol]; - _count.Add(symbol, 0); + if (_count.ContainsKey(symbol)) + { + if (!((DateTime.UtcNow - _count[symbol].Timestamp).TotalMinutes > 5)) return _count[symbol].Count; + _count[symbol] = new LatestReceiptTime + { + Timestamp = DateTime.UtcNow, + Count = 0 + }; + return 0; + + } + _count.Add(symbol, new LatestReceiptTime + { + Timestamp = DateTime.UtcNow, + Count = 0 + }); return 0; } - public void Set(string symbol, long count) + public void Set(DateTime time,string symbol, long count) { - _count[symbol] = count; + var timeCount = new LatestReceiptTime + { + Timestamp = time, + Count = count + }; + _count[symbol] = timeCount; } + +} +public class LatestReceiptTime +{ + public DateTime Timestamp { get; set; } + public long Count { get; set; } } \ No newline at end of file From 948d863d4b0d15662ffc74e8584dda2d038569db Mon Sep 17 00:00:00 2001 From: zhxymh Date: Thu, 15 Sep 2022 18:17:14 +0800 Subject: [PATCH 51/66] fix: check transmit transaction --- .../ApiClient.cs | 12 +------- modules/AElf.Client.Bridge/BridgeService.cs | 12 ++++---- .../CoinGeckoTokenPriceProvider.cs | 12 +------- .../Providers/ITransmitTransactionProvider.cs | 30 +++++++++++-------- src/AElf.PriceWorker/AElf.PriceWorker.csproj | 1 + src/AElf.PriceWorker/AElfPriceWorkerModule.cs | 3 ++ src/AElf.PriceWorker/PriceSyncWorker.cs | 13 ++++---- 7 files changed, 38 insertions(+), 45 deletions(-) diff --git a/modules/AElf.BlockchainTransactionFee/ApiClient.cs b/modules/AElf.BlockchainTransactionFee/ApiClient.cs index bbfaee5c..875964e5 100644 --- a/modules/AElf.BlockchainTransactionFee/ApiClient.cs +++ b/modules/AElf.BlockchainTransactionFee/ApiClient.cs @@ -15,17 +15,7 @@ public ApiClient() public async Task GetAsync(string uri) { - var proxy = new WebProxy - { - Address = new Uri("http://127.0.0.1:1087"), - }; - var clientHandler = new HttpClientHandler() - { - Proxy = proxy, - }; - var client = new HttpClient(clientHandler); - - var response = await client.GetAsync(uri) + var response = await _httpClient.GetAsync(uri) .ConfigureAwait(false); response.EnsureSuccessStatusCode(); diff --git a/modules/AElf.Client.Bridge/BridgeService.cs b/modules/AElf.Client.Bridge/BridgeService.cs index 3a6cae91..beec29fb 100644 --- a/modules/AElf.Client.Bridge/BridgeService.cs +++ b/modules/AElf.Client.Bridge/BridgeService.cs @@ -15,8 +15,8 @@ public interface IBridgeService Task GetSpaceIdBySwapIdAsync(string chainId, Hash swapId); Task SetGasPriceAsync(string chainId, SetGasPriceInput input); Task SetPriceRatioAsync(string chainId, SetPriceRatioInput input); - Task GetGasPriceAsync(string chainId, StringValue input); - Task GetPriceRatioAsync(string chainId, StringValue input); + Task GetGasPriceAsync(string chainId, StringValue input); + Task GetPriceRatioAsync(string chainId, StringValue input); Task GetReceiptIdInfoAsync(string chainId, Hash receiptIdHash); } @@ -62,20 +62,20 @@ public async Task SetPriceRatioAsync(string chainId, SetP }; } - public async Task GetGasPriceAsync(string chainId, StringValue input) + public async Task GetGasPriceAsync(string chainId, StringValue input) { var result = await _clientService.ViewAsync(GetContractAddress(chainId), "GetGasPrice", input, AElfChainAliasOptions.Value.Mapping[chainId]); - var actualResult = new StringValue(); + var actualResult = new Int64Value(); actualResult.MergeFrom(result); return actualResult; } - public async Task GetPriceRatioAsync(string chainId, StringValue input) + public async Task GetPriceRatioAsync(string chainId, StringValue input) { var result = await _clientService.ViewAsync(GetContractAddress(chainId), "GetPriceRatio", input, AElfChainAliasOptions.Value.Mapping[chainId]); - var actualResult = new StringValue(); + var actualResult = new Int64Value(); actualResult.MergeFrom(result); return actualResult; } diff --git a/modules/AElf.TokenPrice.CoinGecko/CoinGeckoTokenPriceProvider.cs b/modules/AElf.TokenPrice.CoinGecko/CoinGeckoTokenPriceProvider.cs index 2bd8414c..a503c2cc 100644 --- a/modules/AElf.TokenPrice.CoinGecko/CoinGeckoTokenPriceProvider.cs +++ b/modules/AElf.TokenPrice.CoinGecko/CoinGeckoTokenPriceProvider.cs @@ -31,19 +31,9 @@ public async Task GetPriceAsync(string coinId) { try { - var proxy = new WebProxy - { - Address = new Uri("http://127.0.0.1:1087"), - }; - var clientHandler = new HttpClientHandler() - { - Proxy = proxy, - }; - var client = new CoinGeckoClient(clientHandler); - var coinData = await RequestAsync(async () => - await client.SimpleClient.GetSimplePrice(new[] {coinId}, new[] { UsdSymbol })); + await _coinGeckoClient.SimpleClient.GetSimplePrice(new[] {coinId}, new[] { UsdSymbol })); if (!coinData.TryGetValue(coinId,out var value)) { diff --git a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs index 5bb80d49..98548f39 100644 --- a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs +++ b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs @@ -125,23 +125,28 @@ public async Task UpdateQueueAsync(string chainId) item.RetryTimes += 1; await EnqueueAsync(GetQueueName(TransmitSendingQueue, item.ChainId), item); } - - var currentHeight = await _nethereumService.GetBlockNumberAsync(ethAlias); - if (receipt.BlockNumber.ToLong() >= currentHeight - _blockConfirmationOptions.ConfirmationCount[item.TargetChainId]) + else { - break; - } + var currentHeight = await _nethereumService.GetBlockNumberAsync(ethAlias); + if (receipt.BlockNumber.ToLong() >= currentHeight - _blockConfirmationOptions.ConfirmationCount[item.TargetChainId]) + { + break; + } - var block = await _nethereumService.GetBlockByNumberAsync(ethAlias, receipt.BlockNumber); - if (block.BlockHash != receipt.BlockHash) - { - Logger.LogError($"Transmit transaction forked. Chain: {item.TargetChainId}, TxId: {item.TransactionId}"); - item.RetryTimes += 1; - await EnqueueAsync(GetQueueName(TransmitSendingQueue, item.ChainId), item); + var block = await _nethereumService.GetBlockByNumberAsync(ethAlias, receipt.BlockNumber); + if (block.BlockHash != receipt.BlockHash) + { + Logger.LogError($"Transmit transaction forked. Chain: {item.TargetChainId}, TxId: {item.TransactionId}"); + item.RetryTimes += 1; + await EnqueueAsync(GetQueueName(TransmitSendingQueue, item.ChainId), item); + } + else + { + Logger.LogInformation($"Transmit transaction finished. TxId: {item.TransactionId}"); + } } await DequeueAsync(GetQueueName(TransmitCheckingQueue,chainId)); - Logger.LogInformation($"Transmit transaction finished. TxId: {item.TransactionId}"); item = await GetFirstItemAsync(GetQueueName(TransmitCheckingQueue,chainId)); } @@ -152,6 +157,7 @@ public async Task ReSendFailedJobAsync(string chainId) var item = await GetFirstItemAsync(GetQueueName(TransmitFailedQueue,chainId)); while (item != null) { + item.RetryTimes = 0; await EnqueueAsync(item); await DequeueAsync(GetQueueName(TransmitFailedQueue, chainId)); diff --git a/src/AElf.PriceWorker/AElf.PriceWorker.csproj b/src/AElf.PriceWorker/AElf.PriceWorker.csproj index 4f4ab383..09fe6dec 100644 --- a/src/AElf.PriceWorker/AElf.PriceWorker.csproj +++ b/src/AElf.PriceWorker/AElf.PriceWorker.csproj @@ -26,6 +26,7 @@ + diff --git a/src/AElf.PriceWorker/AElfPriceWorkerModule.cs b/src/AElf.PriceWorker/AElfPriceWorkerModule.cs index 4235f928..6c4a7bcc 100644 --- a/src/AElf.PriceWorker/AElfPriceWorkerModule.cs +++ b/src/AElf.PriceWorker/AElfPriceWorkerModule.cs @@ -1,3 +1,6 @@ +using System; +using System.Net; +using System.Net.Http; using AElf.BlockchainTransactionFee; using AElf.Client.Bridge; using AElf.Client.Core; diff --git a/src/AElf.PriceWorker/PriceSyncWorker.cs b/src/AElf.PriceWorker/PriceSyncWorker.cs index f7ac52df..14942daf 100644 --- a/src/AElf.PriceWorker/PriceSyncWorker.cs +++ b/src/AElf.PriceWorker/PriceSyncWorker.cs @@ -2,7 +2,9 @@ using System.Threading.Tasks; using AElf.BlockchainTransactionFee; using AElf.Client.Bridge; +using AElf.Client.Core; using AElf.Contracts.Bridge; +using AElf.Nethereum.Core; using AElf.TokenPrice; using Google.Protobuf.WellKnownTypes; using Microsoft.Extensions.DependencyInjection; @@ -19,15 +21,18 @@ public class PriceSyncWorker : AsyncPeriodicBackgroundWorkerBase private readonly IBridgeService _bridgeService; private readonly IBlockchainTransactionFeeService _blockchainTransactionFeeService; private readonly ITokenPriceService _tokenPriceService; + private readonly IAElfClientService _aelfClientService; public PriceSyncWorker(AbpAsyncTimer timer, IServiceScopeFactory serviceScopeFactory, IOptionsSnapshot priceSyncOptions, IBridgeService bridgeService, - IBlockchainTransactionFeeService blockchainTransactionFeeService, ITokenPriceService tokenPriceService) : base( + IBlockchainTransactionFeeService blockchainTransactionFeeService, ITokenPriceService tokenPriceService, + IAElfClientService aelfClientService) : base( timer, serviceScopeFactory) { _bridgeService = bridgeService; _blockchainTransactionFeeService = blockchainTransactionFeeService; _tokenPriceService = tokenPriceService; + _aelfClientService = aelfClientService; _priceSyncOptions = priceSyncOptions.Value; Timer.Period = 1000 * 1; @@ -35,12 +40,10 @@ public PriceSyncWorker(AbpAsyncTimer timer, IServiceScopeFactory serviceScopeFac protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) { - Logger.LogInformation($"================"); var setGasPriceInput = new SetGasPriceInput(); var setPriceRatioInput = new SetPriceRatioInput(); - var elfPrice = await _tokenPriceService.GetPriceAsync("ELF"); - + foreach (var item in _priceSyncOptions.SourceChains) { var gasFee = await _blockchainTransactionFeeService.GetTransactionFeeAsync(item.ChainType); @@ -59,7 +62,7 @@ protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext worker PriceRatio_ = ratio }); } - + foreach (var item in _priceSyncOptions.TargetChains) { await _bridgeService.SetGasPriceAsync(item, setGasPriceInput); From 2b75124a22107df443b043413be3be003ac1d514 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Fri, 16 Sep 2022 17:26:45 +0800 Subject: [PATCH 52/66] feat: add log --- src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs index 98548f39..d8fb8b77 100644 --- a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs +++ b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs @@ -94,7 +94,7 @@ public async Task SendByLibAsync(string chainId, string libHash, long libHeight) item.TransactionId = sendResult; await EnqueueAsync(GetQueueName(TransmitCheckingQueue,item.ChainId), item); - Logger.LogInformation($"Send Transmit transaction. TxId: {sendResult}"); + Logger.LogInformation($"Send Transmit transaction. TxId: {sendResult}, Report: {item.Report.ToHex()}"); } catch (Exception e) { From 7adf1041abbde9234f04deda4e9a1fa5fd84af69 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Mon, 19 Sep 2022 11:10:22 +0800 Subject: [PATCH 53/66] feat: improve config --- src/AElf.PriceWorker/PriceSyncWorker.cs | 3 +++ src/AElf.PriceWorker/appsettings.json | 15 ++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/AElf.PriceWorker/PriceSyncWorker.cs b/src/AElf.PriceWorker/PriceSyncWorker.cs index 14942daf..acb8a59e 100644 --- a/src/AElf.PriceWorker/PriceSyncWorker.cs +++ b/src/AElf.PriceWorker/PriceSyncWorker.cs @@ -10,6 +10,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +using Serilog; using Volo.Abp.BackgroundWorkers; using Volo.Abp.Threading; @@ -66,7 +67,9 @@ protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext worker foreach (var item in _priceSyncOptions.TargetChains) { await _bridgeService.SetGasPriceAsync(item, setGasPriceInput); + Logger.LogDebug($"SetGasPrice success, ChainId: {item}."); await _bridgeService.SetPriceRatioAsync(item, setPriceRatioInput); + Logger.LogDebug($"SetPriceRatio success, ChainId: {item}."); } } } \ No newline at end of file diff --git a/src/AElf.PriceWorker/appsettings.json b/src/AElf.PriceWorker/appsettings.json index f658920b..1a9930e9 100644 --- a/src/AElf.PriceWorker/appsettings.json +++ b/src/AElf.PriceWorker/appsettings.json @@ -28,29 +28,26 @@ "AElfContract": { "ContractDirectory": "", "ContractAddressList": { - "AELF": { - "BridgeContract": "2hqsqJndRAZGzk96fsEvyuVBTAvoBjcuwTjkuyJffBPueJFrLa" + "MainChain_AELF": { + "BridgeContract": "225ajURvev5rgX8HnMJ8GjbPnRxUrCHoD7HUjhWQqewEJ5GAv1" } } }, "AElfChainAlias": { "Mapping": { - "AELF": "AELF-Test" + "MainChain_AELF": "AELF-Test" } }, "PriceSync": { "SourceChains": [ { - "ChainId": "Ethereum", + "ChainId": "Kovan", + "ChainType": "Ethereum", "NativeToken": "ETH" - }, - { - "ChainId": "BSC", - "NativeToken": "BNB" } ], "TargetChains": [ - "AELF" + "MainChain_AELF" ] }, "TokenPrice": { From 474ce33f86024f9057183454559939d3701b6917 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Mon, 19 Sep 2022 11:11:24 +0800 Subject: [PATCH 54/66] feat: adjust timer --- src/AElf.PriceWorker/PriceSyncWorker.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AElf.PriceWorker/PriceSyncWorker.cs b/src/AElf.PriceWorker/PriceSyncWorker.cs index acb8a59e..dff6d43d 100644 --- a/src/AElf.PriceWorker/PriceSyncWorker.cs +++ b/src/AElf.PriceWorker/PriceSyncWorker.cs @@ -36,7 +36,7 @@ public PriceSyncWorker(AbpAsyncTimer timer, IServiceScopeFactory serviceScopeFac _aelfClientService = aelfClientService; _priceSyncOptions = priceSyncOptions.Value; - Timer.Period = 1000 * 1; + Timer.Period = 1000 * 60; } protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) From e120449bb0e051b841d686c18183f740f66ace89 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Tue, 20 Sep 2022 17:48:04 +0800 Subject: [PATCH 55/66] fix: test gas fee --- modules/AElf.Nethereum.Bridge/IBridgeOutService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs index a7eeb4d0..0617f895 100644 --- a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs +++ b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs @@ -19,10 +19,10 @@ public async Task TransmitAsync(string chainId, string contractAddress, { var setValueFunction = GetFunction(chainId, contractAddress, "transmit"); var sender = GetAccount().Address; - var gas = await setValueFunction.EstimateGasAsync(sender, null, null, swapHashId, report, rs, ss, rawVs); - gas.Value += BigInteger.Divide(gas.Value, new BigInteger(20)); + // var gas = await setValueFunction.EstimateGasAsync(sender, null, null, swapHashId, report, rs, ss, rawVs); + // gas.Value += BigInteger.Divide(gas.Value, new BigInteger(20)); var transactionResult = - await setValueFunction.SendTransactionAsync(sender, gas, null, null, swapHashId, report, + await setValueFunction.SendTransactionAsync(sender, null, null, null, swapHashId, report, rs, ss, rawVs); return transactionResult; } From 5a322b98f5738a1f05f7ee42e4ad020ea8c11790 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Wed, 21 Sep 2022 10:59:22 +0800 Subject: [PATCH 56/66] fix: change gas fee --- modules/AElf.Nethereum.Bridge/IBridgeOutService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs index 0617f895..8a2a6630 100644 --- a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs +++ b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs @@ -19,10 +19,10 @@ public async Task TransmitAsync(string chainId, string contractAddress, { var setValueFunction = GetFunction(chainId, contractAddress, "transmit"); var sender = GetAccount().Address; - // var gas = await setValueFunction.EstimateGasAsync(sender, null, null, swapHashId, report, rs, ss, rawVs); - // gas.Value += BigInteger.Divide(gas.Value, new BigInteger(20)); + var gas = await setValueFunction.EstimateGasAsync(sender, null, null, swapHashId, report, rs, ss, rawVs); + gas.Value = BigInteger.Multiply(gas.Value, 2); var transactionResult = - await setValueFunction.SendTransactionAsync(sender, null, null, null, swapHashId, report, + await setValueFunction.SendTransactionAsync(sender, gas, null, null, swapHashId, report, rs, ss, rawVs); return transactionResult; } From 08e0ac5127b520a7d08b4ce8fcf15a7d8074a3e9 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Wed, 21 Sep 2022 16:52:21 +0800 Subject: [PATCH 57/66] feat: improve send transmit --- .../Providers/ITransmitTransactionProvider.cs | 75 +++++++++++++------ 1 file changed, 54 insertions(+), 21 deletions(-) diff --git a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs index d8fb8b77..47d19f8c 100644 --- a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs +++ b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs @@ -40,6 +40,9 @@ public class TransmitTransactionProvider : AbpRedisCache, ITransmitTransactionPr private const string TransmitCheckingQueue = "TransmitCheckingQueue"; private const string TransmitFailedQueue = "TransmitFailedQueue"; + private const int MaxSendTransmitTimes = 3; + private const int MaxQueryTransmitTimes = 10; + public TransmitTransactionProvider(IOptions optionsAccessor, IOptionsSnapshot ethereumAElfChainAliasOptions, IOptionsSnapshot aelfChainAliasOption, @@ -74,32 +77,36 @@ public async Task SendByLibAsync(string chainId, string libHash, long libHeight) var block = await _aelfClientService.GetBlockByHeightAsync(_aelfChainAliasOption.Mapping[item.ChainId], item.BlockHeight); if (block.BlockHash == item.BlockHash) { - if (item.RetryTimes > 3) + if (item.SendTimes > MaxSendTransmitTimes) { - Logger.LogError($"Transmit transaction failed after retry {item.RetryTimes-1} times. Chain: {item.TargetChainId}, TxId: {item.TransactionId}"); + Logger.LogError($"Send transmit transaction failed after retry {item.SendTimes} times. Chain: {item.TargetChainId}, TxId: {item.TransactionId}"); await EnqueueAsync(GetQueueName(TransmitFailedQueue, item.ChainId), item); } else { try { + item.SendTimes += 1; + item.QueryTimes = 0; + var sendResult = await _bridgeOutService.TransmitAsync(item.TargetChainId, item.TargetContractAddress,item.SwapHashId, item.Report, item.Rs, item.Ss, item.RawVs); if (string.IsNullOrWhiteSpace(sendResult)) { Logger.LogError("Failed to transmit."); - break; + await EnqueueAsync(GetQueueName(TransmitSendingQueue, item.ChainId), item); + } + else + { + item.TransactionId = sendResult; + await EnqueueAsync(GetQueueName(TransmitCheckingQueue,item.ChainId), item); + Logger.LogInformation($"Send Transmit transaction. TxId: {sendResult}, Report: {item.Report.ToHex()}"); } - - item.TransactionId = sendResult; - await EnqueueAsync(GetQueueName(TransmitCheckingQueue,item.ChainId), item); - Logger.LogInformation($"Send Transmit transaction. TxId: {sendResult}, Report: {item.Report.ToHex()}"); } catch (Exception e) { Logger.LogError($"Send Transmit transaction Failed. Message: {e.Message}", e); - item.RetryTimes += 1; await EnqueueAsync(GetQueueName(TransmitSendingQueue, item.ChainId), item); } @@ -113,22 +120,42 @@ public async Task SendByLibAsync(string chainId, string libHash, long libHeight) public async Task UpdateQueueAsync(string chainId) { - var item = await GetFirstItemAsync(GetQueueName(TransmitCheckingQueue,chainId)); + var item = await GetFirstItemAsync(GetQueueName(TransmitCheckingQueue, chainId)); + + string firstCheckingChainId = null; + string firstCheckingTransactionId = null; + while (item != null) { + if (item.TargetChainId == firstCheckingChainId && item.TransactionId == firstCheckingTransactionId) + { + break; + } + var ethAlias = _ethereumAElfChainAliasOptions.Mapping[item.TargetChainId]; var receipt = await _nethereumService.GetTransactionReceiptAsync(ethAlias, item.TransactionId); if (receipt == null || receipt.Status == null || receipt.Status.Value != 1) { - Logger.LogError($"Transmit transaction failed. Chain: {item.TargetChainId}, TxId: {item.TransactionId}"); - item.RetryTimes += 1; - await EnqueueAsync(GetQueueName(TransmitSendingQueue, item.ChainId), item); + item.QueryTimes += 1; + if (item.QueryTimes > MaxQueryTransmitTimes) + { + Logger.LogDebug( + $"Transmit transaction query failed after retry {MaxQueryTransmitTimes} times. Chain: {item.TargetChainId}, TxId: {item.TransactionId}"); + await EnqueueAsync(GetQueueName(TransmitSendingQueue, item.ChainId), item); + } + else + { + Logger.LogDebug( + $"Transmit transaction query failed. Chain: {item.TargetChainId}, TxId: {item.TransactionId}"); + await EnqueueAsync(GetQueueName(TransmitCheckingQueue, item.ChainId), item); + } } else { var currentHeight = await _nethereumService.GetBlockNumberAsync(ethAlias); - if (receipt.BlockNumber.ToLong() >= currentHeight - _blockConfirmationOptions.ConfirmationCount[item.TargetChainId]) + if (receipt.BlockNumber.ToLong() >= + currentHeight - _blockConfirmationOptions.ConfirmationCount[item.TargetChainId]) { break; } @@ -136,8 +163,8 @@ public async Task UpdateQueueAsync(string chainId) var block = await _nethereumService.GetBlockByNumberAsync(ethAlias, receipt.BlockNumber); if (block.BlockHash != receipt.BlockHash) { - Logger.LogError($"Transmit transaction forked. Chain: {item.TargetChainId}, TxId: {item.TransactionId}"); - item.RetryTimes += 1; + Logger.LogError( + $"Transmit transaction forked. Chain: {item.TargetChainId}, TxId: {item.TransactionId}"); await EnqueueAsync(GetQueueName(TransmitSendingQueue, item.ChainId), item); } else @@ -145,10 +172,15 @@ public async Task UpdateQueueAsync(string chainId) Logger.LogInformation($"Transmit transaction finished. TxId: {item.TransactionId}"); } } - - await DequeueAsync(GetQueueName(TransmitCheckingQueue,chainId)); - item = await GetFirstItemAsync(GetQueueName(TransmitCheckingQueue,chainId)); + if (firstCheckingChainId == null && firstCheckingTransactionId == null) + { + firstCheckingChainId = item.TargetChainId; + firstCheckingTransactionId = item.TransactionId; + } + + await DequeueAsync(GetQueueName(TransmitCheckingQueue, chainId)); + item = await GetFirstItemAsync(GetQueueName(TransmitCheckingQueue, chainId)); } } @@ -157,7 +189,8 @@ public async Task ReSendFailedJobAsync(string chainId) var item = await GetFirstItemAsync(GetQueueName(TransmitFailedQueue,chainId)); while (item != null) { - item.RetryTimes = 0; + item.QueryTimes = 0; + item.SendTimes = 0; await EnqueueAsync(item); await DequeueAsync(GetQueueName(TransmitFailedQueue, chainId)); @@ -207,6 +240,6 @@ public class SendTransmitArgs public byte[][] Rs { get; set; } public byte[][] Ss{ get; set; } public byte[] RawVs { get; set; } - public int RetryTimes { get; set; } - + public int QueryTimes { get; set; } + public int SendTimes { get; set; } } From d68b38ea9721d777b64f888717fa34f039360fbc Mon Sep 17 00:00:00 2001 From: zhxymh Date: Fri, 23 Sep 2022 16:24:20 +0800 Subject: [PATCH 58/66] fix: fix request times --- modules/AElf.TokenPrice.CoinGecko/IRequestLimitProvider.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/AElf.TokenPrice.CoinGecko/IRequestLimitProvider.cs b/modules/AElf.TokenPrice.CoinGecko/IRequestLimitProvider.cs index 21f54c0d..7a5d239a 100644 --- a/modules/AElf.TokenPrice.CoinGecko/IRequestLimitProvider.cs +++ b/modules/AElf.TokenPrice.CoinGecko/IRequestLimitProvider.cs @@ -25,6 +25,7 @@ public RequestLimitProvider(IDistributedCache requestTimeCache) public async Task RecordRequestAsync() { + return; var requestTime = await _requestTimeCache.GetOrAddAsync(CoinGeckoApiConsts.RequestTimeCacheKey, async () => new RequestTime(), () => new DistributedCacheEntryOptions { From e8bfc0c6ced2254133b88b36950cd53728f6f4cc Mon Sep 17 00:00:00 2001 From: zhxymh Date: Tue, 27 Sep 2022 10:12:07 +0800 Subject: [PATCH 59/66] fix: add logs and fault handling --- modules/AElf.Nethereum.Bridge/IBridgeOutService.cs | 6 ++++++ src/AElf.EventHandler/EventHandlerAppModule.cs | 13 +++++++++---- .../Options/FaultHandlingOptions.cs | 7 +++++++ src/AElf.EventHandler/appsettings.json | 4 ++++ 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 src/AElf.EventHandler/Options/FaultHandlingOptions.cs diff --git a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs index 8a2a6630..0e470c0f 100644 --- a/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs +++ b/modules/AElf.Nethereum.Bridge/IBridgeOutService.cs @@ -1,5 +1,6 @@ using System.Numerics; using AElf.Nethereum.Core; +using Microsoft.Extensions.Logging; using Nethereum.RPC.Eth.DTOs; using Volo.Abp.DependencyInjection; @@ -14,11 +15,16 @@ public class BridgeOutService : ContractServiceBase, IBridgeOutService, ITransie { protected override string SmartContractName { get; } = "BridgeOut"; + public ILogger Logger { get; set; } + public async Task TransmitAsync(string chainId, string contractAddress, byte[] swapHashId, byte[] report, byte[][] rs, byte[][] ss, byte[] rawVs) { var setValueFunction = GetFunction(chainId, contractAddress, "transmit"); var sender = GetAccount().Address; + + Logger.LogInformation($"Transmit sender: {sender}"); + var gas = await setValueFunction.EstimateGasAsync(sender, null, null, swapHashId, report, rs, ss, rawVs); gas.Value = BigInteger.Multiply(gas.Value, 2); var transactionResult = diff --git a/src/AElf.EventHandler/EventHandlerAppModule.cs b/src/AElf.EventHandler/EventHandlerAppModule.cs index 9d8c7655..9c0ce4d7 100644 --- a/src/AElf.EventHandler/EventHandlerAppModule.cs +++ b/src/AElf.EventHandler/EventHandlerAppModule.cs @@ -13,6 +13,7 @@ using AElf.Nethereum.Core; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; using RabbitMQ.Client; using Volo.Abp; using Volo.Abp.Autofac; @@ -78,6 +79,7 @@ public override void ConfigureServices(ServiceConfigurationContext context) Configure(configuration.GetSection("Bridge")); Configure(configuration.GetSection("BlockConfirmation")); Configure(configuration.GetSection("ChainIdMapping")); + Configure(configuration.GetSection("FaultHandling")); context.Services.AddHostedService(); context.Services.AddTransient(typeof(ILogEventProcessor<>), typeof(LogEventProcessorBase<>)); @@ -88,9 +90,12 @@ public override void OnApplicationInitialization(ApplicationInitializationContex { context.AddBackgroundWorkerAsync(); context.AddBackgroundWorkerAsync(); - // var service = context.ServiceProvider.GetRequiredService(); - // AsyncHelper.RunSync(service.ExecuteAsync); - // var service = context.ServiceProvider.GetRequiredService(); - // var status = AsyncHelper.RunSync(async () => await service.GetChainStatusAsync("AELF-Test")); + + var faultHandlingOptions = context.ServiceProvider.GetRequiredService>(); + if (faultHandlingOptions.Value.IsReSendFailedJob) + { + var service = context.ServiceProvider.GetRequiredService(); + AsyncHelper.RunSync(async()=> await service.ReSendFailedJobAsync(faultHandlingOptions.Value.ReSendFailedJobChainId)); + } } } \ No newline at end of file diff --git a/src/AElf.EventHandler/Options/FaultHandlingOptions.cs b/src/AElf.EventHandler/Options/FaultHandlingOptions.cs new file mode 100644 index 00000000..b05b30f5 --- /dev/null +++ b/src/AElf.EventHandler/Options/FaultHandlingOptions.cs @@ -0,0 +1,7 @@ +namespace AElf.EventHandler; + +public class FaultHandlingOptions +{ + public bool IsReSendFailedJob { get; set; } = false; + public string ReSendFailedJobChainId { get; set; } +} \ No newline at end of file diff --git a/src/AElf.EventHandler/appsettings.json b/src/AElf.EventHandler/appsettings.json index ed10021a..a149a06d 100644 --- a/src/AElf.EventHandler/appsettings.json +++ b/src/AElf.EventHandler/appsettings.json @@ -160,5 +160,9 @@ "1866392": "SideChain_tDVV", "1931928": "SideChain_tDVW" } + }, + "FaultHandling": { + "IsReSendFailedJob": false, + "ReSendFailedJobChainId": "MainChain_AELF" } } \ No newline at end of file From 748a5b45090ac83669553e8081adea450ae68912 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Tue, 27 Sep 2022 11:23:54 +0800 Subject: [PATCH 60/66] fix: test invalid sender --- .../INethereumClientProvider.cs | 61 ++++++++++++------- .../Providers/ITransmitTransactionProvider.cs | 12 ++++ 2 files changed, 50 insertions(+), 23 deletions(-) diff --git a/modules/AElf.Nethereum.Core/INethereumClientProvider.cs b/modules/AElf.Nethereum.Core/INethereumClientProvider.cs index 9ea9d7e1..bd3e2481 100644 --- a/modules/AElf.Nethereum.Core/INethereumClientProvider.cs +++ b/modules/AElf.Nethereum.Core/INethereumClientProvider.cs @@ -25,32 +25,47 @@ public NethereumClientProvider(IOptionsSnapshot ethereumC public Web3 GetClient(string clientAlias, string accountAlias = null) { - var keys = Keys.Where(o => o.ClientAlias == clientAlias && o.AccountAlias == accountAlias).ToList(); - if (keys.Count == 0) + var clientConfig = _ethereumClientOptions.ClientConfigList + .FirstOrDefault(o => o.Alias == clientAlias); + Web3 client; + if (string.IsNullOrWhiteSpace(accountAlias)) { - var clientConfig = _ethereumClientOptions.ClientConfigList - .FirstOrDefault(o => o.Alias == clientAlias); - Web3 client; - if (string.IsNullOrWhiteSpace(accountAlias)) - { - client = new Web3(clientConfig.Url); - } - else - { - var account = _nethereumAccountProvider.GetAccount(accountAlias); - client = new Web3(account, clientConfig.Url); - } - - TryAdd(new NethereumClientInfo - { - ClientAlias = clientAlias, - AccountAlias = accountAlias - }, client); - - return client; + client = new Web3(clientConfig.Url); + } + else + { + var account = _nethereumAccountProvider.GetAccount(accountAlias); + client = new Web3(account, clientConfig.Url); } - return this[keys.Single()]; + return client; + + // var keys = Keys.Where(o => o.ClientAlias == clientAlias && o.AccountAlias == accountAlias).ToList(); + // if (keys.Count == 0) + // { + // var clientConfig = _ethereumClientOptions.ClientConfigList + // .FirstOrDefault(o => o.Alias == clientAlias); + // Web3 client; + // if (string.IsNullOrWhiteSpace(accountAlias)) + // { + // client = new Web3(clientConfig.Url); + // } + // else + // { + // var account = _nethereumAccountProvider.GetAccount(accountAlias); + // client = new Web3(account, clientConfig.Url); + // } + // + // TryAdd(new NethereumClientInfo + // { + // ClientAlias = clientAlias, + // AccountAlias = accountAlias + // }, client); + // + // return client; + // } + // + // return this[keys.Single()]; } } diff --git a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs index 47d19f8c..2ebc825f 100644 --- a/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs +++ b/src/AElf.EventHandler/Providers/ITransmitTransactionProvider.cs @@ -67,6 +67,8 @@ public async Task EnqueueAsync(SendTransmitArgs args) public async Task SendByLibAsync(string chainId, string libHash, long libHeight) { var item = await GetFirstItemAsync(GetQueueName(TransmitSendingQueue, chainId)); + string firstSwapHashId = null; + string firstReport = null; while (item != null) { if (item.BlockHeight > libHeight) @@ -74,6 +76,11 @@ public async Task SendByLibAsync(string chainId, string libHash, long libHeight) break; } + if (firstSwapHashId == item.SwapHashId.ToHex() && firstReport == item.Report.ToHex()) + { + break; + } + var block = await _aelfClientService.GetBlockByHeightAsync(_aelfChainAliasOption.Mapping[item.ChainId], item.BlockHeight); if (block.BlockHash == item.BlockHash) { @@ -114,6 +121,11 @@ public async Task SendByLibAsync(string chainId, string libHash, long libHeight) } await DequeueAsync(GetQueueName(TransmitSendingQueue, chainId)); + if (firstSwapHashId == null && firstReport == null) + { + firstSwapHashId = item.SwapHashId.ToHex(); + firstReport = item.Report.ToHex(); + } item = await GetFirstItemAsync(GetQueueName(TransmitSendingQueue, chainId)); } } From 691fce41f0352f0bdf4965e3dec2ac1553156228 Mon Sep 17 00:00:00 2001 From: zhxymh Date: Thu, 29 Sep 2022 16:21:57 +0800 Subject: [PATCH 61/66] fix: remove account cache --- modules/AElf.Nethereum.Core/INethereumAccountProvider.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/AElf.Nethereum.Core/INethereumAccountProvider.cs b/modules/AElf.Nethereum.Core/INethereumAccountProvider.cs index 02a5a476..7e96ae66 100644 --- a/modules/AElf.Nethereum.Core/INethereumAccountProvider.cs +++ b/modules/AElf.Nethereum.Core/INethereumAccountProvider.cs @@ -11,7 +11,7 @@ public interface INethereumAccountProvider Account GetAccount(string alias); } -public class NethereumAccountProvider : ConcurrentDictionary, INethereumAccountProvider, ISingletonDependency +public class NethereumAccountProvider : ConcurrentDictionary, INethereumAccountProvider, ISingletonDependency { private readonly EthereumAccountOptions _ethereumAccountOptions; @@ -21,12 +21,12 @@ public NethereumAccountProvider(IOptionsSnapshot options foreach (var item in _ethereumAccountOptions.AccountConfigList) { - TryAdd(item.Alias, new Account(item.PrivateKey)); + TryAdd(item.Alias, item); } } public Account GetAccount(string alias) { - return this[alias]; + return new Account(this[alias].PrivateKey); } } \ No newline at end of file From 9016e92eb0044de7d890495d0633335ae8ebdf68 Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Thu, 29 Sep 2022 19:00:23 +0800 Subject: [PATCH 62/66] feat: add ci. --- CodeCoverage.runsettings | 17 +++ azure-pipelines.yml | 102 ++++++++++++++++++ build.cake | 224 +++++++++++++++++++++++++++++++++++++++ build.config | 3 + build.ps1 | 154 +++++++++++++++++++++++++++ build.sh | 75 +++++++++++++ codecov.sh | 12 +++ codecov.yml | 3 + 8 files changed, 590 insertions(+) create mode 100644 CodeCoverage.runsettings create mode 100644 azure-pipelines.yml create mode 100755 build.cake create mode 100644 build.config create mode 100644 build.ps1 create mode 100755 build.sh create mode 100755 codecov.sh create mode 100644 codecov.yml diff --git a/CodeCoverage.runsettings b/CodeCoverage.runsettings new file mode 100644 index 00000000..fca024f1 --- /dev/null +++ b/CodeCoverage.runsettings @@ -0,0 +1,17 @@ + + + + + + + + cobertura + [xunit.*]*,[*Tests]* + **/test/**/*.cs,**/AElf.ContractTestBase/**/*.cs,**/src/**/*.cs + Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute + false + + + + + diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000..05ee1cf5 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,102 @@ +jobs: +# All tasks on Windows.... +- job: build_all_windows + displayName: Build all tasks (Windows) + timeoutInMinutes: 120 + pool: + vmImage: windows-latest + variables: + CI_TEST: true + steps: + - task: UseDotNet@2 + displayName: 'Install .NET Core SDK' + inputs: + version: 6.0.x + - script: choco install protoc --version=3.19.4 -y + displayName: 'Install protobuf' + - script: choco install unzip + displayName: 'Install unzip' + - task: BatchScript@1 + displayName: 'Download AElf build tools' + inputs: + filename: 'scripts/download_binary.bat' + - script: PowerShell.exe -file build.ps1 -target=Run-Unit-Tests + displayName: 'Build and Test' + - task: PublishTestResults@2 + condition: always() + inputs: + testRunner: VSTest + testResultsFiles: '**/*.trx' + +# - task: reportgenerator@5 +# displayName: ReportGenerator +# inputs: +# reports: '$(Build.SourcesDirectory)/test/*/TestResults/*/coverage.cobertura.xml' +# targetdir: '$(Build.SourcesDirectory)/CodeCoverage' +# reporttypes: 'Cobertura' +# assemblyfilters: '-xunit*' +# - script: PowerShell.exe -file build.ps1 -target=Upload-Coverage-Azure +# displayName: 'Upload data to Codecov' +# All tasks on Linux +- job: build_all_linux + displayName: Build all tasks (Linux) + timeoutInMinutes: 120 + pool: + vmImage: ubuntu-latest + steps: + - task: UseDotNet@2 + displayName: 'Install .NET Core SDK' + inputs: + version: 6.0.x + - script: bash scripts/install_protobuf.sh + - script: bash scripts/download_binary.sh + - script: bash build.sh -target=Test-with-Codecov + displayName: 'Build and Test' + - task: PublishTestResults@2 + condition: always() + inputs: + testRunner: VSTest + testResultsFiles: '**/*.trx' + + - task: reportgenerator@5 + displayName: ReportGenerator + inputs: + reports: '$(Build.SourcesDirectory)/test/*/TestResults/*/coverage.cobertura.xml' + targetdir: '$(Build.SourcesDirectory)/CodeCoverage' + reporttypes: 'Cobertura' + assemblyfilters: '-xunit*' + - script: bash build.sh -target=Upload-Coverage-Azure + displayName: 'Upload data to Codecov' + +# All tasks on macOS +- job: build_all_darwin + displayName: Build all tasks (macOS) + timeoutInMinutes: 120 + pool: + vmImage: macos-latest + variables: + CI_TEST: true + steps: + - task: UseDotNet@2 + displayName: 'Install .NET Core SDK' + inputs: + version: 6.0.x + - script: bash scripts/install_protobuf.sh + - script: bash scripts/download_binary.sh + - script: bash build.sh -target=Run-Unit-Tests + displayName: 'Build and Test' + - task: PublishTestResults@2 + condition: always() + inputs: + testRunner: VSTest + testResultsFiles: '**/*.trx' + +# - task: reportgenerator@5 +# displayName: ReportGenerator +# inputs: +# reports: '$(Build.SourcesDirectory)/test/*/TestResults/*/coverage.cobertura.xml' +# targetdir: '$(Build.SourcesDirectory)/CodeCoverage' +# reporttypes: 'Cobertura' +# assemblyfilters: '-xunit*' +# - script: bash build.sh -target=Upload-Coverage-Azure +# displayName: 'Upload data to Codecov' diff --git a/build.cake b/build.cake new file mode 100755 index 00000000..c096f680 --- /dev/null +++ b/build.cake @@ -0,0 +1,224 @@ +#tool nuget:?package=Codecov +#addin nuget:?package=Cake.Codecov&version=0.8.0 +var target = Argument("target", "Default"); +var configuration = Argument("configuration", "Debug"); +var rootPath = "./"; +var srcPath = rootPath + "src/"; +var contractPath = rootPath + "contract/"; +var testPath = rootPath + "test/"; +var distPath = rootPath + "aelf-node/"; +var solution = rootPath + "AElf.Contracts.PortAll.sln"; +var srcProjects = GetFiles(srcPath + "**/*.csproj"); +var contractProjects = GetFiles(contractPath + "**/*.csproj"); + + +Task("Clean") + .Description("clean up project cache") + .Does(() => +{ + DeleteFiles(distPath + "*.nupkg"); + CleanDirectories(srcPath + "**/bin"); + CleanDirectories(srcPath + "**/obj"); + CleanDirectories(contractPath + "**/bin"); + CleanDirectories(contractPath + "**/obj"); + CleanDirectories(testPath + "**/bin"); + CleanDirectories(testPath + "**/obj"); +}); + +Task("Restore") + .Description("restore project dependencies") + .Does(() => +{ + var restoreSettings = new DotNetCoreRestoreSettings{ + ArgumentCustomization = args => { + return args.Append("-v quiet");} +}; + DotNetCoreRestore(solution,restoreSettings); +}); +Task("Build") + .Description("Compilation project") + .IsDependentOn("Clean") + .IsDependentOn("Restore") + .Does(() => +{ + var buildSetting = new DotNetCoreBuildSettings{ + Configuration = configuration, + NoRestore = true, + ArgumentCustomization = args => { + return args.Append("/clp:ErrorsOnly") + .Append("/p:GeneratePackageOnBuild=false") + .Append("-v quiet");} + }; + + DotNetCoreBuild(solution, buildSetting); +}); +Task("Build-Release") + .Description("Compilation project") + .IsDependentOn("Clean") + .IsDependentOn("Restore") + .Does(() => +{ var versionPrefix = EnvironmentVariable("MYGET_VERSION_PREFIX"); + var buildVersion = (DateTime.UtcNow.Ticks - 621355968000000000) / 10000000 / 86400; + var buildSetting = new DotNetCoreBuildSettings{ + NoRestore = true, + Configuration = "Release", + ArgumentCustomization = args => { + return args.Append("/clp:ErrorsOnly") + .Append("-v quiet") + .Append($"-P:Version={versionPrefix}-{buildVersion}") + .Append("-P:Authors=AElf") + .Append("-o ./nuget") +;} + }; + + DotNetCoreBuild(solution, buildSetting); +}); + +Task("Test-with-Codecov") + .Description("operation test_with_codecov") + .IsDependentOn("Build") + .Does(() => +{ + var testSetting = new DotNetCoreTestSettings{ + Configuration = configuration, + NoRestore = true, + NoBuild = true, + ArgumentCustomization = args => { + return args + .Append("--logger trx") + .Append("--settings CodeCoverage.runsettings") + .Append("--collect:\"XPlat Code Coverage\""); + } + }; + var codecovToken = "$CODECOV_TOKEN"; + var actions = new List(); + var testProjects = GetFiles("./test/*.Tests/*.csproj"); + + foreach(var testProject in testProjects) + { + var action=new Action(()=>{ + DotNetCoreTest(testProject.FullPath, testSetting); + + // if(codecovToken!=""){ + // var dir=testProject.GetDirectory().FullPath; + // var reports = GetFiles(dir + "/TestResults/*/coverage.cobertura.xml"); + + // foreach(var report in reports) + // { + // Codecov(report.FullPath,"$CODECOV_TOKEN"); + // } + // } + }); + actions.Add(action); + } + + + var options = new ParallelOptions { + MaxDegreeOfParallelism = 1, + //CancellationToken = cancellationToken + }; + + Parallel.Invoke(options, actions.ToArray()); +}); + +Task("Test-with-Codecov-N") + .Description("operation test_with_codecov") + .IsDependentOn("Build") + .Does(() => +{ + var testSetting = new DotNetCoreTestSettings{ + Configuration = configuration, + NoRestore = true, + NoBuild = true, + ArgumentCustomization = args => { + return args + .Append("--logger trx") + .Append("--settings CodeCoverage.runsettings") + .Append("--collect:\"XPlat Code Coverage\""); + } + }; + var testSetting_nocoverage = new DotNetCoreTestSettings{ + NoRestore = true, + NoBuild = true, + ArgumentCustomization = args => { + return args + .Append("--logger trx"); + } + }; + var codecovToken = "$CODECOV_TOKEN"; + var actions = new List(); + var testProjects = GetFiles("./test/*.Tests/*.csproj"); + var testProjectList = testProjects.OrderBy(p=>p.FullPath).ToList(); + var n = Argument("n",1); + var parts = Argument("parts",1); + + Information($"n:{n}, parts:{parts}"); + int i=0; + foreach(var testProject in testProjectList) + { + if(i++ % parts == n - 1){ + DotNetCoreTest(testProject.FullPath, testSetting); + }else{ + DotNetCoreTest(testProject.FullPath, testSetting_nocoverage); + } + } +}); + +Task("Run-Unit-Tests") + .Description("operation test") + .IsDependentOn("Build") + .Does(() => +{ + var testSetting = new DotNetCoreTestSettings{ + Configuration = configuration, + NoRestore = true, + NoBuild = true, + ArgumentCustomization = args => { + return args.Append("--logger trx"); + } +}; + var testProjects = GetFiles("./test/*.Tests/*.csproj"); + + + foreach(var testProject in testProjects) + { + DotNetCoreTest(testProject.FullPath, testSetting); + } +}); +Task("Upload-Coverage") + .Does(() => +{ + var reports = GetFiles("./test/*.Tests/TestResults/*/coverage.cobertura.xml"); + + foreach(var report in reports) + { + Codecov(report.FullPath,"$CODECOV_TOKEN"); + } +}); +Task("Upload-Coverage-Azure") + .Does(() => +{ + Codecov("./CodeCoverage/Cobertura.xml","$CODECOV_TOKEN"); +}); +Task("Publish-MyGet") + .IsDependentOn("Build-Release") + .Does(() => { + var apiKey = EnvironmentVariable("MYGET_API_KEY"); + var pushSettings = new DotNetCoreNuGetPushSettings + { + Source = "https://www.myget.org/F/aelf-project-dev/api/v3/index.json", + ApiKey = apiKey + + }; + + var pkgs = GetFiles("./nuget/*.nupkg"); + foreach(var pkg in pkgs) + { + Information($"Publishing \"{pkg}\"."); + DotNetCoreNuGetPush(pkg.FullPath, pushSettings); + } + }); +Task("Default") + .IsDependentOn("Run-Unit-Tests"); + +RunTarget(target); diff --git a/build.config b/build.config new file mode 100644 index 00000000..015ef8ec --- /dev/null +++ b/build.config @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +CAKE_VERSION=0.37.0 +DOTNET_VERSION=6.0.300 diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 00000000..e48d09a0 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,154 @@ +#!/usr/bin/env pwsh +$DotNetInstallerUri = 'https://dot.net/v1/dotnet-install.ps1'; +$DotNetUnixInstallerUri = 'https://dot.net/v1/dotnet-install.sh' +$DotNetChannel = 'LTS' +$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent + +[string] $CakeVersion = '' +[string] $DotNetVersion= '' +foreach($line in Get-Content (Join-Path $PSScriptRoot 'build.config')) +{ + if ($line -like 'CAKE_VERSION=*') { + $CakeVersion = $line.SubString(13) + } + elseif ($line -like 'DOTNET_VERSION=*') { + $DotNetVersion =$line.SubString(15) + } +} + + +if ([string]::IsNullOrEmpty($CakeVersion) -or [string]::IsNullOrEmpty($DotNetVersion)) { + 'Failed to parse Cake / .NET Core SDK Version' + exit 1 +} + +# Make sure tools folder exists +$ToolPath = Join-Path $PSScriptRoot "tools" +if (!(Test-Path $ToolPath)) { + Write-Verbose "Creating tools directory..." + New-Item -Path $ToolPath -Type Directory -Force | out-null +} + + +if ($PSVersionTable.PSEdition -ne 'Core') { + # Attempt to set highest encryption available for SecurityProtocol. + # PowerShell will not set this by default (until maybe .NET 4.6.x). This + # will typically produce a message for PowerShell v2 (just an info + # message though) + try { + # Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48) + # Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't + # exist in .NET 4.0, even though they are addressable if .NET 4.5+ is + # installed (.NET 4.5 is an in-place upgrade). + [System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48 + } catch { + Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3' + } +} + +########################################################################### +# INSTALL .NET CORE CLI +########################################################################### + +$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +$env:DOTNET_CLI_TELEMETRY_OPTOUT=1 +$env:DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX=2 + + +Function Remove-PathVariable([string]$VariableToRemove) +{ + $SplitChar = ';' + if ($IsMacOS -or $IsLinux) { + $SplitChar = ':' + } + + $path = [Environment]::GetEnvironmentVariable("PATH", "User") + if ($path -ne $null) + { + $newItems = $path.Split($SplitChar, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove } + [Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($SplitChar, $newItems), "User") + } + + $path = [Environment]::GetEnvironmentVariable("PATH", "Process") + if ($path -ne $null) + { + $newItems = $path.Split($SplitChar, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove } + [Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($SplitChar, $newItems), "Process") + } +} + +# Get .NET Core CLI path if installed. +$FoundDotNetCliVersion = $null; +if (Get-Command dotnet -ErrorAction SilentlyContinue) { + $FoundDotNetCliVersion = dotnet --version; +} + +if($FoundDotNetCliVersion -ne $DotNetVersion) { + $InstallPath = Join-Path $PSScriptRoot ".dotnet" + if (!(Test-Path $InstallPath)) { + New-Item -Path $InstallPath -ItemType Directory -Force | Out-Null; + } + + if ($IsMacOS -or $IsLinux) { + $ScriptPath = Join-Path $InstallPath 'dotnet-install.sh' + (New-Object System.Net.WebClient).DownloadFile($DotNetUnixInstallerUri, $ScriptPath); + & bash $ScriptPath --version "$DotNetVersion" --install-dir "$InstallPath" --channel "$DotNetChannel" --no-path + + Remove-PathVariable "$InstallPath" + $env:PATH = "$($InstallPath):$env:PATH" + } + else { + $ScriptPath = Join-Path $InstallPath 'dotnet-install.ps1' + (New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, $ScriptPath); + & $ScriptPath -Channel $DotNetChannel -Version $DotNetVersion -InstallDir $InstallPath; + + Remove-PathVariable "$InstallPath" + $env:PATH = "$InstallPath;$env:PATH" + } + $env:DOTNET_ROOT=$InstallPath +} + +########################################################################### +# INSTALL CAKE +########################################################################### + +# Make sure Cake has been installed. +[string] $CakeExePath = '' +[string] $CakeInstalledVersion = Get-Command dotnet-cake -ErrorAction SilentlyContinue | % {&$_.Source --version} + +if ($CakeInstalledVersion -eq $CakeVersion) { + # Cake found locally + $CakeExePath = (Get-Command dotnet-cake).Source +} +else { + $CakePath = [System.IO.Path]::Combine($ToolPath,'.store', 'cake.tool', $CakeVersion) # Old PowerShell versions Join-Path only supports one child path + + $CakeExePath = (Get-ChildItem -Path $ToolPath -Filter "dotnet-cake*" -File| ForEach-Object FullName | Select-Object -First 1) + + + if ((!(Test-Path -Path $CakePath -PathType Container)) -or (!(Test-Path $CakeExePath -PathType Leaf))) { + + if ((![string]::IsNullOrEmpty($CakeExePath)) -and (Test-Path $CakeExePath -PathType Leaf)) + { + & dotnet tool uninstall --tool-path $ToolPath Cake.Tool + } + + & dotnet tool install --tool-path $ToolPath --version $CakeVersion Cake.Tool + if ($LASTEXITCODE -ne 0) + { + 'Failed to install cake' + exit 1 + } + $CakeExePath = (Get-ChildItem -Path $ToolPath -Filter "dotnet-cake*" -File| ForEach-Object FullName | Select-Object -First 1) + } +} + +########################################################################### +# RUN BUILD SCRIPT +########################################################################### +& "$CakeExePath" ./build.cake --bootstrap +if ($LASTEXITCODE -eq 0) +{ + & "$CakeExePath" ./build.cake $args +} +exit $LASTEXITCODE \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..06bcee80 --- /dev/null +++ b/build.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash +# Define varibles +SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +source $SCRIPT_DIR/build.config +TOOLS_DIR=$SCRIPT_DIR/tools +CAKE_EXE=$TOOLS_DIR/dotnet-cake +CAKE_PATH=$TOOLS_DIR/.store/cake.tool/$CAKE_VERSION + +if [ "$CAKE_VERSION" = "" ] || [ "$DOTNET_VERSION" = "" ]; then + echo "An error occured while parsing Cake / .NET Core SDK version." + exit 1 +fi + +# Make sure the tools folder exist. +if [ ! -d "$TOOLS_DIR" ]; then + mkdir "$TOOLS_DIR" +fi + +########################################################################### +# INSTALL .NET CORE CLI +########################################################################### + +export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +export DOTNET_CLI_TELEMETRY_OPTOUT=1 +export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0 +export DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX=2 + +DOTNET_INSTALLED_VERSION=$(dotnet --version 2>&1) + +if [ "$DOTNET_VERSION" != "$DOTNET_INSTALLED_VERSION" ]; then + echo "Installing .NET CLI..." + if [ ! -d "$SCRIPT_DIR/.dotnet" ]; then + mkdir "$SCRIPT_DIR/.dotnet" + fi + curl -Lsfo "$SCRIPT_DIR/.dotnet/dotnet-install.sh" https://dot.net/v1/dotnet-install.sh + bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --version $DOTNET_VERSION --install-dir .dotnet --no-path + export PATH="$SCRIPT_DIR/.dotnet":$PATH + export DOTNET_ROOT="$SCRIPT_DIR/.dotnet" +fi + +########################################################################### +# INSTALL CAKE +########################################################################### + +CAKE_INSTALLED_VERSION=$(dotnet-cake --version 2>&1) + +if [ "$CAKE_VERSION" != "$CAKE_INSTALLED_VERSION" ]; then + if [ ! -f "$CAKE_EXE" ] || [ ! -d "$CAKE_PATH" ]; then + if [ -f "$CAKE_EXE" ]; then + dotnet tool uninstall --tool-path $TOOLS_DIR Cake.Tool + fi + + echo "Installing Cake $CAKE_VERSION..." + dotnet tool install --tool-path $TOOLS_DIR --version $CAKE_VERSION Cake.Tool + if [ $? -ne 0 ]; then + echo "An error occured while installing Cake." + exit 1 + fi + fi + + # Make sure that Cake has been installed. + if [ ! -f "$CAKE_EXE" ]; then + echo "Could not find Cake.exe at '$CAKE_EXE'." + exit 1 + fi +else + CAKE_EXE="dotnet-cake" +fi + +########################################################################### +# RUN BUILD SCRIPT +########################################################################### + +# Start Cake +(exec "$CAKE_EXE" build.cake --bootstrap) && (exec "$CAKE_EXE" build.cake "$@") \ No newline at end of file diff --git a/codecov.sh b/codecov.sh new file mode 100755 index 00000000..6b97c5b6 --- /dev/null +++ b/codecov.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +TOKEN=$1 +rm -r ./test/*.Tests/TestResults +rm -r CodeCoverage +for name in `ls ./test/*.Tests/*.csproj | awk '{print $NF}'`; +do + echo ${name} + dotnet test ${name} --logger trx --settings CodeCoverage.runsettings --collect:"XPlat Code Coverage" +done +reportgenerator /test/*/TestResults/*/coverage.cobertura.xml -reports:./test/*/TestResults/*/coverage.cobertura.xml -targetdir:./CodeCoverage -reporttypes:Cobertura -assemblyfilters:-xunit* +codecov -f ./CodeCoverage/Cobertura.xml -t ${TOKEN} \ No newline at end of file diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..13395c9c --- /dev/null +++ b/codecov.yml @@ -0,0 +1,3 @@ +codecov: + notify: + after_n_builds: 1 \ No newline at end of file From 9a4e1856764ca74f0df64a234fabb193011c75f7 Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Wed, 12 Oct 2022 14:37:29 +0800 Subject: [PATCH 63/66] feat: test ci. --- build.cake | 1 + 1 file changed, 1 insertion(+) diff --git a/build.cake b/build.cake index c096f680..109f173d 100755 --- a/build.cake +++ b/build.cake @@ -222,3 +222,4 @@ Task("Default") .IsDependentOn("Run-Unit-Tests"); RunTarget(target); + From 7c2a76bd97fc04dfddc02a58c536697b66da908a Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Wed, 12 Oct 2022 15:03:36 +0800 Subject: [PATCH 64/66] feat: add coverlet.collector. --- .../AElf.Contracts.Bridge.Tests.csproj | 4 ++++ .../AElf.Contracts.Lottery.Tests.csproj | 4 ++++ .../AElf.Contracts.Oracle.Tests.csproj | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/test/AElf.Contracts.Bridge.Tests/AElf.Contracts.Bridge.Tests.csproj b/test/AElf.Contracts.Bridge.Tests/AElf.Contracts.Bridge.Tests.csproj index 84710565..b2048cdb 100644 --- a/test/AElf.Contracts.Bridge.Tests/AElf.Contracts.Bridge.Tests.csproj +++ b/test/AElf.Contracts.Bridge.Tests/AElf.Contracts.Bridge.Tests.csproj @@ -17,6 +17,10 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/AElf.Contracts.Lottery.Tests/AElf.Contracts.Lottery.Tests.csproj b/test/AElf.Contracts.Lottery.Tests/AElf.Contracts.Lottery.Tests.csproj index ed298376..0a063c02 100644 --- a/test/AElf.Contracts.Lottery.Tests/AElf.Contracts.Lottery.Tests.csproj +++ b/test/AElf.Contracts.Lottery.Tests/AElf.Contracts.Lottery.Tests.csproj @@ -17,6 +17,10 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/AElf.Contracts.Oracle.Tests/AElf.Contracts.Oracle.Tests.csproj b/test/AElf.Contracts.Oracle.Tests/AElf.Contracts.Oracle.Tests.csproj index 5c284b3b..33b13fb4 100644 --- a/test/AElf.Contracts.Oracle.Tests/AElf.Contracts.Oracle.Tests.csproj +++ b/test/AElf.Contracts.Oracle.Tests/AElf.Contracts.Oracle.Tests.csproj @@ -17,6 +17,10 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + From c0199cc1a3567191fe25d2253929953cef0c04ac Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Wed, 12 Oct 2022 18:03:45 +0800 Subject: [PATCH 65/66] feat: remove code coverage. --- azure-pipelines.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 05ee1cf5..e8e83974 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,7 +20,7 @@ jobs: displayName: 'Download AElf build tools' inputs: filename: 'scripts/download_binary.bat' - - script: PowerShell.exe -file build.ps1 -target=Run-Unit-Tests + - script: PowerShell.exe -file build.ps1 -target=Build displayName: 'Build and Test' - task: PublishTestResults@2 condition: always() @@ -50,7 +50,7 @@ jobs: version: 6.0.x - script: bash scripts/install_protobuf.sh - script: bash scripts/download_binary.sh - - script: bash build.sh -target=Test-with-Codecov + - script: bash build.sh -target=Build displayName: 'Build and Test' - task: PublishTestResults@2 condition: always() @@ -58,15 +58,15 @@ jobs: testRunner: VSTest testResultsFiles: '**/*.trx' - - task: reportgenerator@5 - displayName: ReportGenerator - inputs: - reports: '$(Build.SourcesDirectory)/test/*/TestResults/*/coverage.cobertura.xml' - targetdir: '$(Build.SourcesDirectory)/CodeCoverage' - reporttypes: 'Cobertura' - assemblyfilters: '-xunit*' - - script: bash build.sh -target=Upload-Coverage-Azure - displayName: 'Upload data to Codecov' +# - task: reportgenerator@5 +# displayName: ReportGenerator +# inputs: +# reports: '$(Build.SourcesDirectory)/test/*/TestResults/*/coverage.cobertura.xml' +# targetdir: '$(Build.SourcesDirectory)/CodeCoverage' +# reporttypes: 'Cobertura' +# assemblyfilters: '-xunit*' +# - script: bash build.sh -target=Upload-Coverage-Azure +# displayName: 'Upload data to Codecov' # All tasks on macOS - job: build_all_darwin @@ -83,7 +83,7 @@ jobs: version: 6.0.x - script: bash scripts/install_protobuf.sh - script: bash scripts/download_binary.sh - - script: bash build.sh -target=Run-Unit-Tests + - script: bash build.sh -target=Build displayName: 'Build and Test' - task: PublishTestResults@2 condition: always() From df144a81fc2329cb21dc390dc8b900d080669553 Mon Sep 17 00:00:00 2001 From: ssun0121 Date: Thu, 13 Oct 2022 11:48:31 +0800 Subject: [PATCH 66/66] feat: add readme. --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 465b802c..b050fb4d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ # PortAll 该repo中主要为与aelf预言机机制(或者port-all平台)或多或少相关的合约。 +BRANCH | AZURE PIPELINES | TESTS | CODE COVERAGE +-------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------- +MAIN | [![Build Status](https://dev.azure.com/portall-finance/port-all-contracts/_apis/build/status/portall-finance.port-all-contracts?branchName=main)](https://dev.azure.com/portall-finance/port-all-contracts/_build/latest?definitionId=1&branchName=main) | [![Test Status](https://img.shields.io/azure-devops/tests/portall-finance/port-all-contracts/1/main)](https://dev.azure.com/portall-finance/port-all-contracts/_build/latest?definitionId=1&branchName=main) | [![codecov](https://codecov.io/gh/portall-finance/port-all-contracts/branch/main/graph/badge.svg)](https://codecov.io/gh/portall-finance/port-all-contracts) +DEV | [![Build Status](https://dev.azure.com/portall-finance/port-all-contracts/_apis/build/status/portall-finance.port-all-contracts?branchName=dev)](https://dev.azure.com/portall-finance/port-all-contracts/_build/latest?definitionId=1&branchName=dev) | [![Test Status](https://img.shields.io/azure-devops/tests/portall-finance/port-all-contracts/1/dev)](https://dev.azure.com/portall-finance/port-all-contracts/_build/latest?definitionId=1&branchName=dev) | [![codecov](https://codecov.io/gh/portall-finance/port-all-contracts/branch/dev/graph/badge.svg)](https://codecov.io/gh/portall-finance/port-all-contracts) + ## 预言机合约 ### [Regiment合约](https://github.com/PortAllProject/port-all-contracts/tree/dev/contract/AElf.Contracts.Regiment)