From 5088d1c186de5b06d9372d6323cd2c76d7f045c4 Mon Sep 17 00:00:00 2001 From: jaeseung-bae <119839167+jaeseung-bae@users.noreply.github.com> Date: Fri, 3 May 2024 23:03:51 +0900 Subject: [PATCH] feat: introduce new modules(fswap, fbridge) (#1352) * feat: initialize fswap module (#1336) * feat: initial fswap module Signed-off-by: 170210 * chore: correct dependencies Signed-off-by: 170210 * chore: remove unuse files Signed-off-by: 170210 * feat: add proto files Signed-off-by: 170210 * chore: make proto-gen Signed-off-by: 170210 * chore: fix compile error Signed-off-by: 170210 * chore: add new field in params proto Signed-off-by: 170210 * fix: fix lint Signed-off-by: 170210 * feat: add query&tx commands of fswap module Signed-off-by: 170210 * fix: fix for comment Signed-off-by: 170210 * docs: update CHANGLOG.md Signed-off-by: 170210 * docs: fix error docs Signed-off-by: 170210 * fix: fix consensusversion Signed-off-by: 170210 * fix: remove route,type&getSignBytes in msgs.go Signed-off-by: 170210 * fix: update proto files Signed-off-by: 170210 * fix: fix NewKeeper Signed-off-by: 170210 * fix: fix for comment Signed-off-by: 170210 --------- Signed-off-by: 170210 * feat: implement fswap module's genesis and params (#1339) * feat: implement genesis related functions Signed-off-by: 170210 * chore: use mockgen Signed-off-by: 170210 * chore: add tests Signed-off-by: 170210 * fix: add subspace in paramsKeeper Signed-off-by: 170210 * fix: fix lint Signed-off-by: 170210 * fix: fix for test errors Signed-off-by: 170210 * fix: fix lint Signed-off-by: 170210 * fix: fix appmodulebasic Signed-off-by: 170210 * chore: update CHANGLOG.md Signed-off-by: 170210 * fix: use configuration instead of params Signed-off-by: 170210 * chore: refactor new&default fswapped Signed-off-by: 170210 * fix: add total_supply into genesisStatus & remove calculate logic Signed-off-by: 170210 * fix: fix lint Signed-off-by: 170210 * fix: fix module_simulation Signed-off-by: 170210 * fix: set swappableNewCoinDenom as params Signed-off-by: 170210 * fix: change total_supply name to swappableNewCoinAmount Signed-off-by: 170210 * fix: fix lint Signed-off-by: 170210 * fix: use io/collection to generate key Signed-off-by: 170210 * Revert "fix: use io/collection to generate key" This reverts commit e42e064d451b1ed3d3c2f65b5abbed46ddfa5954. * fix: change sdk.Coin to sdk.Int Signed-off-by: 170210 * fix: fix lint Signed-off-by: 170210 * fix: remote unnecessary codes Signed-off-by: 170210 * fix: add validate for swappable new coin Signed-off-by: 170210 * fix: add randomizedGenState Signed-off-by: 170210 * fix: fix error doc Signed-off-by: 170210 * fix: fix lint Signed-off-by: 170210 * fix: change proto message fields' name Signed-off-by: 170210 --------- Signed-off-by: 170210 * feat: initialize fbridge module (#1340) * initialize fbridge module * add all proto files for fbridge * add missing proto files * initialize module structure * modify proto based on discussion * add codec * add CHANGELOG * modify UpdateRole feature * feat: fbridge transfer (#1347) * impl bridge transfer tx/query * add CLI * feat: save sequence for every bridge request (#1351) * feat: add SeqToBlocknum * add CHANGELOG * add query bound for SeqToBlocknums * feat: fswap module's basic functionality(MsgSwap, MsgSwapAll, Query, Proposal) (#1345) * refactor: fswap module's proto Signed-off-by: 170210 * refactor: remove config¶ms and modify genesis Signed-off-by: 170210 * refactor: use gov/proposal to change fswapInit Signed-off-by: 170210 * chore: fix simulation Signed-off-by: 170210 * chore: correct query cli Signed-off-by: 170210 * chore: add query for test Signed-off-by: 170210 * chore: lint fix * chore: fix for tx cli * chore: update proto * chore: update genesis logic * chore: add basic tx and queries * chore: rename fswap to swap * chore: change old/new to from/to * chore: clean-up * chore: clean errors and rename * chore: update proto * chore: clean unnecessary member variables * chore: update proto, introduce config, clean code * chore: remove redundant denom validation * chore: remove cache-like operation, rename swap proposal in proto, errors start with number 2 * chore: apply feedbacks * chore: fix some * chore: fix for initGenesis * chore: apply feedbacks * chore: update changelog * chore: remove redundant logic * chore: update error doc * chore: update proto and logic to accept bank.Metadata * chore: add query to get all the swaps * chore: change swap_multiple to swap_rate * chore: disallow updating existing denom metadata with different values * chore: fix for calcSwap logic * chore: extract CalcSwap to function * chore: add missing query cmd * chore: fix for proposal cli * chore: fix for init timing * chore: fix query cli * chore: fix to prevent generating swap more than MaxSwaps * fix: add missing call validateBasic for proposal * fix: * chore: change error type for temporal test-pass * chore: fix for make-swap-proposal update * chore: fix to check swap count after increase in order not to make more than limit * chore: prevent any proposal with different denom * chore: change amount cap type * chore: fix codec-related parts * chore: minor change for convert to-coin-amount-cap --------- Signed-off-by: 170210 Co-authored-by: jaeseung.bae --------- Signed-off-by: 170210 Co-authored-by: 170210 <85928898+170210@users.noreply.github.com> Co-authored-by: Jayden Lee <41176085+tkxkd0159@users.noreply.github.com> --- CHANGELOG.md | 10 +- Makefile | 2 + client/docs/config.json | 14 + docs/core/proto-docs.md | 2655 +++++++-- proto/lbm/fbridge/v1/event.proto | 44 + proto/lbm/fbridge/v1/fbridge.proto | 75 + proto/lbm/fbridge/v1/genesis.proto | 81 + proto/lbm/fbridge/v1/query.proto | 199 + proto/lbm/fbridge/v1/tx.proto | 169 + proto/lbm/fswap/v1/event.proto | 18 + proto/lbm/fswap/v1/fswap.proto | 46 + proto/lbm/fswap/v1/genesis.proto | 14 + proto/lbm/fswap/v1/query.proto | 55 + proto/lbm/fswap/v1/tx.proto | 32 + simapp/app.go | 33 +- x/fbridge/client/cli/query.go | 92 + x/fbridge/client/cli/tx.go | 67 + x/fbridge/keeper/genesis.go | 42 + x/fbridge/keeper/grpc_query.go | 97 + x/fbridge/keeper/keeper.go | 60 + x/fbridge/keeper/msg_server.go | 88 + x/fbridge/keeper/transfer.go | 105 + x/fbridge/keeper/transfer_test.go | 65 + x/fbridge/module/module.go | 164 + x/fbridge/testutil/expected_keepers_mocks.go | 119 + x/fbridge/testutil/setup.go | 75 + x/fbridge/types/codec.go | 63 + x/fbridge/types/event.pb.go | 1292 ++++ x/fbridge/types/expected_keepers.go | 15 + x/fbridge/types/fbridge.pb.go | 1629 +++++ x/fbridge/types/genesis.go | 30 + x/fbridge/types/genesis.pb.go | 2347 ++++++++ x/fbridge/types/keys.go | 23 + x/fbridge/types/msgs.go | 127 + x/fbridge/types/params.go | 1 + x/fbridge/types/query.pb.go | 5594 ++++++++++++++++++ x/fbridge/types/query.pb.gw.go | 1246 ++++ x/fbridge/types/tx.pb.go | 4495 ++++++++++++++ x/fswap/client/cli/query.go | 112 + x/fswap/client/cli/tx.go | 255 + x/fswap/client/proposal_handler.go | 8 + x/fswap/codec/codec.go | 18 + x/fswap/handler.go | 27 + x/fswap/keeper/calc.go | 7 + x/fswap/keeper/calc_test.go | 65 + x/fswap/keeper/expected_keepers.go | 19 + x/fswap/keeper/genesis.go | 57 + x/fswap/keeper/genesis_test.go | 21 + x/fswap/keeper/grpc_query.go | 70 + x/fswap/keeper/keeper.go | 203 + x/fswap/keeper/keeper_test.go | 189 + x/fswap/keeper/keys.go | 19 + x/fswap/keeper/msg_server.go | 62 + x/fswap/keeper/msg_server_test.go | 135 + x/fswap/keeper/proposal.go | 163 + x/fswap/keeper/proposal_test.go | 138 + x/fswap/module.go | 159 + x/fswap/module_simulation.go | 40 + x/fswap/proposal_handler_test.go | 40 + x/fswap/simulation/genesis.go | 1 + x/fswap/simulation/genesis_test.go | 1 + x/fswap/spec/README.md | 16 + x/fswap/testutil/expected_keepers_mocks.go | 153 + x/fswap/types/codec.go | 39 + x/fswap/types/config.go | 13 + x/fswap/types/errors.go | 15 + x/fswap/types/event.pb.go | 434 ++ x/fswap/types/fswap.go | 76 + x/fswap/types/fswap.pb.go | 1247 ++++ x/fswap/types/genesis.go | 39 + x/fswap/types/genesis.pb.go | 448 ++ x/fswap/types/genesis_test.go | 33 + x/fswap/types/keys.go | 15 + x/fswap/types/msgs.go | 79 + x/fswap/types/proposal.go | 54 + x/fswap/types/query.pb.go | 1603 +++++ x/fswap/types/query.pb.gw.go | 326 + x/fswap/types/tx.pb.go | 1069 ++++ 78 files changed, 28212 insertions(+), 539 deletions(-) create mode 100644 proto/lbm/fbridge/v1/event.proto create mode 100644 proto/lbm/fbridge/v1/fbridge.proto create mode 100644 proto/lbm/fbridge/v1/genesis.proto create mode 100644 proto/lbm/fbridge/v1/query.proto create mode 100644 proto/lbm/fbridge/v1/tx.proto create mode 100644 proto/lbm/fswap/v1/event.proto create mode 100644 proto/lbm/fswap/v1/fswap.proto create mode 100644 proto/lbm/fswap/v1/genesis.proto create mode 100644 proto/lbm/fswap/v1/query.proto create mode 100644 proto/lbm/fswap/v1/tx.proto create mode 100644 x/fbridge/client/cli/query.go create mode 100644 x/fbridge/client/cli/tx.go create mode 100644 x/fbridge/keeper/genesis.go create mode 100644 x/fbridge/keeper/grpc_query.go create mode 100644 x/fbridge/keeper/keeper.go create mode 100644 x/fbridge/keeper/msg_server.go create mode 100644 x/fbridge/keeper/transfer.go create mode 100644 x/fbridge/keeper/transfer_test.go create mode 100644 x/fbridge/module/module.go create mode 100644 x/fbridge/testutil/expected_keepers_mocks.go create mode 100644 x/fbridge/testutil/setup.go create mode 100644 x/fbridge/types/codec.go create mode 100644 x/fbridge/types/event.pb.go create mode 100644 x/fbridge/types/expected_keepers.go create mode 100644 x/fbridge/types/fbridge.pb.go create mode 100644 x/fbridge/types/genesis.go create mode 100644 x/fbridge/types/genesis.pb.go create mode 100644 x/fbridge/types/keys.go create mode 100644 x/fbridge/types/msgs.go create mode 100644 x/fbridge/types/params.go create mode 100644 x/fbridge/types/query.pb.go create mode 100644 x/fbridge/types/query.pb.gw.go create mode 100644 x/fbridge/types/tx.pb.go create mode 100644 x/fswap/client/cli/query.go create mode 100644 x/fswap/client/cli/tx.go create mode 100644 x/fswap/client/proposal_handler.go create mode 100644 x/fswap/codec/codec.go create mode 100644 x/fswap/handler.go create mode 100644 x/fswap/keeper/calc.go create mode 100644 x/fswap/keeper/calc_test.go create mode 100644 x/fswap/keeper/expected_keepers.go create mode 100644 x/fswap/keeper/genesis.go create mode 100644 x/fswap/keeper/genesis_test.go create mode 100644 x/fswap/keeper/grpc_query.go create mode 100644 x/fswap/keeper/keeper.go create mode 100644 x/fswap/keeper/keeper_test.go create mode 100644 x/fswap/keeper/keys.go create mode 100644 x/fswap/keeper/msg_server.go create mode 100644 x/fswap/keeper/msg_server_test.go create mode 100644 x/fswap/keeper/proposal.go create mode 100644 x/fswap/keeper/proposal_test.go create mode 100644 x/fswap/module.go create mode 100644 x/fswap/module_simulation.go create mode 100644 x/fswap/proposal_handler_test.go create mode 100644 x/fswap/simulation/genesis.go create mode 100644 x/fswap/simulation/genesis_test.go create mode 100644 x/fswap/spec/README.md create mode 100644 x/fswap/testutil/expected_keepers_mocks.go create mode 100644 x/fswap/types/codec.go create mode 100644 x/fswap/types/config.go create mode 100644 x/fswap/types/errors.go create mode 100644 x/fswap/types/event.pb.go create mode 100644 x/fswap/types/fswap.go create mode 100644 x/fswap/types/fswap.pb.go create mode 100644 x/fswap/types/genesis.go create mode 100644 x/fswap/types/genesis.pb.go create mode 100644 x/fswap/types/genesis_test.go create mode 100644 x/fswap/types/keys.go create mode 100644 x/fswap/types/msgs.go create mode 100644 x/fswap/types/proposal.go create mode 100644 x/fswap/types/query.pb.go create mode 100644 x/fswap/types/query.pb.gw.go create mode 100644 x/fswap/types/tx.pb.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 08c431b9e6..2bfcd7d7fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,12 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased](https://github.com/Finschia/finschia-sdk/compare/v0.48.1...HEAD) ### Features +* (x/fswap) [\#1336](https://github.com/Finschia/finschia-sdk/pull/1336) Initialize fswap module +* (x/fswap) [\#1339](https://github.com/Finschia/finschia-sdk/pull/1339) Implement fswap module's genesis +* (x/fbridge) [\#1340](https://github.com/Finschia/finschia-sdk/pull/1340) Initialize fbridge module +* (x/fbridge) [\#1347](https://github.com/Finschia/finschia-sdk/pull/1347) Implement bridge transfer feature (sending side) +* (x/fbridge) [\#1351](https://github.com/Finschia/finschia-sdk/pull/1351) Map a sequence to block number for every bridge request (sending side) +* (x/fswap) [\#1345](https://github.com/Finschia/finschia-sdk/pull/1345) Implement fswap's basic functionality(MsgSwap, MsgSwapAll, Query, Proposal) ### Improvements * (types) [\#1314](https://github.com/Finschia/finschia-sdk/pull/1314) replace IsEqual with Equal @@ -50,13 +56,13 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/collection) [\#1290](https://github.com/Finschia/finschia-sdk/pull/1290) export x/collection params into genesis (backport #1268) * (x/foundation) [\#1295](https://github.com/Finschia/finschia-sdk/pull/1295) add missing error handling for migration * (sec) [\#1302](https://github.com/Finschia/finschia-sdk/pull/1302) remove map iteration non-determinism with keys + sorting -* (client) [\#1303](https://github.com/Finschia/finschia-sdk/pull/1303) fix possible overflow in BuildUnsignedTx +* (client) [\#1303](https://github.com/Finschia/finschia-sdk/pull/1303) fix possible overflow in BuildUnsignedTx * (types) [\#1299](https://github.com/Finschia/finschia-sdk/pull/1299) add missing nil checks * (x/staking) [\#1301](https://github.com/Finschia/finschia-sdk/pull/1301) Use bytes instead of string comparison in delete validator queue (backport cosmos/cosmos-sdk#12303) * (client/keys) [#1312](https://github.com/Finschia/finschia-sdk/pull/1312) ignore error when key not found in `keys delete` * (store) [\#1310](https://github.com/Finschia/finschia-sdk/pull/1310) fix app-hash mismatch if upgrade migration commit is interrupted(backport cosmos/cosmos-sdk#13530) * (types) [\#1313](https://github.com/Finschia/finschia-sdk/pull/1313) fix correctly coalesce coins even with repeated denominations(backport cosmos/cosmos-sdk#13265) -* (x/crypto) [\#1316](https://github.com/Finschia/finschia-sdk/pull/1316) error if incorrect ledger public key (backport cosmos/cosmos-sdk#14460, cosmos/cosmos-sdk#19691) +* (x/crypto) [\#1316](https://github.com/Finschia/finschia-sdk/pull/1316) error if incorrect ledger public key (backport cosmos/cosmos-sdk#14460, cosmos/cosmos-sdk#19691) * (x/auth) [#1319](https://github.com/Finschia/finschia-sdk/pull/1319) prevent signing from wrong key in multisig * (x/mint, x/slashing) [\#1323](https://github.com/Finschia/finschia-sdk/pull/1323) add missing nil check for params validation * (x/server) [\#1337](https://github.com/Finschia/finschia-sdk/pull/1337) fix panic when defining minimum gas config as `100stake;100uatom`. Use a `,` delimiter instead of `;`. Fixes the server config getter to use the correct delimiter (backport cosmos/cosmos-sdk#18537) diff --git a/Makefile b/Makefile index e8a87b95c2..5eb0153b3d 100644 --- a/Makefile +++ b/Makefile @@ -146,6 +146,8 @@ mocks: $(MOCKS_DIR) mockgen -package mocks -destination tests/mocks/grpc_server.go github.com/gogo/protobuf/grpc Server mockgen -package mocks -destination tests/mocks/tendermint_tendermint_libs_log_DB.go github.com/Finschia/ostracon/libs/log Logger mockgen -source=x/stakingplus/expected_keepers.go -package testutil -destination x/stakingplus/testutil/expected_keepers_mocks.go + mockgen -source=x/fswap/types/expected_keepers.go -package testutil -destination x/fswap/testutil/expected_keepers_mocks.go + mockgen -source=x/fbridge/types/expected_keepers.go -package testutil -destination x/fbridge/testutil/expected_keepers_mocks.go .PHONY: mocks $(MOCKS_DIR): diff --git a/client/docs/config.json b/client/docs/config.json index 725ebb71b3..5f216e3efe 100644 --- a/client/docs/config.json +++ b/client/docs/config.json @@ -190,6 +190,20 @@ "GetBlockWithTxs": "GetBlockWithTxs2" } } + }, + { + "url": "./tmp-swagger-gen/lbm/fbridge/v1/query.swagger.json", + "operationIds": { + "rename": { + "Params": "FBridgeParams", + "Commitments": "FBridgeCommitments", + "Guardians": "FBridgeGuardians", + "Operators": "FBridgeOperators", + "Judges": "FBridgeJudges", + "Proposals": "FBridgeProposals", + "Proposal": "FBridgeProposal" + } + } } ] } diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 6456b10c22..244844700d 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -777,6 +777,89 @@ - [Msg](#lbm.collection.v1.Msg) +- [lbm/fbridge/v1/event.proto](#lbm/fbridge/v1/event.proto) + - [EventClaim](#lbm.fbridge.v1.EventClaim) + - [EventConfirmProvision](#lbm.fbridge.v1.EventConfirmProvision) + - [EventProvision](#lbm.fbridge.v1.EventProvision) + - [EventTransfer](#lbm.fbridge.v1.EventTransfer) + +- [lbm/fbridge/v1/fbridge.proto](#lbm/fbridge/v1/fbridge.proto) + - [Fraction](#lbm.fbridge.v1.Fraction) + - [Params](#lbm.fbridge.v1.Params) + - [ProvisionData](#lbm.fbridge.v1.ProvisionData) + - [ProvisionStatus](#lbm.fbridge.v1.ProvisionStatus) + - [RoleProposal](#lbm.fbridge.v1.RoleProposal) + + - [Role](#lbm.fbridge.v1.Role) + +- [lbm/fbridge/v1/genesis.proto](#lbm/fbridge/v1/genesis.proto) + - [BlockSeqInfo](#lbm.fbridge.v1.BlockSeqInfo) + - [Commitment](#lbm.fbridge.v1.Commitment) + - [ConfirmedProvision](#lbm.fbridge.v1.ConfirmedProvision) + - [GenesisState](#lbm.fbridge.v1.GenesisState) + - [OperatorSeqInfo](#lbm.fbridge.v1.OperatorSeqInfo) + - [Provision](#lbm.fbridge.v1.Provision) + - [ReceivingState](#lbm.fbridge.v1.ReceivingState) + - [SendingState](#lbm.fbridge.v1.SendingState) + +- [lbm/fbridge/v1/query.proto](#lbm/fbridge/v1/query.proto) + - [QueryCommitmentsRequest](#lbm.fbridge.v1.QueryCommitmentsRequest) + - [QueryCommitmentsResponse](#lbm.fbridge.v1.QueryCommitmentsResponse) + - [QueryConfirmedProvisionRequest](#lbm.fbridge.v1.QueryConfirmedProvisionRequest) + - [QueryConfirmedProvisionResponse](#lbm.fbridge.v1.QueryConfirmedProvisionResponse) + - [QueryGreatestConsecutiveConfirmedSeqRequest](#lbm.fbridge.v1.QueryGreatestConsecutiveConfirmedSeqRequest) + - [QueryGreatestConsecutiveConfirmedSeqResponse](#lbm.fbridge.v1.QueryGreatestConsecutiveConfirmedSeqResponse) + - [QueryGreatestSeqByOperatorRequest](#lbm.fbridge.v1.QueryGreatestSeqByOperatorRequest) + - [QueryGreatestSeqByOperatorResponse](#lbm.fbridge.v1.QueryGreatestSeqByOperatorResponse) + - [QueryGuardiansRequest](#lbm.fbridge.v1.QueryGuardiansRequest) + - [QueryGuardiansResponse](#lbm.fbridge.v1.QueryGuardiansResponse) + - [QueryJudgesRequest](#lbm.fbridge.v1.QueryJudgesRequest) + - [QueryJudgesResponse](#lbm.fbridge.v1.QueryJudgesResponse) + - [QueryNeededSubmissionSeqsRequest](#lbm.fbridge.v1.QueryNeededSubmissionSeqsRequest) + - [QueryNeededSubmissionSeqsResponse](#lbm.fbridge.v1.QueryNeededSubmissionSeqsResponse) + - [QueryNextSeqSendRequest](#lbm.fbridge.v1.QueryNextSeqSendRequest) + - [QueryNextSeqSendResponse](#lbm.fbridge.v1.QueryNextSeqSendResponse) + - [QueryOperatorsRequest](#lbm.fbridge.v1.QueryOperatorsRequest) + - [QueryOperatorsResponse](#lbm.fbridge.v1.QueryOperatorsResponse) + - [QueryParamsRequest](#lbm.fbridge.v1.QueryParamsRequest) + - [QueryParamsResponse](#lbm.fbridge.v1.QueryParamsResponse) + - [QueryProposalRequest](#lbm.fbridge.v1.QueryProposalRequest) + - [QueryProposalResponse](#lbm.fbridge.v1.QueryProposalResponse) + - [QueryProposalsRequest](#lbm.fbridge.v1.QueryProposalsRequest) + - [QueryProposalsResponse](#lbm.fbridge.v1.QueryProposalsResponse) + - [QuerySeqToBlocknumsRequest](#lbm.fbridge.v1.QuerySeqToBlocknumsRequest) + - [QuerySeqToBlocknumsResponse](#lbm.fbridge.v1.QuerySeqToBlocknumsResponse) + - [QuerySubmittedProvisionRequest](#lbm.fbridge.v1.QuerySubmittedProvisionRequest) + - [QuerySubmittedProvisionResponse](#lbm.fbridge.v1.QuerySubmittedProvisionResponse) + + - [Query](#lbm.fbridge.v1.Query) + +- [lbm/fbridge/v1/tx.proto](#lbm/fbridge/v1/tx.proto) + - [MsgAddVoteForRole](#lbm.fbridge.v1.MsgAddVoteForRole) + - [MsgAddVoteForRoleResponse](#lbm.fbridge.v1.MsgAddVoteForRoleResponse) + - [MsgClaim](#lbm.fbridge.v1.MsgClaim) + - [MsgClaimBatch](#lbm.fbridge.v1.MsgClaimBatch) + - [MsgClaimBatchResponse](#lbm.fbridge.v1.MsgClaimBatchResponse) + - [MsgClaimResponse](#lbm.fbridge.v1.MsgClaimResponse) + - [MsgHalt](#lbm.fbridge.v1.MsgHalt) + - [MsgHaltResponse](#lbm.fbridge.v1.MsgHaltResponse) + - [MsgHoldTransfer](#lbm.fbridge.v1.MsgHoldTransfer) + - [MsgHoldTransferResponse](#lbm.fbridge.v1.MsgHoldTransferResponse) + - [MsgProvision](#lbm.fbridge.v1.MsgProvision) + - [MsgProvisionResponse](#lbm.fbridge.v1.MsgProvisionResponse) + - [MsgReleaseTransfer](#lbm.fbridge.v1.MsgReleaseTransfer) + - [MsgReleaseTransferResponse](#lbm.fbridge.v1.MsgReleaseTransferResponse) + - [MsgRemoveProvision](#lbm.fbridge.v1.MsgRemoveProvision) + - [MsgRemoveProvisionResponse](#lbm.fbridge.v1.MsgRemoveProvisionResponse) + - [MsgResume](#lbm.fbridge.v1.MsgResume) + - [MsgResumeResponse](#lbm.fbridge.v1.MsgResumeResponse) + - [MsgSuggestRole](#lbm.fbridge.v1.MsgSuggestRole) + - [MsgSuggestRoleResponse](#lbm.fbridge.v1.MsgSuggestRoleResponse) + - [MsgTransfer](#lbm.fbridge.v1.MsgTransfer) + - [MsgTransferResponse](#lbm.fbridge.v1.MsgTransferResponse) + + - [Msg](#lbm.fbridge.v1.Msg) + - [lbm/foundation/v1/authz.proto](#lbm/foundation/v1/authz.proto) - [ReceiveFromTreasuryAuthorization](#lbm.foundation.v1.ReceiveFromTreasuryAuthorization) @@ -879,6 +962,36 @@ - [Msg](#lbm.foundation.v1.Msg) +- [lbm/fswap/v1/event.proto](#lbm/fswap/v1/event.proto) + - [EventSwapCoins](#lbm.fswap.v1.EventSwapCoins) + +- [lbm/fswap/v1/fswap.proto](#lbm/fswap/v1/fswap.proto) + - [MakeSwapProposal](#lbm.fswap.v1.MakeSwapProposal) + - [Swap](#lbm.fswap.v1.Swap) + - [SwapStats](#lbm.fswap.v1.SwapStats) + - [Swapped](#lbm.fswap.v1.Swapped) + +- [lbm/fswap/v1/genesis.proto](#lbm/fswap/v1/genesis.proto) + - [GenesisState](#lbm.fswap.v1.GenesisState) + +- [lbm/fswap/v1/query.proto](#lbm/fswap/v1/query.proto) + - [QuerySwappedRequest](#lbm.fswap.v1.QuerySwappedRequest) + - [QuerySwappedResponse](#lbm.fswap.v1.QuerySwappedResponse) + - [QuerySwapsRequest](#lbm.fswap.v1.QuerySwapsRequest) + - [QuerySwapsResponse](#lbm.fswap.v1.QuerySwapsResponse) + - [QueryTotalSwappableToCoinAmountRequest](#lbm.fswap.v1.QueryTotalSwappableToCoinAmountRequest) + - [QueryTotalSwappableToCoinAmountResponse](#lbm.fswap.v1.QueryTotalSwappableToCoinAmountResponse) + + - [Query](#lbm.fswap.v1.Query) + +- [lbm/fswap/v1/tx.proto](#lbm/fswap/v1/tx.proto) + - [MsgSwap](#lbm.fswap.v1.MsgSwap) + - [MsgSwapAll](#lbm.fswap.v1.MsgSwapAll) + - [MsgSwapAllResponse](#lbm.fswap.v1.MsgSwapAllResponse) + - [MsgSwapResponse](#lbm.fswap.v1.MsgSwapResponse) + + - [Msg](#lbm.fswap.v1.Msg) + - [lbm/stakingplus/v1/authz.proto](#lbm/stakingplus/v1/authz.proto) - [CreateValidatorAuthorization](#lbm.stakingplus.v1.CreateValidatorAuthorization) @@ -11633,354 +11746,356 @@ Msg defines the collection Msg service. - +

Top

-## lbm/foundation/v1/authz.proto +## lbm/fbridge/v1/event.proto - + + +### EventClaim + -### ReceiveFromTreasuryAuthorization -ReceiveFromTreasuryAuthorization allows the grantee to receive coins -up to receive_limit from the treasury. +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | +| `sender` | [string](#string) | | the sender address on the source chain | +| `receiver` | [string](#string) | | the recipient address on the destination chain | +| `amount` | [string](#string) | | the amount of token to be claimed | - - - + - +### EventConfirmProvision - -

Top

+| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | -## lbm/foundation/v1/foundation.proto - -### Censorship + + + +### EventProvision | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `msg_type_url` | [string](#string) | | | -| `authority` | [CensorshipAuthority](#lbm.foundation.v1.CensorshipAuthority) | | | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | +| `sender` | [string](#string) | | the sender address on the source chain | +| `receiver` | [string](#string) | | the recipient address on the destination chain | +| `amount` | [string](#string) | | the amount of token to be claimed | +| `operator` | [string](#string) | | the address of the operator | - + + +### EventTransfer -### DecisionPolicyWindows -DecisionPolicyWindows defines the different windows for voting and execution. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `voting_period` | [google.protobuf.Duration](#google.protobuf.Duration) | | voting_period is the duration from submission of a proposal to the end of voting period Within this times votes can be submitted with MsgVote. | -| `min_execution_period` | [google.protobuf.Duration](#google.protobuf.Duration) | | min_execution_period is the minimum duration after the proposal submission where members can start sending MsgExec. This means that the window for sending a MsgExec transaction is: `[ submission + min_execution_period ; submission + voting_period + max_execution_period]` where max_execution_period is a app-specific config, defined in the keeper. If not set, min_execution_period will default to 0. +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | +| `sender` | [string](#string) | | the sender address on the source chain | +| `receiver` | [string](#string) | | the recipient address on the destination chain | +| `amount` | [string](#string) | | the amount of token to be transferred | -Please make sure to set a `min_execution_period` that is smaller than `voting_period + max_execution_period`, or else the above execution window is empty, meaning that all proposals created with this decision policy won't be able to be executed. | + + - + + + -### FoundationExecProposal -FoundationExecProposal is x/gov proposal to trigger the x/foundation messages on behalf of x/gov. + + + +

Top

+ +## lbm/fbridge/v1/fbridge.proto + + + + + +### Fraction +Fraction defines the protobuf message type for tmmath.Fraction that only +supports positive values. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `title` | [string](#string) | | | -| `description` | [string](#string) | | | -| `messages` | [google.protobuf.Any](#google.protobuf.Any) | repeated | x/foundation messages to execute all the signers must be x/gov authority. | +| `numerator` | [uint64](#uint64) | | | +| `denominator` | [uint64](#uint64) | | | - + + +### Params -### FoundationInfo -FoundationInfo represents the high-level on-chain information for the foundation. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `version` | [uint64](#uint64) | | version is used to track changes to the foundation's membership structure that would break existing proposals. Whenever any member is added or removed, this version is incremented and will cause proposals based on older versions of the foundation to fail | -| `total_weight` | [string](#string) | | total_weight is the number of the foundation members. | -| `decision_policy` | [google.protobuf.Any](#google.protobuf.Any) | | decision_policy specifies the foundation's decision policy. | +| `operator_trust_level` | [Fraction](#lbm.fbridge.v1.Fraction) | | ratio of how many operators' confirmations are needed to be valid. | +| `guardian_trust_level` | [Fraction](#lbm.fbridge.v1.Fraction) | | ratio of how many guardians' confirmations are needed to be valid. | +| `judge_trust_level` | [Fraction](#lbm.fbridge.v1.Fraction) | | ratio of how many judges' confirmations are needed to be valid. | +| `timelock_period` | [uint64](#uint64) | | default timelock period for each provision (unix timestamp) | +| `proposal_period` | [uint64](#uint64) | | default period of the proposal to update the role | - + -### Member -Member represents a foundation member with an account address and metadata. +### ProvisionData +Provision is a struct that represents a provision internally. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | address is the member's account address. | -| `metadata` | [string](#string) | | metadata is any arbitrary metadata to attached to the member. | -| `added_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | added_at is a timestamp specifying when a member was added. | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | +| `amount` | [string](#string) | | the amount of token to be claimed | +| `sender` | [string](#string) | | the sender address on the source chain | +| `receiver` | [string](#string) | | the recipient address on the destination chain | - + -### MemberRequest -MemberRequest represents a foundation member to be used in Msg server requests. -Contrary to `Member`, it doesn't have any `added_at` field -since this field cannot be set as part of requests. +### ProvisionStatus +ProvisionStatus is a struct that represents the status of a provision. +To optimize computational cost, we have collected frequently changing values from provision. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | address is the member's account address. | -| `remove` | [bool](#bool) | | remove is the flag which allows one to remove the member by setting the flag to true. | -| `metadata` | [string](#string) | | metadata is any arbitrary metadata attached to the member. | +| `timelock_end` | [uint64](#uint64) | | the unix timestamp the provision will be able to be claimed (unix timestamp) | +| `confirm_counts` | [int32](#int32) | | a value that tells how many operators have submitted this provision | +| `is_claimed` | [bool](#bool) | | whether the provision has been claimed | - + + +### RoleProposal -### OutsourcingDecisionPolicy -OutsourcingDecisionPolicy is a dummy decision policy which is set after -the proposal feature has been outsourced to x/group. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `description` | [string](#string) | | | +| `id` | [uint64](#uint64) | | | +| `proposer` | [string](#string) | | the proposer address | +| `target` | [string](#string) | | the address to update the role | +| `role` | [Role](#lbm.fbridge.v1.Role) | | the role to be updated - unspecified : 0, used to remove the address from a group - guardian : 1 - operator : 2 - judge : 3 | +| `expired_at` | [uint64](#uint64) | | the unix timestamp the proposal will be expired (unix timestamp) | + - -### Params -Params defines the parameters for the foundation module. + +### Role +Role defines the role of the operator, guardian, and judge. -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `foundation_tax` | [string](#string) | | | +| Name | Number | Description | +| ---- | ------ | ----------- | +| UNSPECIFIED | 0 | | +| GUARDIAN | 1 | | +| OPERATOR | 2 | | +| JUDGE | 3 | | + + + - -### PercentageDecisionPolicy -PercentageDecisionPolicy is a decision policy where a proposal passes when -it satisfies the two following conditions: -1. The percentage of all `YES` voters' weights out of the total group weight - is greater or equal than the given `percentage`. -2. The voting and execution periods of the proposal respect the parameters - given by `windows`. + +

Top

+ +## lbm/fbridge/v1/genesis.proto + + + + + +### BlockSeqInfo + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `percentage` | [string](#string) | | percentage is the minimum percentage the sum of yes votes must meet for a proposal to succeed. | -| `windows` | [DecisionPolicyWindows](#lbm.foundation.v1.DecisionPolicyWindows) | | windows defines the different windows for voting and execution. | +| `seq` | [uint64](#uint64) | | | +| `blocknum` | [uint64](#uint64) | | | - + + +### Commitment -### Pool -Pool is used for tracking treasury. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `treasury` | [cosmos.base.v1beta1.DecCoin](#cosmos.base.v1beta1.DecCoin) | repeated | | +| `operator` | [string](#string) | | the operator address | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | +| `commitment` | [string](#string) | | commitment is the hash value of a provision | - + + +### ConfirmedProvision -### Proposal -Proposal defines a foundation proposal. Any member of the foundation can submit a proposal -for a group policy to decide upon. -A proposal consists of a set of `sdk.Msg`s that will be executed if the proposal -passes as well as some optional metadata associated with the proposal. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `id` | [uint64](#uint64) | | id is the unique id of the proposal. | -| `metadata` | [string](#string) | | metadata is any arbitrary metadata to attached to the proposal. | -| `proposers` | [string](#string) | repeated | proposers are the account addresses of the proposers. | -| `submit_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | submit_time is a timestamp specifying when a proposal was submitted. | -| `foundation_version` | [uint64](#uint64) | | foundation_version tracks the version of the foundation that this proposal corresponds to. When foundation info is changed, existing proposals from previous foundation versions will become invalid. | -| `status` | [ProposalStatus](#lbm.foundation.v1.ProposalStatus) | | status represents the high level position in the life cycle of the proposal. Initial value is Submitted. | -| `final_tally_result` | [TallyResult](#lbm.foundation.v1.TallyResult) | | final_tally_result contains the sums of all votes for this proposal for each vote option, after tallying. When querying a proposal via gRPC, this field is not populated until the proposal's voting period has ended. | -| `voting_period_end` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | voting_period_end is the timestamp before which voting must be done. Unless a successfull MsgExec is called before (to execute a proposal whose tally is successful before the voting period ends), tallying will be done at this point, and the `final_tally_result`, as well as `status` and `result` fields will be accordingly updated. | -| `executor_result` | [ProposalExecutorResult](#lbm.foundation.v1.ProposalExecutorResult) | | executor_result is the final result based on the votes and election rule. Initial value is NotRun. | -| `messages` | [google.protobuf.Any](#google.protobuf.Any) | repeated | messages is a list of Msgs that will be executed if the proposal passes. | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | +| `commitment` | [string](#string) | | commitment is the hash value of a provision | - + -### TallyResult -TallyResult represents the sum of votes for each vote option. +### GenesisState +GenesisState defines the fbridge module's genesis state. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `yes_count` | [string](#string) | | yes_count is the sum of yes votes. | -| `abstain_count` | [string](#string) | | abstain_count is the sum of abstainers. | -| `no_count` | [string](#string) | | no is the sum of no votes. | -| `no_with_veto_count` | [string](#string) | | no_with_veto_count is the sum of veto. | +| `params` | [Params](#lbm.fbridge.v1.Params) | | params defines all the parameters of the module. | +| `sending_state` | [SendingState](#lbm.fbridge.v1.SendingState) | | sending_state defines status saved when sending tokens to a counterpart chain | +| `receiving_state` | [ReceivingState](#lbm.fbridge.v1.ReceivingState) | | receiving_state defines status saved when receiving tokens from a counterpart chain | - + + +### OperatorSeqInfo -### ThresholdDecisionPolicy -ThresholdDecisionPolicy is a decision policy where a proposal passes when it -satisfies the two following conditions: -1. The sum of all `YES` voters' weights is greater or equal than the defined - `threshold`. -2. The voting and execution periods of the proposal respect the parameters - given by `windows`. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `threshold` | [string](#string) | | threshold is the minimum sum of yes votes that must be met or exceeded for a proposal to succeed. | -| `windows` | [DecisionPolicyWindows](#lbm.foundation.v1.DecisionPolicyWindows) | | windows defines the different windows for voting and execution. | +| `operator` | [string](#string) | | the operator address | +| `seq` | [uint64](#uint64) | | the sequence number | - + + +### Provision -### Vote -Vote represents a vote for a proposal. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `proposal_id` | [uint64](#uint64) | | proposal is the unique ID of the proposal. | -| `voter` | [string](#string) | | voter is the account address of the voter. | -| `option` | [VoteOption](#lbm.foundation.v1.VoteOption) | | option is the voter's choice on the proposal. | -| `metadata` | [string](#string) | | metadata is any arbitrary metadata to attached to the vote. | -| `submit_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | submit_time is the timestamp when the vote was submitted. | +| `commitment` | [string](#string) | | | +| `data` | [ProvisionData](#lbm.fbridge.v1.ProvisionData) | | | +| `status` | [ProvisionStatus](#lbm.fbridge.v1.ProvisionStatus) | | | - - - + -### CensorshipAuthority +### ReceivingState -| Name | Number | Description | -| ---- | ------ | ----------- | -| CENSORSHIP_AUTHORITY_UNSPECIFIED | 0 | CENSORSHIP_AUTHORITY_UNSPECIFIED defines an invalid authority. | -| CENSORSHIP_AUTHORITY_GOVERNANCE | 1 | CENSORSHIP_AUTHORITY_GOVERNANCE defines x/gov authority. | -| CENSORSHIP_AUTHORITY_FOUNDATION | 2 | CENSORSHIP_AUTHORITY_FOUNDATION defines x/foundation authority. | +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `greatest_consecutive_seq_by_operator` | [OperatorSeqInfo](#lbm.fbridge.v1.OperatorSeqInfo) | repeated | the greatest consecutive sequence number confirmed by each operator | +| `greatest_seq_by_operator` | [OperatorSeqInfo](#lbm.fbridge.v1.OperatorSeqInfo) | repeated | the greatest sequence number confirmed by each operator | +| `greatest_consecutive_seq` | [uint64](#uint64) | | the greatest consecutive sequence numbers confirmed by n-of-m operators consecutiveness is judged starting from the number closest to 0. | +| `pending_claim_seqs` | [uint64](#uint64) | repeated | the set of sequence numbers to be claimed | +| `commitments` | [Commitment](#lbm.fbridge.v1.Commitment) | repeated | commitment is the hash value of a specific provision. | +| `provisions` | [Provision](#lbm.fbridge.v1.Provision) | repeated | provision associated with a specific commitment. | +| `confirmed_seq_to_commitment` | [ConfirmedProvision](#lbm.fbridge.v1.ConfirmedProvision) | repeated | map the sequence number confirmed by n-of-m operators with commitment | - -### ProposalExecutorResult -ProposalExecutorResult defines types of proposal executor results. -| Name | Number | Description | -| ---- | ------ | ----------- | -| PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED | 0 | An empty value is not allowed. | -| PROPOSAL_EXECUTOR_RESULT_NOT_RUN | 1 | We have not yet run the executor. | -| PROPOSAL_EXECUTOR_RESULT_SUCCESS | 2 | The executor was successful and proposed action updated state. | -| PROPOSAL_EXECUTOR_RESULT_FAILURE | 3 | The executor returned an error and proposed action didn't update state. | + - +### SendingState -### ProposalStatus -ProposalStatus defines proposal statuses. -| Name | Number | Description | -| ---- | ------ | ----------- | -| PROPOSAL_STATUS_UNSPECIFIED | 0 | An empty value is invalid and not allowed. | -| PROPOSAL_STATUS_SUBMITTED | 1 | Initial status of a proposal when submitted. | -| PROPOSAL_STATUS_ACCEPTED | 2 | Final status of a proposal when the final tally is done and the outcome passes the foundation's decision policy. | -| PROPOSAL_STATUS_REJECTED | 3 | Final status of a proposal when the final tally is done and the outcome is rejected by the foundation's decision policy. | -| PROPOSAL_STATUS_ABORTED | 4 | Final status of a proposal when the decision policy is modified before the final tally. | -| PROPOSAL_STATUS_WITHDRAWN | 5 | A proposal can be withdrawn before the voting start time by the owner. When this happens the final status is Withdrawn. | +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `next_seq` | [uint64](#uint64) | | the next sequence number of the bridge request (greatest sequence number + 1) | +| `seq_to_blocknum` | [BlockSeqInfo](#lbm.fbridge.v1.BlockSeqInfo) | repeated | sequence-per-block number mapping | - -### VoteOption -VoteOption enumerates the valid vote options for a given proposal. -| Name | Number | Description | -| ---- | ------ | ----------- | -| VOTE_OPTION_UNSPECIFIED | 0 | VOTE_OPTION_UNSPECIFIED defines a no-op vote option. | -| VOTE_OPTION_YES | 1 | VOTE_OPTION_YES defines a yes vote option. | -| VOTE_OPTION_ABSTAIN | 2 | VOTE_OPTION_ABSTAIN defines an abstain vote option. | -| VOTE_OPTION_NO | 3 | VOTE_OPTION_NO defines a no vote option. | -| VOTE_OPTION_NO_WITH_VETO | 4 | VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. | + @@ -11990,708 +12105,1824 @@ VoteOption enumerates the valid vote options for a given proposal. - +

Top

-## lbm/foundation/v1/event.proto +## lbm/fbridge/v1/query.proto - + + +### QueryCommitmentsRequest -### EventExec -EventExec is an event emitted when a proposal is executed. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `proposal_id` | [uint64](#uint64) | | proposal_id is the unique ID of the proposal. | -| `result` | [ProposalExecutorResult](#lbm.foundation.v1.ProposalExecutorResult) | | result is the proposal execution result. | -| `logs` | [string](#string) | | logs contains error logs in case the execution result is FAILURE. | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | - + + +### QueryCommitmentsResponse -### EventFundTreasury -EventFundTreasury is an event emitted when one funds the treasury. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `from` | [string](#string) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | +| `commitments` | [string](#string) | repeated | | - + + +### QueryConfirmedProvisionRequest -### EventGrant -EventGrant is emitted on Msg/Grant | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `grantee` | [string](#string) | | the address of the grantee. | -| `authorization` | [google.protobuf.Any](#google.protobuf.Any) | | authorization granted. | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | - + + +### QueryConfirmedProvisionResponse -### EventLeaveFoundation -EventLeaveFoundation is an event emitted when a foundation member leaves the foundation. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | address is the account address of the foundation member. | +| `data` | [ProvisionData](#lbm.fbridge.v1.ProvisionData) | | | +| `status` | [ProvisionStatus](#lbm.fbridge.v1.ProvisionStatus) | | | - + -### EventRevoke -EventRevoke is emitted on Msg/Revoke +### QueryGreatestConsecutiveConfirmedSeqRequest -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `grantee` | [string](#string) | | address of the grantee. | -| `msg_type_url` | [string](#string) | | message type url for which an autorization is revoked. | + - +### QueryGreatestConsecutiveConfirmedSeqResponse -### EventSubmitProposal -EventSubmitProposal is an event emitted when a proposal is created. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `proposal` | [Proposal](#lbm.foundation.v1.Proposal) | | proposal is the unique ID of the proposal. | +| `seq` | [uint64](#uint64) | | | - + + +### QueryGreatestSeqByOperatorRequest -### EventUpdateCensorship -EventUpdateCensorship is emitted when a censorship information updated. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `censorship` | [Censorship](#lbm.foundation.v1.Censorship) | | | +| `operator` | [string](#string) | | the address of the operator | - + + +### QueryGreatestSeqByOperatorResponse -### EventUpdateDecisionPolicy -EventUpdateDecisionPolicy is an event emitted when the decision policy have been updated. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `decision_policy` | [google.protobuf.Any](#google.protobuf.Any) | | | +| `seq` | [uint64](#uint64) | | | - + -### EventUpdateMembers -EventUpdateMembers is an event emitted when the members have been updated. +### QueryGuardiansRequest -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `member_updates` | [MemberRequest](#lbm.foundation.v1.MemberRequest) | repeated | | + - +### QueryGuardiansResponse -### EventVote -EventVote is an event emitted when a voter votes on a proposal. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `vote` | [Vote](#lbm.foundation.v1.Vote) | | | +| `guardians` | [string](#string) | repeated | | - + -### EventWithdrawFromTreasury -EventWithdrawFromTreasury is an event emitted when coins are withdrawn from the treasury. +### QueryJudgesRequest -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `to` | [string](#string) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + - +### QueryJudgesResponse -### EventWithdrawProposal -EventWithdrawProposal is an event emitted when a proposal is withdrawn. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `proposal_id` | [uint64](#uint64) | | proposal_id is the unique ID of the proposal. | +| `judges` | [string](#string) | repeated | | - - + - +### QueryNeededSubmissionSeqsRequest - +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `operator` | [string](#string) | | the address of the operator | +| `range` | [uint64](#uint64) | | range specifies the size of the range to search | - -

Top

-## lbm/foundation/v1/genesis.proto - -### GenesisState -GenesisState defines the foundation module's genesis state. + + +### QueryNeededSubmissionSeqsResponse + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `params` | [Params](#lbm.foundation.v1.Params) | | params defines the module parameters at genesis. | -| `foundation` | [FoundationInfo](#lbm.foundation.v1.FoundationInfo) | | foundation is the foundation info. | -| `members` | [Member](#lbm.foundation.v1.Member) | repeated | members is the list of the foundation members. | -| `previous_proposal_id` | [uint64](#uint64) | | it is used to get the next proposal ID. | -| `proposals` | [Proposal](#lbm.foundation.v1.Proposal) | repeated | proposals is the list of proposals. | -| `votes` | [Vote](#lbm.foundation.v1.Vote) | repeated | votes is the list of votes. | -| `authorizations` | [GrantAuthorization](#lbm.foundation.v1.GrantAuthorization) | repeated | grants | -| `pool` | [Pool](#lbm.foundation.v1.Pool) | | pool | -| `censorships` | [Censorship](#lbm.foundation.v1.Censorship) | repeated | | +| `seqs` | [uint64](#uint64) | repeated | | - + -### GrantAuthorization -GrantAuthorization defines authorization grant to grantee via route. +### QueryNextSeqSendRequest -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `grantee` | [string](#string) | | | -| `authorization` | [google.protobuf.Any](#google.protobuf.Any) | | | - + - +### QueryNextSeqSendResponse - - +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `seq` | [uint64](#uint64) | | | - -

Top

-## lbm/foundation/v1/query.proto - + -### QueryCensorshipsRequest -QueryCensorshipsRequest is the request type for the Query/Censorships RPC method. +### QueryOperatorsRequest -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | + - +### QueryOperatorsResponse -### QueryCensorshipsResponse -QueryCensorshipsResponse is the response type for the Query/Censorships RPC method. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `censorships` | [Censorship](#lbm.foundation.v1.Censorship) | repeated | authorizations is a list of grants granted for grantee. | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | +| `operators` | [string](#string) | repeated | | - + -### QueryFoundationInfoRequest -QueryFoundationInfoRequest is the Query/FoundationInfo request type. +### QueryParamsRequest - -### QueryFoundationInfoResponse -QueryFoundationInfoResponse is the Query/FoundationInfo response type. + + +### QueryParamsResponse + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `info` | [FoundationInfo](#lbm.foundation.v1.FoundationInfo) | | info is the FoundationInfo for the foundation. | +| `params` | [Params](#lbm.fbridge.v1.Params) | | | - + + +### QueryProposalRequest -### QueryGrantsRequest -QueryGrantsRequest is the request type for the Query/Grants RPC method. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `grantee` | [string](#string) | | | -| `msg_type_url` | [string](#string) | | Optional, msg_type_url, when set, will query only grants matching given msg type. | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | +| `proposal_id` | [string](#string) | | the proposal id | - + + +### QueryProposalResponse -### QueryGrantsResponse -QueryGrantsResponse is the response type for the Query/Grants RPC method. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authorizations` | [google.protobuf.Any](#google.protobuf.Any) | repeated | authorizations is a list of grants granted for grantee. | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | +| `proposal` | [RoleProposal](#lbm.fbridge.v1.RoleProposal) | | | - + + +### QueryProposalsRequest -### QueryMemberRequest -QueryMemberRequest is the Query/Member request type. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | - + + +### QueryProposalsResponse -### QueryMemberResponse -QueryMemberResponse is the Query/MemberResponse response type. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `member` | [Member](#lbm.foundation.v1.Member) | | member is the members of the foundation. | +| `proposals` | [RoleProposal](#lbm.fbridge.v1.RoleProposal) | repeated | | - + + +### QuerySeqToBlocknumsRequest -### QueryMembersRequest -QueryMembersRequest is the Query/Members request type. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | +| `seqs` | [uint64](#uint64) | repeated | list of sequence number of the bridge request | - + + +### QuerySeqToBlocknumsResponse -### QueryMembersResponse -QueryMembersResponse is the Query/MembersResponse response type. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `members` | [Member](#lbm.foundation.v1.Member) | repeated | members are the members of the foundation. | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | +| `blocknums` | [uint64](#uint64) | repeated | | - + -### QueryParamsRequest -QueryParamsRequest is the request type for the Query/Params RPC method. +### QuerySubmittedProvisionRequest +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `operator` | [string](#string) | | the address of the operator | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | - -### QueryParamsResponse -QueryParamsResponse is the response type for the Query/Params RPC method. -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `params` | [Params](#lbm.foundation.v1.Params) | | | + +### QuerySubmittedProvisionResponse +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `data` | [ProvisionData](#lbm.fbridge.v1.ProvisionData) | | | +| `status` | [ProvisionStatus](#lbm.fbridge.v1.ProvisionStatus) | | | - -### QueryProposalRequest -QueryProposalRequest is the Query/Proposal request type. -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `proposal_id` | [uint64](#uint64) | | proposal_id is the unique ID of a proposal. | + + + + + +### Query - +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `Params` | [QueryParamsRequest](#lbm.fbridge.v1.QueryParamsRequest) | [QueryParamsResponse](#lbm.fbridge.v1.QueryParamsResponse) | Params queries the parameters of x/fbridge module. | GET|/lbm/fbridge/v1/params| +| `NextSeqSend` | [QueryNextSeqSendRequest](#lbm.fbridge.v1.QueryNextSeqSendRequest) | [QueryNextSeqSendResponse](#lbm.fbridge.v1.QueryNextSeqSendResponse) | NextSeqSend queries the sequence of next bridge request | GET|/lbm/fbridge/v1/sending/nextseq| +| `SeqToBlocknums` | [QuerySeqToBlocknumsRequest](#lbm.fbridge.v1.QuerySeqToBlocknumsRequest) | [QuerySeqToBlocknumsResponse](#lbm.fbridge.v1.QuerySeqToBlocknumsResponse) | BlocknumToSeqs queries a list of block numbers for which each sequence has been confirmed. | GET|/lbm/fbridge/v1/sending/blocknums| +| `GreatestSeqByOperator` | [QueryGreatestSeqByOperatorRequest](#lbm.fbridge.v1.QueryGreatestSeqByOperatorRequest) | [QueryGreatestSeqByOperatorResponse](#lbm.fbridge.v1.QueryGreatestSeqByOperatorResponse) | GreatestSeqByOperator queries a greatest sequence number confirmed by a particular operator | GET|/lbm/fbridge/v1/receiving/operators/{operator}/seq| +| `GreatestConsecutiveConfirmedSeq` | [QueryGreatestConsecutiveConfirmedSeqRequest](#lbm.fbridge.v1.QueryGreatestConsecutiveConfirmedSeqRequest) | [QueryGreatestConsecutiveConfirmedSeqResponse](#lbm.fbridge.v1.QueryGreatestConsecutiveConfirmedSeqResponse) | GreatestConsecutiveConfirmedSeq queries a greatest consecutive sequence number confirmed by n-of-m operators | GET|/lbm/fbridge/v1/receiving/greatest_confirmed_seq| +| `SubmittedProvision` | [QuerySubmittedProvisionRequest](#lbm.fbridge.v1.QuerySubmittedProvisionRequest) | [QuerySubmittedProvisionResponse](#lbm.fbridge.v1.QuerySubmittedProvisionResponse) | SubmittedProvision queries a provision submitted by a particular operator | GET|/lbm/fbridge/v1/receiving/operators/{operator}/provision/{seq}| +| `ConfirmedProvision` | [QueryConfirmedProvisionRequest](#lbm.fbridge.v1.QueryConfirmedProvisionRequest) | [QueryConfirmedProvisionResponse](#lbm.fbridge.v1.QueryConfirmedProvisionResponse) | ConfirmedProvision queries a particular sequence of confirmed provisions | GET|/lbm/fbridge/v1/receiving/provision/{seq}| +| `NeededSubmissionSeqs` | [QueryNeededSubmissionSeqsRequest](#lbm.fbridge.v1.QueryNeededSubmissionSeqsRequest) | [QueryNeededSubmissionSeqsResponse](#lbm.fbridge.v1.QueryNeededSubmissionSeqsResponse) | NeededSubmissionSeqs queries a list of sequence numbers that need to be submitted by a particular operator The search scope is [greatest_consecutive_seq_by_operator, min(greatest_consecutive_seq_by_operator + range, greatest_seq_by_operator)] greatest_consecutive_seq_by_operator can be replaced with greatest_consecutive_seq if the operator is newly added | GET|/lbm/fbridge/v1/receiving/operators/{operator}/needed_submission_seqs| +| `Commitments` | [QueryCommitmentsRequest](#lbm.fbridge.v1.QueryCommitmentsRequest) | [QueryCommitmentsResponse](#lbm.fbridge.v1.QueryCommitmentsResponse) | Commitments queries commitments of a specific sequence number | GET|/lbm/fbridge/v1/receiving/commitments/{seq}| +| `Guardians` | [QueryGuardiansRequest](#lbm.fbridge.v1.QueryGuardiansRequest) | [QueryGuardiansResponse](#lbm.fbridge.v1.QueryGuardiansResponse) | Guardians queries a list of Guardians registered on the bridge | GET|/lbm/fbridge/v1/guardians| +| `Operators` | [QueryOperatorsRequest](#lbm.fbridge.v1.QueryOperatorsRequest) | [QueryOperatorsResponse](#lbm.fbridge.v1.QueryOperatorsResponse) | Operators queries a list of Operators registered on the bridge | GET|/lbm/fbridge/v1/operators| +| `Judges` | [QueryJudgesRequest](#lbm.fbridge.v1.QueryJudgesRequest) | [QueryJudgesResponse](#lbm.fbridge.v1.QueryJudgesResponse) | Judges queries a list of Judges registered on the bridge | GET|/lbm/fbridge/v1/judges| +| `Proposals` | [QueryProposalsRequest](#lbm.fbridge.v1.QueryProposalsRequest) | [QueryProposalsResponse](#lbm.fbridge.v1.QueryProposalsResponse) | Proposals queries a list of SuggestRole Proposals | GET|/lbm/fbridge/v1/role/proposals| +| `Proposal` | [QueryProposalRequest](#lbm.fbridge.v1.QueryProposalRequest) | [QueryProposalResponse](#lbm.fbridge.v1.QueryProposalResponse) | Proposal queries a SuggestRole Proposal | GET|/lbm/fbridge/v1/role/proposals/{proposal_id}| -### QueryProposalResponse -QueryProposalResponse is the Query/Proposal response type. + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `proposal` | [Proposal](#lbm.foundation.v1.Proposal) | | proposal is the proposal info. | + +

Top

+## lbm/fbridge/v1/tx.proto + - +### MsgAddVoteForRole -### QueryProposalsRequest -QueryProposals is the Query/Proposals request type. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | +| `from` | [string](#string) | | the guardian address | +| `proposal_id` | [uint64](#uint64) | | the proposal ID | +| `option` | [bool](#bool) | | the vote option - yes : true - no : false | - - -### QueryProposalsResponse -QueryProposalsResponse is the Query/Proposals response type. + +### MsgAddVoteForRoleResponse -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `proposals` | [Proposal](#lbm.foundation.v1.Proposal) | repeated | proposals are the proposals of the foundation. | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | - + -### QueryTallyResultRequest -QueryTallyResultRequest is the Query/TallyResult request type. +### MsgClaim +MsgClaim is input values required for claiming a provision | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `proposal_id` | [uint64](#uint64) | | proposal_id is the unique id of a proposal. | +| `from` | [string](#string) | | the claimer address | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | - + -### QueryTallyResultResponse -QueryTallyResultResponse is the Query/TallyResult response type. +### MsgClaimBatch +MsgClaimBatch is input values required for claiming multiple claimable provisions | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `tally` | [TallyResult](#lbm.foundation.v1.TallyResult) | | tally defines the requested tally. | +| `from` | [string](#string) | | the claimer address | +| `max_claims` | [uint64](#uint64) | | the maximum number of claims to be made at once | - + -### QueryTreasuryRequest -QueryTreasuryRequest is the request type for the -Query/Treasury RPC method. +### MsgClaimBatchResponse - -### QueryTreasuryResponse -QueryTreasuryResponse is the response type for the -Query/Treasury RPC method. + +### MsgClaimResponse -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `amount` | [cosmos.base.v1beta1.DecCoin](#cosmos.base.v1beta1.DecCoin) | repeated | | - + -### QueryVoteRequest -QueryVote is the Query/Vote request type. +### MsgHalt +MsgHalt is input values required for halting the bridge module | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `proposal_id` | [uint64](#uint64) | | proposal_id is the unique ID of a proposal. | -| `voter` | [string](#string) | | voter is a proposal voter account address. | +| `guardian` | [string](#string) | | the guardian address | - - -### QueryVoteResponse -QueryVoteResponse is the Query/Vote response type. + +### MsgHaltResponse -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `vote` | [Vote](#lbm.foundation.v1.Vote) | | vote is the vote with given proposal_id and voter. | - + -### QueryVotesRequest -QueryVotes is the Query/Votes request type. +### MsgHoldTransfer +MsgHoldTransfer is input values required for holding transfer | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `proposal_id` | [uint64](#uint64) | | proposal_id is the unique ID of a proposal. | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | +| `from` | [string](#string) | | the judge address | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | - + -### QueryVotesResponse -QueryVotesResponse is the Query/Votes response type. +### MsgHoldTransferResponse -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `votes` | [Vote](#lbm.foundation.v1.Vote) | repeated | votes are the list of votes for given proposal_id. | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | - + - +### MsgProvision +MsgProvision is input values required for provisioning - +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `from` | [string](#string) | | the operator address | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | +| `sender` | [string](#string) | | the sender address on the source chain | +| `receiver` | [string](#string) | | the recipient address on the destination chain | +| `amount` | [string](#string) | | the amount of token to be claimed | - -### Query -Query defines the gRPC querier service for foundation module. -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `Params` | [QueryParamsRequest](#lbm.foundation.v1.QueryParamsRequest) | [QueryParamsResponse](#lbm.foundation.v1.QueryParamsResponse) | Params queries the module params. | GET|/lbm/foundation/v1/params| -| `Treasury` | [QueryTreasuryRequest](#lbm.foundation.v1.QueryTreasuryRequest) | [QueryTreasuryResponse](#lbm.foundation.v1.QueryTreasuryResponse) | Treasury queries the foundation treasury. | GET|/lbm/foundation/v1/treasury| -| `FoundationInfo` | [QueryFoundationInfoRequest](#lbm.foundation.v1.QueryFoundationInfoRequest) | [QueryFoundationInfoResponse](#lbm.foundation.v1.QueryFoundationInfoResponse) | FoundationInfo queries foundation info. | GET|/lbm/foundation/v1/foundation_info| -| `Member` | [QueryMemberRequest](#lbm.foundation.v1.QueryMemberRequest) | [QueryMemberResponse](#lbm.foundation.v1.QueryMemberResponse) | Member queries a member of the foundation | GET|/lbm/foundation/v1/foundation_members/{address}| -| `Members` | [QueryMembersRequest](#lbm.foundation.v1.QueryMembersRequest) | [QueryMembersResponse](#lbm.foundation.v1.QueryMembersResponse) | Members queries members of the foundation | GET|/lbm/foundation/v1/foundation_members| -| `Proposal` | [QueryProposalRequest](#lbm.foundation.v1.QueryProposalRequest) | [QueryProposalResponse](#lbm.foundation.v1.QueryProposalResponse) | Proposal queries a proposal based on proposal id. | GET|/lbm/foundation/v1/proposals/{proposal_id}| -| `Proposals` | [QueryProposalsRequest](#lbm.foundation.v1.QueryProposalsRequest) | [QueryProposalsResponse](#lbm.foundation.v1.QueryProposalsResponse) | Proposals queries all proposals. | GET|/lbm/foundation/v1/proposals| -| `Vote` | [QueryVoteRequest](#lbm.foundation.v1.QueryVoteRequest) | [QueryVoteResponse](#lbm.foundation.v1.QueryVoteResponse) | Vote queries a vote by proposal id and voter. | GET|/lbm/foundation/v1/proposals/{proposal_id}/votes/{voter}| -| `Votes` | [QueryVotesRequest](#lbm.foundation.v1.QueryVotesRequest) | [QueryVotesResponse](#lbm.foundation.v1.QueryVotesResponse) | Votes queries a vote by proposal. | GET|/lbm/foundation/v1/proposals/{proposal_id}/votes| -| `TallyResult` | [QueryTallyResultRequest](#lbm.foundation.v1.QueryTallyResultRequest) | [QueryTallyResultResponse](#lbm.foundation.v1.QueryTallyResultResponse) | TallyResult queries the tally of a proposal votes. | GET|/lbm/foundation/v1/proposals/{proposal_id}/tally| -| `Censorships` | [QueryCensorshipsRequest](#lbm.foundation.v1.QueryCensorshipsRequest) | [QueryCensorshipsResponse](#lbm.foundation.v1.QueryCensorshipsResponse) | Censorships queries the censorship informations. | GET|/lbm/foundation/v1/censorships| -| `Grants` | [QueryGrantsRequest](#lbm.foundation.v1.QueryGrantsRequest) | [QueryGrantsResponse](#lbm.foundation.v1.QueryGrantsResponse) | Returns list of authorizations, granted to the grantee. | GET|/lbm/foundation/v1/grants/{grantee}/{msg_type_url}| - + - -

Top

+### MsgProvisionResponse -## lbm/foundation/v1/tx.proto - -### MsgExec -MsgExec is the Msg/Exec request type. + + + + +### MsgReleaseTransfer +MsgReleaseTransfer is input values required for releasing a held transfer by time lock | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `proposal_id` | [uint64](#uint64) | | proposal is the unique ID of the proposal. | -| `signer` | [string](#string) | | signer is the account address used to execute the proposal. | +| `from` | [string](#string) | | the guardian address | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | - + -### MsgExecResponse -MsgExecResponse is the Msg/Exec request type. +### MsgReleaseTransferResponse - -### MsgFundTreasury -MsgFundTreasury is the Msg/FundTreasury request type. + + +### MsgRemoveProvision +MsgRemoveProvision is input values required for removing a specific confirmed provision | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `from` | [string](#string) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | +| `from` | [string](#string) | | the judge address | +| `seq` | [uint64](#uint64) | | the sequence number of the bridge request | - + -### MsgFundTreasuryResponse +### MsgRemoveProvisionResponse + + + + + + + + + +### MsgResume +MsgResume is input values required for resuming the bridge module + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `from` | [string](#string) | | the guardian address | + + + + + + + + +### MsgResumeResponse + + + + + + + + + +### MsgSuggestRole +MsgUpdateRole is input values required for updating the role of an address + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `from` | [string](#string) | | the guardian address | +| `target` | [string](#string) | | the address to update the role | +| `role` | [Role](#lbm.fbridge.v1.Role) | | the role to be updated - unspecified : 0, used to remove the address from a group - guardian : 1 - operator : 2 - judge : 3 | + + + + + + + + +### MsgSuggestRoleResponse + + + + + + + + + +### MsgTransfer +MsgTransfer is input values required for bridge transfer + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `sender` | [string](#string) | | the sender address on the source chain | +| `receiver` | [string](#string) | | the recipient address on the destination chain | +| `amount` | [string](#string) | | the amount of token to be transferred | + + + + + + + + +### MsgTransferResponse + + + + + + + + + + + + + + + +### Msg + + +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `Transfer` | [MsgTransfer](#lbm.fbridge.v1.MsgTransfer) | [MsgTransferResponse](#lbm.fbridge.v1.MsgTransferResponse) | Submit a transfer request to the bridge module. | | +| `Provision` | [MsgProvision](#lbm.fbridge.v1.MsgProvision) | [MsgProvisionResponse](#lbm.fbridge.v1.MsgProvisionResponse) | Submit a provision to the bridge module. | | +| `HoldTransfer` | [MsgHoldTransfer](#lbm.fbridge.v1.MsgHoldTransfer) | [MsgHoldTransferResponse](#lbm.fbridge.v1.MsgHoldTransferResponse) | Set the time lock value from default value to uint64.max for specific confirmed provision. | | +| `ReleaseTransfer` | [MsgReleaseTransfer](#lbm.fbridge.v1.MsgReleaseTransfer) | [MsgReleaseTransferResponse](#lbm.fbridge.v1.MsgReleaseTransferResponse) | Set the time lock value to 0 for specific confirmed provision. | | +| `RemoveProvision` | [MsgRemoveProvision](#lbm.fbridge.v1.MsgRemoveProvision) | [MsgRemoveProvisionResponse](#lbm.fbridge.v1.MsgRemoveProvisionResponse) | Remove a specific confirmed provision (reset for specific sequence number). | | +| `ClaimBatch` | [MsgClaimBatch](#lbm.fbridge.v1.MsgClaimBatch) | [MsgClaimBatchResponse](#lbm.fbridge.v1.MsgClaimBatchResponse) | ClaimBatch processes the claiming of multiple claimable provisions in a single operation | | +| `Claim` | [MsgClaim](#lbm.fbridge.v1.MsgClaim) | [MsgClaimResponse](#lbm.fbridge.v1.MsgClaimResponse) | Claim processes the claiming of a provision with a specific sequence number | | +| `SuggestRole` | [MsgSuggestRole](#lbm.fbridge.v1.MsgSuggestRole) | [MsgSuggestRoleResponse](#lbm.fbridge.v1.MsgSuggestRoleResponse) | SuggestRole suggests updating the role of an address in the bridge module. The role can be one of the following: guardian, operator, judge. The proposal will be passed only with the consent of +2/3 Guardian members. | | +| `AddVoteForRole` | [MsgAddVoteForRole](#lbm.fbridge.v1.MsgAddVoteForRole) | [MsgAddVoteForRoleResponse](#lbm.fbridge.v1.MsgAddVoteForRoleResponse) | AddVoteForRole adds a vote for a role change proposal. | | +| `Halt` | [MsgHalt](#lbm.fbridge.v1.MsgHalt) | [MsgHaltResponse](#lbm.fbridge.v1.MsgHaltResponse) | Halt the bridge module. | | +| `Resume` | [MsgResume](#lbm.fbridge.v1.MsgResume) | [MsgResumeResponse](#lbm.fbridge.v1.MsgResumeResponse) | Resume the bridge module. | | + + + + + + +

Top

+ +## lbm/foundation/v1/authz.proto + + + + + +### ReceiveFromTreasuryAuthorization +ReceiveFromTreasuryAuthorization allows the grantee to receive coins +up to receive_limit from the treasury. + + + + + + + + + + + + + + + + +

Top

+ +## lbm/foundation/v1/foundation.proto + + + + + +### Censorship + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `msg_type_url` | [string](#string) | | | +| `authority` | [CensorshipAuthority](#lbm.foundation.v1.CensorshipAuthority) | | | + + + + + + + + +### DecisionPolicyWindows +DecisionPolicyWindows defines the different windows for voting and execution. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `voting_period` | [google.protobuf.Duration](#google.protobuf.Duration) | | voting_period is the duration from submission of a proposal to the end of voting period Within this times votes can be submitted with MsgVote. | +| `min_execution_period` | [google.protobuf.Duration](#google.protobuf.Duration) | | min_execution_period is the minimum duration after the proposal submission where members can start sending MsgExec. This means that the window for sending a MsgExec transaction is: `[ submission + min_execution_period ; submission + voting_period + max_execution_period]` where max_execution_period is a app-specific config, defined in the keeper. If not set, min_execution_period will default to 0. + +Please make sure to set a `min_execution_period` that is smaller than `voting_period + max_execution_period`, or else the above execution window is empty, meaning that all proposals created with this decision policy won't be able to be executed. | + + + + + + + + +### FoundationExecProposal +FoundationExecProposal is x/gov proposal to trigger the x/foundation messages on behalf of x/gov. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `title` | [string](#string) | | | +| `description` | [string](#string) | | | +| `messages` | [google.protobuf.Any](#google.protobuf.Any) | repeated | x/foundation messages to execute all the signers must be x/gov authority. | + + + + + + + + +### FoundationInfo +FoundationInfo represents the high-level on-chain information for the foundation. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `version` | [uint64](#uint64) | | version is used to track changes to the foundation's membership structure that would break existing proposals. Whenever any member is added or removed, this version is incremented and will cause proposals based on older versions of the foundation to fail | +| `total_weight` | [string](#string) | | total_weight is the number of the foundation members. | +| `decision_policy` | [google.protobuf.Any](#google.protobuf.Any) | | decision_policy specifies the foundation's decision policy. | + + + + + + + + +### Member +Member represents a foundation member with an account address and metadata. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `address` | [string](#string) | | address is the member's account address. | +| `metadata` | [string](#string) | | metadata is any arbitrary metadata to attached to the member. | +| `added_at` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | added_at is a timestamp specifying when a member was added. | + + + + + + + + +### MemberRequest +MemberRequest represents a foundation member to be used in Msg server requests. +Contrary to `Member`, it doesn't have any `added_at` field +since this field cannot be set as part of requests. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `address` | [string](#string) | | address is the member's account address. | +| `remove` | [bool](#bool) | | remove is the flag which allows one to remove the member by setting the flag to true. | +| `metadata` | [string](#string) | | metadata is any arbitrary metadata attached to the member. | + + + + + + + + +### OutsourcingDecisionPolicy +OutsourcingDecisionPolicy is a dummy decision policy which is set after +the proposal feature has been outsourced to x/group. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `description` | [string](#string) | | | + + + + + + + + +### Params +Params defines the parameters for the foundation module. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `foundation_tax` | [string](#string) | | | + + + + + + + + +### PercentageDecisionPolicy +PercentageDecisionPolicy is a decision policy where a proposal passes when +it satisfies the two following conditions: +1. The percentage of all `YES` voters' weights out of the total group weight + is greater or equal than the given `percentage`. +2. The voting and execution periods of the proposal respect the parameters + given by `windows`. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `percentage` | [string](#string) | | percentage is the minimum percentage the sum of yes votes must meet for a proposal to succeed. | +| `windows` | [DecisionPolicyWindows](#lbm.foundation.v1.DecisionPolicyWindows) | | windows defines the different windows for voting and execution. | + + + + + + + + +### Pool +Pool is used for tracking treasury. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `treasury` | [cosmos.base.v1beta1.DecCoin](#cosmos.base.v1beta1.DecCoin) | repeated | | + + + + + + + + +### Proposal +Proposal defines a foundation proposal. Any member of the foundation can submit a proposal +for a group policy to decide upon. +A proposal consists of a set of `sdk.Msg`s that will be executed if the proposal +passes as well as some optional metadata associated with the proposal. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `id` | [uint64](#uint64) | | id is the unique id of the proposal. | +| `metadata` | [string](#string) | | metadata is any arbitrary metadata to attached to the proposal. | +| `proposers` | [string](#string) | repeated | proposers are the account addresses of the proposers. | +| `submit_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | submit_time is a timestamp specifying when a proposal was submitted. | +| `foundation_version` | [uint64](#uint64) | | foundation_version tracks the version of the foundation that this proposal corresponds to. When foundation info is changed, existing proposals from previous foundation versions will become invalid. | +| `status` | [ProposalStatus](#lbm.foundation.v1.ProposalStatus) | | status represents the high level position in the life cycle of the proposal. Initial value is Submitted. | +| `final_tally_result` | [TallyResult](#lbm.foundation.v1.TallyResult) | | final_tally_result contains the sums of all votes for this proposal for each vote option, after tallying. When querying a proposal via gRPC, this field is not populated until the proposal's voting period has ended. | +| `voting_period_end` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | voting_period_end is the timestamp before which voting must be done. Unless a successfull MsgExec is called before (to execute a proposal whose tally is successful before the voting period ends), tallying will be done at this point, and the `final_tally_result`, as well as `status` and `result` fields will be accordingly updated. | +| `executor_result` | [ProposalExecutorResult](#lbm.foundation.v1.ProposalExecutorResult) | | executor_result is the final result based on the votes and election rule. Initial value is NotRun. | +| `messages` | [google.protobuf.Any](#google.protobuf.Any) | repeated | messages is a list of Msgs that will be executed if the proposal passes. | + + + + + + + + +### TallyResult +TallyResult represents the sum of votes for each vote option. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `yes_count` | [string](#string) | | yes_count is the sum of yes votes. | +| `abstain_count` | [string](#string) | | abstain_count is the sum of abstainers. | +| `no_count` | [string](#string) | | no is the sum of no votes. | +| `no_with_veto_count` | [string](#string) | | no_with_veto_count is the sum of veto. | + + + + + + + + +### ThresholdDecisionPolicy +ThresholdDecisionPolicy is a decision policy where a proposal passes when it +satisfies the two following conditions: +1. The sum of all `YES` voters' weights is greater or equal than the defined + `threshold`. +2. The voting and execution periods of the proposal respect the parameters + given by `windows`. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `threshold` | [string](#string) | | threshold is the minimum sum of yes votes that must be met or exceeded for a proposal to succeed. | +| `windows` | [DecisionPolicyWindows](#lbm.foundation.v1.DecisionPolicyWindows) | | windows defines the different windows for voting and execution. | + + + + + + + + +### Vote +Vote represents a vote for a proposal. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal_id` | [uint64](#uint64) | | proposal is the unique ID of the proposal. | +| `voter` | [string](#string) | | voter is the account address of the voter. | +| `option` | [VoteOption](#lbm.foundation.v1.VoteOption) | | option is the voter's choice on the proposal. | +| `metadata` | [string](#string) | | metadata is any arbitrary metadata to attached to the vote. | +| `submit_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | submit_time is the timestamp when the vote was submitted. | + + + + + + + + + + +### CensorshipAuthority + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| CENSORSHIP_AUTHORITY_UNSPECIFIED | 0 | CENSORSHIP_AUTHORITY_UNSPECIFIED defines an invalid authority. | +| CENSORSHIP_AUTHORITY_GOVERNANCE | 1 | CENSORSHIP_AUTHORITY_GOVERNANCE defines x/gov authority. | +| CENSORSHIP_AUTHORITY_FOUNDATION | 2 | CENSORSHIP_AUTHORITY_FOUNDATION defines x/foundation authority. | + + + + + +### ProposalExecutorResult +ProposalExecutorResult defines types of proposal executor results. + +| Name | Number | Description | +| ---- | ------ | ----------- | +| PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED | 0 | An empty value is not allowed. | +| PROPOSAL_EXECUTOR_RESULT_NOT_RUN | 1 | We have not yet run the executor. | +| PROPOSAL_EXECUTOR_RESULT_SUCCESS | 2 | The executor was successful and proposed action updated state. | +| PROPOSAL_EXECUTOR_RESULT_FAILURE | 3 | The executor returned an error and proposed action didn't update state. | + + + + + +### ProposalStatus +ProposalStatus defines proposal statuses. + +| Name | Number | Description | +| ---- | ------ | ----------- | +| PROPOSAL_STATUS_UNSPECIFIED | 0 | An empty value is invalid and not allowed. | +| PROPOSAL_STATUS_SUBMITTED | 1 | Initial status of a proposal when submitted. | +| PROPOSAL_STATUS_ACCEPTED | 2 | Final status of a proposal when the final tally is done and the outcome passes the foundation's decision policy. | +| PROPOSAL_STATUS_REJECTED | 3 | Final status of a proposal when the final tally is done and the outcome is rejected by the foundation's decision policy. | +| PROPOSAL_STATUS_ABORTED | 4 | Final status of a proposal when the decision policy is modified before the final tally. | +| PROPOSAL_STATUS_WITHDRAWN | 5 | A proposal can be withdrawn before the voting start time by the owner. When this happens the final status is Withdrawn. | + + + + + +### VoteOption +VoteOption enumerates the valid vote options for a given proposal. + +| Name | Number | Description | +| ---- | ------ | ----------- | +| VOTE_OPTION_UNSPECIFIED | 0 | VOTE_OPTION_UNSPECIFIED defines a no-op vote option. | +| VOTE_OPTION_YES | 1 | VOTE_OPTION_YES defines a yes vote option. | +| VOTE_OPTION_ABSTAIN | 2 | VOTE_OPTION_ABSTAIN defines an abstain vote option. | +| VOTE_OPTION_NO | 3 | VOTE_OPTION_NO defines a no vote option. | +| VOTE_OPTION_NO_WITH_VETO | 4 | VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. | + + + + + + + + + + + +

Top

+ +## lbm/foundation/v1/event.proto + + + + + +### EventExec +EventExec is an event emitted when a proposal is executed. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal_id` | [uint64](#uint64) | | proposal_id is the unique ID of the proposal. | +| `result` | [ProposalExecutorResult](#lbm.foundation.v1.ProposalExecutorResult) | | result is the proposal execution result. | +| `logs` | [string](#string) | | logs contains error logs in case the execution result is FAILURE. | + + + + + + + + +### EventFundTreasury +EventFundTreasury is an event emitted when one funds the treasury. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `from` | [string](#string) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + + + + + + + +### EventGrant +EventGrant is emitted on Msg/Grant + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `grantee` | [string](#string) | | the address of the grantee. | +| `authorization` | [google.protobuf.Any](#google.protobuf.Any) | | authorization granted. | + + + + + + + + +### EventLeaveFoundation +EventLeaveFoundation is an event emitted when a foundation member leaves the foundation. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `address` | [string](#string) | | address is the account address of the foundation member. | + + + + + + + + +### EventRevoke +EventRevoke is emitted on Msg/Revoke + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `grantee` | [string](#string) | | address of the grantee. | +| `msg_type_url` | [string](#string) | | message type url for which an autorization is revoked. | + + + + + + + + +### EventSubmitProposal +EventSubmitProposal is an event emitted when a proposal is created. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal` | [Proposal](#lbm.foundation.v1.Proposal) | | proposal is the unique ID of the proposal. | + + + + + + + + +### EventUpdateCensorship +EventUpdateCensorship is emitted when a censorship information updated. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `censorship` | [Censorship](#lbm.foundation.v1.Censorship) | | | + + + + + + + + +### EventUpdateDecisionPolicy +EventUpdateDecisionPolicy is an event emitted when the decision policy have been updated. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `decision_policy` | [google.protobuf.Any](#google.protobuf.Any) | | | + + + + + + + + +### EventUpdateMembers +EventUpdateMembers is an event emitted when the members have been updated. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `member_updates` | [MemberRequest](#lbm.foundation.v1.MemberRequest) | repeated | | + + + + + + + + +### EventVote +EventVote is an event emitted when a voter votes on a proposal. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `vote` | [Vote](#lbm.foundation.v1.Vote) | | | + + + + + + + + +### EventWithdrawFromTreasury +EventWithdrawFromTreasury is an event emitted when coins are withdrawn from the treasury. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `to` | [string](#string) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + + + + + + + +### EventWithdrawProposal +EventWithdrawProposal is an event emitted when a proposal is withdrawn. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal_id` | [uint64](#uint64) | | proposal_id is the unique ID of the proposal. | + + + + + + + + + + + + + + + + +

Top

+ +## lbm/foundation/v1/genesis.proto + + + + + +### GenesisState +GenesisState defines the foundation module's genesis state. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `params` | [Params](#lbm.foundation.v1.Params) | | params defines the module parameters at genesis. | +| `foundation` | [FoundationInfo](#lbm.foundation.v1.FoundationInfo) | | foundation is the foundation info. | +| `members` | [Member](#lbm.foundation.v1.Member) | repeated | members is the list of the foundation members. | +| `previous_proposal_id` | [uint64](#uint64) | | it is used to get the next proposal ID. | +| `proposals` | [Proposal](#lbm.foundation.v1.Proposal) | repeated | proposals is the list of proposals. | +| `votes` | [Vote](#lbm.foundation.v1.Vote) | repeated | votes is the list of votes. | +| `authorizations` | [GrantAuthorization](#lbm.foundation.v1.GrantAuthorization) | repeated | grants | +| `pool` | [Pool](#lbm.foundation.v1.Pool) | | pool | +| `censorships` | [Censorship](#lbm.foundation.v1.Censorship) | repeated | | + + + + + + + + +### GrantAuthorization +GrantAuthorization defines authorization grant to grantee via route. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `grantee` | [string](#string) | | | +| `authorization` | [google.protobuf.Any](#google.protobuf.Any) | | | + + + + + + + + + + + + + + + + +

Top

+ +## lbm/foundation/v1/query.proto + + + + + +### QueryCensorshipsRequest +QueryCensorshipsRequest is the request type for the Query/Censorships RPC method. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | + + + + + + + + +### QueryCensorshipsResponse +QueryCensorshipsResponse is the response type for the Query/Censorships RPC method. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `censorships` | [Censorship](#lbm.foundation.v1.Censorship) | repeated | authorizations is a list of grants granted for grantee. | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | + + + + + + + + +### QueryFoundationInfoRequest +QueryFoundationInfoRequest is the Query/FoundationInfo request type. + + + + + + + + +### QueryFoundationInfoResponse +QueryFoundationInfoResponse is the Query/FoundationInfo response type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `info` | [FoundationInfo](#lbm.foundation.v1.FoundationInfo) | | info is the FoundationInfo for the foundation. | + + + + + + + + +### QueryGrantsRequest +QueryGrantsRequest is the request type for the Query/Grants RPC method. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `grantee` | [string](#string) | | | +| `msg_type_url` | [string](#string) | | Optional, msg_type_url, when set, will query only grants matching given msg type. | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | + + + + + + + + +### QueryGrantsResponse +QueryGrantsResponse is the response type for the Query/Grants RPC method. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `authorizations` | [google.protobuf.Any](#google.protobuf.Any) | repeated | authorizations is a list of grants granted for grantee. | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | + + + + + + + + +### QueryMemberRequest +QueryMemberRequest is the Query/Member request type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `address` | [string](#string) | | | + + + + + + + + +### QueryMemberResponse +QueryMemberResponse is the Query/MemberResponse response type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `member` | [Member](#lbm.foundation.v1.Member) | | member is the members of the foundation. | + + + + + + + + +### QueryMembersRequest +QueryMembersRequest is the Query/Members request type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | + + + + + + + + +### QueryMembersResponse +QueryMembersResponse is the Query/MembersResponse response type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `members` | [Member](#lbm.foundation.v1.Member) | repeated | members are the members of the foundation. | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | + + + + + + + + +### QueryParamsRequest +QueryParamsRequest is the request type for the Query/Params RPC method. + + + + + + + + +### QueryParamsResponse +QueryParamsResponse is the response type for the Query/Params RPC method. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `params` | [Params](#lbm.foundation.v1.Params) | | | + + + + + + + + +### QueryProposalRequest +QueryProposalRequest is the Query/Proposal request type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal_id` | [uint64](#uint64) | | proposal_id is the unique ID of a proposal. | + + + + + + + + +### QueryProposalResponse +QueryProposalResponse is the Query/Proposal response type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal` | [Proposal](#lbm.foundation.v1.Proposal) | | proposal is the proposal info. | + + + + + + + + +### QueryProposalsRequest +QueryProposals is the Query/Proposals request type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | + + + + + + + + +### QueryProposalsResponse +QueryProposalsResponse is the Query/Proposals response type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposals` | [Proposal](#lbm.foundation.v1.Proposal) | repeated | proposals are the proposals of the foundation. | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | + + + + + + + + +### QueryTallyResultRequest +QueryTallyResultRequest is the Query/TallyResult request type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal_id` | [uint64](#uint64) | | proposal_id is the unique id of a proposal. | + + + + + + + + +### QueryTallyResultResponse +QueryTallyResultResponse is the Query/TallyResult response type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `tally` | [TallyResult](#lbm.foundation.v1.TallyResult) | | tally defines the requested tally. | + + + + + + + + +### QueryTreasuryRequest +QueryTreasuryRequest is the request type for the +Query/Treasury RPC method. + + + + + + + + +### QueryTreasuryResponse +QueryTreasuryResponse is the response type for the +Query/Treasury RPC method. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `amount` | [cosmos.base.v1beta1.DecCoin](#cosmos.base.v1beta1.DecCoin) | repeated | | + + + + + + + + +### QueryVoteRequest +QueryVote is the Query/Vote request type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal_id` | [uint64](#uint64) | | proposal_id is the unique ID of a proposal. | +| `voter` | [string](#string) | | voter is a proposal voter account address. | + + + + + + + + +### QueryVoteResponse +QueryVoteResponse is the Query/Vote response type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `vote` | [Vote](#lbm.foundation.v1.Vote) | | vote is the vote with given proposal_id and voter. | + + + + + + + + +### QueryVotesRequest +QueryVotes is the Query/Votes request type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal_id` | [uint64](#uint64) | | proposal_id is the unique ID of a proposal. | +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | + + + + + + + + +### QueryVotesResponse +QueryVotesResponse is the Query/Votes response type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `votes` | [Vote](#lbm.foundation.v1.Vote) | repeated | votes are the list of votes for given proposal_id. | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. | + + + + + + + + + + + + + + +### Query +Query defines the gRPC querier service for foundation module. + +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `Params` | [QueryParamsRequest](#lbm.foundation.v1.QueryParamsRequest) | [QueryParamsResponse](#lbm.foundation.v1.QueryParamsResponse) | Params queries the module params. | GET|/lbm/foundation/v1/params| +| `Treasury` | [QueryTreasuryRequest](#lbm.foundation.v1.QueryTreasuryRequest) | [QueryTreasuryResponse](#lbm.foundation.v1.QueryTreasuryResponse) | Treasury queries the foundation treasury. | GET|/lbm/foundation/v1/treasury| +| `FoundationInfo` | [QueryFoundationInfoRequest](#lbm.foundation.v1.QueryFoundationInfoRequest) | [QueryFoundationInfoResponse](#lbm.foundation.v1.QueryFoundationInfoResponse) | FoundationInfo queries foundation info. | GET|/lbm/foundation/v1/foundation_info| +| `Member` | [QueryMemberRequest](#lbm.foundation.v1.QueryMemberRequest) | [QueryMemberResponse](#lbm.foundation.v1.QueryMemberResponse) | Member queries a member of the foundation | GET|/lbm/foundation/v1/foundation_members/{address}| +| `Members` | [QueryMembersRequest](#lbm.foundation.v1.QueryMembersRequest) | [QueryMembersResponse](#lbm.foundation.v1.QueryMembersResponse) | Members queries members of the foundation | GET|/lbm/foundation/v1/foundation_members| +| `Proposal` | [QueryProposalRequest](#lbm.foundation.v1.QueryProposalRequest) | [QueryProposalResponse](#lbm.foundation.v1.QueryProposalResponse) | Proposal queries a proposal based on proposal id. | GET|/lbm/foundation/v1/proposals/{proposal_id}| +| `Proposals` | [QueryProposalsRequest](#lbm.foundation.v1.QueryProposalsRequest) | [QueryProposalsResponse](#lbm.foundation.v1.QueryProposalsResponse) | Proposals queries all proposals. | GET|/lbm/foundation/v1/proposals| +| `Vote` | [QueryVoteRequest](#lbm.foundation.v1.QueryVoteRequest) | [QueryVoteResponse](#lbm.foundation.v1.QueryVoteResponse) | Vote queries a vote by proposal id and voter. | GET|/lbm/foundation/v1/proposals/{proposal_id}/votes/{voter}| +| `Votes` | [QueryVotesRequest](#lbm.foundation.v1.QueryVotesRequest) | [QueryVotesResponse](#lbm.foundation.v1.QueryVotesResponse) | Votes queries a vote by proposal. | GET|/lbm/foundation/v1/proposals/{proposal_id}/votes| +| `TallyResult` | [QueryTallyResultRequest](#lbm.foundation.v1.QueryTallyResultRequest) | [QueryTallyResultResponse](#lbm.foundation.v1.QueryTallyResultResponse) | TallyResult queries the tally of a proposal votes. | GET|/lbm/foundation/v1/proposals/{proposal_id}/tally| +| `Censorships` | [QueryCensorshipsRequest](#lbm.foundation.v1.QueryCensorshipsRequest) | [QueryCensorshipsResponse](#lbm.foundation.v1.QueryCensorshipsResponse) | Censorships queries the censorship informations. | GET|/lbm/foundation/v1/censorships| +| `Grants` | [QueryGrantsRequest](#lbm.foundation.v1.QueryGrantsRequest) | [QueryGrantsResponse](#lbm.foundation.v1.QueryGrantsResponse) | Returns list of authorizations, granted to the grantee. | GET|/lbm/foundation/v1/grants/{grantee}/{msg_type_url}| + + + + + + +

Top

+ +## lbm/foundation/v1/tx.proto + + + + + +### MsgExec +MsgExec is the Msg/Exec request type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal_id` | [uint64](#uint64) | | proposal is the unique ID of the proposal. | +| `signer` | [string](#string) | | signer is the account address used to execute the proposal. | + + + + + + + + +### MsgExecResponse +MsgExecResponse is the Msg/Exec request type. + + + + + + + + +### MsgFundTreasury +MsgFundTreasury is the Msg/FundTreasury request type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `from` | [string](#string) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + + + + + + + +### MsgFundTreasuryResponse MsgFundTreasuryResponse is the Msg/FundTreasury response type. @@ -12699,346 +13930,698 @@ MsgFundTreasuryResponse is the Msg/FundTreasury response type. - + + +### MsgGrant +MsgGrant is the Msg/Grant request type. +on behalf of the foundation. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `authority` | [string](#string) | | authority is the address of the privileged account. | +| `grantee` | [string](#string) | | | +| `authorization` | [google.protobuf.Any](#google.protobuf.Any) | | | + + + + + + + + +### MsgGrantResponse +MsgGrantResponse is the Msg/MsgGrant response type. + + + + + + + + +### MsgLeaveFoundation +MsgLeaveFoundation is the Msg/LeaveFoundation request type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `address` | [string](#string) | | address is the account address of the foundation member. | + + + + + + + + +### MsgLeaveFoundationResponse +MsgLeaveFoundationResponse is the Msg/LeaveFoundation response type. + + + + + + + + +### MsgRevoke +MsgRevoke is the Msg/Revoke request type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `authority` | [string](#string) | | authority is the address of the privileged account. | +| `grantee` | [string](#string) | | | +| `msg_type_url` | [string](#string) | | | + + + + + + + + +### MsgRevokeResponse +MsgRevokeResponse is the Msg/MsgRevokeResponse response type. + + + + + + + + +### MsgSubmitProposal +MsgSubmitProposal is the Msg/SubmitProposal request type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposers` | [string](#string) | repeated | proposers are the account addresses of the proposers. Proposers signatures will be counted as yes votes. | +| `metadata` | [string](#string) | | metadata is any arbitrary metadata to attached to the proposal. | +| `messages` | [google.protobuf.Any](#google.protobuf.Any) | repeated | messages is a list of `sdk.Msg`s that will be executed if the proposal passes. | +| `exec` | [Exec](#lbm.foundation.v1.Exec) | | exec defines the mode of execution of the proposal, whether it should be executed immediately on creation or not. If so, proposers signatures are considered as Yes votes. | + + + + + + + + +### MsgSubmitProposalResponse +MsgSubmitProposalResponse is the Msg/SubmitProposal response type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal_id` | [uint64](#uint64) | | proposal is the unique ID of the proposal. | + + + + + + + + +### MsgUpdateCensorship +MsgUpdateCensorship is the Msg/UpdateCensorship request type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `authority` | [string](#string) | | authority over the target censorship. | +| `censorship` | [Censorship](#lbm.foundation.v1.Censorship) | | new censorship information | + + + + + + + + +### MsgUpdateCensorshipResponse +MsgUpdateCensorshipResponse is the Msg/UpdateCensorship response type. + + + + + + + + +### MsgUpdateDecisionPolicy +MsgUpdateDecisionPolicy is the Msg/UpdateDecisionPolicy request type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `authority` | [string](#string) | | authority is the address of the privileged account. | +| `decision_policy` | [google.protobuf.Any](#google.protobuf.Any) | | decision_policy is the updated decision policy. | + + + + + + + + +### MsgUpdateDecisionPolicyResponse +MsgUpdateDecisionPolicyResponse is the Msg/UpdateDecisionPolicy response type. + + + + + + + + +### MsgUpdateMembers +MsgUpdateMembers is the Msg/UpdateMembers request type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `authority` | [string](#string) | | authority is the address of the privileged account. | +| `member_updates` | [MemberRequest](#lbm.foundation.v1.MemberRequest) | repeated | member_updates is the list of members to update, set remove to true to remove a member. | + + + + + + + + +### MsgUpdateMembersResponse +MsgUpdateMembersResponse is the Msg/UpdateMembers response type. + + + + + + + + +### MsgUpdateParams +MsgUpdateParams is the Msg/UpdateParams request type. +NOTE: This is not for tx + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `authority` | [string](#string) | | authority is the address of the privileged account. | +| `params` | [Params](#lbm.foundation.v1.Params) | | params defines the x/foundation parameters to update. + +NOTE: All parameters must be supplied. | + + + + + + + + +### MsgUpdateParamsResponse +MsgUpdateParamsResponse is the Msg/UpdateParams response type. +NOTE: This is not for tx + + + + + + + + +### MsgVote +MsgVote is the Msg/Vote request type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal_id` | [uint64](#uint64) | | proposal is the unique ID of the proposal. | +| `voter` | [string](#string) | | voter is the voter account address. | +| `option` | [VoteOption](#lbm.foundation.v1.VoteOption) | | option is the voter's choice on the proposal. | +| `metadata` | [string](#string) | | metadata is any arbitrary metadata to attached to the vote. | +| `exec` | [Exec](#lbm.foundation.v1.Exec) | | exec defines whether the proposal should be executed immediately after voting or not. | + + + + + + + + +### MsgVoteResponse +MsgVoteResponse is the Msg/Vote response type. + + + + + + + + +### MsgWithdrawFromTreasury +MsgWithdrawFromTreasury is the Msg/WithdrawFromTreasury request type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `authority` | [string](#string) | | authority is the address of the privileged account. | +| `to` | [string](#string) | | | +| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + + + + + + + +### MsgWithdrawFromTreasuryResponse +MsgWithdrawFromTreasuryResponse is the Msg/WithdrawFromTreasury response type. + + -### MsgGrant -MsgGrant is the Msg/Grant request type. -on behalf of the foundation. + + + + + +### MsgWithdrawProposal +MsgWithdrawProposal is the Msg/WithdrawProposal request type. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | authority is the address of the privileged account. | -| `grantee` | [string](#string) | | | -| `authorization` | [google.protobuf.Any](#google.protobuf.Any) | | | +| `proposal_id` | [uint64](#uint64) | | proposal is the unique ID of the proposal. | +| `address` | [string](#string) | | address of one of the proposer of the proposal. | - + -### MsgGrantResponse -MsgGrantResponse is the Msg/MsgGrant response type. +### MsgWithdrawProposalResponse +MsgWithdrawProposalResponse is the Msg/WithdrawProposal response type. + - -### MsgLeaveFoundation -MsgLeaveFoundation is the Msg/LeaveFoundation request type. + + +### Exec +Exec defines modes of execution of a proposal on creation or on new vote. +| Name | Number | Description | +| ---- | ------ | ----------- | +| EXEC_UNSPECIFIED | 0 | An empty value means that there should be a separate MsgExec request for the proposal to execute. | +| EXEC_TRY | 1 | Try to execute the proposal immediately. If the proposal is not allowed per the DecisionPolicy, the proposal will still be open and could be executed at a later point. | -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | address is the account address of the foundation member. | + + + +### Msg +Msg defines the foundation Msg service. - +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `FundTreasury` | [MsgFundTreasury](#lbm.foundation.v1.MsgFundTreasury) | [MsgFundTreasuryResponse](#lbm.foundation.v1.MsgFundTreasuryResponse) | FundTreasury defines a method to fund the treasury. | | +| `WithdrawFromTreasury` | [MsgWithdrawFromTreasury](#lbm.foundation.v1.MsgWithdrawFromTreasury) | [MsgWithdrawFromTreasuryResponse](#lbm.foundation.v1.MsgWithdrawFromTreasuryResponse) | WithdrawFromTreasury defines a method to withdraw coins from the treasury. | | +| `UpdateMembers` | [MsgUpdateMembers](#lbm.foundation.v1.MsgUpdateMembers) | [MsgUpdateMembersResponse](#lbm.foundation.v1.MsgUpdateMembersResponse) | UpdateMembers updates the foundation members. | | +| `UpdateDecisionPolicy` | [MsgUpdateDecisionPolicy](#lbm.foundation.v1.MsgUpdateDecisionPolicy) | [MsgUpdateDecisionPolicyResponse](#lbm.foundation.v1.MsgUpdateDecisionPolicyResponse) | UpdateDecisionPolicy allows a group policy's decision policy to be updated. | | +| `SubmitProposal` | [MsgSubmitProposal](#lbm.foundation.v1.MsgSubmitProposal) | [MsgSubmitProposalResponse](#lbm.foundation.v1.MsgSubmitProposalResponse) | SubmitProposal submits a new proposal. | | +| `WithdrawProposal` | [MsgWithdrawProposal](#lbm.foundation.v1.MsgWithdrawProposal) | [MsgWithdrawProposalResponse](#lbm.foundation.v1.MsgWithdrawProposalResponse) | WithdrawProposal aborts a proposal. | | +| `Vote` | [MsgVote](#lbm.foundation.v1.MsgVote) | [MsgVoteResponse](#lbm.foundation.v1.MsgVoteResponse) | Vote allows a voter to vote on a proposal. | | +| `Exec` | [MsgExec](#lbm.foundation.v1.MsgExec) | [MsgExecResponse](#lbm.foundation.v1.MsgExecResponse) | Exec executes a proposal. | | +| `LeaveFoundation` | [MsgLeaveFoundation](#lbm.foundation.v1.MsgLeaveFoundation) | [MsgLeaveFoundationResponse](#lbm.foundation.v1.MsgLeaveFoundationResponse) | LeaveFoundation allows a member to leave the foundation. | | +| `UpdateCensorship` | [MsgUpdateCensorship](#lbm.foundation.v1.MsgUpdateCensorship) | [MsgUpdateCensorshipResponse](#lbm.foundation.v1.MsgUpdateCensorshipResponse) | UpdateCensorship updates censorship information. | | +| `Grant` | [MsgGrant](#lbm.foundation.v1.MsgGrant) | [MsgGrantResponse](#lbm.foundation.v1.MsgGrantResponse) | Grant grants the provided authorization to the grantee with authority of the foundation. If there is already a grant for the given (grantee, Authorization) tuple, then the grant will be overwritten. | | +| `Revoke` | [MsgRevoke](#lbm.foundation.v1.MsgRevoke) | [MsgRevokeResponse](#lbm.foundation.v1.MsgRevokeResponse) | Revoke revokes any authorization corresponding to the provided method name that has been granted to the grantee. | | -### MsgLeaveFoundationResponse -MsgLeaveFoundationResponse is the Msg/LeaveFoundation response type. + + +

Top

+## lbm/fswap/v1/event.proto - -### MsgRevoke -MsgRevoke is the Msg/Revoke request type. + + +### EventSwapCoins + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | authority is the address of the privileged account. | -| `grantee` | [string](#string) | | | -| `msg_type_url` | [string](#string) | | | +| `address` | [string](#string) | | holder's address | +| `from_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | from-coin amount | +| `to_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | to-coin amount | + - + -### MsgRevokeResponse -MsgRevokeResponse is the Msg/MsgRevokeResponse response type. + + + + +

Top

+## lbm/fswap/v1/fswap.proto - -### MsgSubmitProposal -MsgSubmitProposal is the Msg/SubmitProposal request type. + + +### MakeSwapProposal +From cosmos-sdk 0.46.0 they deprecated this way, but currently finschia-sdk based on 0.45.10 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `proposers` | [string](#string) | repeated | proposers are the account addresses of the proposers. Proposers signatures will be counted as yes votes. | -| `metadata` | [string](#string) | | metadata is any arbitrary metadata to attached to the proposal. | -| `messages` | [google.protobuf.Any](#google.protobuf.Any) | repeated | messages is a list of `sdk.Msg`s that will be executed if the proposal passes. | -| `exec` | [Exec](#lbm.foundation.v1.Exec) | | exec defines the mode of execution of the proposal, whether it should be executed immediately on creation or not. If so, proposers signatures are considered as Yes votes. | +| `title` | [string](#string) | | | +| `description` | [string](#string) | | | +| `swap` | [Swap](#lbm.fswap.v1.Swap) | | | +| `to_denom_metadata` | [cosmos.bank.v1beta1.Metadata](#cosmos.bank.v1beta1.Metadata) | | | - + + +### Swap -### MsgSubmitProposalResponse -MsgSubmitProposalResponse is the Msg/SubmitProposal response type. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `proposal_id` | [uint64](#uint64) | | proposal is the unique ID of the proposal. | +| `from_denom` | [string](#string) | | | +| `to_denom` | [string](#string) | | | +| `amount_cap_for_to_denom` | [string](#string) | | | +| `swap_rate` | [string](#string) | | | - + + +### SwapStats -### MsgUpdateCensorship -MsgUpdateCensorship is the Msg/UpdateCensorship request type. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | authority over the target censorship. | -| `censorship` | [Censorship](#lbm.foundation.v1.Censorship) | | new censorship information | +| `swap_count` | [int32](#int32) | | | - + -### MsgUpdateCensorshipResponse -MsgUpdateCensorshipResponse is the Msg/UpdateCensorship response type. +### Swapped +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `from_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `to_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | + - -### MsgUpdateDecisionPolicy -MsgUpdateDecisionPolicy is the Msg/UpdateDecisionPolicy request type. + + + + + + + + + + + +

Top

+ +## lbm/fswap/v1/genesis.proto + + + + + +### GenesisState +GenesisState defines the fswap module's genesis state. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | authority is the address of the privileged account. | -| `decision_policy` | [google.protobuf.Any](#google.protobuf.Any) | | decision_policy is the updated decision policy. | +| `swaps` | [Swap](#lbm.fswap.v1.Swap) | repeated | | +| `swap_stats` | [SwapStats](#lbm.fswap.v1.SwapStats) | | | +| `swappeds` | [Swapped](#lbm.fswap.v1.Swapped) | repeated | | + - + -### MsgUpdateDecisionPolicyResponse -MsgUpdateDecisionPolicyResponse is the Msg/UpdateDecisionPolicy response type. + + + +

Top

+## lbm/fswap/v1/query.proto - -### MsgUpdateMembers -MsgUpdateMembers is the Msg/UpdateMembers request type. + + + +### QuerySwappedRequest + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | authority is the address of the privileged account. | -| `member_updates` | [MemberRequest](#lbm.foundation.v1.MemberRequest) | repeated | member_updates is the list of members to update, set remove to true to remove a member. | +| `fromDenom` | [string](#string) | | | +| `toDenom` | [string](#string) | | | - + + +### QuerySwappedResponse + -### MsgUpdateMembersResponse -MsgUpdateMembersResponse is the Msg/UpdateMembers response type. +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `from_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | +| `to_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - -### MsgUpdateParams -MsgUpdateParams is the Msg/UpdateParams request type. -NOTE: This is not for tx + + +### QuerySwapsRequest + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | authority is the address of the privileged account. | -| `params` | [Params](#lbm.foundation.v1.Params) | | params defines the x/foundation parameters to update. +| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | -NOTE: All parameters must be supplied. | + - +### QuerySwapsResponse -### MsgUpdateParamsResponse -MsgUpdateParamsResponse is the Msg/UpdateParams response type. -NOTE: This is not for tx +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `swaps` | [Swap](#lbm.fswap.v1.Swap) | repeated | | +| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | - -### MsgVote -MsgVote is the Msg/Vote request type. + + + +### QueryTotalSwappableToCoinAmountRequest + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `proposal_id` | [uint64](#uint64) | | proposal is the unique ID of the proposal. | -| `voter` | [string](#string) | | voter is the voter account address. | -| `option` | [VoteOption](#lbm.foundation.v1.VoteOption) | | option is the voter's choice on the proposal. | -| `metadata` | [string](#string) | | metadata is any arbitrary metadata to attached to the vote. | -| `exec` | [Exec](#lbm.foundation.v1.Exec) | | exec defines whether the proposal should be executed immediately after voting or not. | +| `fromDenom` | [string](#string) | | | +| `toDenom` | [string](#string) | | | - + -### MsgVoteResponse -MsgVoteResponse is the Msg/Vote response type. +### QueryTotalSwappableToCoinAmountResponse +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `swappable_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | | - -### MsgWithdrawFromTreasury -MsgWithdrawFromTreasury is the Msg/WithdrawFromTreasury request type. + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `authority` | [string](#string) | | authority is the address of the privileged account. | -| `to` | [string](#string) | | | -| `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + + +### Query - +| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | +| ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `Swapped` | [QuerySwappedRequest](#lbm.fswap.v1.QuerySwappedRequest) | [QuerySwappedResponse](#lbm.fswap.v1.QuerySwappedResponse) | Swapped queries the current swapped status that includes a burnt amount of from-coin and a minted amount of to-coin. | GET|/lbm/fswap/v1/swapped| +| `TotalSwappableToCoinAmount` | [QueryTotalSwappableToCoinAmountRequest](#lbm.fswap.v1.QueryTotalSwappableToCoinAmountRequest) | [QueryTotalSwappableToCoinAmountResponse](#lbm.fswap.v1.QueryTotalSwappableToCoinAmountResponse) | TotalSwappableToCoinAmount queries the current swappable amount for to-coin. | GET|/lbm/fswap/v1/total_swappable_to_coin_amount| +| `Swaps` | [QuerySwapsRequest](#lbm.fswap.v1.QuerySwapsRequest) | [QuerySwapsResponse](#lbm.fswap.v1.QuerySwapsResponse) | Swaps queries all the swap that registered | GET|/lbm/fswap/v1/swaps| -### MsgWithdrawFromTreasuryResponse -MsgWithdrawFromTreasuryResponse is the Msg/WithdrawFromTreasury response type. + + +

Top

+## lbm/fswap/v1/tx.proto - -### MsgWithdrawProposal -MsgWithdrawProposal is the Msg/WithdrawProposal request type. + + +### MsgSwap + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `proposal_id` | [uint64](#uint64) | | proposal is the unique ID of the proposal. | -| `address` | [string](#string) | | address of one of the proposer of the proposal. | +| `from_address` | [string](#string) | | holder's address | +| `from_coin_amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | from-coin amount | +| `to_denom` | [string](#string) | | | - + -### MsgWithdrawProposalResponse -MsgWithdrawProposalResponse is the Msg/WithdrawProposal response type. +### MsgSwapAll +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `from_address` | [string](#string) | | holder's address | +| `from_denom` | [string](#string) | | | +| `to_denom` | [string](#string) | | | - - -### Exec -Exec defines modes of execution of a proposal on creation or on new vote. -| Name | Number | Description | -| ---- | ------ | ----------- | -| EXEC_UNSPECIFIED | 0 | An empty value means that there should be a separate MsgExec request for the proposal to execute. | -| EXEC_TRY | 1 | Try to execute the proposal immediately. If the proposal is not allowed per the DecisionPolicy, the proposal will still be open and could be executed at a later point. | + + +### MsgSwapAllResponse + + + + + + + + + +### MsgSwapResponse + + + + + + - + ### Msg -Msg defines the foundation Msg service. + | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `FundTreasury` | [MsgFundTreasury](#lbm.foundation.v1.MsgFundTreasury) | [MsgFundTreasuryResponse](#lbm.foundation.v1.MsgFundTreasuryResponse) | FundTreasury defines a method to fund the treasury. | | -| `WithdrawFromTreasury` | [MsgWithdrawFromTreasury](#lbm.foundation.v1.MsgWithdrawFromTreasury) | [MsgWithdrawFromTreasuryResponse](#lbm.foundation.v1.MsgWithdrawFromTreasuryResponse) | WithdrawFromTreasury defines a method to withdraw coins from the treasury. | | -| `UpdateMembers` | [MsgUpdateMembers](#lbm.foundation.v1.MsgUpdateMembers) | [MsgUpdateMembersResponse](#lbm.foundation.v1.MsgUpdateMembersResponse) | UpdateMembers updates the foundation members. | | -| `UpdateDecisionPolicy` | [MsgUpdateDecisionPolicy](#lbm.foundation.v1.MsgUpdateDecisionPolicy) | [MsgUpdateDecisionPolicyResponse](#lbm.foundation.v1.MsgUpdateDecisionPolicyResponse) | UpdateDecisionPolicy allows a group policy's decision policy to be updated. | | -| `SubmitProposal` | [MsgSubmitProposal](#lbm.foundation.v1.MsgSubmitProposal) | [MsgSubmitProposalResponse](#lbm.foundation.v1.MsgSubmitProposalResponse) | SubmitProposal submits a new proposal. | | -| `WithdrawProposal` | [MsgWithdrawProposal](#lbm.foundation.v1.MsgWithdrawProposal) | [MsgWithdrawProposalResponse](#lbm.foundation.v1.MsgWithdrawProposalResponse) | WithdrawProposal aborts a proposal. | | -| `Vote` | [MsgVote](#lbm.foundation.v1.MsgVote) | [MsgVoteResponse](#lbm.foundation.v1.MsgVoteResponse) | Vote allows a voter to vote on a proposal. | | -| `Exec` | [MsgExec](#lbm.foundation.v1.MsgExec) | [MsgExecResponse](#lbm.foundation.v1.MsgExecResponse) | Exec executes a proposal. | | -| `LeaveFoundation` | [MsgLeaveFoundation](#lbm.foundation.v1.MsgLeaveFoundation) | [MsgLeaveFoundationResponse](#lbm.foundation.v1.MsgLeaveFoundationResponse) | LeaveFoundation allows a member to leave the foundation. | | -| `UpdateCensorship` | [MsgUpdateCensorship](#lbm.foundation.v1.MsgUpdateCensorship) | [MsgUpdateCensorshipResponse](#lbm.foundation.v1.MsgUpdateCensorshipResponse) | UpdateCensorship updates censorship information. | | -| `Grant` | [MsgGrant](#lbm.foundation.v1.MsgGrant) | [MsgGrantResponse](#lbm.foundation.v1.MsgGrantResponse) | Grant grants the provided authorization to the grantee with authority of the foundation. If there is already a grant for the given (grantee, Authorization) tuple, then the grant will be overwritten. | | -| `Revoke` | [MsgRevoke](#lbm.foundation.v1.MsgRevoke) | [MsgRevokeResponse](#lbm.foundation.v1.MsgRevokeResponse) | Revoke revokes any authorization corresponding to the provided method name that has been granted to the grantee. | | +| `Swap` | [MsgSwap](#lbm.fswap.v1.MsgSwap) | [MsgSwapResponse](#lbm.fswap.v1.MsgSwapResponse) | | | +| `SwapAll` | [MsgSwapAll](#lbm.fswap.v1.MsgSwapAll) | [MsgSwapAllResponse](#lbm.fswap.v1.MsgSwapAllResponse) | | | diff --git a/proto/lbm/fbridge/v1/event.proto b/proto/lbm/fbridge/v1/event.proto new file mode 100644 index 0000000000..e7594d4dc8 --- /dev/null +++ b/proto/lbm/fbridge/v1/event.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; +package lbm.fbridge.v1; + +option go_package = "github.com/Finschia/finschia-sdk/x/fbridge/types"; + +message EventTransfer { + // the sequence number of the bridge request + uint64 seq = 1; + // the sender address on the source chain + string sender = 2; + // the recipient address on the destination chain + string receiver = 3; + // the amount of token to be transferred + string amount = 4; +} + +message EventProvision { + // the sequence number of the bridge request + uint64 seq = 1; + // the sender address on the source chain + string sender = 2; + // the recipient address on the destination chain + string receiver = 3; + // the amount of token to be claimed + string amount = 4; + // the address of the operator + string operator = 5; +} + +message EventConfirmProvision { + // the sequence number of the bridge request + uint64 seq = 1; +} + +message EventClaim { + // the sequence number of the bridge request + uint64 seq = 1; + // the sender address on the source chain + string sender = 2; + // the recipient address on the destination chain + string receiver = 3; + // the amount of token to be claimed + string amount = 4; +} diff --git a/proto/lbm/fbridge/v1/fbridge.proto b/proto/lbm/fbridge/v1/fbridge.proto new file mode 100644 index 0000000000..fccbf79a22 --- /dev/null +++ b/proto/lbm/fbridge/v1/fbridge.proto @@ -0,0 +1,75 @@ +syntax = "proto3"; +package lbm.fbridge.v1; + +option go_package = "github.com/Finschia/finschia-sdk/x/fbridge/types"; + +import "gogoproto/gogo.proto"; + +message Params { + // ratio of how many operators' confirmations are needed to be valid. + Fraction operator_trust_level = 1 [(gogoproto.nullable) = false]; + // ratio of how many guardians' confirmations are needed to be valid. + Fraction guardian_trust_level = 2 [(gogoproto.nullable) = false]; + // ratio of how many judges' confirmations are needed to be valid. + Fraction judge_trust_level = 3 [(gogoproto.nullable) = false]; + // default timelock period for each provision (unix timestamp) + uint64 timelock_period = 4; + // default period of the proposal to update the role + uint64 proposal_period = 5; +} + +// Provision is a struct that represents a provision internally. +message ProvisionData { + // the sequence number of the bridge request + uint64 seq = 1; + // the amount of token to be claimed + string amount = 2 + [(gogoproto.customtype) = "github.com/Finschia/finschia-sdk/types.Int", (gogoproto.nullable) = false]; + // the sender address on the source chain + string sender = 3; + // the recipient address on the destination chain + string receiver = 4; +} + +// ProvisionStatus is a struct that represents the status of a provision. +// To optimize computational cost, we have collected frequently changing values from provision. +message ProvisionStatus { + // the unix timestamp the provision will be able to be claimed (unix timestamp) + uint64 timelock_end = 1; + // a value that tells how many operators have submitted this provision + int32 confirm_counts = 2; + // whether the provision has been claimed + bool is_claimed = 3; +} + +// Fraction defines the protobuf message type for tmmath.Fraction that only +// supports positive values. +message Fraction { + uint64 numerator = 1; + uint64 denominator = 2; +} + +// Role defines the role of the operator, guardian, and judge. +enum Role { + UNSPECIFIED = 0; + GUARDIAN = 1; + OPERATOR = 2; + JUDGE = 3; +} + +message RoleProposal { + uint64 id = 1; + // the proposer address + string proposer = 2; + // the address to update the role + string target = 3; + // the role to be updated + // - unspecified : 0, used to remove the address from a group + // - guardian : 1 + // - operator : 2 + // - judge : 3 + Role role = 4; + + // the unix timestamp the proposal will be expired (unix timestamp) + uint64 expired_at = 5; +} diff --git a/proto/lbm/fbridge/v1/genesis.proto b/proto/lbm/fbridge/v1/genesis.proto new file mode 100644 index 0000000000..35775047b2 --- /dev/null +++ b/proto/lbm/fbridge/v1/genesis.proto @@ -0,0 +1,81 @@ +syntax = "proto3"; +package lbm.fbridge.v1; + +option go_package = "github.com/Finschia/finschia-sdk/x/fbridge/types"; + +import "gogoproto/gogo.proto"; +import "lbm/fbridge/v1/fbridge.proto"; + +// GenesisState defines the fbridge module's genesis state. +message GenesisState { + // params defines all the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false]; + // sending_state defines status saved when sending tokens to a counterpart chain + SendingState sending_state = 2 [(gogoproto.nullable) = false]; + // receiving_state defines status saved when receiving tokens from a counterpart chain + ReceivingState receiving_state = 3 [(gogoproto.nullable) = false]; +} + +message SendingState { + option (gogoproto.goproto_getters) = false; + + // the next sequence number of the bridge request (greatest sequence number + 1) + uint64 next_seq = 1; + // sequence-per-block number mapping + repeated BlockSeqInfo seq_to_blocknum = 2 [(gogoproto.nullable) = false]; +} + +message BlockSeqInfo { + uint64 seq = 1; + uint64 blocknum = 2; +} + +message ReceivingState { + option (gogoproto.goproto_getters) = false; + + // the greatest consecutive sequence number confirmed by each operator + repeated OperatorSeqInfo greatest_consecutive_seq_by_operator = 1; + // the greatest sequence number confirmed by each operator + repeated OperatorSeqInfo greatest_seq_by_operator = 2; + // the greatest consecutive sequence numbers confirmed by n-of-m operators + // consecutiveness is judged starting from the number closest to 0. + uint64 greatest_consecutive_seq = 3; + // the set of sequence numbers to be claimed + repeated uint64 pending_claim_seqs = 4; + // commitment is the hash value of a specific provision. + repeated Commitment commitments = 6; + // provision associated with a specific commitment. + repeated Provision provisions = 7; + // map the sequence number confirmed by n-of-m operators with commitment + repeated ConfirmedProvision confirmed_seq_to_commitment = 8; +} + +message OperatorSeqInfo { + // the operator address + string operator = 1; + // the sequence number + uint64 seq = 2; +} + +message Commitment { + // the operator address + string operator = 1; + // the sequence number of the bridge request + uint64 seq = 2; + // commitment is the hash value of a provision + string commitment = 3; +} + +message Provision { + string commitment = 1; + ProvisionData data = 2; + ProvisionStatus status = 3; +} + +message ConfirmedProvision { + // the sequence number of the bridge request + uint64 seq = 1; + + // commitment is the hash value of a provision + string commitment = 2; +} diff --git a/proto/lbm/fbridge/v1/query.proto b/proto/lbm/fbridge/v1/query.proto new file mode 100644 index 0000000000..120039df88 --- /dev/null +++ b/proto/lbm/fbridge/v1/query.proto @@ -0,0 +1,199 @@ +syntax = "proto3"; +package lbm.fbridge.v1; + +option go_package = "github.com/Finschia/finschia-sdk/x/fbridge/types"; + +import "google/api/annotations.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "lbm/fbridge/v1/fbridge.proto"; + +service Query { + // Params queries the parameters of x/fbridge module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/params"; + } + + // NextSeqSend queries the sequence of next bridge request + rpc NextSeqSend(QueryNextSeqSendRequest) returns (QueryNextSeqSendResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/sending/nextseq"; + } + + // BlocknumToSeqs queries a list of block numbers for which each sequence has been confirmed. + rpc SeqToBlocknums(QuerySeqToBlocknumsRequest) returns (QuerySeqToBlocknumsResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/sending/blocknums"; + } + + // GreatestSeqByOperator queries a greatest sequence number confirmed by a particular operator + rpc GreatestSeqByOperator(QueryGreatestSeqByOperatorRequest) returns (QueryGreatestSeqByOperatorResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/receiving/operators/{operator}/seq"; + } + + // GreatestConsecutiveConfirmedSeq queries a greatest consecutive sequence number confirmed by n-of-m operators + rpc GreatestConsecutiveConfirmedSeq(QueryGreatestConsecutiveConfirmedSeqRequest) + returns (QueryGreatestConsecutiveConfirmedSeqResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/receiving/greatest_confirmed_seq"; + } + + // SubmittedProvision queries a provision submitted by a particular operator + rpc SubmittedProvision(QuerySubmittedProvisionRequest) returns (QuerySubmittedProvisionResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/receiving/operators/{operator}/provision/{seq}"; + } + + // ConfirmedProvision queries a particular sequence of confirmed provisions + rpc ConfirmedProvision(QueryConfirmedProvisionRequest) returns (QueryConfirmedProvisionResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/receiving/provision/{seq}"; + } + + // NeededSubmissionSeqs queries a list of sequence numbers that need to be submitted by a particular operator + // The search scope is [greatest_consecutive_seq_by_operator, min(greatest_consecutive_seq_by_operator + range, + // greatest_seq_by_operator)] greatest_consecutive_seq_by_operator can be replaced with greatest_consecutive_seq if + // the operator is newly added + rpc NeededSubmissionSeqs(QueryNeededSubmissionSeqsRequest) returns (QueryNeededSubmissionSeqsResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/receiving/operators/{operator}/needed_submission_seqs"; + } + + // Commitments queries commitments of a specific sequence number + rpc Commitments(QueryCommitmentsRequest) returns (QueryCommitmentsResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/receiving/commitments/{seq}"; + } + + // Guardians queries a list of Guardians registered on the bridge + rpc Guardians(QueryGuardiansRequest) returns (QueryGuardiansResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/guardians"; + } + + // Operators queries a list of Operators registered on the bridge + rpc Operators(QueryOperatorsRequest) returns (QueryOperatorsResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/operators"; + } + + // Judges queries a list of Judges registered on the bridge + rpc Judges(QueryJudgesRequest) returns (QueryJudgesResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/judges"; + } + + // Proposals queries a list of SuggestRole Proposals + rpc Proposals(QueryProposalsRequest) returns (QueryProposalsResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/role/proposals"; + } + + // Proposal queries a SuggestRole Proposal + rpc Proposal(QueryProposalRequest) returns (QueryProposalResponse) { + option (google.api.http).get = "/lbm/fbridge/v1/role/proposals/{proposal_id}"; + } +} + +message QueryParamsRequest {} + +message QueryParamsResponse { + Params params = 1 [(gogoproto.nullable) = false]; +} + +message QueryNextSeqSendRequest {} + +message QueryNextSeqSendResponse { + uint64 seq = 1; +} + +message QuerySeqToBlocknumsRequest { + // list of sequence number of the bridge request + repeated uint64 seqs = 1; +} + +message QuerySeqToBlocknumsResponse { + repeated uint64 blocknums = 1; +} + +message QueryGreatestSeqByOperatorRequest { + // the address of the operator + string operator = 1; +} + +message QueryGreatestSeqByOperatorResponse { + uint64 seq = 1; +} + +message QueryGreatestConsecutiveConfirmedSeqRequest {} + +message QueryGreatestConsecutiveConfirmedSeqResponse { + uint64 seq = 1; +} + +message QuerySubmittedProvisionRequest { + // the address of the operator + string operator = 1; + // the sequence number of the bridge request + uint64 seq = 2; +} + +message QuerySubmittedProvisionResponse { + ProvisionData data = 1 [(gogoproto.nullable) = false]; + ProvisionStatus status = 2 [(gogoproto.nullable) = false]; +} + +message QueryNeededSubmissionSeqsRequest { + // the address of the operator + string operator = 1; + // range specifies the size of the range to search + uint64 range = 2; +} + +message QueryNeededSubmissionSeqsResponse { + repeated uint64 seqs = 1; +} + +message QueryConfirmedProvisionRequest { + // the sequence number of the bridge request + uint64 seq = 1; +} + +message QueryConfirmedProvisionResponse { + ProvisionData data = 1 [(gogoproto.nullable) = false]; + ProvisionStatus status = 2 [(gogoproto.nullable) = false]; +} + +message QueryCommitmentsRequest { + // the sequence number of the bridge request + uint64 seq = 1; +} + +message QueryCommitmentsResponse { + repeated string commitments = 1; +} + +message QueryGuardiansRequest {} + +message QueryGuardiansResponse { + repeated string guardians = 1; +} + +message QueryOperatorsRequest {} + +message QueryOperatorsResponse { + repeated string operators = 1; +} + +message QueryJudgesRequest {} + +message QueryJudgesResponse { + repeated string judges = 1; +} + +message QueryProposalsRequest { + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryProposalsResponse { + repeated RoleProposal proposals = 1; +} + +message QueryProposalRequest { + // the proposal id + string proposal_id = 1; +} + +message QueryProposalResponse { + RoleProposal proposal = 1; +} diff --git a/proto/lbm/fbridge/v1/tx.proto b/proto/lbm/fbridge/v1/tx.proto new file mode 100644 index 0000000000..8b114a8645 --- /dev/null +++ b/proto/lbm/fbridge/v1/tx.proto @@ -0,0 +1,169 @@ +syntax = "proto3"; +package lbm.fbridge.v1; + +option go_package = "github.com/Finschia/finschia-sdk/x/fbridge/types"; + +import "gogoproto/gogo.proto"; +import "lbm/fbridge/v1/fbridge.proto"; + +service Msg { + // Submit a transfer request to the bridge module. + rpc Transfer(MsgTransfer) returns (MsgTransferResponse); + + // Submit a provision to the bridge module. + rpc Provision(MsgProvision) returns (MsgProvisionResponse); + + // Set the time lock value from default value to uint64.max for specific confirmed provision. + rpc HoldTransfer(MsgHoldTransfer) returns (MsgHoldTransferResponse); + + // Set the time lock value to 0 for specific confirmed provision. + rpc ReleaseTransfer(MsgReleaseTransfer) returns (MsgReleaseTransferResponse); + + // Remove a specific confirmed provision (reset for specific sequence number). + rpc RemoveProvision(MsgRemoveProvision) returns (MsgRemoveProvisionResponse); + + // ClaimBatch processes the claiming of multiple claimable provisions in a single operation + rpc ClaimBatch(MsgClaimBatch) returns (MsgClaimBatchResponse); + + // Claim processes the claiming of a provision with a specific sequence number + rpc Claim(MsgClaim) returns (MsgClaimResponse); + + // SuggestRole suggests updating the role of an address in the bridge module. + // The role can be one of the following: guardian, operator, judge. + // The proposal will be passed only with the consent of +2/3 Guardian members. + rpc SuggestRole(MsgSuggestRole) returns (MsgSuggestRoleResponse); + + // AddVoteForRole adds a vote for a role change proposal. + rpc AddVoteForRole(MsgAddVoteForRole) returns (MsgAddVoteForRoleResponse); + + // Halt the bridge module. + rpc Halt(MsgHalt) returns (MsgHaltResponse); + + // Resume the bridge module. + rpc Resume(MsgResume) returns (MsgResumeResponse); +} + +// MsgTransfer is input values required for bridge transfer +message MsgTransfer { + // the sender address on the source chain + string sender = 1; + // the recipient address on the destination chain + string receiver = 2; + // the amount of token to be transferred + string amount = 3 + [(gogoproto.customtype) = "github.com/Finschia/finschia-sdk/types.Int", (gogoproto.nullable) = false]; +} + +message MsgTransferResponse {} + +// MsgProvision is input values required for provisioning +message MsgProvision { + // the operator address + string from = 1; + // the sequence number of the bridge request + uint64 seq = 2; + // the sender address on the source chain + string sender = 3; + // the recipient address on the destination chain + string receiver = 4; + // the amount of token to be claimed + string amount = 5 + [(gogoproto.customtype) = "github.com/Finschia/finschia-sdk/types.Int", (gogoproto.nullable) = false]; +} + +message MsgProvisionResponse {} + +// MsgHoldTransfer is input values required for holding transfer +message MsgHoldTransfer { + // the judge address + string from = 1; + // the sequence number of the bridge request + uint64 seq = 2; +} + +message MsgHoldTransferResponse {} + +// MsgReleaseTransfer is input values required for releasing a held transfer by time lock +message MsgReleaseTransfer { + // the guardian address + string from = 1; + // the sequence number of the bridge request + uint64 seq = 2; +} + +message MsgReleaseTransferResponse {} + +// MsgRemoveProvision is input values required for removing a specific confirmed provision +message MsgRemoveProvision { + // the judge address + string from = 1; + // the sequence number of the bridge request + uint64 seq = 2; +} + +message MsgRemoveProvisionResponse {} + +// MsgClaimBatch is input values required for claiming multiple claimable provisions +message MsgClaimBatch { + // the claimer address + string from = 1; + // the maximum number of claims to be made at once + uint64 max_claims = 2; +} + +message MsgClaimBatchResponse {} + +// MsgClaim is input values required for claiming a provision +message MsgClaim { + // the claimer address + string from = 1; + // the sequence number of the bridge request + uint64 seq = 2; +} + +message MsgClaimResponse {} + +// MsgUpdateRole is input values required for updating the role of an address +message MsgSuggestRole { + // the guardian address + string from = 1; + // the address to update the role + string target = 2; + // the role to be updated + // - unspecified : 0, used to remove the address from a group + // - guardian : 1 + // - operator : 2 + // - judge : 3 + Role role = 3; +} + +message MsgSuggestRoleResponse {} + +message MsgAddVoteForRole { + // the guardian address + string from = 1; + // the proposal ID + uint64 proposal_id = 2; + // the vote option + // - yes : true + // - no : false + bool option = 3; +} + +message MsgAddVoteForRoleResponse {} + +// MsgHalt is input values required for halting the bridge module +message MsgHalt { + // the guardian address + string guardian = 1; +} + +message MsgHaltResponse {} + +// MsgResume is input values required for resuming the bridge module +message MsgResume { + // the guardian address + string from = 1; +} + +message MsgResumeResponse {} diff --git a/proto/lbm/fswap/v1/event.proto b/proto/lbm/fswap/v1/event.proto new file mode 100644 index 0000000000..6834da7654 --- /dev/null +++ b/proto/lbm/fswap/v1/event.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; +package lbm.fswap.v1; + +option go_package = "github.com/Finschia/finschia-sdk/x/fswap/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +message EventSwapCoins { + // holder's address + string address = 1; + // from-coin amount + cosmos.base.v1beta1.Coin from_coin_amount = 2 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; + // to-coin amount + cosmos.base.v1beta1.Coin to_coin_amount = 3 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; +} diff --git a/proto/lbm/fswap/v1/fswap.proto b/proto/lbm/fswap/v1/fswap.proto new file mode 100644 index 0000000000..13a5c2a006 --- /dev/null +++ b/proto/lbm/fswap/v1/fswap.proto @@ -0,0 +1,46 @@ +syntax = "proto3"; +package lbm.fswap.v1; + +option go_package = "github.com/Finschia/finschia-sdk/x/fswap/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/bank/v1beta1/bank.proto"; + +message Swap { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + string from_denom = 1; + string to_denom = 2; + string amount_cap_for_to_denom = 3 + [(gogoproto.customtype) = "github.com/Finschia/finschia-sdk/types.Int", (gogoproto.nullable) = false]; + string swap_rate = 4 + [(gogoproto.customtype) = "github.com/Finschia/finschia-sdk/types.Dec", (gogoproto.nullable) = false]; +} + +message SwapStats { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + int32 swap_count = 1; +} + +// From cosmos-sdk 0.46.0 they deprecated this way, but currently finschia-sdk based on 0.45.10 +message MakeSwapProposal { + option (gogoproto.goproto_stringer) = false; + + string title = 1; + string description = 2; + Swap swap = 3 [(gogoproto.nullable) = false]; + cosmos.bank.v1beta1.Metadata to_denom_metadata = 4 + [(gogoproto.moretags) = "yaml:\"denom_metadata\"", (gogoproto.nullable) = false]; +} + +message Swapped { + option (gogoproto.goproto_stringer) = false; + cosmos.base.v1beta1.Coin from_coin_amount = 1 + [(gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin", (gogoproto.nullable) = false]; + cosmos.base.v1beta1.Coin to_coin_amount = 2 + [(gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin", (gogoproto.nullable) = false]; +} diff --git a/proto/lbm/fswap/v1/genesis.proto b/proto/lbm/fswap/v1/genesis.proto new file mode 100644 index 0000000000..c001741269 --- /dev/null +++ b/proto/lbm/fswap/v1/genesis.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package lbm.fswap.v1; + +option go_package = "github.com/Finschia/finschia-sdk/x/fswap/types"; + +import "gogoproto/gogo.proto"; +import "lbm/fswap/v1/fswap.proto"; + +// GenesisState defines the fswap module's genesis state. +message GenesisState { + repeated Swap swaps = 1 [(gogoproto.nullable) = false]; + SwapStats swap_stats = 2 [(gogoproto.nullable) = false]; + repeated Swapped swappeds = 3 [(gogoproto.nullable) = false]; +} diff --git a/proto/lbm/fswap/v1/query.proto b/proto/lbm/fswap/v1/query.proto new file mode 100644 index 0000000000..a2a88b7093 --- /dev/null +++ b/proto/lbm/fswap/v1/query.proto @@ -0,0 +1,55 @@ +syntax = "proto3"; +package lbm.fswap.v1; + +option go_package = "github.com/Finschia/finschia-sdk/x/fswap/types"; + +import "google/api/annotations.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "lbm/fswap/v1/fswap.proto"; + +service Query { + // Swapped queries the current swapped status that includes a burnt amount of from-coin and a minted amount of + // to-coin. + rpc Swapped(QuerySwappedRequest) returns (QuerySwappedResponse) { + option (google.api.http).get = "/lbm/fswap/v1/swapped"; + } + // TotalSwappableToCoinAmount queries the current swappable amount for to-coin. + rpc TotalSwappableToCoinAmount(QueryTotalSwappableToCoinAmountRequest) + returns (QueryTotalSwappableToCoinAmountResponse) { + option (google.api.http).get = "/lbm/fswap/v1/total_swappable_to_coin_amount"; + } + // Swaps queries all the swap that registered + rpc Swaps(QuerySwapsRequest) returns (QuerySwapsResponse) { + option (google.api.http).get = "/lbm/fswap/v1/swaps"; + } +} + +message QuerySwappedRequest { + string fromDenom = 1; + string toDenom = 2; +} +message QuerySwappedResponse { + cosmos.base.v1beta1.Coin from_coin_amount = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; + cosmos.base.v1beta1.Coin to_coin_amount = 2 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; +} + +message QueryTotalSwappableToCoinAmountRequest { + string fromDenom = 1; + string toDenom = 2; +} +message QueryTotalSwappableToCoinAmountResponse { + cosmos.base.v1beta1.Coin swappable_amount = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; +} + +message QuerySwapsRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} +message QuerySwapsResponse { + repeated Swap swaps = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} \ No newline at end of file diff --git a/proto/lbm/fswap/v1/tx.proto b/proto/lbm/fswap/v1/tx.proto new file mode 100644 index 0000000000..07813f9eab --- /dev/null +++ b/proto/lbm/fswap/v1/tx.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; +package lbm.fswap.v1; + +option go_package = "github.com/Finschia/finschia-sdk/x/fswap/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +service Msg { + rpc Swap(MsgSwap) returns (MsgSwapResponse); + rpc SwapAll(MsgSwapAll) returns (MsgSwapAllResponse); +} + +message MsgSwap { + // holder's address + string from_address = 1; + // from-coin amount + cosmos.base.v1beta1.Coin from_coin_amount = 2 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/Finschia/finschia-sdk/types.Coin"]; + string to_denom = 3; +} + +message MsgSwapResponse {} + +message MsgSwapAll { + // holder's address + string from_address = 1; + string from_denom = 2; + string to_denom = 3; +} + +message MsgSwapAllResponse {} diff --git a/simapp/app.go b/simapp/app.go index c37163f9ef..c0e5597804 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -67,6 +67,9 @@ import ( "github.com/Finschia/finschia-sdk/x/evidence" evidencekeeper "github.com/Finschia/finschia-sdk/x/evidence/keeper" evidencetypes "github.com/Finschia/finschia-sdk/x/evidence/types" + fbridgekeeper "github.com/Finschia/finschia-sdk/x/fbridge/keeper" + fbridgemodule "github.com/Finschia/finschia-sdk/x/fbridge/module" + fbridgetypes "github.com/Finschia/finschia-sdk/x/fbridge/types" "github.com/Finschia/finschia-sdk/x/feegrant" feegrantkeeper "github.com/Finschia/finschia-sdk/x/feegrant/keeper" feegrantmodule "github.com/Finschia/finschia-sdk/x/feegrant/module" @@ -74,6 +77,10 @@ import ( foundationclient "github.com/Finschia/finschia-sdk/x/foundation/client" foundationkeeper "github.com/Finschia/finschia-sdk/x/foundation/keeper" foundationmodule "github.com/Finschia/finschia-sdk/x/foundation/module" + "github.com/Finschia/finschia-sdk/x/fswap" + fswapclient "github.com/Finschia/finschia-sdk/x/fswap/client" + fswapkeeper "github.com/Finschia/finschia-sdk/x/fswap/keeper" + fswaptypes "github.com/Finschia/finschia-sdk/x/fswap/types" "github.com/Finschia/finschia-sdk/x/genutil" genutiltypes "github.com/Finschia/finschia-sdk/x/genutil/types" "github.com/Finschia/finschia-sdk/x/gov" @@ -132,6 +139,7 @@ var ( upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler, foundationclient.ProposalHandler, + fswapclient.ProposalHandler, ), params.AppModuleBasic{}, crisis.AppModuleBasic{}, @@ -143,6 +151,8 @@ var ( vesting.AppModuleBasic{}, tokenmodule.AppModuleBasic{}, collectionmodule.AppModuleBasic{}, + fswap.AppModuleBasic{}, + fbridgemodule.AppModuleBasic{}, ) // module account permissions @@ -155,11 +165,14 @@ var ( stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, govtypes.ModuleName: {authtypes.Burner}, + fbridgetypes.ModuleName: {authtypes.Burner}, + fswaptypes.ModuleName: {authtypes.Burner, authtypes.Minter}, } // module accounts that are allowed to receive tokens allowedReceivingModAcc = map[string]bool{ // govtypes.ModuleName: true, // TODO: uncomment it when authority is ready + fbridgetypes.ModuleName: true, } ) @@ -202,6 +215,8 @@ type SimApp struct { ClassKeeper classkeeper.Keeper TokenKeeper tokenkeeper.Keeper CollectionKeeper collectionkeeper.Keeper + FswapKeeper fswapkeeper.Keeper + FbridgeKeeper fbridgekeeper.Keeper // the module manager mm *module.Manager @@ -255,6 +270,8 @@ func NewSimApp( token.StoreKey, collection.StoreKey, authzkeeper.StoreKey, + fswaptypes.StoreKey, + fbridgetypes.StoreKey, ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) // NOTE: The testingkey is just mounted for testing purposes. Actual applications should @@ -331,13 +348,17 @@ func NewSimApp( app.AuthzKeeper = authzkeeper.NewKeeper(keys[authzkeeper.StoreKey], appCodec, app.BaseApp.MsgServiceRouter()) + fswapConfig := fswaptypes.DefaultConfig() + app.FswapKeeper = fswapkeeper.NewKeeper(appCodec, keys[fswaptypes.StoreKey], fswapConfig, app.BankKeeper) + // register the proposal types govRouter := govtypes.NewRouter() govRouter.AddRoute(govtypes.RouterKey, govtypes.ProposalHandler). AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)). AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). - AddRoute(foundation.RouterKey, foundationkeeper.NewFoundationProposalsHandler(app.FoundationKeeper)) + AddRoute(foundation.RouterKey, foundationkeeper.NewFoundationProposalsHandler(app.FoundationKeeper)). + AddRoute(fswaptypes.RouterKey, fswap.NewSwapHandler(app.FswapKeeper)) govKeeper := govkeeper.NewKeeper( appCodec, keys[govtypes.StoreKey], app.GetSubspace(govtypes.ModuleName), app.AccountKeeper, app.BankKeeper, @@ -357,6 +378,8 @@ func NewSimApp( // If evidence needs to be handled for the app, set routes in router here and seal app.EvidenceKeeper = *evidenceKeeper + app.FbridgeKeeper = fbridgekeeper.NewKeeper(appCodec, keys[fbridgetypes.StoreKey], app.AccountKeeper, app.BankKeeper, "stake", authtypes.NewModuleAddress(govtypes.ModuleName).String()) + /**** Module Options ****/ // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment @@ -388,6 +411,8 @@ func NewSimApp( tokenmodule.NewAppModule(appCodec, app.TokenKeeper), collectionmodule.NewAppModule(appCodec, app.CollectionKeeper), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), + fswap.NewAppModule(appCodec, app.FswapKeeper, app.BankKeeper), + fbridgemodule.NewAppModule(appCodec, app.FbridgeKeeper), ) // During begin block slashing happens after distr.BeginBlocker so that @@ -415,6 +440,8 @@ func NewSimApp( vestingtypes.ModuleName, token.ModuleName, collection.ModuleName, + fswaptypes.ModuleName, + fbridgetypes.ModuleName, ) app.mm.SetOrderEndBlockers( crisistypes.ModuleName, @@ -436,6 +463,8 @@ func NewSimApp( foundation.ModuleName, token.ModuleName, collection.ModuleName, + fswaptypes.ModuleName, + fbridgetypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -463,6 +492,8 @@ func NewSimApp( vestingtypes.ModuleName, token.ModuleName, collection.ModuleName, + fswaptypes.ModuleName, + fbridgetypes.ModuleName, ) // Uncomment if you want to set a custom migration order here. diff --git a/x/fbridge/client/cli/query.go b/x/fbridge/client/cli/query.go new file mode 100644 index 0000000000..4878af22e7 --- /dev/null +++ b/x/fbridge/client/cli/query.go @@ -0,0 +1,92 @@ +package cli + +import ( + "fmt" + + "github.com/spf13/cobra" + + "github.com/Finschia/finschia-sdk/client" + "github.com/Finschia/finschia-sdk/client/flags" + "github.com/Finschia/finschia-sdk/version" + "github.com/Finschia/finschia-sdk/x/fbridge/types" +) + +const ( + flagSequences = "sequences" +) + +// NewQueryCmd returns the query commands for fbridge module +func NewQueryCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: "Querying commands for the fbridge module", + } + + cmd.AddCommand( + NewQueryNextSeqSendCmd(), + NewQuerySeqToBlocknumsCmd(), + ) + + return cmd +} + +func NewQueryNextSeqSendCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "sending-next-seq", + Short: "Query the next sequence number for sending", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + qc := types.NewQueryClient(clientCtx) + res, err := qc.NextSeqSend(cmd.Context(), &types.QueryNextSeqSendRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +func NewQuerySeqToBlocknumsCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "seq-to-blocknums", + Short: "Query the block number for given sequence numbers", + Args: cobra.NoArgs, + Example: fmt.Sprintf("%s query %s sending seq-to-blocknums --sequences=1,2,3", version.AppName, types.ModuleName), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + qc := types.NewQueryClient(clientCtx) + + seqSlice, err := cmd.Flags().GetInt64Slice(flagSequences) + if err != nil { + return err + } + + seqs := make([]uint64, len(seqSlice)) + for i, seq := range seqSlice { + seqs[i] = uint64(seq) + } + + res, err := qc.SeqToBlocknums(cmd.Context(), &types.QuerySeqToBlocknumsRequest{Seqs: seqs}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + cmd.Flags().Int64Slice(flagSequences, []int64{}, "comma separated list of bridge sequnece numbers") + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/fbridge/client/cli/tx.go b/x/fbridge/client/cli/tx.go new file mode 100644 index 0000000000..8aa3b892bb --- /dev/null +++ b/x/fbridge/client/cli/tx.go @@ -0,0 +1,67 @@ +package cli + +import ( + "github.com/spf13/cobra" + + "github.com/Finschia/finschia-sdk/client" + "github.com/Finschia/finschia-sdk/client/flags" + "github.com/Finschia/finschia-sdk/client/tx" + sdk "github.com/Finschia/finschia-sdk/types" + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" + "github.com/Finschia/finschia-sdk/x/fbridge/types" +) + +// NewTxCmd returns the transaction commands for fbridge module +func NewTxCmd() *cobra.Command { + TxCmd := &cobra.Command{ + Use: types.ModuleName, + Short: "fbridge transactions subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + TxCmd.AddCommand( + NewTransferTxCmd(), + ) + + return TxCmd +} + +func NewTransferTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "transfer [to_address] [amount]", + Short: `Transfer token from current chain to counterparty chain`, + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + fromAddr := clientCtx.GetFromAddress().String() + if _, err := sdk.AccAddressFromBech32(fromAddr); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid address: %s", fromAddr) + } + toAddr := args[0] + coins, err := sdk.ParseCoinsNormalized(args[1]) + if err != nil { + return err + } + if len(coins) != 1 { + return sdkerrors.ErrInvalidRequest.Wrapf("only one native coin type is allowed") + } + + msg := types.MsgTransfer{ + Sender: fromAddr, + Receiver: toAddr, + Amount: coins[0].Amount, + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/fbridge/keeper/genesis.go b/x/fbridge/keeper/genesis.go new file mode 100644 index 0000000000..9312e18a97 --- /dev/null +++ b/x/fbridge/keeper/genesis.go @@ -0,0 +1,42 @@ +package keeper + +import ( + "encoding/binary" + + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/x/fbridge/types" +) + +func (k Keeper) InitGenesis(ctx sdk.Context, gs *types.GenesisState) error { + k.setNextSequence(ctx, gs.SendingState.NextSeq) + for _, info := range gs.SendingState.SeqToBlocknum { + k.setSeqToBlocknum(ctx, info.Seq, info.Blocknum) + } + + return nil +} + +func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + return &types.GenesisState{ + SendingState: types.SendingState{ + NextSeq: k.GetNextSequence(ctx), + SeqToBlocknum: k.getAllSeqToBlocknums(ctx), + }, + } +} + +func (k Keeper) getAllSeqToBlocknums(ctx sdk.Context) []types.BlockSeqInfo { + infos := make([]types.BlockSeqInfo, 0) + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, types.KeySeqToBlocknumPrefix) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + seq := binary.BigEndian.Uint64(iterator.Key()[1:]) + v := binary.BigEndian.Uint64(iterator.Value()) + info := types.BlockSeqInfo{Seq: seq, Blocknum: v} + infos = append(infos, info) + } + + return infos +} diff --git a/x/fbridge/keeper/grpc_query.go b/x/fbridge/keeper/grpc_query.go new file mode 100644 index 0000000000..e2460064c2 --- /dev/null +++ b/x/fbridge/keeper/grpc_query.go @@ -0,0 +1,97 @@ +package keeper + +import ( + "context" + "fmt" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/x/fbridge/types" +) + +var _ types.QueryServer = Keeper{} + +func (k Keeper) Params(ctx context.Context, request *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + panic("implement me") +} + +func (k Keeper) NextSeqSend(goCtx context.Context, req *types.QueryNextSeqSendRequest) (*types.QueryNextSeqSendResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + seq := k.GetNextSequence(ctx) + + return &types.QueryNextSeqSendResponse{Seq: seq}, nil +} + +func (k Keeper) SeqToBlocknums(goCtx context.Context, req *types.QuerySeqToBlocknumsRequest) (*types.QuerySeqToBlocknumsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + const lowerBound int = 1 + const upperBound int = 1000 + if len(req.Seqs) < lowerBound || len(req.Seqs) > upperBound { + return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("The number of seqs requested must be between %d and %d", lowerBound, upperBound)) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + bhList := make([]uint64, len(req.Seqs)) + for i, seq := range req.Seqs { + bh, err := k.GetSeqToBlocknum(ctx, seq) + if err != nil { + return nil, err + } + bhList[i] = bh + } + + return &types.QuerySeqToBlocknumsResponse{Blocknums: bhList}, nil +} + +func (k Keeper) GreatestSeqByOperator(ctx context.Context, request *types.QueryGreatestSeqByOperatorRequest) (*types.QueryGreatestSeqByOperatorResponse, error) { + panic("implement me") +} + +func (k Keeper) GreatestConsecutiveConfirmedSeq(ctx context.Context, request *types.QueryGreatestConsecutiveConfirmedSeqRequest) (*types.QueryGreatestConsecutiveConfirmedSeqResponse, error) { + panic("implement me") +} + +func (k Keeper) SubmittedProvision(ctx context.Context, request *types.QuerySubmittedProvisionRequest) (*types.QuerySubmittedProvisionResponse, error) { + panic("implement me") +} + +func (k Keeper) ConfirmedProvision(ctx context.Context, request *types.QueryConfirmedProvisionRequest) (*types.QueryConfirmedProvisionResponse, error) { + panic("implement me") +} + +func (k Keeper) NeededSubmissionSeqs(ctx context.Context, request *types.QueryNeededSubmissionSeqsRequest) (*types.QueryNeededSubmissionSeqsResponse, error) { + panic("implement me") +} + +func (k Keeper) Commitments(ctx context.Context, request *types.QueryCommitmentsRequest) (*types.QueryCommitmentsResponse, error) { + panic("implement me") +} + +func (k Keeper) Guardians(ctx context.Context, request *types.QueryGuardiansRequest) (*types.QueryGuardiansResponse, error) { + panic("implement me") +} + +func (k Keeper) Operators(ctx context.Context, request *types.QueryOperatorsRequest) (*types.QueryOperatorsResponse, error) { + panic("implement me") +} + +func (k Keeper) Judges(ctx context.Context, request *types.QueryJudgesRequest) (*types.QueryJudgesResponse, error) { + panic("implement me") +} + +func (k Keeper) Proposals(ctx context.Context, request *types.QueryProposalsRequest) (*types.QueryProposalsResponse, error) { + panic("implement me") +} + +func (k Keeper) Proposal(ctx context.Context, request *types.QueryProposalRequest) (*types.QueryProposalResponse, error) { + panic("implement me") +} diff --git a/x/fbridge/keeper/keeper.go b/x/fbridge/keeper/keeper.go new file mode 100644 index 0000000000..6059da88bc --- /dev/null +++ b/x/fbridge/keeper/keeper.go @@ -0,0 +1,60 @@ +package keeper + +import ( + "errors" + + "github.com/tendermint/tendermint/libs/log" + + "github.com/Finschia/finschia-sdk/codec" + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/x/fbridge/types" +) + +type Keeper struct { + storeKey sdk.StoreKey + cdc codec.BinaryCodec + authKeeper types.AccountKeeper + bankKeeper types.BankKeeper + + // the target denom for the bridge + targetDenom string + + // the authority address that can execute privileged operations only if the guardian group is not set + // - UpdateParams + // - SuggestRole + authority string +} + +func NewKeeper( + cdc codec.BinaryCodec, + key sdk.StoreKey, + authKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, + targetDenom string, + authority string, +) Keeper { + if addr := authKeeper.GetModuleAddress(types.ModuleName); addr == nil { + panic(errors.New("fbridge module account has not been set")) + } + + if authority != types.DefaultAuthority().String() { + panic(errors.New("authority must be gov module")) + } + + return Keeper{ + storeKey: key, + cdc: cdc, + authKeeper: authKeeper, + bankKeeper: bankKeeper, + targetDenom: targetDenom, + authority: authority, + } +} + +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", "x/"+types.ModuleName) +} + +func (k Keeper) GetAuthority() string { + return k.authority +} diff --git a/x/fbridge/keeper/msg_server.go b/x/fbridge/keeper/msg_server.go new file mode 100644 index 0000000000..491f57c632 --- /dev/null +++ b/x/fbridge/keeper/msg_server.go @@ -0,0 +1,88 @@ +package keeper + +import ( + "context" + + sdk "github.com/Finschia/finschia-sdk/types" + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" + "github.com/Finschia/finschia-sdk/x/fbridge/types" +) + +type msgServer struct { + Keeper +} + +var _ types.MsgServer = msgServer{} + +func NewMsgServer(k Keeper) types.MsgServer { + return &msgServer{k} +} + +func (m msgServer) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + from, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) + } + + if err := IsValidEthereumAddress(msg.Receiver); err != nil { + return nil, sdkerrors.Wrap(err, "invalid receiver address") + } + + seq, err := m.handleBridgeTransfer(ctx, from, msg.Amount) + if err != nil { + return nil, err + } + + if err := ctx.EventManager().EmitTypedEvent(&types.EventTransfer{ + Sender: msg.Sender, + Receiver: msg.Receiver, + Amount: msg.Amount.String(), + Seq: seq, + }); err != nil { + panic(err) + } + + return &types.MsgTransferResponse{}, nil +} + +func (m msgServer) Provision(ctx context.Context, msg *types.MsgProvision) (*types.MsgProvisionResponse, error) { + panic("implement me") +} + +func (m msgServer) HoldTransfer(ctx context.Context, msg *types.MsgHoldTransfer) (*types.MsgHoldTransferResponse, error) { + panic("implement me") +} + +func (m msgServer) ReleaseTransfer(ctx context.Context, msg *types.MsgReleaseTransfer) (*types.MsgReleaseTransferResponse, error) { + panic("implement me") +} + +func (m msgServer) RemoveProvision(ctx context.Context, msg *types.MsgRemoveProvision) (*types.MsgRemoveProvisionResponse, error) { + panic("implement me") +} + +func (m msgServer) ClaimBatch(ctx context.Context, msg *types.MsgClaimBatch) (*types.MsgClaimBatchResponse, error) { + panic("implement me") +} + +func (m msgServer) Claim(ctx context.Context, msg *types.MsgClaim) (*types.MsgClaimResponse, error) { + panic("implement me") +} + +func (m msgServer) SuggestRole(ctx context.Context, msg *types.MsgSuggestRole) (*types.MsgSuggestRoleResponse, error) { + panic("implement me") +} + +func (m msgServer) AddVoteForRole(ctx context.Context, msg *types.MsgAddVoteForRole) (*types.MsgAddVoteForRoleResponse, error) { + panic("implement me") +} + +func (m msgServer) Halt(ctx context.Context, msg *types.MsgHalt) (*types.MsgHaltResponse, error) { + panic("implement me") +} + +func (m msgServer) Resume(ctx context.Context, resume *types.MsgResume) (*types.MsgResumeResponse, error) { + panic("implement me") +} diff --git a/x/fbridge/keeper/transfer.go b/x/fbridge/keeper/transfer.go new file mode 100644 index 0000000000..8e63588366 --- /dev/null +++ b/x/fbridge/keeper/transfer.go @@ -0,0 +1,105 @@ +package keeper + +import ( + "encoding/binary" + "encoding/hex" + "errors" + "fmt" + "regexp" + "strconv" + "strings" + + "golang.org/x/crypto/sha3" + + sdk "github.com/Finschia/finschia-sdk/types" + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" + "github.com/Finschia/finschia-sdk/x/fbridge/types" +) + +func (k Keeper) handleBridgeTransfer(ctx sdk.Context, sender sdk.AccAddress, amount sdk.Int) (uint64, error) { + token := sdk.Coins{sdk.Coin{Denom: k.targetDenom, Amount: amount}} + if err := k.bankKeeper.IsSendEnabledCoins(ctx, token...); err != nil { + return 0, err + } + + if err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, token); err != nil { + panic(err) + } + + if err := k.bankKeeper.BurnCoins(ctx, types.ModuleName, token); err != nil { + panic(fmt.Errorf("cannot burn coins after a successful send to a module account: %v", err)) + } + + seq := k.GetNextSequence(ctx) + k.setNextSequence(ctx, seq+1) + k.setSeqToBlocknum(ctx, seq, uint64(ctx.BlockHeight())) + + return seq, nil +} + +func (k Keeper) setSeqToBlocknum(ctx sdk.Context, seq, height uint64) { + store := ctx.KVStore(k.storeKey) + bz := make([]byte, 8) + binary.BigEndian.PutUint64(bz, height) + store.Set(types.SeqToBlocknumKey(seq), bz) +} + +func (k Keeper) GetSeqToBlocknum(ctx sdk.Context, seq uint64) (uint64, error) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.SeqToBlocknumKey(seq)) + if len(bz) == 0 { + return 0, sdkerrors.ErrNotFound.Wrapf("sequence %d not found", seq) + } + + return binary.BigEndian.Uint64(bz), nil +} + +func (k Keeper) GetNextSequence(ctx sdk.Context) uint64 { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.KeyNextSeqSend) + if len(bz) == 0 { + panic(errors.New("sending next sequence should have been set")) + } + + return binary.BigEndian.Uint64(bz) +} + +func (k Keeper) setNextSequence(ctx sdk.Context, seq uint64) { + store := ctx.KVStore(k.storeKey) + bz := make([]byte, 8) + binary.BigEndian.PutUint64(bz, seq) + store.Set(types.KeyNextSeqSend, bz) +} + +func IsValidEthereumAddress(address string) error { + matched, err := regexp.MatchString(`^0x[a-fA-F0-9]{40}$`, address) + if err != nil || !matched { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid eth address: %s", address) + } + + address = address[2:] + addressLower := strings.ToLower(address) + + hasher := sha3.NewLegacyKeccak256() + hasher.Write([]byte(addressLower)) + addressHash := hex.EncodeToString(hasher.Sum(nil)) + + checksumAddress := "" + for i := 0; i < len(addressLower); i++ { + c, err := strconv.ParseUint(string(addressHash[i]), 16, 4) + if err != nil { + return err + } + if c < 8 { + checksumAddress += string(addressLower[i]) + } else { + checksumAddress += strings.ToUpper(string(addressLower[i])) + } + } + + if address != checksumAddress { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid checksum for eth address: %s", address) + } + + return nil +} diff --git a/x/fbridge/keeper/transfer_test.go b/x/fbridge/keeper/transfer_test.go new file mode 100644 index 0000000000..ac0743ad98 --- /dev/null +++ b/x/fbridge/keeper/transfer_test.go @@ -0,0 +1,65 @@ +package keeper + +import ( + "encoding/binary" + "testing" + + "github.com/stretchr/testify/require" + + sdk "github.com/Finschia/finschia-sdk/types" + authtypes "github.com/Finschia/finschia-sdk/x/auth/types" + "github.com/Finschia/finschia-sdk/x/fbridge/testutil" + "github.com/Finschia/finschia-sdk/x/fbridge/types" +) + +func TestHandleBridgeTransfer(t *testing.T) { + key, ctx, encCfg, authKeeper, bankKeeper := testutil.PrepareFbridgeTest(t) + + sender := sdk.AccAddress("test") + amt := sdk.NewInt(1000000) + denom := "stake" + token := sdk.Coins{sdk.Coin{Denom: denom, Amount: amt}} + + bridge := authtypes.NewEmptyModuleAccount("fbridge") + authKeeper.EXPECT().GetModuleAddress(types.ModuleName).Return(bridge.GetAddress()).AnyTimes() + bankKeeper.EXPECT().IsSendEnabledCoins(ctx, token).Return(nil) + bankKeeper.EXPECT().SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, token).Return(nil) + bankKeeper.EXPECT().BurnCoins(ctx, types.ModuleName, token).Return(nil) + + k := NewKeeper(encCfg.Codec, key, authKeeper, bankKeeper, denom, authtypes.NewModuleAddress("gov").String()) + targetSeq := uint64(2) + bz := make([]byte, 8) + binary.BigEndian.PutUint64(bz, targetSeq) + ctx.KVStore(key).Set(types.KeyNextSeqSend, bz) + + handledSeq, err := k.handleBridgeTransfer(ctx, sender, amt) + require.NoError(t, err) + require.Equal(t, targetSeq, handledSeq) + afterSeq := k.GetNextSequence(ctx) + require.Equal(t, targetSeq+1, afterSeq) + h, err := k.GetSeqToBlocknum(ctx, handledSeq) + require.NoError(t, err) + require.Equal(t, uint64(ctx.BlockHeight()), h) +} + +func TestIsValidEthereumAddress(t *testing.T) { + tcs := map[string]struct { + isErr bool + address string + }{ + "valid": { + isErr: true, + address: "0xf7bAc63fc7CEaCf0589F25454Ecf5C2ce904997c", + }, + "invalid": { + isErr: false, + address: "0xf7bAc63fc7CEaCf0589F25454Ecf5C2ce905997c", + }, + } + + for name, tc := range tcs { + t.Run(name, func(t *testing.T) { + require.Equal(t, tc.isErr, IsValidEthereumAddress(tc.address) == nil) + }) + } +} diff --git a/x/fbridge/module/module.go b/x/fbridge/module/module.go new file mode 100644 index 0000000000..e7f7cfc28c --- /dev/null +++ b/x/fbridge/module/module.go @@ -0,0 +1,164 @@ +package module + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + abci "github.com/tendermint/tendermint/abci/types" + + sdkclient "github.com/Finschia/finschia-sdk/client" + "github.com/Finschia/finschia-sdk/codec" + codectypes "github.com/Finschia/finschia-sdk/codec/types" + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/types/module" + "github.com/Finschia/finschia-sdk/x/fbridge/client/cli" + "github.com/Finschia/finschia-sdk/x/fbridge/keeper" + "github.com/Finschia/finschia-sdk/x/fbridge/types" +) + +const ( + consensusVersion uint64 = 1 +) + +var ( + _ module.AppModuleBasic = AppModuleBasic{} + _ module.AppModuleGenesis = AppModule{} + _ module.AppModule = AppModule{} +) + +// AppModuleBasic defines the basic application module used by the fbridge module. +type AppModuleBasic struct{} + +// Name returns the ModuleName +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the fbridge types on the LegacyAmino codec +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} + +// DefaultGenesis returns default genesis state as raw bytes for the fbridge +// module. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesisState()) +} + +// ValidateGenesis performs genesis state validation for the fbridge module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config sdkclient.TxEncodingConfig, bz json.RawMessage) error { + var data types.GenesisState + if err := cdc.UnmarshalJSON(bz, &data); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + + return types.ValidateGenesis(data) +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the fbridge module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx sdkclient.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// GetQueryCmd returns the cli query commands for this module +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.NewQueryCmd() +} + +// GetTxCmd returns the transaction commands for this module +func (AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.NewTxCmd() +} + +func (b AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) +} + +// ____________________________________________________________________________ + +// AppModule implements an application module for the fbridge module. +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper +} + +// NewAppModule creates a new AppModule object +func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { + return AppModule{ + keeper: keeper, + } +} + +// RegisterServices registers a GRPC query service to respond to the +// module-specific GRPC queries. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServer(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +// InitGenesis performs genesis initialization for the fbridge module. It returns +// no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { + var genesisState types.GenesisState + cdc.MustUnmarshalJSON(data, &genesisState) + if err := am.keeper.InitGenesis(ctx, &genesisState); err != nil { + panic(err) + } + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the exported genesis state as raw bytes for the fbridge +// module. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + gs := am.keeper.ExportGenesis(ctx) + return cdc.MustMarshalJSON(gs) +} + +// ConsensusVersion implements AppModule/ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return consensusVersion } + +// RegisterInvariants does nothing, there are no invariants to enforce +func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { + _ = ir +} + +// Deprecated: Route does nothing. +func (am AppModule) Route() sdk.Route { return sdk.NewRoute("", nil) } + +// Deprecated: QuerierRoute does nothing. +func (am AppModule) QuerierRoute() string { return "" } + +// Deprecated: LegacyQuerierHandler does nothing. +func (am AppModule) LegacyQuerierHandler(*codec.LegacyAmino) sdk.Querier { return nil } + +// ____________________________________________________________________________ + +// AppModuleSimulation functions + +// // GenerateGenesisState creates a randomized GenState of the fbridge module. +// func (AppModule) GenerateGenesisState(simState *module.SimulationState) { +// simulation.RandomizedGenState(simState) +// } + +// // ProposalContents returns all the fbridge content functions used to +// // simulate fbridge proposals. +// func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { +// return simulation.ProposalContents() +// } + +// // RegisterStoreDecoder registers a decoder for fbridge module's types +// func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { +// sdr[types.StoreKey] = simulation.NewDecodeStore(am.cdc) +// } + +//// WeightedOperations returns the all the gov module operations with their respective weights. +// func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { +// return simulation.WeightedOperations( +// simState.AppParams, simState.Cdc, simState.TxConfig, +// am.accountKeeper, am.bankKeeper, am.keeper, +// ) +//} diff --git a/x/fbridge/testutil/expected_keepers_mocks.go b/x/fbridge/testutil/expected_keepers_mocks.go new file mode 100644 index 0000000000..680b029205 --- /dev/null +++ b/x/fbridge/testutil/expected_keepers_mocks.go @@ -0,0 +1,119 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: x/fbridge/types/expected_keepers.go + +// Package testutil is a generated GoMock package. +package testutil + +import ( + reflect "reflect" + + types "github.com/Finschia/finschia-sdk/types" + gomock "github.com/golang/mock/gomock" +) + +// MockAccountKeeper is a mock of AccountKeeper interface. +type MockAccountKeeper struct { + ctrl *gomock.Controller + recorder *MockAccountKeeperMockRecorder +} + +// MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. +type MockAccountKeeperMockRecorder struct { + mock *MockAccountKeeper +} + +// NewMockAccountKeeper creates a new mock instance. +func NewMockAccountKeeper(ctrl *gomock.Controller) *MockAccountKeeper { + mock := &MockAccountKeeper{ctrl: ctrl} + mock.recorder = &MockAccountKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAccountKeeper) EXPECT() *MockAccountKeeperMockRecorder { + return m.recorder +} + +// GetModuleAddress mocks base method. +func (m *MockAccountKeeper) GetModuleAddress(moduleName string) types.AccAddress { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetModuleAddress", moduleName) + ret0, _ := ret[0].(types.AccAddress) + return ret0 +} + +// GetModuleAddress indicates an expected call of GetModuleAddress. +func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(moduleName interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddress", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddress), moduleName) +} + +// MockBankKeeper is a mock of BankKeeper interface. +type MockBankKeeper struct { + ctrl *gomock.Controller + recorder *MockBankKeeperMockRecorder +} + +// MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. +type MockBankKeeperMockRecorder struct { + mock *MockBankKeeper +} + +// NewMockBankKeeper creates a new mock instance. +func NewMockBankKeeper(ctrl *gomock.Controller) *MockBankKeeper { + mock := &MockBankKeeper{ctrl: ctrl} + mock.recorder = &MockBankKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder { + return m.recorder +} + +// BurnCoins mocks base method. +func (m *MockBankKeeper) BurnCoins(ctx types.Context, moduleName string, amt types.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BurnCoins", ctx, moduleName, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// BurnCoins indicates an expected call of BurnCoins. +func (mr *MockBankKeeperMockRecorder) BurnCoins(ctx, moduleName, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BurnCoins", reflect.TypeOf((*MockBankKeeper)(nil).BurnCoins), ctx, moduleName, amt) +} + +// IsSendEnabledCoins mocks base method. +func (m *MockBankKeeper) IsSendEnabledCoins(ctx types.Context, coins ...types.Coin) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range coins { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "IsSendEnabledCoins", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// IsSendEnabledCoins indicates an expected call of IsSendEnabledCoins. +func (mr *MockBankKeeperMockRecorder) IsSendEnabledCoins(ctx interface{}, coins ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, coins...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSendEnabledCoins", reflect.TypeOf((*MockBankKeeper)(nil).IsSendEnabledCoins), varargs...) +} + +// SendCoinsFromAccountToModule mocks base method. +func (m *MockBankKeeper) SendCoinsFromAccountToModule(ctx types.Context, senderAddr types.AccAddress, recipientModule string, amt types.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendCoinsFromAccountToModule", ctx, senderAddr, recipientModule, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendCoinsFromAccountToModule indicates an expected call of SendCoinsFromAccountToModule. +func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromAccountToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt) +} diff --git a/x/fbridge/testutil/setup.go b/x/fbridge/testutil/setup.go new file mode 100644 index 0000000000..029772fac0 --- /dev/null +++ b/x/fbridge/testutil/setup.go @@ -0,0 +1,75 @@ +package testutil + +import ( + "testing" + + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" + "github.com/tendermint/tendermint/libs/log" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + dbm "github.com/tendermint/tm-db" + + "github.com/Finschia/finschia-sdk/client" + "github.com/Finschia/finschia-sdk/codec" + codectypes "github.com/Finschia/finschia-sdk/codec/types" + "github.com/Finschia/finschia-sdk/std" + "github.com/Finschia/finschia-sdk/store" + storetypes "github.com/Finschia/finschia-sdk/store/types" + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/x/auth/tx" + "github.com/Finschia/finschia-sdk/x/fbridge/types" +) + +func DefaultContextWithDB(tb testing.TB, key, tkey storetypes.StoreKey) sdk.Context { + tb.Helper() + db := dbm.NewMemDB() + cms := store.NewCommitMultiStore(db) + cms.MountStoreWithDB(key, storetypes.StoreTypeIAVL, db) + cms.MountStoreWithDB(tkey, storetypes.StoreTypeTransient, db) + err := cms.LoadLatestVersion() + assert.NoError(tb, err) + + ctx := sdk.NewContext(cms, tmproto.Header{}, false, log.NewNopLogger()) + + return ctx +} + +type TestEncodingConfig struct { + InterfaceRegistry codectypes.InterfaceRegistry + Codec codec.Codec + TxConfig client.TxConfig + Amino *codec.LegacyAmino +} + +func MakeTestEncodingConfig() TestEncodingConfig { + cdc := codec.NewLegacyAmino() + interfaceRegistry := codectypes.NewInterfaceRegistry() + marshaler := codec.NewProtoCodec(interfaceRegistry) + + encCfg := TestEncodingConfig{ + InterfaceRegistry: interfaceRegistry, + Codec: marshaler, + TxConfig: tx.NewTxConfig(marshaler, tx.DefaultSignModes), + Amino: cdc, + } + + std.RegisterLegacyAminoCodec(encCfg.Amino) + std.RegisterInterfaces(encCfg.InterfaceRegistry) + types.RegisterLegacyAminoCodec(encCfg.Amino) + types.RegisterInterfaces(encCfg.InterfaceRegistry) + return encCfg +} + +func PrepareFbridgeTest(tb testing.TB) (*sdk.KVStoreKey, sdk.Context, TestEncodingConfig, *MockAccountKeeper, *MockBankKeeper) { + tb.Helper() + + ctrl := gomock.NewController(tb) + key := storetypes.NewKVStoreKey(types.StoreKey) + ctx := DefaultContextWithDB(tb, key, sdk.NewTransientStoreKey("transient_test")) + encCfg := MakeTestEncodingConfig() + + authKeeper := NewMockAccountKeeper(ctrl) + bankKeeper := NewMockBankKeeper(ctrl) + + return key, ctx, encCfg, authKeeper, bankKeeper +} diff --git a/x/fbridge/types/codec.go b/x/fbridge/types/codec.go new file mode 100644 index 0000000000..c2edd215be --- /dev/null +++ b/x/fbridge/types/codec.go @@ -0,0 +1,63 @@ +package types + +import ( + "github.com/Finschia/finschia-sdk/codec" + "github.com/Finschia/finschia-sdk/codec/legacy" + "github.com/Finschia/finschia-sdk/codec/types" + cryptocodec "github.com/Finschia/finschia-sdk/crypto/codec" + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/types/msgservice" + authzcodec "github.com/Finschia/finschia-sdk/x/authz/codec" + fdncodec "github.com/Finschia/finschia-sdk/x/foundation/codec" + govcodec "github.com/Finschia/finschia-sdk/x/gov/codec" +) + +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + legacy.RegisterAminoMsg(cdc, &MsgTransfer{}, "lbm-sdk/MsgTransfer") + legacy.RegisterAminoMsg(cdc, &MsgProvision{}, "lbm-sdk/MsgProvision") + legacy.RegisterAminoMsg(cdc, &MsgHoldTransfer{}, "lbm-sdk/MsgHoldTransfer") + legacy.RegisterAminoMsg(cdc, &MsgReleaseTransfer{}, "lbm-sdk/MsgReleaseTransfer") + legacy.RegisterAminoMsg(cdc, &MsgRemoveProvision{}, "lbm-sdk/MsgRemoveProvision") + legacy.RegisterAminoMsg(cdc, &MsgClaimBatch{}, "lbm-sdk/MsgClaimBatch") + legacy.RegisterAminoMsg(cdc, &MsgClaim{}, "lbm-sdk/MsgClaim") + legacy.RegisterAminoMsg(cdc, &MsgSuggestRole{}, "lbm-sdk/MsgSuggestRole") + legacy.RegisterAminoMsg(cdc, &MsgAddVoteForRole{}, "lbm-sdk/MsgAddVoteForRole") + legacy.RegisterAminoMsg(cdc, &MsgHalt{}, "lbm-sdk/MsgHalt") + legacy.RegisterAminoMsg(cdc, &MsgResume{}, "lbm-sdk/MsgResume") +} + +func RegisterInterfaces(registrar types.InterfaceRegistry) { + registrar.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgTransfer{}, + &MsgProvision{}, + &MsgHoldTransfer{}, + &MsgReleaseTransfer{}, + &MsgRemoveProvision{}, + &MsgClaimBatch{}, + &MsgClaim{}, + &MsgSuggestRole{}, + &MsgAddVoteForRole{}, + &MsgHalt{}, + &MsgResume{}, + ) + + msgservice.RegisterMsgServiceDesc(registrar, &_Msg_serviceDesc) +} + +var ( + Amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(Amino) +) + +func init() { + cryptocodec.RegisterCrypto(Amino) + codec.RegisterEvidences(Amino) + sdk.RegisterLegacyAminoCodec(Amino) + + // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be + // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances + RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(govcodec.Amino) + RegisterLegacyAminoCodec(fdncodec.Amino) +} diff --git a/x/fbridge/types/event.pb.go b/x/fbridge/types/event.pb.go new file mode 100644 index 0000000000..0749710deb --- /dev/null +++ b/x/fbridge/types/event.pb.go @@ -0,0 +1,1292 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lbm/fbridge/v1/event.proto + +package types + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type EventTransfer struct { + // the sequence number of the bridge request + Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` + // the sender address on the source chain + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + // the recipient address on the destination chain + Receiver string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"` + // the amount of token to be transferred + Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (m *EventTransfer) Reset() { *m = EventTransfer{} } +func (m *EventTransfer) String() string { return proto.CompactTextString(m) } +func (*EventTransfer) ProtoMessage() {} +func (*EventTransfer) Descriptor() ([]byte, []int) { + return fileDescriptor_a36aa6e56f2275b8, []int{0} +} +func (m *EventTransfer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventTransfer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventTransfer.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventTransfer) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventTransfer.Merge(m, src) +} +func (m *EventTransfer) XXX_Size() int { + return m.Size() +} +func (m *EventTransfer) XXX_DiscardUnknown() { + xxx_messageInfo_EventTransfer.DiscardUnknown(m) +} + +var xxx_messageInfo_EventTransfer proto.InternalMessageInfo + +func (m *EventTransfer) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +func (m *EventTransfer) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *EventTransfer) GetReceiver() string { + if m != nil { + return m.Receiver + } + return "" +} + +func (m *EventTransfer) GetAmount() string { + if m != nil { + return m.Amount + } + return "" +} + +type EventProvision struct { + // the sequence number of the bridge request + Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` + // the sender address on the source chain + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + // the recipient address on the destination chain + Receiver string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"` + // the amount of token to be claimed + Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` + // the address of the operator + Operator string `protobuf:"bytes,5,opt,name=operator,proto3" json:"operator,omitempty"` +} + +func (m *EventProvision) Reset() { *m = EventProvision{} } +func (m *EventProvision) String() string { return proto.CompactTextString(m) } +func (*EventProvision) ProtoMessage() {} +func (*EventProvision) Descriptor() ([]byte, []int) { + return fileDescriptor_a36aa6e56f2275b8, []int{1} +} +func (m *EventProvision) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventProvision) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventProvision.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventProvision) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventProvision.Merge(m, src) +} +func (m *EventProvision) XXX_Size() int { + return m.Size() +} +func (m *EventProvision) XXX_DiscardUnknown() { + xxx_messageInfo_EventProvision.DiscardUnknown(m) +} + +var xxx_messageInfo_EventProvision proto.InternalMessageInfo + +func (m *EventProvision) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +func (m *EventProvision) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *EventProvision) GetReceiver() string { + if m != nil { + return m.Receiver + } + return "" +} + +func (m *EventProvision) GetAmount() string { + if m != nil { + return m.Amount + } + return "" +} + +func (m *EventProvision) GetOperator() string { + if m != nil { + return m.Operator + } + return "" +} + +type EventConfirmProvision struct { + // the sequence number of the bridge request + Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` +} + +func (m *EventConfirmProvision) Reset() { *m = EventConfirmProvision{} } +func (m *EventConfirmProvision) String() string { return proto.CompactTextString(m) } +func (*EventConfirmProvision) ProtoMessage() {} +func (*EventConfirmProvision) Descriptor() ([]byte, []int) { + return fileDescriptor_a36aa6e56f2275b8, []int{2} +} +func (m *EventConfirmProvision) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventConfirmProvision) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventConfirmProvision.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventConfirmProvision) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventConfirmProvision.Merge(m, src) +} +func (m *EventConfirmProvision) XXX_Size() int { + return m.Size() +} +func (m *EventConfirmProvision) XXX_DiscardUnknown() { + xxx_messageInfo_EventConfirmProvision.DiscardUnknown(m) +} + +var xxx_messageInfo_EventConfirmProvision proto.InternalMessageInfo + +func (m *EventConfirmProvision) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +type EventClaim struct { + // the sequence number of the bridge request + Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` + // the sender address on the source chain + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + // the recipient address on the destination chain + Receiver string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"` + // the amount of token to be claimed + Amount string `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (m *EventClaim) Reset() { *m = EventClaim{} } +func (m *EventClaim) String() string { return proto.CompactTextString(m) } +func (*EventClaim) ProtoMessage() {} +func (*EventClaim) Descriptor() ([]byte, []int) { + return fileDescriptor_a36aa6e56f2275b8, []int{3} +} +func (m *EventClaim) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventClaim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventClaim.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventClaim) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventClaim.Merge(m, src) +} +func (m *EventClaim) XXX_Size() int { + return m.Size() +} +func (m *EventClaim) XXX_DiscardUnknown() { + xxx_messageInfo_EventClaim.DiscardUnknown(m) +} + +var xxx_messageInfo_EventClaim proto.InternalMessageInfo + +func (m *EventClaim) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +func (m *EventClaim) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *EventClaim) GetReceiver() string { + if m != nil { + return m.Receiver + } + return "" +} + +func (m *EventClaim) GetAmount() string { + if m != nil { + return m.Amount + } + return "" +} + +func init() { + proto.RegisterType((*EventTransfer)(nil), "lbm.fbridge.v1.EventTransfer") + proto.RegisterType((*EventProvision)(nil), "lbm.fbridge.v1.EventProvision") + proto.RegisterType((*EventConfirmProvision)(nil), "lbm.fbridge.v1.EventConfirmProvision") + proto.RegisterType((*EventClaim)(nil), "lbm.fbridge.v1.EventClaim") +} + +func init() { proto.RegisterFile("lbm/fbridge/v1/event.proto", fileDescriptor_a36aa6e56f2275b8) } + +var fileDescriptor_a36aa6e56f2275b8 = []byte{ + // 276 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x91, 0xbd, 0x4e, 0xc3, 0x30, + 0x10, 0xc7, 0x63, 0x5a, 0x2a, 0xb0, 0x44, 0x85, 0x22, 0x81, 0xa2, 0x0e, 0x56, 0x95, 0xa9, 0x0c, + 0xc4, 0x54, 0xbc, 0x01, 0x08, 0x06, 0x26, 0x54, 0x31, 0xb1, 0xe5, 0xe3, 0xd2, 0x1a, 0x62, 0x3b, + 0x9c, 0x5d, 0x0b, 0x5e, 0x81, 0x89, 0xc7, 0x62, 0xec, 0xc8, 0x88, 0x92, 0x17, 0x41, 0xf9, 0xa0, + 0x63, 0xb7, 0x6e, 0xf7, 0xd3, 0xff, 0x7e, 0xba, 0xbf, 0x74, 0x74, 0x52, 0x24, 0x92, 0xe7, 0x09, + 0x8a, 0x6c, 0x09, 0xdc, 0xcd, 0x39, 0x38, 0x50, 0x36, 0x2a, 0x51, 0x5b, 0xed, 0x8f, 0x8b, 0x44, + 0x46, 0x7d, 0x16, 0xb9, 0x79, 0x28, 0xe9, 0xc9, 0x5d, 0x13, 0x3f, 0x61, 0xac, 0x4c, 0x0e, 0xe8, + 0x9f, 0xd2, 0x81, 0x81, 0xb7, 0x80, 0x4c, 0xc9, 0x6c, 0xb8, 0x68, 0x46, 0xff, 0x9c, 0x8e, 0x0c, + 0xa8, 0x0c, 0x30, 0x38, 0x98, 0x92, 0xd9, 0xf1, 0xa2, 0x27, 0x7f, 0x42, 0x8f, 0x10, 0x52, 0x10, + 0x0e, 0x30, 0x18, 0xb4, 0xc9, 0x96, 0x1b, 0x27, 0x96, 0x7a, 0xad, 0x6c, 0x30, 0xec, 0x9c, 0x8e, + 0xc2, 0x4f, 0x42, 0xc7, 0xed, 0xbd, 0x47, 0xd4, 0x4e, 0x18, 0xa1, 0xd5, 0x7e, 0x0f, 0x36, 0x8e, + 0x2e, 0x01, 0x63, 0xab, 0x31, 0x38, 0xec, 0x9c, 0x7f, 0x0e, 0x2f, 0xe8, 0x59, 0xdb, 0xe5, 0x56, + 0xab, 0x5c, 0xa0, 0xdc, 0x51, 0x29, 0x7c, 0xa1, 0xb4, 0x5b, 0x2d, 0x62, 0x21, 0xf7, 0x5b, 0xf9, + 0xe6, 0xe1, 0xbb, 0x62, 0x64, 0x53, 0x31, 0xf2, 0x5b, 0x31, 0xf2, 0x55, 0x33, 0x6f, 0x53, 0x33, + 0xef, 0xa7, 0x66, 0xde, 0xf3, 0xd5, 0x52, 0xd8, 0xd5, 0x3a, 0x89, 0x52, 0x2d, 0xf9, 0xbd, 0x50, + 0x26, 0x5d, 0x89, 0x98, 0xe7, 0xfd, 0x70, 0x69, 0xb2, 0x57, 0xfe, 0xbe, 0xfd, 0xbb, 0xfd, 0x28, + 0xc1, 0x24, 0xa3, 0xf6, 0xeb, 0xd7, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3b, 0x5f, 0xda, 0xeb, + 0x13, 0x02, 0x00, 0x00, +} + +func (m *EventTransfer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventTransfer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventTransfer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + i -= len(m.Amount) + copy(dAtA[i:], m.Amount) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Amount))) + i-- + dAtA[i] = 0x22 + } + if len(m.Receiver) > 0 { + i -= len(m.Receiver) + copy(dAtA[i:], m.Receiver) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Receiver))) + i-- + dAtA[i] = 0x1a + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + if m.Seq != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EventProvision) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventProvision) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventProvision) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Operator) > 0 { + i -= len(m.Operator) + copy(dAtA[i:], m.Operator) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Operator))) + i-- + dAtA[i] = 0x2a + } + if len(m.Amount) > 0 { + i -= len(m.Amount) + copy(dAtA[i:], m.Amount) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Amount))) + i-- + dAtA[i] = 0x22 + } + if len(m.Receiver) > 0 { + i -= len(m.Receiver) + copy(dAtA[i:], m.Receiver) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Receiver))) + i-- + dAtA[i] = 0x1a + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + if m.Seq != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EventConfirmProvision) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventConfirmProvision) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventConfirmProvision) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Seq != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EventClaim) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventClaim) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + i -= len(m.Amount) + copy(dAtA[i:], m.Amount) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Amount))) + i-- + dAtA[i] = 0x22 + } + if len(m.Receiver) > 0 { + i -= len(m.Receiver) + copy(dAtA[i:], m.Receiver) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Receiver))) + i-- + dAtA[i] = 0x1a + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + if m.Seq != 0 { + i = encodeVarintEvent(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintEvent(dAtA []byte, offset int, v uint64) int { + offset -= sovEvent(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EventTransfer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Seq != 0 { + n += 1 + sovEvent(uint64(m.Seq)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.Receiver) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.Amount) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventProvision) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Seq != 0 { + n += 1 + sovEvent(uint64(m.Seq)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.Receiver) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.Amount) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.Operator) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func (m *EventConfirmProvision) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Seq != 0 { + n += 1 + sovEvent(uint64(m.Seq)) + } + return n +} + +func (m *EventClaim) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Seq != 0 { + n += 1 + sovEvent(uint64(m.Seq)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.Receiver) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = len(m.Amount) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + return n +} + +func sovEvent(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvent(x uint64) (n int) { + return sovEvent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EventTransfer) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventTransfer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventTransfer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventProvision) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventProvision: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventProvision: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Operator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventConfirmProvision) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventConfirmProvision: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventConfirmProvision: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventClaim) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventClaim: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventClaim: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvent(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEvent + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvent + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvent + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvent = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvent = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvent = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/fbridge/types/expected_keepers.go b/x/fbridge/types/expected_keepers.go new file mode 100644 index 0000000000..ea23be5d64 --- /dev/null +++ b/x/fbridge/types/expected_keepers.go @@ -0,0 +1,15 @@ +package types + +import ( + sdk "github.com/Finschia/finschia-sdk/types" +) + +type AccountKeeper interface { + GetModuleAddress(moduleName string) sdk.AccAddress +} + +type BankKeeper interface { + SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + IsSendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) error + BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error +} diff --git a/x/fbridge/types/fbridge.pb.go b/x/fbridge/types/fbridge.pb.go new file mode 100644 index 0000000000..a9b8197a74 --- /dev/null +++ b/x/fbridge/types/fbridge.pb.go @@ -0,0 +1,1629 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lbm/fbridge/v1/fbridge.proto + +package types + +import ( + fmt "fmt" + github_com_Finschia_finschia_sdk_types "github.com/Finschia/finschia-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Role defines the role of the operator, guardian, and judge. +type Role int32 + +const ( + Role_UNSPECIFIED Role = 0 + Role_GUARDIAN Role = 1 + Role_OPERATOR Role = 2 + Role_JUDGE Role = 3 +) + +var Role_name = map[int32]string{ + 0: "UNSPECIFIED", + 1: "GUARDIAN", + 2: "OPERATOR", + 3: "JUDGE", +} + +var Role_value = map[string]int32{ + "UNSPECIFIED": 0, + "GUARDIAN": 1, + "OPERATOR": 2, + "JUDGE": 3, +} + +func (x Role) String() string { + return proto.EnumName(Role_name, int32(x)) +} + +func (Role) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_62374d75fc6aa1ba, []int{0} +} + +type Params struct { + // ratio of how many operators' confirmations are needed to be valid. + OperatorTrustLevel Fraction `protobuf:"bytes,1,opt,name=operator_trust_level,json=operatorTrustLevel,proto3" json:"operator_trust_level"` + // ratio of how many guardians' confirmations are needed to be valid. + GuardianTrustLevel Fraction `protobuf:"bytes,2,opt,name=guardian_trust_level,json=guardianTrustLevel,proto3" json:"guardian_trust_level"` + // ratio of how many judges' confirmations are needed to be valid. + JudgeTrustLevel Fraction `protobuf:"bytes,3,opt,name=judge_trust_level,json=judgeTrustLevel,proto3" json:"judge_trust_level"` + // default timelock period for each provision (unix timestamp) + TimelockPeriod uint64 `protobuf:"varint,4,opt,name=timelock_period,json=timelockPeriod,proto3" json:"timelock_period,omitempty"` + // default period of the proposal to update the role + ProposalPeriod uint64 `protobuf:"varint,5,opt,name=proposal_period,json=proposalPeriod,proto3" json:"proposal_period,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_62374d75fc6aa1ba, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetOperatorTrustLevel() Fraction { + if m != nil { + return m.OperatorTrustLevel + } + return Fraction{} +} + +func (m *Params) GetGuardianTrustLevel() Fraction { + if m != nil { + return m.GuardianTrustLevel + } + return Fraction{} +} + +func (m *Params) GetJudgeTrustLevel() Fraction { + if m != nil { + return m.JudgeTrustLevel + } + return Fraction{} +} + +func (m *Params) GetTimelockPeriod() uint64 { + if m != nil { + return m.TimelockPeriod + } + return 0 +} + +func (m *Params) GetProposalPeriod() uint64 { + if m != nil { + return m.ProposalPeriod + } + return 0 +} + +// Provision is a struct that represents a provision internally. +type ProvisionData struct { + // the sequence number of the bridge request + Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` + // the amount of token to be claimed + Amount github_com_Finschia_finschia_sdk_types.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=github.com/Finschia/finschia-sdk/types.Int" json:"amount"` + // the sender address on the source chain + Sender string `protobuf:"bytes,3,opt,name=sender,proto3" json:"sender,omitempty"` + // the recipient address on the destination chain + Receiver string `protobuf:"bytes,4,opt,name=receiver,proto3" json:"receiver,omitempty"` +} + +func (m *ProvisionData) Reset() { *m = ProvisionData{} } +func (m *ProvisionData) String() string { return proto.CompactTextString(m) } +func (*ProvisionData) ProtoMessage() {} +func (*ProvisionData) Descriptor() ([]byte, []int) { + return fileDescriptor_62374d75fc6aa1ba, []int{1} +} +func (m *ProvisionData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProvisionData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ProvisionData.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ProvisionData) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProvisionData.Merge(m, src) +} +func (m *ProvisionData) XXX_Size() int { + return m.Size() +} +func (m *ProvisionData) XXX_DiscardUnknown() { + xxx_messageInfo_ProvisionData.DiscardUnknown(m) +} + +var xxx_messageInfo_ProvisionData proto.InternalMessageInfo + +func (m *ProvisionData) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +func (m *ProvisionData) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *ProvisionData) GetReceiver() string { + if m != nil { + return m.Receiver + } + return "" +} + +// ProvisionStatus is a struct that represents the status of a provision. +// To optimize computational cost, we have collected frequently changing values from provision. +type ProvisionStatus struct { + // the unix timestamp the provision will be able to be claimed (unix timestamp) + TimelockEnd uint64 `protobuf:"varint,1,opt,name=timelock_end,json=timelockEnd,proto3" json:"timelock_end,omitempty"` + // a value that tells how many operators have submitted this provision + ConfirmCounts int32 `protobuf:"varint,2,opt,name=confirm_counts,json=confirmCounts,proto3" json:"confirm_counts,omitempty"` + // whether the provision has been claimed + IsClaimed bool `protobuf:"varint,3,opt,name=is_claimed,json=isClaimed,proto3" json:"is_claimed,omitempty"` +} + +func (m *ProvisionStatus) Reset() { *m = ProvisionStatus{} } +func (m *ProvisionStatus) String() string { return proto.CompactTextString(m) } +func (*ProvisionStatus) ProtoMessage() {} +func (*ProvisionStatus) Descriptor() ([]byte, []int) { + return fileDescriptor_62374d75fc6aa1ba, []int{2} +} +func (m *ProvisionStatus) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProvisionStatus) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ProvisionStatus.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ProvisionStatus) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProvisionStatus.Merge(m, src) +} +func (m *ProvisionStatus) XXX_Size() int { + return m.Size() +} +func (m *ProvisionStatus) XXX_DiscardUnknown() { + xxx_messageInfo_ProvisionStatus.DiscardUnknown(m) +} + +var xxx_messageInfo_ProvisionStatus proto.InternalMessageInfo + +func (m *ProvisionStatus) GetTimelockEnd() uint64 { + if m != nil { + return m.TimelockEnd + } + return 0 +} + +func (m *ProvisionStatus) GetConfirmCounts() int32 { + if m != nil { + return m.ConfirmCounts + } + return 0 +} + +func (m *ProvisionStatus) GetIsClaimed() bool { + if m != nil { + return m.IsClaimed + } + return false +} + +// Fraction defines the protobuf message type for tmmath.Fraction that only +// supports positive values. +type Fraction struct { + Numerator uint64 `protobuf:"varint,1,opt,name=numerator,proto3" json:"numerator,omitempty"` + Denominator uint64 `protobuf:"varint,2,opt,name=denominator,proto3" json:"denominator,omitempty"` +} + +func (m *Fraction) Reset() { *m = Fraction{} } +func (m *Fraction) String() string { return proto.CompactTextString(m) } +func (*Fraction) ProtoMessage() {} +func (*Fraction) Descriptor() ([]byte, []int) { + return fileDescriptor_62374d75fc6aa1ba, []int{3} +} +func (m *Fraction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Fraction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Fraction.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Fraction) XXX_Merge(src proto.Message) { + xxx_messageInfo_Fraction.Merge(m, src) +} +func (m *Fraction) XXX_Size() int { + return m.Size() +} +func (m *Fraction) XXX_DiscardUnknown() { + xxx_messageInfo_Fraction.DiscardUnknown(m) +} + +var xxx_messageInfo_Fraction proto.InternalMessageInfo + +func (m *Fraction) GetNumerator() uint64 { + if m != nil { + return m.Numerator + } + return 0 +} + +func (m *Fraction) GetDenominator() uint64 { + if m != nil { + return m.Denominator + } + return 0 +} + +type RoleProposal struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // the proposer address + Proposer string `protobuf:"bytes,2,opt,name=proposer,proto3" json:"proposer,omitempty"` + // the address to update the role + Target string `protobuf:"bytes,3,opt,name=target,proto3" json:"target,omitempty"` + // the role to be updated + // - unspecified : 0, used to remove the address from a group + // - guardian : 1 + // - operator : 2 + // - judge : 3 + Role Role `protobuf:"varint,4,opt,name=role,proto3,enum=lbm.fbridge.v1.Role" json:"role,omitempty"` + // the unix timestamp the proposal will be expired (unix timestamp) + ExpiredAt uint64 `protobuf:"varint,5,opt,name=expired_at,json=expiredAt,proto3" json:"expired_at,omitempty"` +} + +func (m *RoleProposal) Reset() { *m = RoleProposal{} } +func (m *RoleProposal) String() string { return proto.CompactTextString(m) } +func (*RoleProposal) ProtoMessage() {} +func (*RoleProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_62374d75fc6aa1ba, []int{4} +} +func (m *RoleProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RoleProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RoleProposal.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RoleProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_RoleProposal.Merge(m, src) +} +func (m *RoleProposal) XXX_Size() int { + return m.Size() +} +func (m *RoleProposal) XXX_DiscardUnknown() { + xxx_messageInfo_RoleProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_RoleProposal proto.InternalMessageInfo + +func (m *RoleProposal) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *RoleProposal) GetProposer() string { + if m != nil { + return m.Proposer + } + return "" +} + +func (m *RoleProposal) GetTarget() string { + if m != nil { + return m.Target + } + return "" +} + +func (m *RoleProposal) GetRole() Role { + if m != nil { + return m.Role + } + return Role_UNSPECIFIED +} + +func (m *RoleProposal) GetExpiredAt() uint64 { + if m != nil { + return m.ExpiredAt + } + return 0 +} + +func init() { + proto.RegisterEnum("lbm.fbridge.v1.Role", Role_name, Role_value) + proto.RegisterType((*Params)(nil), "lbm.fbridge.v1.Params") + proto.RegisterType((*ProvisionData)(nil), "lbm.fbridge.v1.ProvisionData") + proto.RegisterType((*ProvisionStatus)(nil), "lbm.fbridge.v1.ProvisionStatus") + proto.RegisterType((*Fraction)(nil), "lbm.fbridge.v1.Fraction") + proto.RegisterType((*RoleProposal)(nil), "lbm.fbridge.v1.RoleProposal") +} + +func init() { proto.RegisterFile("lbm/fbridge/v1/fbridge.proto", fileDescriptor_62374d75fc6aa1ba) } + +var fileDescriptor_62374d75fc6aa1ba = []byte{ + // 614 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x41, 0x4f, 0x1b, 0x3d, + 0x10, 0xcd, 0x86, 0x10, 0x65, 0x27, 0x90, 0xe4, 0xb3, 0xd0, 0x27, 0x84, 0x68, 0xa0, 0x91, 0xaa, + 0x22, 0xa4, 0x26, 0x85, 0xde, 0x2b, 0x05, 0x12, 0x50, 0xa2, 0x0a, 0x56, 0x06, 0x2e, 0xbd, 0x44, + 0xce, 0xae, 0x59, 0x5c, 0x76, 0xed, 0xad, 0xed, 0x8d, 0x68, 0x7f, 0x45, 0xef, 0x3d, 0xf5, 0xdf, + 0xa0, 0x9e, 0x38, 0x56, 0x3d, 0xa0, 0x0a, 0xfe, 0x48, 0x65, 0xef, 0x6e, 0x0a, 0xbd, 0x94, 0xdb, + 0xcc, 0xdb, 0x37, 0xcf, 0xcf, 0xcf, 0x93, 0xc0, 0x7a, 0x34, 0x8d, 0x7b, 0xe7, 0x53, 0xc9, 0x82, + 0x90, 0xf6, 0x66, 0x3b, 0x45, 0xd9, 0x4d, 0xa4, 0xd0, 0x02, 0x35, 0xa2, 0x69, 0xdc, 0x2d, 0xa0, + 0xd9, 0xce, 0xda, 0x4a, 0x28, 0x42, 0x61, 0x3f, 0xf5, 0x4c, 0x95, 0xb1, 0x3a, 0xdf, 0xcb, 0x50, + 0xf5, 0x88, 0x24, 0xb1, 0x42, 0x1e, 0xac, 0x88, 0x84, 0x4a, 0xa2, 0x85, 0x9c, 0x68, 0x99, 0x2a, + 0x3d, 0x89, 0xe8, 0x8c, 0x46, 0xab, 0xce, 0xa6, 0xb3, 0x55, 0xdf, 0x5d, 0xed, 0x3e, 0xd6, 0xeb, + 0x1e, 0x48, 0xe2, 0x6b, 0x26, 0xf8, 0x5e, 0xe5, 0xfa, 0x76, 0xa3, 0x84, 0x51, 0x31, 0x7b, 0x6a, + 0x46, 0xdf, 0x99, 0x49, 0xa3, 0x18, 0xa6, 0x44, 0x06, 0x8c, 0xf0, 0x47, 0x8a, 0xe5, 0xa7, 0x29, + 0x16, 0xb3, 0x0f, 0x14, 0xc7, 0xf0, 0xdf, 0x87, 0x34, 0x08, 0xe9, 0x23, 0xb9, 0x85, 0x27, 0xc9, + 0x35, 0xed, 0xe0, 0x03, 0xad, 0x97, 0xd0, 0xd4, 0x2c, 0xa6, 0x91, 0xf0, 0x2f, 0x27, 0x09, 0x95, + 0x4c, 0x04, 0xab, 0x95, 0x4d, 0x67, 0xab, 0x82, 0x1b, 0x05, 0xec, 0x59, 0xd4, 0x10, 0x13, 0x29, + 0x12, 0xa1, 0x48, 0x54, 0x10, 0x17, 0x33, 0x62, 0x01, 0x67, 0xc4, 0xce, 0x37, 0x07, 0x96, 0x3d, + 0x29, 0x66, 0x4c, 0x31, 0xc1, 0x07, 0x44, 0x13, 0xd4, 0x82, 0x05, 0x45, 0x3f, 0xda, 0x08, 0x2b, + 0xd8, 0x94, 0x68, 0x0c, 0x55, 0x12, 0x8b, 0x94, 0x6b, 0x9b, 0x82, 0xbb, 0xb7, 0x6b, 0xcc, 0xfd, + 0xbc, 0xdd, 0xd8, 0x0e, 0x99, 0xbe, 0x48, 0xa7, 0x5d, 0x5f, 0xc4, 0xbd, 0x03, 0xc6, 0x95, 0x7f, + 0xc1, 0x48, 0xef, 0x3c, 0x2f, 0x5e, 0xa9, 0xe0, 0xb2, 0xa7, 0x3f, 0x25, 0x54, 0x75, 0x47, 0x5c, + 0xe3, 0x5c, 0x01, 0xfd, 0x0f, 0x55, 0x45, 0x79, 0x40, 0xa5, 0x8d, 0xc0, 0xc5, 0x79, 0x87, 0xd6, + 0xa0, 0x26, 0xa9, 0x4f, 0xd9, 0x8c, 0x4a, 0x7b, 0x25, 0x17, 0xcf, 0xfb, 0xce, 0x67, 0x68, 0xce, + 0x2d, 0x9e, 0x68, 0xa2, 0x53, 0x85, 0x9e, 0xc3, 0xd2, 0x3c, 0x08, 0xca, 0x83, 0xdc, 0x6d, 0xbd, + 0xc0, 0x86, 0x3c, 0x40, 0x2f, 0xa0, 0xe1, 0x0b, 0x7e, 0xce, 0x64, 0x3c, 0xf1, 0xcd, 0xd1, 0xca, + 0xba, 0x5f, 0xc4, 0xcb, 0x39, 0xba, 0x6f, 0x41, 0xf4, 0x0c, 0x80, 0xa9, 0x89, 0x1f, 0x11, 0x16, + 0xd3, 0xc0, 0x9a, 0xaa, 0x61, 0x97, 0xa9, 0xfd, 0x0c, 0xe8, 0x8c, 0xa1, 0x56, 0x3c, 0x0a, 0x5a, + 0x07, 0x97, 0xa7, 0x71, 0xb6, 0x32, 0xf9, 0x89, 0x7f, 0x00, 0xb4, 0x09, 0xf5, 0x80, 0x72, 0x11, + 0x33, 0x6e, 0xbf, 0x97, 0x33, 0x47, 0x0f, 0xa0, 0xce, 0x57, 0x07, 0x96, 0xb0, 0x88, 0xa8, 0x97, + 0x3f, 0x01, 0x6a, 0x40, 0x99, 0x15, 0xde, 0xcb, 0x2c, 0x30, 0x21, 0x64, 0xcf, 0x43, 0xb3, 0x79, + 0x17, 0xcf, 0x7b, 0x13, 0x9c, 0x26, 0x32, 0xa4, 0xba, 0x08, 0x2e, 0xeb, 0xd0, 0x16, 0x54, 0xa4, + 0x88, 0xa8, 0x0d, 0xad, 0xb1, 0xbb, 0xf2, 0xf7, 0x46, 0x99, 0xf3, 0xb0, 0x65, 0x98, 0x9b, 0xd2, + 0xab, 0x84, 0x49, 0x1a, 0x4c, 0x88, 0xce, 0xd7, 0xc1, 0xcd, 0x91, 0xbe, 0xde, 0x7e, 0x0b, 0x15, + 0x43, 0x46, 0x4d, 0xa8, 0x9f, 0x1d, 0x9d, 0x78, 0xc3, 0xfd, 0xd1, 0xc1, 0x68, 0x38, 0x68, 0x95, + 0xd0, 0x12, 0xd4, 0x0e, 0xcf, 0xfa, 0x78, 0x30, 0xea, 0x1f, 0xb5, 0x1c, 0xd3, 0x1d, 0x7b, 0x43, + 0xdc, 0x3f, 0x3d, 0xc6, 0xad, 0x32, 0x72, 0x61, 0x71, 0x7c, 0x36, 0x38, 0x1c, 0xb6, 0x16, 0xf6, + 0xc6, 0xd7, 0x77, 0x6d, 0xe7, 0xe6, 0xae, 0xed, 0xfc, 0xba, 0x6b, 0x3b, 0x5f, 0xee, 0xdb, 0xa5, + 0x9b, 0xfb, 0x76, 0xe9, 0xc7, 0x7d, 0xbb, 0xf4, 0xfe, 0xf5, 0x3f, 0xf7, 0xe4, 0x6a, 0xfe, 0x9f, + 0x60, 0x37, 0x66, 0x5a, 0xb5, 0xbf, 0xf4, 0x37, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x74, 0xf3, + 0xa0, 0x53, 0x2f, 0x04, 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ProposalPeriod != 0 { + i = encodeVarintFbridge(dAtA, i, uint64(m.ProposalPeriod)) + i-- + dAtA[i] = 0x28 + } + if m.TimelockPeriod != 0 { + i = encodeVarintFbridge(dAtA, i, uint64(m.TimelockPeriod)) + i-- + dAtA[i] = 0x20 + } + { + size, err := m.JudgeTrustLevel.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFbridge(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.GuardianTrustLevel.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFbridge(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.OperatorTrustLevel.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFbridge(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ProvisionData) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ProvisionData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProvisionData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Receiver) > 0 { + i -= len(m.Receiver) + copy(dAtA[i:], m.Receiver) + i = encodeVarintFbridge(dAtA, i, uint64(len(m.Receiver))) + i-- + dAtA[i] = 0x22 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintFbridge(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x1a + } + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintFbridge(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.Seq != 0 { + i = encodeVarintFbridge(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *ProvisionStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ProvisionStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProvisionStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.IsClaimed { + i-- + if m.IsClaimed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.ConfirmCounts != 0 { + i = encodeVarintFbridge(dAtA, i, uint64(m.ConfirmCounts)) + i-- + dAtA[i] = 0x10 + } + if m.TimelockEnd != 0 { + i = encodeVarintFbridge(dAtA, i, uint64(m.TimelockEnd)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Fraction) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Fraction) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Fraction) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Denominator != 0 { + i = encodeVarintFbridge(dAtA, i, uint64(m.Denominator)) + i-- + dAtA[i] = 0x10 + } + if m.Numerator != 0 { + i = encodeVarintFbridge(dAtA, i, uint64(m.Numerator)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *RoleProposal) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RoleProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RoleProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ExpiredAt != 0 { + i = encodeVarintFbridge(dAtA, i, uint64(m.ExpiredAt)) + i-- + dAtA[i] = 0x28 + } + if m.Role != 0 { + i = encodeVarintFbridge(dAtA, i, uint64(m.Role)) + i-- + dAtA[i] = 0x20 + } + if len(m.Target) > 0 { + i -= len(m.Target) + copy(dAtA[i:], m.Target) + i = encodeVarintFbridge(dAtA, i, uint64(len(m.Target))) + i-- + dAtA[i] = 0x1a + } + if len(m.Proposer) > 0 { + i -= len(m.Proposer) + copy(dAtA[i:], m.Proposer) + i = encodeVarintFbridge(dAtA, i, uint64(len(m.Proposer))) + i-- + dAtA[i] = 0x12 + } + if m.Id != 0 { + i = encodeVarintFbridge(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintFbridge(dAtA []byte, offset int, v uint64) int { + offset -= sovFbridge(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.OperatorTrustLevel.Size() + n += 1 + l + sovFbridge(uint64(l)) + l = m.GuardianTrustLevel.Size() + n += 1 + l + sovFbridge(uint64(l)) + l = m.JudgeTrustLevel.Size() + n += 1 + l + sovFbridge(uint64(l)) + if m.TimelockPeriod != 0 { + n += 1 + sovFbridge(uint64(m.TimelockPeriod)) + } + if m.ProposalPeriod != 0 { + n += 1 + sovFbridge(uint64(m.ProposalPeriod)) + } + return n +} + +func (m *ProvisionData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Seq != 0 { + n += 1 + sovFbridge(uint64(m.Seq)) + } + l = m.Amount.Size() + n += 1 + l + sovFbridge(uint64(l)) + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovFbridge(uint64(l)) + } + l = len(m.Receiver) + if l > 0 { + n += 1 + l + sovFbridge(uint64(l)) + } + return n +} + +func (m *ProvisionStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TimelockEnd != 0 { + n += 1 + sovFbridge(uint64(m.TimelockEnd)) + } + if m.ConfirmCounts != 0 { + n += 1 + sovFbridge(uint64(m.ConfirmCounts)) + } + if m.IsClaimed { + n += 2 + } + return n +} + +func (m *Fraction) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Numerator != 0 { + n += 1 + sovFbridge(uint64(m.Numerator)) + } + if m.Denominator != 0 { + n += 1 + sovFbridge(uint64(m.Denominator)) + } + return n +} + +func (m *RoleProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovFbridge(uint64(m.Id)) + } + l = len(m.Proposer) + if l > 0 { + n += 1 + l + sovFbridge(uint64(l)) + } + l = len(m.Target) + if l > 0 { + n += 1 + l + sovFbridge(uint64(l)) + } + if m.Role != 0 { + n += 1 + sovFbridge(uint64(m.Role)) + } + if m.ExpiredAt != 0 { + n += 1 + sovFbridge(uint64(m.ExpiredAt)) + } + return n +} + +func sovFbridge(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozFbridge(x uint64) (n int) { + return sovFbridge(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorTrustLevel", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFbridge + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFbridge + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OperatorTrustLevel.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GuardianTrustLevel", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFbridge + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFbridge + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.GuardianTrustLevel.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field JudgeTrustLevel", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFbridge + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFbridge + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.JudgeTrustLevel.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimelockPeriod", wireType) + } + m.TimelockPeriod = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TimelockPeriod |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalPeriod", wireType) + } + m.ProposalPeriod = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalPeriod |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipFbridge(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFbridge + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ProvisionData) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ProvisionData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProvisionData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFbridge + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFbridge + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFbridge + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFbridge + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFbridge + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFbridge + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFbridge(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFbridge + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ProvisionStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ProvisionStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProvisionStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimelockEnd", wireType) + } + m.TimelockEnd = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TimelockEnd |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ConfirmCounts", wireType) + } + m.ConfirmCounts = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ConfirmCounts |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsClaimed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsClaimed = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipFbridge(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFbridge + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Fraction) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Fraction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Fraction: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Numerator", wireType) + } + m.Numerator = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Numerator |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Denominator", wireType) + } + m.Denominator = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Denominator |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipFbridge(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFbridge + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RoleProposal) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RoleProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RoleProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFbridge + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFbridge + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Proposer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFbridge + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFbridge + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Target = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType) + } + m.Role = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Role |= Role(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpiredAt", wireType) + } + m.ExpiredAt = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFbridge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExpiredAt |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipFbridge(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFbridge + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipFbridge(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFbridge + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFbridge + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFbridge + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthFbridge + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupFbridge + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthFbridge + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthFbridge = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowFbridge = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupFbridge = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/fbridge/types/genesis.go b/x/fbridge/types/genesis.go new file mode 100644 index 0000000000..07af6f9677 --- /dev/null +++ b/x/fbridge/types/genesis.go @@ -0,0 +1,30 @@ +package types + +import ( + "errors" + + sdk "github.com/Finschia/finschia-sdk/types" + authtypes "github.com/Finschia/finschia-sdk/x/auth/types" + govtypes "github.com/Finschia/finschia-sdk/x/gov/types" +) + +func DefaultGenesisState() *GenesisState { + return &GenesisState{ + SendingState: SendingState{ + NextSeq: 1, + }, + ReceivingState: ReceivingState{}, + } +} + +func ValidateGenesis(data GenesisState) error { + if data.SendingState.NextSeq < 1 { + panic(errors.New("next sequence must be positive")) + } + + return nil +} + +func DefaultAuthority() sdk.AccAddress { + return authtypes.NewModuleAddress(govtypes.ModuleName) +} diff --git a/x/fbridge/types/genesis.pb.go b/x/fbridge/types/genesis.pb.go new file mode 100644 index 0000000000..7b28e12f13 --- /dev/null +++ b/x/fbridge/types/genesis.pb.go @@ -0,0 +1,2347 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lbm/fbridge/v1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the fbridge module's genesis state. +type GenesisState struct { + // params defines all the parameters of the module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + // sending_state defines status saved when sending tokens to a counterpart chain + SendingState SendingState `protobuf:"bytes,2,opt,name=sending_state,json=sendingState,proto3" json:"sending_state"` + // receiving_state defines status saved when receiving tokens from a counterpart chain + ReceivingState ReceivingState `protobuf:"bytes,3,opt,name=receiving_state,json=receivingState,proto3" json:"receiving_state"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_0fc3cc4535a29f6d, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetSendingState() SendingState { + if m != nil { + return m.SendingState + } + return SendingState{} +} + +func (m *GenesisState) GetReceivingState() ReceivingState { + if m != nil { + return m.ReceivingState + } + return ReceivingState{} +} + +type SendingState struct { + // the next sequence number of the bridge request (greatest sequence number + 1) + NextSeq uint64 `protobuf:"varint,1,opt,name=next_seq,json=nextSeq,proto3" json:"next_seq,omitempty"` + // sequence-per-block number mapping + SeqToBlocknum []BlockSeqInfo `protobuf:"bytes,2,rep,name=seq_to_blocknum,json=seqToBlocknum,proto3" json:"seq_to_blocknum"` +} + +func (m *SendingState) Reset() { *m = SendingState{} } +func (m *SendingState) String() string { return proto.CompactTextString(m) } +func (*SendingState) ProtoMessage() {} +func (*SendingState) Descriptor() ([]byte, []int) { + return fileDescriptor_0fc3cc4535a29f6d, []int{1} +} +func (m *SendingState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SendingState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SendingState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SendingState) XXX_Merge(src proto.Message) { + xxx_messageInfo_SendingState.Merge(m, src) +} +func (m *SendingState) XXX_Size() int { + return m.Size() +} +func (m *SendingState) XXX_DiscardUnknown() { + xxx_messageInfo_SendingState.DiscardUnknown(m) +} + +var xxx_messageInfo_SendingState proto.InternalMessageInfo + +type BlockSeqInfo struct { + Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` + Blocknum uint64 `protobuf:"varint,2,opt,name=blocknum,proto3" json:"blocknum,omitempty"` +} + +func (m *BlockSeqInfo) Reset() { *m = BlockSeqInfo{} } +func (m *BlockSeqInfo) String() string { return proto.CompactTextString(m) } +func (*BlockSeqInfo) ProtoMessage() {} +func (*BlockSeqInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_0fc3cc4535a29f6d, []int{2} +} +func (m *BlockSeqInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BlockSeqInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BlockSeqInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BlockSeqInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockSeqInfo.Merge(m, src) +} +func (m *BlockSeqInfo) XXX_Size() int { + return m.Size() +} +func (m *BlockSeqInfo) XXX_DiscardUnknown() { + xxx_messageInfo_BlockSeqInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockSeqInfo proto.InternalMessageInfo + +func (m *BlockSeqInfo) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +func (m *BlockSeqInfo) GetBlocknum() uint64 { + if m != nil { + return m.Blocknum + } + return 0 +} + +type ReceivingState struct { + // the greatest consecutive sequence number confirmed by each operator + GreatestConsecutiveSeqByOperator []*OperatorSeqInfo `protobuf:"bytes,1,rep,name=greatest_consecutive_seq_by_operator,json=greatestConsecutiveSeqByOperator,proto3" json:"greatest_consecutive_seq_by_operator,omitempty"` + // the greatest sequence number confirmed by each operator + GreatestSeqByOperator []*OperatorSeqInfo `protobuf:"bytes,2,rep,name=greatest_seq_by_operator,json=greatestSeqByOperator,proto3" json:"greatest_seq_by_operator,omitempty"` + // the greatest consecutive sequence numbers confirmed by n-of-m operators + // consecutiveness is judged starting from the number closest to 0. + GreatestConsecutiveSeq uint64 `protobuf:"varint,3,opt,name=greatest_consecutive_seq,json=greatestConsecutiveSeq,proto3" json:"greatest_consecutive_seq,omitempty"` + // the set of sequence numbers to be claimed + PendingClaimSeqs []uint64 `protobuf:"varint,4,rep,packed,name=pending_claim_seqs,json=pendingClaimSeqs,proto3" json:"pending_claim_seqs,omitempty"` + // commitment is the hash value of a specific provision. + Commitments []*Commitment `protobuf:"bytes,6,rep,name=commitments,proto3" json:"commitments,omitempty"` + // provision associated with a specific commitment. + Provisions []*Provision `protobuf:"bytes,7,rep,name=provisions,proto3" json:"provisions,omitempty"` + // map the sequence number confirmed by n-of-m operators with commitment + ConfirmedSeqToCommitment []*ConfirmedProvision `protobuf:"bytes,8,rep,name=confirmed_seq_to_commitment,json=confirmedSeqToCommitment,proto3" json:"confirmed_seq_to_commitment,omitempty"` +} + +func (m *ReceivingState) Reset() { *m = ReceivingState{} } +func (m *ReceivingState) String() string { return proto.CompactTextString(m) } +func (*ReceivingState) ProtoMessage() {} +func (*ReceivingState) Descriptor() ([]byte, []int) { + return fileDescriptor_0fc3cc4535a29f6d, []int{3} +} +func (m *ReceivingState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ReceivingState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ReceivingState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ReceivingState) XXX_Merge(src proto.Message) { + xxx_messageInfo_ReceivingState.Merge(m, src) +} +func (m *ReceivingState) XXX_Size() int { + return m.Size() +} +func (m *ReceivingState) XXX_DiscardUnknown() { + xxx_messageInfo_ReceivingState.DiscardUnknown(m) +} + +var xxx_messageInfo_ReceivingState proto.InternalMessageInfo + +type OperatorSeqInfo struct { + // the operator address + Operator string `protobuf:"bytes,1,opt,name=operator,proto3" json:"operator,omitempty"` + // the sequence number + Seq uint64 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq,omitempty"` +} + +func (m *OperatorSeqInfo) Reset() { *m = OperatorSeqInfo{} } +func (m *OperatorSeqInfo) String() string { return proto.CompactTextString(m) } +func (*OperatorSeqInfo) ProtoMessage() {} +func (*OperatorSeqInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_0fc3cc4535a29f6d, []int{4} +} +func (m *OperatorSeqInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OperatorSeqInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OperatorSeqInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *OperatorSeqInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_OperatorSeqInfo.Merge(m, src) +} +func (m *OperatorSeqInfo) XXX_Size() int { + return m.Size() +} +func (m *OperatorSeqInfo) XXX_DiscardUnknown() { + xxx_messageInfo_OperatorSeqInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_OperatorSeqInfo proto.InternalMessageInfo + +func (m *OperatorSeqInfo) GetOperator() string { + if m != nil { + return m.Operator + } + return "" +} + +func (m *OperatorSeqInfo) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +type Commitment struct { + // the operator address + Operator string `protobuf:"bytes,1,opt,name=operator,proto3" json:"operator,omitempty"` + // the sequence number of the bridge request + Seq uint64 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq,omitempty"` + // commitment is the hash value of a provision + Commitment string `protobuf:"bytes,3,opt,name=commitment,proto3" json:"commitment,omitempty"` +} + +func (m *Commitment) Reset() { *m = Commitment{} } +func (m *Commitment) String() string { return proto.CompactTextString(m) } +func (*Commitment) ProtoMessage() {} +func (*Commitment) Descriptor() ([]byte, []int) { + return fileDescriptor_0fc3cc4535a29f6d, []int{5} +} +func (m *Commitment) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Commitment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Commitment.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Commitment) XXX_Merge(src proto.Message) { + xxx_messageInfo_Commitment.Merge(m, src) +} +func (m *Commitment) XXX_Size() int { + return m.Size() +} +func (m *Commitment) XXX_DiscardUnknown() { + xxx_messageInfo_Commitment.DiscardUnknown(m) +} + +var xxx_messageInfo_Commitment proto.InternalMessageInfo + +func (m *Commitment) GetOperator() string { + if m != nil { + return m.Operator + } + return "" +} + +func (m *Commitment) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +func (m *Commitment) GetCommitment() string { + if m != nil { + return m.Commitment + } + return "" +} + +type Provision struct { + Commitment string `protobuf:"bytes,1,opt,name=commitment,proto3" json:"commitment,omitempty"` + Data *ProvisionData `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + Status *ProvisionStatus `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"` +} + +func (m *Provision) Reset() { *m = Provision{} } +func (m *Provision) String() string { return proto.CompactTextString(m) } +func (*Provision) ProtoMessage() {} +func (*Provision) Descriptor() ([]byte, []int) { + return fileDescriptor_0fc3cc4535a29f6d, []int{6} +} +func (m *Provision) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Provision) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Provision.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Provision) XXX_Merge(src proto.Message) { + xxx_messageInfo_Provision.Merge(m, src) +} +func (m *Provision) XXX_Size() int { + return m.Size() +} +func (m *Provision) XXX_DiscardUnknown() { + xxx_messageInfo_Provision.DiscardUnknown(m) +} + +var xxx_messageInfo_Provision proto.InternalMessageInfo + +func (m *Provision) GetCommitment() string { + if m != nil { + return m.Commitment + } + return "" +} + +func (m *Provision) GetData() *ProvisionData { + if m != nil { + return m.Data + } + return nil +} + +func (m *Provision) GetStatus() *ProvisionStatus { + if m != nil { + return m.Status + } + return nil +} + +type ConfirmedProvision struct { + // the sequence number of the bridge request + Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` + // commitment is the hash value of a provision + Commitment string `protobuf:"bytes,2,opt,name=commitment,proto3" json:"commitment,omitempty"` +} + +func (m *ConfirmedProvision) Reset() { *m = ConfirmedProvision{} } +func (m *ConfirmedProvision) String() string { return proto.CompactTextString(m) } +func (*ConfirmedProvision) ProtoMessage() {} +func (*ConfirmedProvision) Descriptor() ([]byte, []int) { + return fileDescriptor_0fc3cc4535a29f6d, []int{7} +} +func (m *ConfirmedProvision) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConfirmedProvision) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConfirmedProvision.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ConfirmedProvision) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConfirmedProvision.Merge(m, src) +} +func (m *ConfirmedProvision) XXX_Size() int { + return m.Size() +} +func (m *ConfirmedProvision) XXX_DiscardUnknown() { + xxx_messageInfo_ConfirmedProvision.DiscardUnknown(m) +} + +var xxx_messageInfo_ConfirmedProvision proto.InternalMessageInfo + +func (m *ConfirmedProvision) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +func (m *ConfirmedProvision) GetCommitment() string { + if m != nil { + return m.Commitment + } + return "" +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "lbm.fbridge.v1.GenesisState") + proto.RegisterType((*SendingState)(nil), "lbm.fbridge.v1.SendingState") + proto.RegisterType((*BlockSeqInfo)(nil), "lbm.fbridge.v1.BlockSeqInfo") + proto.RegisterType((*ReceivingState)(nil), "lbm.fbridge.v1.ReceivingState") + proto.RegisterType((*OperatorSeqInfo)(nil), "lbm.fbridge.v1.OperatorSeqInfo") + proto.RegisterType((*Commitment)(nil), "lbm.fbridge.v1.Commitment") + proto.RegisterType((*Provision)(nil), "lbm.fbridge.v1.Provision") + proto.RegisterType((*ConfirmedProvision)(nil), "lbm.fbridge.v1.ConfirmedProvision") +} + +func init() { proto.RegisterFile("lbm/fbridge/v1/genesis.proto", fileDescriptor_0fc3cc4535a29f6d) } + +var fileDescriptor_0fc3cc4535a29f6d = []byte{ + // 666 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xc7, 0xe3, 0xc4, 0x4a, 0xdb, 0x69, 0xfa, 0xa1, 0x15, 0x54, 0x6e, 0x28, 0x4e, 0x64, 0x71, + 0xe8, 0x01, 0x62, 0x0a, 0x48, 0x7c, 0xa8, 0x12, 0x52, 0x8a, 0x5a, 0x51, 0x09, 0x81, 0x6c, 0x0e, + 0xa8, 0x17, 0xcb, 0x76, 0x36, 0xee, 0xaa, 0xb1, 0x37, 0xf6, 0x6e, 0xa2, 0x56, 0xbc, 0x00, 0x47, + 0x6e, 0x5c, 0xb9, 0xf0, 0x2e, 0x3d, 0xf6, 0xc8, 0x01, 0x21, 0xd4, 0xbe, 0x08, 0xf2, 0x76, 0xfd, + 0x11, 0x37, 0x95, 0xe0, 0xb6, 0xbb, 0xf3, 0x9f, 0xdf, 0xfc, 0x67, 0x3d, 0x5e, 0xd8, 0x1a, 0x79, + 0xa1, 0x39, 0xf4, 0x12, 0x32, 0x08, 0xb0, 0x39, 0xdd, 0x31, 0x03, 0x1c, 0x61, 0x46, 0x58, 0x6f, + 0x9c, 0x50, 0x4e, 0xd1, 0xea, 0xc8, 0x0b, 0x7b, 0x32, 0xda, 0x9b, 0xee, 0xb4, 0xef, 0x04, 0x34, + 0xa0, 0x22, 0x64, 0xa6, 0xab, 0x6b, 0x55, 0xbb, 0xca, 0xc8, 0x12, 0x44, 0xd4, 0xf8, 0xa5, 0x40, + 0xeb, 0xe0, 0x9a, 0x6a, 0x73, 0x97, 0x63, 0xf4, 0x0c, 0x9a, 0x63, 0x37, 0x71, 0x43, 0xa6, 0x29, + 0x5d, 0x65, 0x7b, 0xf9, 0xc9, 0x46, 0x6f, 0xb6, 0x4a, 0xef, 0x83, 0x88, 0xf6, 0xd5, 0xf3, 0xdf, + 0x9d, 0x9a, 0x25, 0xb5, 0xe8, 0x00, 0x56, 0x18, 0x8e, 0x06, 0x24, 0x0a, 0x1c, 0x96, 0x62, 0xb4, + 0xba, 0x48, 0xde, 0xaa, 0x26, 0xdb, 0xd7, 0x22, 0x51, 0x4a, 0x22, 0x5a, 0xac, 0x74, 0x86, 0xde, + 0xc1, 0x5a, 0x82, 0x7d, 0x4c, 0xa6, 0x05, 0xaa, 0x21, 0x50, 0x7a, 0x15, 0x65, 0x65, 0xb2, 0x32, + 0x6c, 0x35, 0x99, 0x39, 0x35, 0x3e, 0x43, 0xab, 0x5c, 0x12, 0x6d, 0xc2, 0x62, 0x84, 0x4f, 0xb9, + 0xc3, 0x70, 0x2c, 0xfa, 0x53, 0xad, 0x85, 0x74, 0x6f, 0xe3, 0x18, 0x1d, 0xc2, 0x1a, 0xc3, 0xb1, + 0xc3, 0xa9, 0xe3, 0x8d, 0xa8, 0x7f, 0x12, 0x4d, 0x42, 0xad, 0xde, 0x6d, 0xcc, 0x6b, 0xa2, 0x9f, + 0xc6, 0x6d, 0x1c, 0xbf, 0x8d, 0x86, 0x54, 0xd6, 0x5d, 0x61, 0x38, 0xfe, 0x48, 0xfb, 0x32, 0xf1, + 0x95, 0xfa, 0xe5, 0x7b, 0xa7, 0x66, 0xec, 0x42, 0xab, 0x2c, 0x45, 0xeb, 0xd0, 0x28, 0xea, 0xa6, + 0x4b, 0xd4, 0x86, 0xc5, 0x52, 0xb1, 0xf4, 0x38, 0xdf, 0x1b, 0x3f, 0x54, 0x58, 0x9d, 0xed, 0x11, + 0x51, 0x78, 0x10, 0x24, 0xd8, 0xe5, 0x98, 0x71, 0xc7, 0xa7, 0x11, 0xc3, 0xfe, 0x84, 0x93, 0x29, + 0x4e, 0xbb, 0x71, 0xbc, 0x33, 0x87, 0x8e, 0x71, 0xe2, 0x72, 0x9a, 0x68, 0x8a, 0xf0, 0xdd, 0xa9, + 0xfa, 0x7e, 0x2f, 0xe3, 0xd2, 0x8f, 0xd5, 0xcd, 0x60, 0x7b, 0x05, 0xcb, 0xc6, 0x71, 0xff, 0x2c, + 0x13, 0xa2, 0x4f, 0xa0, 0xe5, 0x05, 0xab, 0x45, 0xea, 0xff, 0x56, 0xe4, 0x6e, 0x06, 0x98, 0x25, + 0xbf, 0x28, 0x91, 0x2b, 0xad, 0x88, 0x0f, 0xae, 0x5a, 0x1b, 0xf3, 0xdd, 0xa1, 0x87, 0x80, 0xc6, + 0x72, 0xd4, 0xfc, 0x91, 0x4b, 0xc2, 0x34, 0x85, 0x69, 0x6a, 0xb7, 0xb1, 0xad, 0x5a, 0xeb, 0x32, + 0xb2, 0x97, 0x06, 0x6c, 0x1c, 0x33, 0xb4, 0x0b, 0xcb, 0x3e, 0x0d, 0x43, 0xc2, 0x43, 0x1c, 0x71, + 0xa6, 0x35, 0x85, 0xe9, 0x76, 0xd5, 0xf4, 0x5e, 0x2e, 0xb1, 0xca, 0x72, 0xf4, 0x12, 0x60, 0x9c, + 0xd0, 0x29, 0x61, 0x84, 0x46, 0x4c, 0x5b, 0x10, 0xc9, 0x9b, 0x37, 0x7e, 0x88, 0x4c, 0x61, 0x95, + 0xc4, 0xc8, 0x85, 0x7b, 0x3e, 0x8d, 0x86, 0x24, 0x09, 0xf1, 0xc0, 0x91, 0x83, 0x55, 0xa0, 0xb5, + 0x45, 0xc1, 0x32, 0x6e, 0x1a, 0x91, 0x29, 0x05, 0x54, 0xcb, 0x31, 0x76, 0x3a, 0x63, 0x85, 0x55, + 0x39, 0x65, 0xaf, 0x61, 0xad, 0x72, 0xe7, 0xe9, 0x58, 0x95, 0x66, 0x41, 0xd9, 0x5e, 0xb2, 0xf2, + 0x7d, 0x36, 0x84, 0xf5, 0x7c, 0x08, 0x8d, 0x23, 0x80, 0x02, 0xfa, 0x7f, 0xb9, 0x48, 0x07, 0x28, + 0x35, 0xd5, 0x10, 0xfa, 0xd2, 0x89, 0xf1, 0x4d, 0x81, 0xa5, 0xbc, 0x95, 0x8a, 0x5a, 0xa9, 0xaa, + 0xd1, 0x0e, 0xa8, 0x03, 0x97, 0xbb, 0xf2, 0xf1, 0xb8, 0x7f, 0xeb, 0x45, 0xbf, 0x71, 0xb9, 0x6b, + 0x09, 0x29, 0x7a, 0x0e, 0xcd, 0xf4, 0x95, 0x98, 0x30, 0xf9, 0x4c, 0x74, 0x6e, 0x4d, 0xb2, 0x85, + 0xcc, 0x92, 0x72, 0x63, 0x1f, 0xd0, 0xcd, 0xcb, 0x9e, 0xf3, 0x8b, 0xce, 0x7a, 0xae, 0x57, 0x3d, + 0xf7, 0x0f, 0xcf, 0x2f, 0x75, 0xe5, 0xe2, 0x52, 0x57, 0xfe, 0x5c, 0xea, 0xca, 0xd7, 0x2b, 0xbd, + 0x76, 0x71, 0xa5, 0xd7, 0x7e, 0x5e, 0xe9, 0xb5, 0xa3, 0xc7, 0x01, 0xe1, 0xc7, 0x13, 0xaf, 0xe7, + 0xd3, 0xd0, 0xdc, 0x27, 0x11, 0xf3, 0x8f, 0x89, 0x6b, 0x0e, 0xe5, 0xe2, 0x11, 0x1b, 0x9c, 0x98, + 0xa7, 0xf9, 0xbb, 0xcc, 0xcf, 0xc6, 0x98, 0x79, 0x4d, 0xf1, 0x26, 0x3f, 0xfd, 0x1b, 0x00, 0x00, + 0xff, 0xff, 0x21, 0xae, 0xb3, 0xc6, 0xf7, 0x05, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.ReceivingState.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.SendingState.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *SendingState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SendingState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SendingState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SeqToBlocknum) > 0 { + for iNdEx := len(m.SeqToBlocknum) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.SeqToBlocknum[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.NextSeq != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.NextSeq)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *BlockSeqInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BlockSeqInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockSeqInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Blocknum != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Blocknum)) + i-- + dAtA[i] = 0x10 + } + if m.Seq != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *ReceivingState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ReceivingState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ReceivingState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ConfirmedSeqToCommitment) > 0 { + for iNdEx := len(m.ConfirmedSeqToCommitment) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ConfirmedSeqToCommitment[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } + if len(m.Provisions) > 0 { + for iNdEx := len(m.Provisions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Provisions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + } + if len(m.Commitments) > 0 { + for iNdEx := len(m.Commitments) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Commitments[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if len(m.PendingClaimSeqs) > 0 { + dAtA5 := make([]byte, len(m.PendingClaimSeqs)*10) + var j4 int + for _, num := range m.PendingClaimSeqs { + for num >= 1<<7 { + dAtA5[j4] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j4++ + } + dAtA5[j4] = uint8(num) + j4++ + } + i -= j4 + copy(dAtA[i:], dAtA5[:j4]) + i = encodeVarintGenesis(dAtA, i, uint64(j4)) + i-- + dAtA[i] = 0x22 + } + if m.GreatestConsecutiveSeq != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.GreatestConsecutiveSeq)) + i-- + dAtA[i] = 0x18 + } + if len(m.GreatestSeqByOperator) > 0 { + for iNdEx := len(m.GreatestSeqByOperator) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.GreatestSeqByOperator[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.GreatestConsecutiveSeqByOperator) > 0 { + for iNdEx := len(m.GreatestConsecutiveSeqByOperator) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.GreatestConsecutiveSeqByOperator[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *OperatorSeqInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OperatorSeqInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OperatorSeqInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Seq != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x10 + } + if len(m.Operator) > 0 { + i -= len(m.Operator) + copy(dAtA[i:], m.Operator) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Operator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Commitment) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Commitment) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Commitment) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Commitment) > 0 { + i -= len(m.Commitment) + copy(dAtA[i:], m.Commitment) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Commitment))) + i-- + dAtA[i] = 0x1a + } + if m.Seq != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x10 + } + if len(m.Operator) > 0 { + i -= len(m.Operator) + copy(dAtA[i:], m.Operator) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Operator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Provision) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Provision) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Provision) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Status != nil { + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.Data != nil { + { + size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Commitment) > 0 { + i -= len(m.Commitment) + copy(dAtA[i:], m.Commitment) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Commitment))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ConfirmedProvision) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConfirmedProvision) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConfirmedProvision) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Commitment) > 0 { + i -= len(m.Commitment) + copy(dAtA[i:], m.Commitment) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Commitment))) + i-- + dAtA[i] = 0x12 + } + if m.Seq != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + l = m.SendingState.Size() + n += 1 + l + sovGenesis(uint64(l)) + l = m.ReceivingState.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func (m *SendingState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.NextSeq != 0 { + n += 1 + sovGenesis(uint64(m.NextSeq)) + } + if len(m.SeqToBlocknum) > 0 { + for _, e := range m.SeqToBlocknum { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func (m *BlockSeqInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Seq != 0 { + n += 1 + sovGenesis(uint64(m.Seq)) + } + if m.Blocknum != 0 { + n += 1 + sovGenesis(uint64(m.Blocknum)) + } + return n +} + +func (m *ReceivingState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.GreatestConsecutiveSeqByOperator) > 0 { + for _, e := range m.GreatestConsecutiveSeqByOperator { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.GreatestSeqByOperator) > 0 { + for _, e := range m.GreatestSeqByOperator { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if m.GreatestConsecutiveSeq != 0 { + n += 1 + sovGenesis(uint64(m.GreatestConsecutiveSeq)) + } + if len(m.PendingClaimSeqs) > 0 { + l = 0 + for _, e := range m.PendingClaimSeqs { + l += sovGenesis(uint64(e)) + } + n += 1 + sovGenesis(uint64(l)) + l + } + if len(m.Commitments) > 0 { + for _, e := range m.Commitments { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.Provisions) > 0 { + for _, e := range m.Provisions { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.ConfirmedSeqToCommitment) > 0 { + for _, e := range m.ConfirmedSeqToCommitment { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func (m *OperatorSeqInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Operator) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if m.Seq != 0 { + n += 1 + sovGenesis(uint64(m.Seq)) + } + return n +} + +func (m *Commitment) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Operator) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if m.Seq != 0 { + n += 1 + sovGenesis(uint64(m.Seq)) + } + l = len(m.Commitment) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} + +func (m *Provision) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Commitment) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + if m.Data != nil { + l = m.Data.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + if m.Status != nil { + l = m.Status.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} + +func (m *ConfirmedProvision) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Seq != 0 { + n += 1 + sovGenesis(uint64(m.Seq)) + } + l = len(m.Commitment) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SendingState", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SendingState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReceivingState", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ReceivingState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SendingState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SendingState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SendingState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NextSeq", wireType) + } + m.NextSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NextSeq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SeqToBlocknum", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SeqToBlocknum = append(m.SeqToBlocknum, BlockSeqInfo{}) + if err := m.SeqToBlocknum[len(m.SeqToBlocknum)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BlockSeqInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BlockSeqInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlockSeqInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Blocknum", wireType) + } + m.Blocknum = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Blocknum |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ReceivingState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ReceivingState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ReceivingState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GreatestConsecutiveSeqByOperator", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GreatestConsecutiveSeqByOperator = append(m.GreatestConsecutiveSeqByOperator, &OperatorSeqInfo{}) + if err := m.GreatestConsecutiveSeqByOperator[len(m.GreatestConsecutiveSeqByOperator)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GreatestSeqByOperator", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GreatestSeqByOperator = append(m.GreatestSeqByOperator, &OperatorSeqInfo{}) + if err := m.GreatestSeqByOperator[len(m.GreatestSeqByOperator)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GreatestConsecutiveSeq", wireType) + } + m.GreatestConsecutiveSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GreatestConsecutiveSeq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PendingClaimSeqs = append(m.PendingClaimSeqs, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.PendingClaimSeqs) == 0 { + m.PendingClaimSeqs = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PendingClaimSeqs = append(m.PendingClaimSeqs, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PendingClaimSeqs", wireType) + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commitments", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Commitments = append(m.Commitments, &Commitment{}) + if err := m.Commitments[len(m.Commitments)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provisions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Provisions = append(m.Provisions, &Provision{}) + if err := m.Provisions[len(m.Provisions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConfirmedSeqToCommitment", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConfirmedSeqToCommitment = append(m.ConfirmedSeqToCommitment, &ConfirmedProvision{}) + if err := m.ConfirmedSeqToCommitment[len(m.ConfirmedSeqToCommitment)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OperatorSeqInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: OperatorSeqInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OperatorSeqInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Operator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Commitment) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Commitment: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Commitment: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Operator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commitment", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Commitment = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Provision) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Provision: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Provision: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commitment", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Commitment = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Data == nil { + m.Data = &ProvisionData{} + } + if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Status == nil { + m.Status = &ProvisionStatus{} + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConfirmedProvision) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConfirmedProvision: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConfirmedProvision: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commitment", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Commitment = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/fbridge/types/keys.go b/x/fbridge/types/keys.go new file mode 100644 index 0000000000..714c3b4fcf --- /dev/null +++ b/x/fbridge/types/keys.go @@ -0,0 +1,23 @@ +package types + +import "encoding/binary" + +const ( + // ModuleName is the module name constant used in many places + ModuleName = "fbridge" + + // StoreKey is the store key string for distribution + StoreKey = ModuleName +) + +var ( + KeyParams = []byte{0x01} // key for fbridge module params + KeyNextSeqSend = []byte{0x02} // key for the next bridge send sequence + KeySeqToBlocknumPrefix = []byte{0x03} // key prefix for the sequence to block number mapping +) + +func SeqToBlocknumKey(seq uint64) []byte { + bz := make([]byte, 8) + binary.BigEndian.PutUint64(bz, seq) + return append(KeySeqToBlocknumPrefix, bz...) +} diff --git a/x/fbridge/types/msgs.go b/x/fbridge/types/msgs.go new file mode 100644 index 0000000000..fce2320548 --- /dev/null +++ b/x/fbridge/types/msgs.go @@ -0,0 +1,127 @@ +package types + +import sdk "github.com/Finschia/finschia-sdk/types" + +var ( + _ sdk.Msg = &MsgTransfer{} + _ sdk.Msg = &MsgProvision{} + _ sdk.Msg = &MsgHoldTransfer{} + _ sdk.Msg = &MsgReleaseTransfer{} + _ sdk.Msg = &MsgRemoveProvision{} + _ sdk.Msg = &MsgClaimBatch{} + _ sdk.Msg = &MsgClaim{} + _ sdk.Msg = &MsgSuggestRole{} + _ sdk.Msg = &MsgAddVoteForRole{} + _ sdk.Msg = &MsgHalt{} + _ sdk.Msg = &MsgResume{} +) + +func (m MsgTransfer) ValidateBasic() error { return nil } + +func (m MsgTransfer) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.Sender)} +} + +func (m MsgTransfer) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +func (m MsgProvision) ValidateBasic() error { return nil } + +func (m MsgProvision) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.From)} +} + +func (m MsgProvision) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +func (m MsgHoldTransfer) ValidateBasic() error { return nil } + +func (m MsgHoldTransfer) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.From)} +} + +func (m MsgHoldTransfer) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +func (m MsgReleaseTransfer) ValidateBasic() error { return nil } + +func (m MsgReleaseTransfer) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.From)} +} + +func (m MsgReleaseTransfer) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +func (m MsgRemoveProvision) ValidateBasic() error { return nil } + +func (m MsgRemoveProvision) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.From)} +} + +func (m MsgRemoveProvision) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +func (m MsgClaimBatch) ValidateBasic() error { return nil } + +func (m MsgClaimBatch) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.From)} +} + +func (m MsgClaimBatch) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +func (m MsgClaim) ValidateBasic() error { return nil } + +func (m MsgClaim) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.From)} +} + +func (m MsgClaim) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +func (m MsgSuggestRole) ValidateBasic() error { return nil } + +func (m MsgSuggestRole) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.From)} +} + +func (m MsgSuggestRole) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +func (m MsgAddVoteForRole) ValidateBasic() error { return nil } + +func (m MsgAddVoteForRole) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.From)} +} + +func (m MsgAddVoteForRole) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +func (m MsgHalt) ValidateBasic() error { return nil } + +func (m MsgHalt) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.Guardian)} +} + +func (m MsgHalt) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +func (m MsgResume) ValidateBasic() error { return nil } + +func (m MsgResume) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.From)} +} + +func (m MsgResume) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} diff --git a/x/fbridge/types/params.go b/x/fbridge/types/params.go new file mode 100644 index 0000000000..ab1254f4c2 --- /dev/null +++ b/x/fbridge/types/params.go @@ -0,0 +1 @@ +package types diff --git a/x/fbridge/types/query.pb.go b/x/fbridge/types/query.pb.go new file mode 100644 index 0000000000..7583ca187f --- /dev/null +++ b/x/fbridge/types/query.pb.go @@ -0,0 +1,5594 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lbm/fbridge/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + query "github.com/Finschia/finschia-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +type QueryParamsResponse struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +type QueryNextSeqSendRequest struct { +} + +func (m *QueryNextSeqSendRequest) Reset() { *m = QueryNextSeqSendRequest{} } +func (m *QueryNextSeqSendRequest) String() string { return proto.CompactTextString(m) } +func (*QueryNextSeqSendRequest) ProtoMessage() {} +func (*QueryNextSeqSendRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{2} +} +func (m *QueryNextSeqSendRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryNextSeqSendRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryNextSeqSendRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryNextSeqSendRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryNextSeqSendRequest.Merge(m, src) +} +func (m *QueryNextSeqSendRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryNextSeqSendRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryNextSeqSendRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryNextSeqSendRequest proto.InternalMessageInfo + +type QueryNextSeqSendResponse struct { + Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` +} + +func (m *QueryNextSeqSendResponse) Reset() { *m = QueryNextSeqSendResponse{} } +func (m *QueryNextSeqSendResponse) String() string { return proto.CompactTextString(m) } +func (*QueryNextSeqSendResponse) ProtoMessage() {} +func (*QueryNextSeqSendResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{3} +} +func (m *QueryNextSeqSendResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryNextSeqSendResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryNextSeqSendResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryNextSeqSendResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryNextSeqSendResponse.Merge(m, src) +} +func (m *QueryNextSeqSendResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryNextSeqSendResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryNextSeqSendResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryNextSeqSendResponse proto.InternalMessageInfo + +func (m *QueryNextSeqSendResponse) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +type QuerySeqToBlocknumsRequest struct { + // list of sequence number of the bridge request + Seqs []uint64 `protobuf:"varint,1,rep,packed,name=seqs,proto3" json:"seqs,omitempty"` +} + +func (m *QuerySeqToBlocknumsRequest) Reset() { *m = QuerySeqToBlocknumsRequest{} } +func (m *QuerySeqToBlocknumsRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySeqToBlocknumsRequest) ProtoMessage() {} +func (*QuerySeqToBlocknumsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{4} +} +func (m *QuerySeqToBlocknumsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySeqToBlocknumsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySeqToBlocknumsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySeqToBlocknumsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySeqToBlocknumsRequest.Merge(m, src) +} +func (m *QuerySeqToBlocknumsRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySeqToBlocknumsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySeqToBlocknumsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySeqToBlocknumsRequest proto.InternalMessageInfo + +func (m *QuerySeqToBlocknumsRequest) GetSeqs() []uint64 { + if m != nil { + return m.Seqs + } + return nil +} + +type QuerySeqToBlocknumsResponse struct { + Blocknums []uint64 `protobuf:"varint,1,rep,packed,name=blocknums,proto3" json:"blocknums,omitempty"` +} + +func (m *QuerySeqToBlocknumsResponse) Reset() { *m = QuerySeqToBlocknumsResponse{} } +func (m *QuerySeqToBlocknumsResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySeqToBlocknumsResponse) ProtoMessage() {} +func (*QuerySeqToBlocknumsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{5} +} +func (m *QuerySeqToBlocknumsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySeqToBlocknumsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySeqToBlocknumsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySeqToBlocknumsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySeqToBlocknumsResponse.Merge(m, src) +} +func (m *QuerySeqToBlocknumsResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySeqToBlocknumsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySeqToBlocknumsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySeqToBlocknumsResponse proto.InternalMessageInfo + +func (m *QuerySeqToBlocknumsResponse) GetBlocknums() []uint64 { + if m != nil { + return m.Blocknums + } + return nil +} + +type QueryGreatestSeqByOperatorRequest struct { + // the address of the operator + Operator string `protobuf:"bytes,1,opt,name=operator,proto3" json:"operator,omitempty"` +} + +func (m *QueryGreatestSeqByOperatorRequest) Reset() { *m = QueryGreatestSeqByOperatorRequest{} } +func (m *QueryGreatestSeqByOperatorRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGreatestSeqByOperatorRequest) ProtoMessage() {} +func (*QueryGreatestSeqByOperatorRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{6} +} +func (m *QueryGreatestSeqByOperatorRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGreatestSeqByOperatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGreatestSeqByOperatorRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGreatestSeqByOperatorRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGreatestSeqByOperatorRequest.Merge(m, src) +} +func (m *QueryGreatestSeqByOperatorRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGreatestSeqByOperatorRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGreatestSeqByOperatorRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGreatestSeqByOperatorRequest proto.InternalMessageInfo + +func (m *QueryGreatestSeqByOperatorRequest) GetOperator() string { + if m != nil { + return m.Operator + } + return "" +} + +type QueryGreatestSeqByOperatorResponse struct { + Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` +} + +func (m *QueryGreatestSeqByOperatorResponse) Reset() { *m = QueryGreatestSeqByOperatorResponse{} } +func (m *QueryGreatestSeqByOperatorResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGreatestSeqByOperatorResponse) ProtoMessage() {} +func (*QueryGreatestSeqByOperatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{7} +} +func (m *QueryGreatestSeqByOperatorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGreatestSeqByOperatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGreatestSeqByOperatorResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGreatestSeqByOperatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGreatestSeqByOperatorResponse.Merge(m, src) +} +func (m *QueryGreatestSeqByOperatorResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGreatestSeqByOperatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGreatestSeqByOperatorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGreatestSeqByOperatorResponse proto.InternalMessageInfo + +func (m *QueryGreatestSeqByOperatorResponse) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +type QueryGreatestConsecutiveConfirmedSeqRequest struct { +} + +func (m *QueryGreatestConsecutiveConfirmedSeqRequest) Reset() { + *m = QueryGreatestConsecutiveConfirmedSeqRequest{} +} +func (m *QueryGreatestConsecutiveConfirmedSeqRequest) String() string { + return proto.CompactTextString(m) +} +func (*QueryGreatestConsecutiveConfirmedSeqRequest) ProtoMessage() {} +func (*QueryGreatestConsecutiveConfirmedSeqRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{8} +} +func (m *QueryGreatestConsecutiveConfirmedSeqRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGreatestConsecutiveConfirmedSeqRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGreatestConsecutiveConfirmedSeqRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGreatestConsecutiveConfirmedSeqRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGreatestConsecutiveConfirmedSeqRequest.Merge(m, src) +} +func (m *QueryGreatestConsecutiveConfirmedSeqRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGreatestConsecutiveConfirmedSeqRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGreatestConsecutiveConfirmedSeqRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGreatestConsecutiveConfirmedSeqRequest proto.InternalMessageInfo + +type QueryGreatestConsecutiveConfirmedSeqResponse struct { + Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` +} + +func (m *QueryGreatestConsecutiveConfirmedSeqResponse) Reset() { + *m = QueryGreatestConsecutiveConfirmedSeqResponse{} +} +func (m *QueryGreatestConsecutiveConfirmedSeqResponse) String() string { + return proto.CompactTextString(m) +} +func (*QueryGreatestConsecutiveConfirmedSeqResponse) ProtoMessage() {} +func (*QueryGreatestConsecutiveConfirmedSeqResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{9} +} +func (m *QueryGreatestConsecutiveConfirmedSeqResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGreatestConsecutiveConfirmedSeqResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGreatestConsecutiveConfirmedSeqResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGreatestConsecutiveConfirmedSeqResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGreatestConsecutiveConfirmedSeqResponse.Merge(m, src) +} +func (m *QueryGreatestConsecutiveConfirmedSeqResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGreatestConsecutiveConfirmedSeqResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGreatestConsecutiveConfirmedSeqResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGreatestConsecutiveConfirmedSeqResponse proto.InternalMessageInfo + +func (m *QueryGreatestConsecutiveConfirmedSeqResponse) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +type QuerySubmittedProvisionRequest struct { + // the address of the operator + Operator string `protobuf:"bytes,1,opt,name=operator,proto3" json:"operator,omitempty"` + // the sequence number of the bridge request + Seq uint64 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq,omitempty"` +} + +func (m *QuerySubmittedProvisionRequest) Reset() { *m = QuerySubmittedProvisionRequest{} } +func (m *QuerySubmittedProvisionRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySubmittedProvisionRequest) ProtoMessage() {} +func (*QuerySubmittedProvisionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{10} +} +func (m *QuerySubmittedProvisionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySubmittedProvisionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySubmittedProvisionRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySubmittedProvisionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySubmittedProvisionRequest.Merge(m, src) +} +func (m *QuerySubmittedProvisionRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySubmittedProvisionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySubmittedProvisionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySubmittedProvisionRequest proto.InternalMessageInfo + +func (m *QuerySubmittedProvisionRequest) GetOperator() string { + if m != nil { + return m.Operator + } + return "" +} + +func (m *QuerySubmittedProvisionRequest) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +type QuerySubmittedProvisionResponse struct { + Data ProvisionData `protobuf:"bytes,1,opt,name=data,proto3" json:"data"` + Status ProvisionStatus `protobuf:"bytes,2,opt,name=status,proto3" json:"status"` +} + +func (m *QuerySubmittedProvisionResponse) Reset() { *m = QuerySubmittedProvisionResponse{} } +func (m *QuerySubmittedProvisionResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySubmittedProvisionResponse) ProtoMessage() {} +func (*QuerySubmittedProvisionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{11} +} +func (m *QuerySubmittedProvisionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySubmittedProvisionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySubmittedProvisionResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySubmittedProvisionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySubmittedProvisionResponse.Merge(m, src) +} +func (m *QuerySubmittedProvisionResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySubmittedProvisionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySubmittedProvisionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySubmittedProvisionResponse proto.InternalMessageInfo + +func (m *QuerySubmittedProvisionResponse) GetData() ProvisionData { + if m != nil { + return m.Data + } + return ProvisionData{} +} + +func (m *QuerySubmittedProvisionResponse) GetStatus() ProvisionStatus { + if m != nil { + return m.Status + } + return ProvisionStatus{} +} + +type QueryNeededSubmissionSeqsRequest struct { + // the address of the operator + Operator string `protobuf:"bytes,1,opt,name=operator,proto3" json:"operator,omitempty"` + // range specifies the size of the range to search + Range uint64 `protobuf:"varint,2,opt,name=range,proto3" json:"range,omitempty"` +} + +func (m *QueryNeededSubmissionSeqsRequest) Reset() { *m = QueryNeededSubmissionSeqsRequest{} } +func (m *QueryNeededSubmissionSeqsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryNeededSubmissionSeqsRequest) ProtoMessage() {} +func (*QueryNeededSubmissionSeqsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{12} +} +func (m *QueryNeededSubmissionSeqsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryNeededSubmissionSeqsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryNeededSubmissionSeqsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryNeededSubmissionSeqsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryNeededSubmissionSeqsRequest.Merge(m, src) +} +func (m *QueryNeededSubmissionSeqsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryNeededSubmissionSeqsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryNeededSubmissionSeqsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryNeededSubmissionSeqsRequest proto.InternalMessageInfo + +func (m *QueryNeededSubmissionSeqsRequest) GetOperator() string { + if m != nil { + return m.Operator + } + return "" +} + +func (m *QueryNeededSubmissionSeqsRequest) GetRange() uint64 { + if m != nil { + return m.Range + } + return 0 +} + +type QueryNeededSubmissionSeqsResponse struct { + Seqs []uint64 `protobuf:"varint,1,rep,packed,name=seqs,proto3" json:"seqs,omitempty"` +} + +func (m *QueryNeededSubmissionSeqsResponse) Reset() { *m = QueryNeededSubmissionSeqsResponse{} } +func (m *QueryNeededSubmissionSeqsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryNeededSubmissionSeqsResponse) ProtoMessage() {} +func (*QueryNeededSubmissionSeqsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{13} +} +func (m *QueryNeededSubmissionSeqsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryNeededSubmissionSeqsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryNeededSubmissionSeqsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryNeededSubmissionSeqsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryNeededSubmissionSeqsResponse.Merge(m, src) +} +func (m *QueryNeededSubmissionSeqsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryNeededSubmissionSeqsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryNeededSubmissionSeqsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryNeededSubmissionSeqsResponse proto.InternalMessageInfo + +func (m *QueryNeededSubmissionSeqsResponse) GetSeqs() []uint64 { + if m != nil { + return m.Seqs + } + return nil +} + +type QueryConfirmedProvisionRequest struct { + // the sequence number of the bridge request + Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` +} + +func (m *QueryConfirmedProvisionRequest) Reset() { *m = QueryConfirmedProvisionRequest{} } +func (m *QueryConfirmedProvisionRequest) String() string { return proto.CompactTextString(m) } +func (*QueryConfirmedProvisionRequest) ProtoMessage() {} +func (*QueryConfirmedProvisionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{14} +} +func (m *QueryConfirmedProvisionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryConfirmedProvisionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryConfirmedProvisionRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryConfirmedProvisionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConfirmedProvisionRequest.Merge(m, src) +} +func (m *QueryConfirmedProvisionRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryConfirmedProvisionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConfirmedProvisionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryConfirmedProvisionRequest proto.InternalMessageInfo + +func (m *QueryConfirmedProvisionRequest) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +type QueryConfirmedProvisionResponse struct { + Data ProvisionData `protobuf:"bytes,1,opt,name=data,proto3" json:"data"` + Status ProvisionStatus `protobuf:"bytes,2,opt,name=status,proto3" json:"status"` +} + +func (m *QueryConfirmedProvisionResponse) Reset() { *m = QueryConfirmedProvisionResponse{} } +func (m *QueryConfirmedProvisionResponse) String() string { return proto.CompactTextString(m) } +func (*QueryConfirmedProvisionResponse) ProtoMessage() {} +func (*QueryConfirmedProvisionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{15} +} +func (m *QueryConfirmedProvisionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryConfirmedProvisionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryConfirmedProvisionResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryConfirmedProvisionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryConfirmedProvisionResponse.Merge(m, src) +} +func (m *QueryConfirmedProvisionResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryConfirmedProvisionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryConfirmedProvisionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryConfirmedProvisionResponse proto.InternalMessageInfo + +func (m *QueryConfirmedProvisionResponse) GetData() ProvisionData { + if m != nil { + return m.Data + } + return ProvisionData{} +} + +func (m *QueryConfirmedProvisionResponse) GetStatus() ProvisionStatus { + if m != nil { + return m.Status + } + return ProvisionStatus{} +} + +type QueryCommitmentsRequest struct { + // the sequence number of the bridge request + Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` +} + +func (m *QueryCommitmentsRequest) Reset() { *m = QueryCommitmentsRequest{} } +func (m *QueryCommitmentsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryCommitmentsRequest) ProtoMessage() {} +func (*QueryCommitmentsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{16} +} +func (m *QueryCommitmentsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCommitmentsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCommitmentsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryCommitmentsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCommitmentsRequest.Merge(m, src) +} +func (m *QueryCommitmentsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryCommitmentsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCommitmentsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCommitmentsRequest proto.InternalMessageInfo + +func (m *QueryCommitmentsRequest) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +type QueryCommitmentsResponse struct { + Commitments []string `protobuf:"bytes,1,rep,name=commitments,proto3" json:"commitments,omitempty"` +} + +func (m *QueryCommitmentsResponse) Reset() { *m = QueryCommitmentsResponse{} } +func (m *QueryCommitmentsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCommitmentsResponse) ProtoMessage() {} +func (*QueryCommitmentsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{17} +} +func (m *QueryCommitmentsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCommitmentsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCommitmentsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryCommitmentsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCommitmentsResponse.Merge(m, src) +} +func (m *QueryCommitmentsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryCommitmentsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCommitmentsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCommitmentsResponse proto.InternalMessageInfo + +func (m *QueryCommitmentsResponse) GetCommitments() []string { + if m != nil { + return m.Commitments + } + return nil +} + +type QueryGuardiansRequest struct { +} + +func (m *QueryGuardiansRequest) Reset() { *m = QueryGuardiansRequest{} } +func (m *QueryGuardiansRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGuardiansRequest) ProtoMessage() {} +func (*QueryGuardiansRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{18} +} +func (m *QueryGuardiansRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGuardiansRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGuardiansRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGuardiansRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGuardiansRequest.Merge(m, src) +} +func (m *QueryGuardiansRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGuardiansRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGuardiansRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGuardiansRequest proto.InternalMessageInfo + +type QueryGuardiansResponse struct { + Guardians []string `protobuf:"bytes,1,rep,name=guardians,proto3" json:"guardians,omitempty"` +} + +func (m *QueryGuardiansResponse) Reset() { *m = QueryGuardiansResponse{} } +func (m *QueryGuardiansResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGuardiansResponse) ProtoMessage() {} +func (*QueryGuardiansResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{19} +} +func (m *QueryGuardiansResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGuardiansResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGuardiansResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGuardiansResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGuardiansResponse.Merge(m, src) +} +func (m *QueryGuardiansResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGuardiansResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGuardiansResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGuardiansResponse proto.InternalMessageInfo + +func (m *QueryGuardiansResponse) GetGuardians() []string { + if m != nil { + return m.Guardians + } + return nil +} + +type QueryOperatorsRequest struct { +} + +func (m *QueryOperatorsRequest) Reset() { *m = QueryOperatorsRequest{} } +func (m *QueryOperatorsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryOperatorsRequest) ProtoMessage() {} +func (*QueryOperatorsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{20} +} +func (m *QueryOperatorsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOperatorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOperatorsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryOperatorsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOperatorsRequest.Merge(m, src) +} +func (m *QueryOperatorsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryOperatorsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOperatorsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOperatorsRequest proto.InternalMessageInfo + +type QueryOperatorsResponse struct { + Operators []string `protobuf:"bytes,1,rep,name=operators,proto3" json:"operators,omitempty"` +} + +func (m *QueryOperatorsResponse) Reset() { *m = QueryOperatorsResponse{} } +func (m *QueryOperatorsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryOperatorsResponse) ProtoMessage() {} +func (*QueryOperatorsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{21} +} +func (m *QueryOperatorsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOperatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOperatorsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryOperatorsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOperatorsResponse.Merge(m, src) +} +func (m *QueryOperatorsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryOperatorsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOperatorsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOperatorsResponse proto.InternalMessageInfo + +func (m *QueryOperatorsResponse) GetOperators() []string { + if m != nil { + return m.Operators + } + return nil +} + +type QueryJudgesRequest struct { +} + +func (m *QueryJudgesRequest) Reset() { *m = QueryJudgesRequest{} } +func (m *QueryJudgesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryJudgesRequest) ProtoMessage() {} +func (*QueryJudgesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{22} +} +func (m *QueryJudgesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryJudgesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryJudgesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryJudgesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryJudgesRequest.Merge(m, src) +} +func (m *QueryJudgesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryJudgesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryJudgesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryJudgesRequest proto.InternalMessageInfo + +type QueryJudgesResponse struct { + Judges []string `protobuf:"bytes,1,rep,name=judges,proto3" json:"judges,omitempty"` +} + +func (m *QueryJudgesResponse) Reset() { *m = QueryJudgesResponse{} } +func (m *QueryJudgesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryJudgesResponse) ProtoMessage() {} +func (*QueryJudgesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{23} +} +func (m *QueryJudgesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryJudgesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryJudgesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryJudgesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryJudgesResponse.Merge(m, src) +} +func (m *QueryJudgesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryJudgesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryJudgesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryJudgesResponse proto.InternalMessageInfo + +func (m *QueryJudgesResponse) GetJudges() []string { + if m != nil { + return m.Judges + } + return nil +} + +type QueryProposalsRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryProposalsRequest) Reset() { *m = QueryProposalsRequest{} } +func (m *QueryProposalsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryProposalsRequest) ProtoMessage() {} +func (*QueryProposalsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{24} +} +func (m *QueryProposalsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryProposalsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryProposalsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryProposalsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProposalsRequest.Merge(m, src) +} +func (m *QueryProposalsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryProposalsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProposalsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryProposalsRequest proto.InternalMessageInfo + +func (m *QueryProposalsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryProposalsResponse struct { + Proposals []*RoleProposal `protobuf:"bytes,1,rep,name=proposals,proto3" json:"proposals,omitempty"` +} + +func (m *QueryProposalsResponse) Reset() { *m = QueryProposalsResponse{} } +func (m *QueryProposalsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryProposalsResponse) ProtoMessage() {} +func (*QueryProposalsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{25} +} +func (m *QueryProposalsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryProposalsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryProposalsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryProposalsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProposalsResponse.Merge(m, src) +} +func (m *QueryProposalsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryProposalsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProposalsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryProposalsResponse proto.InternalMessageInfo + +func (m *QueryProposalsResponse) GetProposals() []*RoleProposal { + if m != nil { + return m.Proposals + } + return nil +} + +type QueryProposalRequest struct { + // the proposal id + ProposalId string `protobuf:"bytes,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` +} + +func (m *QueryProposalRequest) Reset() { *m = QueryProposalRequest{} } +func (m *QueryProposalRequest) String() string { return proto.CompactTextString(m) } +func (*QueryProposalRequest) ProtoMessage() {} +func (*QueryProposalRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{26} +} +func (m *QueryProposalRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryProposalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryProposalRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryProposalRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProposalRequest.Merge(m, src) +} +func (m *QueryProposalRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryProposalRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProposalRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryProposalRequest proto.InternalMessageInfo + +func (m *QueryProposalRequest) GetProposalId() string { + if m != nil { + return m.ProposalId + } + return "" +} + +type QueryProposalResponse struct { + Proposal *RoleProposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal,omitempty"` +} + +func (m *QueryProposalResponse) Reset() { *m = QueryProposalResponse{} } +func (m *QueryProposalResponse) String() string { return proto.CompactTextString(m) } +func (*QueryProposalResponse) ProtoMessage() {} +func (*QueryProposalResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5e7780f9db9d346e, []int{27} +} +func (m *QueryProposalResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryProposalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryProposalResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryProposalResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProposalResponse.Merge(m, src) +} +func (m *QueryProposalResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryProposalResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProposalResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryProposalResponse proto.InternalMessageInfo + +func (m *QueryProposalResponse) GetProposal() *RoleProposal { + if m != nil { + return m.Proposal + } + return nil +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "lbm.fbridge.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "lbm.fbridge.v1.QueryParamsResponse") + proto.RegisterType((*QueryNextSeqSendRequest)(nil), "lbm.fbridge.v1.QueryNextSeqSendRequest") + proto.RegisterType((*QueryNextSeqSendResponse)(nil), "lbm.fbridge.v1.QueryNextSeqSendResponse") + proto.RegisterType((*QuerySeqToBlocknumsRequest)(nil), "lbm.fbridge.v1.QuerySeqToBlocknumsRequest") + proto.RegisterType((*QuerySeqToBlocknumsResponse)(nil), "lbm.fbridge.v1.QuerySeqToBlocknumsResponse") + proto.RegisterType((*QueryGreatestSeqByOperatorRequest)(nil), "lbm.fbridge.v1.QueryGreatestSeqByOperatorRequest") + proto.RegisterType((*QueryGreatestSeqByOperatorResponse)(nil), "lbm.fbridge.v1.QueryGreatestSeqByOperatorResponse") + proto.RegisterType((*QueryGreatestConsecutiveConfirmedSeqRequest)(nil), "lbm.fbridge.v1.QueryGreatestConsecutiveConfirmedSeqRequest") + proto.RegisterType((*QueryGreatestConsecutiveConfirmedSeqResponse)(nil), "lbm.fbridge.v1.QueryGreatestConsecutiveConfirmedSeqResponse") + proto.RegisterType((*QuerySubmittedProvisionRequest)(nil), "lbm.fbridge.v1.QuerySubmittedProvisionRequest") + proto.RegisterType((*QuerySubmittedProvisionResponse)(nil), "lbm.fbridge.v1.QuerySubmittedProvisionResponse") + proto.RegisterType((*QueryNeededSubmissionSeqsRequest)(nil), "lbm.fbridge.v1.QueryNeededSubmissionSeqsRequest") + proto.RegisterType((*QueryNeededSubmissionSeqsResponse)(nil), "lbm.fbridge.v1.QueryNeededSubmissionSeqsResponse") + proto.RegisterType((*QueryConfirmedProvisionRequest)(nil), "lbm.fbridge.v1.QueryConfirmedProvisionRequest") + proto.RegisterType((*QueryConfirmedProvisionResponse)(nil), "lbm.fbridge.v1.QueryConfirmedProvisionResponse") + proto.RegisterType((*QueryCommitmentsRequest)(nil), "lbm.fbridge.v1.QueryCommitmentsRequest") + proto.RegisterType((*QueryCommitmentsResponse)(nil), "lbm.fbridge.v1.QueryCommitmentsResponse") + proto.RegisterType((*QueryGuardiansRequest)(nil), "lbm.fbridge.v1.QueryGuardiansRequest") + proto.RegisterType((*QueryGuardiansResponse)(nil), "lbm.fbridge.v1.QueryGuardiansResponse") + proto.RegisterType((*QueryOperatorsRequest)(nil), "lbm.fbridge.v1.QueryOperatorsRequest") + proto.RegisterType((*QueryOperatorsResponse)(nil), "lbm.fbridge.v1.QueryOperatorsResponse") + proto.RegisterType((*QueryJudgesRequest)(nil), "lbm.fbridge.v1.QueryJudgesRequest") + proto.RegisterType((*QueryJudgesResponse)(nil), "lbm.fbridge.v1.QueryJudgesResponse") + proto.RegisterType((*QueryProposalsRequest)(nil), "lbm.fbridge.v1.QueryProposalsRequest") + proto.RegisterType((*QueryProposalsResponse)(nil), "lbm.fbridge.v1.QueryProposalsResponse") + proto.RegisterType((*QueryProposalRequest)(nil), "lbm.fbridge.v1.QueryProposalRequest") + proto.RegisterType((*QueryProposalResponse)(nil), "lbm.fbridge.v1.QueryProposalResponse") +} + +func init() { proto.RegisterFile("lbm/fbridge/v1/query.proto", fileDescriptor_5e7780f9db9d346e) } + +var fileDescriptor_5e7780f9db9d346e = []byte{ + // 1229 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xc1, 0x6e, 0xdb, 0x46, + 0x10, 0x35, 0x13, 0xc7, 0xb0, 0x46, 0x40, 0xd0, 0x6e, 0x1d, 0xc7, 0x61, 0x5c, 0xc9, 0x66, 0x1a, + 0xc7, 0x89, 0x6d, 0xd2, 0x52, 0x8c, 0x38, 0x48, 0xd2, 0x36, 0xb0, 0x5b, 0x07, 0x4d, 0xd1, 0xd4, + 0x91, 0x7d, 0xea, 0xc5, 0xa0, 0xc4, 0x35, 0xc3, 0x46, 0xe2, 0x8a, 0x5c, 0x4a, 0xb0, 0x61, 0xf8, + 0x92, 0x5b, 0x0e, 0x05, 0x0a, 0xb4, 0x3d, 0xf4, 0x0f, 0xfa, 0x0d, 0x05, 0x7a, 0x0f, 0x7a, 0x0a, + 0x50, 0xa0, 0xe8, 0xa9, 0x28, 0xec, 0x7e, 0x48, 0xc1, 0xe5, 0xee, 0x4a, 0x22, 0xb9, 0xb2, 0xdc, + 0x4b, 0x6e, 0xd4, 0x70, 0xe6, 0xcd, 0x9b, 0xe1, 0xec, 0xbe, 0x11, 0xe8, 0xcd, 0x7a, 0xcb, 0xda, + 0xaf, 0x87, 0x9e, 0xe3, 0x62, 0xab, 0x5b, 0xb1, 0x82, 0x0e, 0x0e, 0x0f, 0xcd, 0x76, 0x48, 0x22, + 0x82, 0x2e, 0x37, 0xeb, 0x2d, 0x93, 0xbf, 0x33, 0xbb, 0x15, 0x7d, 0xd6, 0x25, 0xc4, 0x6d, 0x62, + 0xcb, 0x6e, 0x7b, 0x96, 0xed, 0xfb, 0x24, 0xb2, 0x23, 0x8f, 0xf8, 0x34, 0xf1, 0xd6, 0xa7, 0x5c, + 0xe2, 0x12, 0xf6, 0x68, 0xc5, 0x4f, 0xdc, 0x7a, 0xa7, 0x41, 0x68, 0x8b, 0x50, 0xab, 0x6e, 0x53, + 0x9c, 0x80, 0x5b, 0xdd, 0x4a, 0x1d, 0x47, 0x76, 0xc5, 0x6a, 0xdb, 0xae, 0xe7, 0x33, 0x08, 0xee, + 0x3b, 0x9b, 0xe2, 0x22, 0x52, 0xb3, 0xb7, 0xc6, 0x14, 0xa0, 0xe7, 0x71, 0xfc, 0xb6, 0x1d, 0xda, + 0x2d, 0x5a, 0xc3, 0x41, 0x07, 0xd3, 0xc8, 0xf8, 0x12, 0x3e, 0x18, 0xb0, 0xd2, 0x36, 0xf1, 0x29, + 0x46, 0x6b, 0x30, 0xd1, 0x66, 0x96, 0x19, 0x6d, 0x4e, 0x5b, 0x2c, 0x56, 0xa7, 0xcd, 0xc1, 0x5a, + 0xcc, 0xc4, 0x7f, 0x63, 0xfc, 0xcd, 0xdf, 0xe5, 0xb1, 0x1a, 0xf7, 0x35, 0xae, 0xc1, 0x55, 0x06, + 0xf6, 0x0c, 0x1f, 0x44, 0x3b, 0x38, 0xd8, 0xc1, 0xbe, 0x23, 0xf2, 0x2c, 0xc3, 0x4c, 0xf6, 0x15, + 0x4f, 0xf6, 0x1e, 0x5c, 0xa4, 0x38, 0x60, 0x99, 0xc6, 0x6b, 0xf1, 0xa3, 0xb1, 0x0a, 0x3a, 0xf3, + 0xde, 0xc1, 0xc1, 0x2e, 0xd9, 0x68, 0x92, 0xc6, 0x4b, 0xbf, 0x23, 0x39, 0x23, 0x04, 0xe3, 0x14, + 0x07, 0x31, 0xb5, 0x8b, 0x8b, 0xe3, 0x35, 0xf6, 0x6c, 0x3c, 0x84, 0xeb, 0xb9, 0x11, 0x3c, 0xc5, + 0x2c, 0x14, 0xea, 0xc2, 0xc8, 0xe3, 0x7a, 0x06, 0xe3, 0x53, 0x98, 0x67, 0xc1, 0x4f, 0x42, 0x6c, + 0x47, 0x98, 0xc6, 0x04, 0x37, 0x0e, 0xbf, 0x6e, 0xe3, 0xd0, 0x8e, 0x48, 0x28, 0xb2, 0xea, 0x30, + 0x49, 0xb8, 0x89, 0x51, 0x2d, 0xd4, 0xe4, 0x6f, 0xe3, 0x1e, 0x18, 0xc3, 0x00, 0x94, 0x75, 0xae, + 0xc0, 0xd2, 0x40, 0xdc, 0x66, 0xec, 0xd7, 0xe8, 0x44, 0x5e, 0x17, 0x6f, 0x12, 0x7f, 0xdf, 0x0b, + 0x5b, 0xd8, 0xd9, 0xc1, 0x81, 0x68, 0xe2, 0x63, 0x58, 0x1e, 0xcd, 0x5d, 0x99, 0xf0, 0x19, 0x94, + 0x92, 0x36, 0x75, 0xea, 0x2d, 0x2f, 0x8a, 0xb0, 0xb3, 0x1d, 0x92, 0xae, 0x47, 0x3d, 0xe2, 0x8f, + 0x50, 0xa6, 0xc0, 0xbb, 0xd0, 0xc3, 0xfb, 0x59, 0x83, 0xb2, 0x12, 0x90, 0xb3, 0x58, 0x87, 0x71, + 0xc7, 0x8e, 0x6c, 0x3e, 0x49, 0x1f, 0x66, 0x26, 0x49, 0x04, 0x7c, 0x66, 0x47, 0x36, 0x1f, 0x28, + 0x16, 0x80, 0x3e, 0x86, 0x09, 0x1a, 0xd9, 0x51, 0x87, 0xb2, 0x8c, 0xc5, 0x6a, 0x59, 0x19, 0xba, + 0xc3, 0xdc, 0xc4, 0x34, 0x26, 0x41, 0xc6, 0x2e, 0xcc, 0xf1, 0x91, 0xc3, 0x0e, 0x76, 0x18, 0x41, + 0xca, 0x9c, 0x71, 0x40, 0x47, 0xa9, 0x76, 0x0a, 0x2e, 0x85, 0xb6, 0xef, 0x62, 0x5e, 0x6f, 0xf2, + 0xc3, 0x58, 0xe7, 0xb3, 0x92, 0x8f, 0xca, 0x4b, 0xce, 0x9b, 0xd0, 0x2a, 0x6f, 0xbd, 0xfc, 0x52, + 0x99, 0xd6, 0x67, 0x3f, 0x97, 0x6c, 0x6f, 0x5e, 0xd0, 0x3b, 0x6e, 0xef, 0x12, 0x3f, 0xec, 0x9b, + 0xa4, 0xd5, 0xf2, 0xa2, 0x16, 0xf6, 0x23, 0xaa, 0x2e, 0xe4, 0x11, 0x3f, 0xfe, 0x03, 0xce, 0xbc, + 0x80, 0x39, 0x28, 0x36, 0x7a, 0x66, 0xd6, 0xb3, 0x42, 0xad, 0xdf, 0x64, 0x5c, 0x85, 0x2b, 0xc9, + 0xdc, 0x77, 0xec, 0xd0, 0xf1, 0x6c, 0x5f, 0xde, 0x5e, 0xf7, 0x60, 0x3a, 0xfd, 0xa2, 0x77, 0xe0, + 0x5d, 0x61, 0xe4, 0x90, 0x3d, 0x83, 0x04, 0x14, 0x47, 0x34, 0x03, 0xd8, 0xf7, 0xa2, 0x07, 0x28, + 0x26, 0x43, 0x02, 0x4a, 0x83, 0xbc, 0x5c, 0x9f, 0x76, 0x1c, 0x17, 0x4b, 0xb4, 0x15, 0x7e, 0xb9, + 0x0a, 0x2b, 0x87, 0x9a, 0x86, 0x89, 0x6f, 0x99, 0x85, 0xe3, 0xf0, 0x5f, 0xc6, 0x1e, 0x67, 0xb5, + 0x1d, 0x92, 0x36, 0xa1, 0x76, 0x53, 0xf6, 0x73, 0x0b, 0xa0, 0x77, 0xd9, 0xf3, 0x0f, 0xbd, 0x60, + 0x26, 0xca, 0x60, 0xc6, 0xca, 0x60, 0x26, 0xb2, 0xc3, 0x95, 0xc1, 0xdc, 0xb6, 0x5d, 0xcc, 0x63, + 0x6b, 0x7d, 0x91, 0xc6, 0x2e, 0xaf, 0xae, 0x2f, 0x01, 0xa7, 0xf4, 0x00, 0x0a, 0x6d, 0x61, 0x64, + 0xac, 0x8a, 0xd5, 0xd9, 0xf4, 0x38, 0xd4, 0x48, 0x13, 0x8b, 0xc8, 0x5a, 0xcf, 0xdd, 0x58, 0x87, + 0xa9, 0x01, 0x54, 0xc1, 0xba, 0x0c, 0x45, 0xe1, 0xb4, 0xe7, 0x39, 0xfc, 0x78, 0x81, 0x30, 0x7d, + 0xe1, 0x18, 0xcf, 0x53, 0xf5, 0x4a, 0x36, 0xf7, 0x61, 0x52, 0xb8, 0xf1, 0x6a, 0x87, 0x93, 0x91, + 0xde, 0xd5, 0xd7, 0xef, 0xc3, 0x25, 0x86, 0x89, 0x02, 0x98, 0x48, 0x34, 0x0a, 0x19, 0xe9, 0xd8, + 0xac, 0x0c, 0xea, 0x37, 0x86, 0xfa, 0x24, 0xb4, 0x8c, 0xd2, 0xab, 0x3f, 0xfe, 0xfd, 0xe1, 0xc2, + 0x0c, 0x9a, 0xb6, 0x52, 0x42, 0x9b, 0xc8, 0x1f, 0x7a, 0xad, 0x41, 0xb1, 0x4f, 0xdf, 0xd0, 0xad, + 0x5c, 0xd0, 0xac, 0x38, 0xea, 0x8b, 0x67, 0x3b, 0x72, 0x0a, 0xb7, 0x18, 0x85, 0x79, 0x54, 0x4e, + 0x53, 0xa0, 0xd8, 0x77, 0x3c, 0xdf, 0xb5, 0x7c, 0x7c, 0x10, 0x51, 0x1c, 0xa0, 0x1f, 0x35, 0xb8, + 0x3c, 0xa8, 0x85, 0xe8, 0x4e, 0x6e, 0x96, 0x5c, 0x89, 0xd5, 0x97, 0x46, 0xf2, 0xe5, 0xa4, 0x6e, + 0x33, 0x52, 0x37, 0xd0, 0xbc, 0x8a, 0x94, 0x54, 0x5a, 0xf4, 0xab, 0x06, 0x57, 0x72, 0x45, 0x12, + 0x55, 0x72, 0x33, 0x0e, 0x53, 0x64, 0xbd, 0x7a, 0x9e, 0x10, 0xce, 0xf5, 0x01, 0xe3, 0xba, 0x86, + 0xaa, 0x69, 0xae, 0x21, 0x6e, 0x60, 0xaf, 0x1b, 0xb3, 0x95, 0xa7, 0xda, 0x3a, 0x12, 0x8f, 0xc7, + 0x56, 0xdc, 0xd3, 0x3f, 0x35, 0x28, 0x9f, 0x21, 0xbd, 0xe8, 0xe1, 0x50, 0x4e, 0xc3, 0xf5, 0x5d, + 0x7f, 0xf4, 0xff, 0x82, 0x79, 0x69, 0xf7, 0x59, 0x69, 0x55, 0xb4, 0xaa, 0x2e, 0xcd, 0xe5, 0x50, + 0x7b, 0x0d, 0x01, 0xb0, 0x17, 0x17, 0xf6, 0x9b, 0x06, 0x28, 0x2b, 0xe0, 0xc8, 0xcc, 0x1f, 0x02, + 0xd5, 0xea, 0xa0, 0x5b, 0x23, 0xfb, 0x73, 0xc6, 0x5b, 0x8c, 0xf1, 0x63, 0xf4, 0xc9, 0x39, 0x3f, + 0x46, 0x5b, 0x20, 0x59, 0x47, 0x14, 0x07, 0xc7, 0xe8, 0x17, 0x0d, 0x50, 0x56, 0x21, 0x15, 0xfc, + 0x95, 0xfa, 0xab, 0xe0, 0xaf, 0x96, 0x5e, 0xa3, 0xc2, 0xf8, 0x2f, 0xa1, 0xdb, 0x6a, 0xfe, 0x69, + 0xaa, 0xbf, 0x6b, 0x30, 0x95, 0xb7, 0x3a, 0xa0, 0x55, 0xc5, 0x1d, 0xa0, 0xdc, 0x5d, 0xf4, 0xca, + 0x39, 0x22, 0x38, 0xe1, 0xaf, 0x18, 0xe1, 0x27, 0xe8, 0xf3, 0x73, 0x36, 0xdc, 0x67, 0xa0, 0x7b, + 0x54, 0xa2, 0xc6, 0x63, 0x43, 0xd1, 0x4f, 0x1a, 0x14, 0xfb, 0x14, 0x5d, 0x71, 0xe1, 0x65, 0x17, + 0x04, 0xc5, 0x85, 0x97, 0xb3, 0x1c, 0x18, 0x77, 0x19, 0xe3, 0x15, 0xb4, 0xa4, 0x66, 0xdc, 0xb7, + 0x29, 0xf0, 0x26, 0x1f, 0x43, 0x41, 0x6e, 0x04, 0xe8, 0x66, 0xfe, 0xa1, 0x4a, 0xad, 0x12, 0xfa, + 0xc2, 0x59, 0x6e, 0x9c, 0xd0, 0x3c, 0x23, 0x74, 0x1d, 0x5d, 0x4b, 0x13, 0x92, 0xdb, 0x45, 0x9c, + 0x5e, 0xee, 0x0f, 0x8a, 0xf4, 0xe9, 0xc5, 0x43, 0x91, 0x3e, 0xb3, 0x86, 0xa8, 0xd3, 0xcb, 0xef, + 0x16, 0x2b, 0x5f, 0xb2, 0x70, 0x28, 0x94, 0x6f, 0x60, 0x47, 0x51, 0x28, 0xdf, 0xe0, 0xc6, 0xa2, + 0x56, 0xbe, 0x64, 0x73, 0x41, 0xaf, 0x34, 0x28, 0xc8, 0xa5, 0x42, 0x51, 0x72, 0x7a, 0xab, 0x51, + 0x94, 0x9c, 0xd9, 0x4d, 0x8c, 0x05, 0x96, 0x7c, 0x0e, 0x95, 0x32, 0x23, 0x40, 0x9a, 0xd8, 0x92, + 0x7b, 0x08, 0xfa, 0x4e, 0x83, 0x49, 0x11, 0x8d, 0x3e, 0x1a, 0x0a, 0x2e, 0x28, 0xdc, 0x3c, 0xc3, + 0x8b, 0x33, 0x58, 0x63, 0x0c, 0x4c, 0xb4, 0x3c, 0x9c, 0x81, 0x75, 0xd4, 0xb7, 0xef, 0x1c, 0x6f, + 0x3c, 0x7d, 0x73, 0x52, 0xd2, 0xde, 0x9e, 0x94, 0xb4, 0x7f, 0x4e, 0x4a, 0xda, 0xf7, 0xa7, 0xa5, + 0xb1, 0xb7, 0xa7, 0xa5, 0xb1, 0xbf, 0x4e, 0x4b, 0x63, 0xdf, 0xac, 0xba, 0x5e, 0xf4, 0xa2, 0x53, + 0x37, 0x1b, 0xa4, 0x65, 0x6d, 0x79, 0x3e, 0x6d, 0xbc, 0xf0, 0x6c, 0x6b, 0x9f, 0x3f, 0xac, 0x50, + 0xe7, 0xa5, 0x75, 0x20, 0xb3, 0x44, 0x87, 0x6d, 0x4c, 0xeb, 0x13, 0xec, 0x3f, 0xfc, 0xdd, 0xff, + 0x02, 0x00, 0x00, 0xff, 0xff, 0x9f, 0x73, 0xd4, 0xb9, 0x6f, 0x10, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Params queries the parameters of x/fbridge module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // NextSeqSend queries the sequence of next bridge request + NextSeqSend(ctx context.Context, in *QueryNextSeqSendRequest, opts ...grpc.CallOption) (*QueryNextSeqSendResponse, error) + // BlocknumToSeqs queries a list of block numbers for which each sequence has been confirmed. + SeqToBlocknums(ctx context.Context, in *QuerySeqToBlocknumsRequest, opts ...grpc.CallOption) (*QuerySeqToBlocknumsResponse, error) + // GreatestSeqByOperator queries a greatest sequence number confirmed by a particular operator + GreatestSeqByOperator(ctx context.Context, in *QueryGreatestSeqByOperatorRequest, opts ...grpc.CallOption) (*QueryGreatestSeqByOperatorResponse, error) + // GreatestConsecutiveConfirmedSeq queries a greatest consecutive sequence number confirmed by n-of-m operators + GreatestConsecutiveConfirmedSeq(ctx context.Context, in *QueryGreatestConsecutiveConfirmedSeqRequest, opts ...grpc.CallOption) (*QueryGreatestConsecutiveConfirmedSeqResponse, error) + // SubmittedProvision queries a provision submitted by a particular operator + SubmittedProvision(ctx context.Context, in *QuerySubmittedProvisionRequest, opts ...grpc.CallOption) (*QuerySubmittedProvisionResponse, error) + // ConfirmedProvision queries a particular sequence of confirmed provisions + ConfirmedProvision(ctx context.Context, in *QueryConfirmedProvisionRequest, opts ...grpc.CallOption) (*QueryConfirmedProvisionResponse, error) + // NeededSubmissionSeqs queries a list of sequence numbers that need to be submitted by a particular operator + // The search scope is [greatest_consecutive_seq_by_operator, min(greatest_consecutive_seq_by_operator + range, + // greatest_seq_by_operator)] greatest_consecutive_seq_by_operator can be replaced with greatest_consecutive_seq if + // the operator is newly added + NeededSubmissionSeqs(ctx context.Context, in *QueryNeededSubmissionSeqsRequest, opts ...grpc.CallOption) (*QueryNeededSubmissionSeqsResponse, error) + // Commitments queries commitments of a specific sequence number + Commitments(ctx context.Context, in *QueryCommitmentsRequest, opts ...grpc.CallOption) (*QueryCommitmentsResponse, error) + // Guardians queries a list of Guardians registered on the bridge + Guardians(ctx context.Context, in *QueryGuardiansRequest, opts ...grpc.CallOption) (*QueryGuardiansResponse, error) + // Operators queries a list of Operators registered on the bridge + Operators(ctx context.Context, in *QueryOperatorsRequest, opts ...grpc.CallOption) (*QueryOperatorsResponse, error) + // Judges queries a list of Judges registered on the bridge + Judges(ctx context.Context, in *QueryJudgesRequest, opts ...grpc.CallOption) (*QueryJudgesResponse, error) + // Proposals queries a list of SuggestRole Proposals + Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) + // Proposal queries a SuggestRole Proposal + Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) NextSeqSend(ctx context.Context, in *QueryNextSeqSendRequest, opts ...grpc.CallOption) (*QueryNextSeqSendResponse, error) { + out := new(QueryNextSeqSendResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/NextSeqSend", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) SeqToBlocknums(ctx context.Context, in *QuerySeqToBlocknumsRequest, opts ...grpc.CallOption) (*QuerySeqToBlocknumsResponse, error) { + out := new(QuerySeqToBlocknumsResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/SeqToBlocknums", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GreatestSeqByOperator(ctx context.Context, in *QueryGreatestSeqByOperatorRequest, opts ...grpc.CallOption) (*QueryGreatestSeqByOperatorResponse, error) { + out := new(QueryGreatestSeqByOperatorResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/GreatestSeqByOperator", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GreatestConsecutiveConfirmedSeq(ctx context.Context, in *QueryGreatestConsecutiveConfirmedSeqRequest, opts ...grpc.CallOption) (*QueryGreatestConsecutiveConfirmedSeqResponse, error) { + out := new(QueryGreatestConsecutiveConfirmedSeqResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/GreatestConsecutiveConfirmedSeq", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) SubmittedProvision(ctx context.Context, in *QuerySubmittedProvisionRequest, opts ...grpc.CallOption) (*QuerySubmittedProvisionResponse, error) { + out := new(QuerySubmittedProvisionResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/SubmittedProvision", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ConfirmedProvision(ctx context.Context, in *QueryConfirmedProvisionRequest, opts ...grpc.CallOption) (*QueryConfirmedProvisionResponse, error) { + out := new(QueryConfirmedProvisionResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/ConfirmedProvision", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) NeededSubmissionSeqs(ctx context.Context, in *QueryNeededSubmissionSeqsRequest, opts ...grpc.CallOption) (*QueryNeededSubmissionSeqsResponse, error) { + out := new(QueryNeededSubmissionSeqsResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/NeededSubmissionSeqs", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Commitments(ctx context.Context, in *QueryCommitmentsRequest, opts ...grpc.CallOption) (*QueryCommitmentsResponse, error) { + out := new(QueryCommitmentsResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Commitments", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Guardians(ctx context.Context, in *QueryGuardiansRequest, opts ...grpc.CallOption) (*QueryGuardiansResponse, error) { + out := new(QueryGuardiansResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Guardians", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Operators(ctx context.Context, in *QueryOperatorsRequest, opts ...grpc.CallOption) (*QueryOperatorsResponse, error) { + out := new(QueryOperatorsResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Operators", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Judges(ctx context.Context, in *QueryJudgesRequest, opts ...grpc.CallOption) (*QueryJudgesResponse, error) { + out := new(QueryJudgesResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Judges", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) { + out := new(QueryProposalsResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Proposals", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) { + out := new(QueryProposalResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Query/Proposal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Params queries the parameters of x/fbridge module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // NextSeqSend queries the sequence of next bridge request + NextSeqSend(context.Context, *QueryNextSeqSendRequest) (*QueryNextSeqSendResponse, error) + // BlocknumToSeqs queries a list of block numbers for which each sequence has been confirmed. + SeqToBlocknums(context.Context, *QuerySeqToBlocknumsRequest) (*QuerySeqToBlocknumsResponse, error) + // GreatestSeqByOperator queries a greatest sequence number confirmed by a particular operator + GreatestSeqByOperator(context.Context, *QueryGreatestSeqByOperatorRequest) (*QueryGreatestSeqByOperatorResponse, error) + // GreatestConsecutiveConfirmedSeq queries a greatest consecutive sequence number confirmed by n-of-m operators + GreatestConsecutiveConfirmedSeq(context.Context, *QueryGreatestConsecutiveConfirmedSeqRequest) (*QueryGreatestConsecutiveConfirmedSeqResponse, error) + // SubmittedProvision queries a provision submitted by a particular operator + SubmittedProvision(context.Context, *QuerySubmittedProvisionRequest) (*QuerySubmittedProvisionResponse, error) + // ConfirmedProvision queries a particular sequence of confirmed provisions + ConfirmedProvision(context.Context, *QueryConfirmedProvisionRequest) (*QueryConfirmedProvisionResponse, error) + // NeededSubmissionSeqs queries a list of sequence numbers that need to be submitted by a particular operator + // The search scope is [greatest_consecutive_seq_by_operator, min(greatest_consecutive_seq_by_operator + range, + // greatest_seq_by_operator)] greatest_consecutive_seq_by_operator can be replaced with greatest_consecutive_seq if + // the operator is newly added + NeededSubmissionSeqs(context.Context, *QueryNeededSubmissionSeqsRequest) (*QueryNeededSubmissionSeqsResponse, error) + // Commitments queries commitments of a specific sequence number + Commitments(context.Context, *QueryCommitmentsRequest) (*QueryCommitmentsResponse, error) + // Guardians queries a list of Guardians registered on the bridge + Guardians(context.Context, *QueryGuardiansRequest) (*QueryGuardiansResponse, error) + // Operators queries a list of Operators registered on the bridge + Operators(context.Context, *QueryOperatorsRequest) (*QueryOperatorsResponse, error) + // Judges queries a list of Judges registered on the bridge + Judges(context.Context, *QueryJudgesRequest) (*QueryJudgesResponse, error) + // Proposals queries a list of SuggestRole Proposals + Proposals(context.Context, *QueryProposalsRequest) (*QueryProposalsResponse, error) + // Proposal queries a SuggestRole Proposal + Proposal(context.Context, *QueryProposalRequest) (*QueryProposalResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) NextSeqSend(ctx context.Context, req *QueryNextSeqSendRequest) (*QueryNextSeqSendResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NextSeqSend not implemented") +} +func (*UnimplementedQueryServer) SeqToBlocknums(ctx context.Context, req *QuerySeqToBlocknumsRequest) (*QuerySeqToBlocknumsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SeqToBlocknums not implemented") +} +func (*UnimplementedQueryServer) GreatestSeqByOperator(ctx context.Context, req *QueryGreatestSeqByOperatorRequest) (*QueryGreatestSeqByOperatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GreatestSeqByOperator not implemented") +} +func (*UnimplementedQueryServer) GreatestConsecutiveConfirmedSeq(ctx context.Context, req *QueryGreatestConsecutiveConfirmedSeqRequest) (*QueryGreatestConsecutiveConfirmedSeqResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GreatestConsecutiveConfirmedSeq not implemented") +} +func (*UnimplementedQueryServer) SubmittedProvision(ctx context.Context, req *QuerySubmittedProvisionRequest) (*QuerySubmittedProvisionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmittedProvision not implemented") +} +func (*UnimplementedQueryServer) ConfirmedProvision(ctx context.Context, req *QueryConfirmedProvisionRequest) (*QueryConfirmedProvisionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConfirmedProvision not implemented") +} +func (*UnimplementedQueryServer) NeededSubmissionSeqs(ctx context.Context, req *QueryNeededSubmissionSeqsRequest) (*QueryNeededSubmissionSeqsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NeededSubmissionSeqs not implemented") +} +func (*UnimplementedQueryServer) Commitments(ctx context.Context, req *QueryCommitmentsRequest) (*QueryCommitmentsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Commitments not implemented") +} +func (*UnimplementedQueryServer) Guardians(ctx context.Context, req *QueryGuardiansRequest) (*QueryGuardiansResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Guardians not implemented") +} +func (*UnimplementedQueryServer) Operators(ctx context.Context, req *QueryOperatorsRequest) (*QueryOperatorsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Operators not implemented") +} +func (*UnimplementedQueryServer) Judges(ctx context.Context, req *QueryJudgesRequest) (*QueryJudgesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Judges not implemented") +} +func (*UnimplementedQueryServer) Proposals(ctx context.Context, req *QueryProposalsRequest) (*QueryProposalsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Proposals not implemented") +} +func (*UnimplementedQueryServer) Proposal(ctx context.Context, req *QueryProposalRequest) (*QueryProposalResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Proposal not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_NextSeqSend_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryNextSeqSendRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).NextSeqSend(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Query/NextSeqSend", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).NextSeqSend(ctx, req.(*QueryNextSeqSendRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_SeqToBlocknums_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySeqToBlocknumsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).SeqToBlocknums(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Query/SeqToBlocknums", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).SeqToBlocknums(ctx, req.(*QuerySeqToBlocknumsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GreatestSeqByOperator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGreatestSeqByOperatorRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GreatestSeqByOperator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Query/GreatestSeqByOperator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GreatestSeqByOperator(ctx, req.(*QueryGreatestSeqByOperatorRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GreatestConsecutiveConfirmedSeq_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGreatestConsecutiveConfirmedSeqRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GreatestConsecutiveConfirmedSeq(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Query/GreatestConsecutiveConfirmedSeq", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GreatestConsecutiveConfirmedSeq(ctx, req.(*QueryGreatestConsecutiveConfirmedSeqRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_SubmittedProvision_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySubmittedProvisionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).SubmittedProvision(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Query/SubmittedProvision", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).SubmittedProvision(ctx, req.(*QuerySubmittedProvisionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ConfirmedProvision_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryConfirmedProvisionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ConfirmedProvision(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Query/ConfirmedProvision", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ConfirmedProvision(ctx, req.(*QueryConfirmedProvisionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_NeededSubmissionSeqs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryNeededSubmissionSeqsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).NeededSubmissionSeqs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Query/NeededSubmissionSeqs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).NeededSubmissionSeqs(ctx, req.(*QueryNeededSubmissionSeqsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Commitments_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCommitmentsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Commitments(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Query/Commitments", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Commitments(ctx, req.(*QueryCommitmentsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Guardians_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGuardiansRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Guardians(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Query/Guardians", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Guardians(ctx, req.(*QueryGuardiansRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Operators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOperatorsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Operators(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Query/Operators", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Operators(ctx, req.(*QueryOperatorsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Judges_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryJudgesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Judges(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Query/Judges", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Judges(ctx, req.(*QueryJudgesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Proposals_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryProposalsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Proposals(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Query/Proposals", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Proposals(ctx, req.(*QueryProposalsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Proposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryProposalRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Proposal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Query/Proposal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Proposal(ctx, req.(*QueryProposalRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "lbm.fbridge.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "NextSeqSend", + Handler: _Query_NextSeqSend_Handler, + }, + { + MethodName: "SeqToBlocknums", + Handler: _Query_SeqToBlocknums_Handler, + }, + { + MethodName: "GreatestSeqByOperator", + Handler: _Query_GreatestSeqByOperator_Handler, + }, + { + MethodName: "GreatestConsecutiveConfirmedSeq", + Handler: _Query_GreatestConsecutiveConfirmedSeq_Handler, + }, + { + MethodName: "SubmittedProvision", + Handler: _Query_SubmittedProvision_Handler, + }, + { + MethodName: "ConfirmedProvision", + Handler: _Query_ConfirmedProvision_Handler, + }, + { + MethodName: "NeededSubmissionSeqs", + Handler: _Query_NeededSubmissionSeqs_Handler, + }, + { + MethodName: "Commitments", + Handler: _Query_Commitments_Handler, + }, + { + MethodName: "Guardians", + Handler: _Query_Guardians_Handler, + }, + { + MethodName: "Operators", + Handler: _Query_Operators_Handler, + }, + { + MethodName: "Judges", + Handler: _Query_Judges_Handler, + }, + { + MethodName: "Proposals", + Handler: _Query_Proposals_Handler, + }, + { + MethodName: "Proposal", + Handler: _Query_Proposal_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "lbm/fbridge/v1/query.proto", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryNextSeqSendRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryNextSeqSendRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryNextSeqSendRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryNextSeqSendResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryNextSeqSendResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryNextSeqSendResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Seq != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QuerySeqToBlocknumsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QuerySeqToBlocknumsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySeqToBlocknumsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Seqs) > 0 { + dAtA3 := make([]byte, len(m.Seqs)*10) + var j2 int + for _, num := range m.Seqs { + for num >= 1<<7 { + dAtA3[j2] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j2++ + } + dAtA3[j2] = uint8(num) + j2++ + } + i -= j2 + copy(dAtA[i:], dAtA3[:j2]) + i = encodeVarintQuery(dAtA, i, uint64(j2)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QuerySeqToBlocknumsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QuerySeqToBlocknumsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySeqToBlocknumsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Blocknums) > 0 { + dAtA5 := make([]byte, len(m.Blocknums)*10) + var j4 int + for _, num := range m.Blocknums { + for num >= 1<<7 { + dAtA5[j4] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j4++ + } + dAtA5[j4] = uint8(num) + j4++ + } + i -= j4 + copy(dAtA[i:], dAtA5[:j4]) + i = encodeVarintQuery(dAtA, i, uint64(j4)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGreatestSeqByOperatorRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGreatestSeqByOperatorRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGreatestSeqByOperatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Operator) > 0 { + i -= len(m.Operator) + copy(dAtA[i:], m.Operator) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Operator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGreatestSeqByOperatorResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGreatestSeqByOperatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGreatestSeqByOperatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Seq != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryGreatestConsecutiveConfirmedSeqRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGreatestConsecutiveConfirmedSeqRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGreatestConsecutiveConfirmedSeqRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryGreatestConsecutiveConfirmedSeqResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGreatestConsecutiveConfirmedSeqResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGreatestConsecutiveConfirmedSeqResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Seq != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QuerySubmittedProvisionRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QuerySubmittedProvisionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySubmittedProvisionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Seq != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x10 + } + if len(m.Operator) > 0 { + i -= len(m.Operator) + copy(dAtA[i:], m.Operator) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Operator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QuerySubmittedProvisionResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QuerySubmittedProvisionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySubmittedProvisionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryNeededSubmissionSeqsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryNeededSubmissionSeqsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryNeededSubmissionSeqsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Range != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Range)) + i-- + dAtA[i] = 0x10 + } + if len(m.Operator) > 0 { + i -= len(m.Operator) + copy(dAtA[i:], m.Operator) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Operator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryNeededSubmissionSeqsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryNeededSubmissionSeqsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryNeededSubmissionSeqsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Seqs) > 0 { + dAtA9 := make([]byte, len(m.Seqs)*10) + var j8 int + for _, num := range m.Seqs { + for num >= 1<<7 { + dAtA9[j8] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j8++ + } + dAtA9[j8] = uint8(num) + j8++ + } + i -= j8 + copy(dAtA[i:], dAtA9[:j8]) + i = encodeVarintQuery(dAtA, i, uint64(j8)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryConfirmedProvisionRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryConfirmedProvisionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConfirmedProvisionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Seq != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryConfirmedProvisionResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryConfirmedProvisionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryConfirmedProvisionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryCommitmentsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryCommitmentsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCommitmentsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Seq != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryCommitmentsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryCommitmentsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCommitmentsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Commitments) > 0 { + for iNdEx := len(m.Commitments) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Commitments[iNdEx]) + copy(dAtA[i:], m.Commitments[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Commitments[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryGuardiansRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGuardiansRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGuardiansRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryGuardiansResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGuardiansResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGuardiansResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Guardians) > 0 { + for iNdEx := len(m.Guardians) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Guardians[iNdEx]) + copy(dAtA[i:], m.Guardians[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Guardians[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryOperatorsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryOperatorsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOperatorsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryOperatorsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryOperatorsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOperatorsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Operators) > 0 { + for iNdEx := len(m.Operators) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Operators[iNdEx]) + copy(dAtA[i:], m.Operators[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Operators[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryJudgesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryJudgesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryJudgesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryJudgesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryJudgesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryJudgesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Judges) > 0 { + for iNdEx := len(m.Judges) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Judges[iNdEx]) + copy(dAtA[i:], m.Judges[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Judges[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryProposalsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryProposalsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProposalsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryProposalsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryProposalsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProposalsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Proposals) > 0 { + for iNdEx := len(m.Proposals) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Proposals[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryProposalRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryProposalRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProposalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ProposalId) > 0 { + i -= len(m.ProposalId) + copy(dAtA[i:], m.ProposalId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ProposalId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryProposalResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryProposalResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Proposal != nil { + { + size, err := m.Proposal.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryNextSeqSendRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryNextSeqSendResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Seq != 0 { + n += 1 + sovQuery(uint64(m.Seq)) + } + return n +} + +func (m *QuerySeqToBlocknumsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Seqs) > 0 { + l = 0 + for _, e := range m.Seqs { + l += sovQuery(uint64(e)) + } + n += 1 + sovQuery(uint64(l)) + l + } + return n +} + +func (m *QuerySeqToBlocknumsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Blocknums) > 0 { + l = 0 + for _, e := range m.Blocknums { + l += sovQuery(uint64(e)) + } + n += 1 + sovQuery(uint64(l)) + l + } + return n +} + +func (m *QueryGreatestSeqByOperatorRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Operator) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryGreatestSeqByOperatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Seq != 0 { + n += 1 + sovQuery(uint64(m.Seq)) + } + return n +} + +func (m *QueryGreatestConsecutiveConfirmedSeqRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryGreatestConsecutiveConfirmedSeqResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Seq != 0 { + n += 1 + sovQuery(uint64(m.Seq)) + } + return n +} + +func (m *QuerySubmittedProvisionRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Operator) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Seq != 0 { + n += 1 + sovQuery(uint64(m.Seq)) + } + return n +} + +func (m *QuerySubmittedProvisionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Data.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryNeededSubmissionSeqsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Operator) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Range != 0 { + n += 1 + sovQuery(uint64(m.Range)) + } + return n +} + +func (m *QueryNeededSubmissionSeqsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Seqs) > 0 { + l = 0 + for _, e := range m.Seqs { + l += sovQuery(uint64(e)) + } + n += 1 + sovQuery(uint64(l)) + l + } + return n +} + +func (m *QueryConfirmedProvisionRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Seq != 0 { + n += 1 + sovQuery(uint64(m.Seq)) + } + return n +} + +func (m *QueryConfirmedProvisionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Data.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryCommitmentsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Seq != 0 { + n += 1 + sovQuery(uint64(m.Seq)) + } + return n +} + +func (m *QueryCommitmentsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Commitments) > 0 { + for _, s := range m.Commitments { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryGuardiansRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryGuardiansResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Guardians) > 0 { + for _, s := range m.Guardians { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryOperatorsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryOperatorsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Operators) > 0 { + for _, s := range m.Operators { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryJudgesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryJudgesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Judges) > 0 { + for _, s := range m.Judges { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryProposalsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryProposalsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Proposals) > 0 { + for _, e := range m.Proposals { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryProposalRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ProposalId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryProposalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Proposal != nil { + l = m.Proposal.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryNextSeqSendRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryNextSeqSendRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryNextSeqSendRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryNextSeqSendResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryNextSeqSendResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryNextSeqSendResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySeqToBlocknumsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySeqToBlocknumsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySeqToBlocknumsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Seqs = append(m.Seqs, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Seqs) == 0 { + m.Seqs = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Seqs = append(m.Seqs, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Seqs", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySeqToBlocknumsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySeqToBlocknumsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySeqToBlocknumsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Blocknums = append(m.Blocknums, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Blocknums) == 0 { + m.Blocknums = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Blocknums = append(m.Blocknums, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Blocknums", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGreatestSeqByOperatorRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGreatestSeqByOperatorRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGreatestSeqByOperatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Operator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGreatestSeqByOperatorResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGreatestSeqByOperatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGreatestSeqByOperatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGreatestConsecutiveConfirmedSeqRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGreatestConsecutiveConfirmedSeqRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGreatestConsecutiveConfirmedSeqRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGreatestConsecutiveConfirmedSeqResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGreatestConsecutiveConfirmedSeqResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGreatestConsecutiveConfirmedSeqResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySubmittedProvisionRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySubmittedProvisionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySubmittedProvisionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Operator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySubmittedProvisionResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySubmittedProvisionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySubmittedProvisionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryNeededSubmissionSeqsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryNeededSubmissionSeqsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryNeededSubmissionSeqsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Operator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) + } + m.Range = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Range |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryNeededSubmissionSeqsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryNeededSubmissionSeqsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryNeededSubmissionSeqsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Seqs = append(m.Seqs, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Seqs) == 0 { + m.Seqs = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Seqs = append(m.Seqs, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Seqs", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryConfirmedProvisionRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConfirmedProvisionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConfirmedProvisionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryConfirmedProvisionResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryConfirmedProvisionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryConfirmedProvisionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCommitmentsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryCommitmentsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCommitmentsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCommitmentsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryCommitmentsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCommitmentsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commitments", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Commitments = append(m.Commitments, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGuardiansRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGuardiansRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGuardiansRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGuardiansResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGuardiansResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGuardiansResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Guardians", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Guardians = append(m.Guardians, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOperatorsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryOperatorsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOperatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOperatorsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryOperatorsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOperatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Operators", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Operators = append(m.Operators, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryJudgesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryJudgesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryJudgesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryJudgesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryJudgesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryJudgesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Judges", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Judges = append(m.Judges, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryProposalsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryProposalsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryProposalsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryProposalsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposals", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Proposals = append(m.Proposals, &RoleProposal{}) + if err := m.Proposals[len(m.Proposals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryProposalRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProposalId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryProposalResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryProposalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposal", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Proposal == nil { + m.Proposal = &RoleProposal{} + } + if err := m.Proposal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/fbridge/types/query.pb.gw.go b/x/fbridge/types/query.pb.gw.go new file mode 100644 index 0000000000..c62ab4e113 --- /dev/null +++ b/x/fbridge/types/query.pb.gw.go @@ -0,0 +1,1246 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: lbm/fbridge/v1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_NextSeqSend_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryNextSeqSendRequest + var metadata runtime.ServerMetadata + + msg, err := client.NextSeqSend(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_NextSeqSend_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryNextSeqSendRequest + var metadata runtime.ServerMetadata + + msg, err := server.NextSeqSend(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_SeqToBlocknums_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_SeqToBlocknums_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySeqToBlocknumsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SeqToBlocknums_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SeqToBlocknums(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_SeqToBlocknums_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySeqToBlocknumsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SeqToBlocknums_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.SeqToBlocknums(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GreatestSeqByOperator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGreatestSeqByOperatorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator") + } + + protoReq.Operator, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator", err) + } + + msg, err := client.GreatestSeqByOperator(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GreatestSeqByOperator_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGreatestSeqByOperatorRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator") + } + + protoReq.Operator, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator", err) + } + + msg, err := server.GreatestSeqByOperator(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GreatestConsecutiveConfirmedSeq_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGreatestConsecutiveConfirmedSeqRequest + var metadata runtime.ServerMetadata + + msg, err := client.GreatestConsecutiveConfirmedSeq(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GreatestConsecutiveConfirmedSeq_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGreatestConsecutiveConfirmedSeqRequest + var metadata runtime.ServerMetadata + + msg, err := server.GreatestConsecutiveConfirmedSeq(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_SubmittedProvision_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySubmittedProvisionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator") + } + + protoReq.Operator, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator", err) + } + + val, ok = pathParams["seq"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "seq") + } + + protoReq.Seq, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "seq", err) + } + + msg, err := client.SubmittedProvision(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_SubmittedProvision_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySubmittedProvisionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator") + } + + protoReq.Operator, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator", err) + } + + val, ok = pathParams["seq"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "seq") + } + + protoReq.Seq, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "seq", err) + } + + msg, err := server.SubmittedProvision(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_ConfirmedProvision_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConfirmedProvisionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["seq"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "seq") + } + + protoReq.Seq, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "seq", err) + } + + msg, err := client.ConfirmedProvision(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ConfirmedProvision_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryConfirmedProvisionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["seq"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "seq") + } + + protoReq.Seq, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "seq", err) + } + + msg, err := server.ConfirmedProvision(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_NeededSubmissionSeqs_0 = &utilities.DoubleArray{Encoding: map[string]int{"operator": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_NeededSubmissionSeqs_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryNeededSubmissionSeqsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator") + } + + protoReq.Operator, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_NeededSubmissionSeqs_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.NeededSubmissionSeqs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_NeededSubmissionSeqs_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryNeededSubmissionSeqsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator") + } + + protoReq.Operator, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_NeededSubmissionSeqs_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.NeededSubmissionSeqs(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Commitments_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCommitmentsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["seq"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "seq") + } + + protoReq.Seq, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "seq", err) + } + + msg, err := client.Commitments(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Commitments_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCommitmentsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["seq"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "seq") + } + + protoReq.Seq, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "seq", err) + } + + msg, err := server.Commitments(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Guardians_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGuardiansRequest + var metadata runtime.ServerMetadata + + msg, err := client.Guardians(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Guardians_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGuardiansRequest + var metadata runtime.ServerMetadata + + msg, err := server.Guardians(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Operators_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOperatorsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Operators(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Operators_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOperatorsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Operators(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Judges_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryJudgesRequest + var metadata runtime.ServerMetadata + + msg, err := client.Judges(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Judges_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryJudgesRequest + var metadata runtime.ServerMetadata + + msg, err := server.Judges(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Proposals_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Proposals_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryProposalsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Proposals_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Proposals(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Proposals_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryProposalsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Proposals_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Proposals(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryProposalRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + msg, err := client.Proposal(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryProposalRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + msg, err := server.Proposal(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_NextSeqSend_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_NextSeqSend_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_NextSeqSend_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SeqToBlocknums_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_SeqToBlocknums_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SeqToBlocknums_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GreatestSeqByOperator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GreatestSeqByOperator_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GreatestSeqByOperator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GreatestConsecutiveConfirmedSeq_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_GreatestConsecutiveConfirmedSeq_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GreatestConsecutiveConfirmedSeq_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SubmittedProvision_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_SubmittedProvision_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SubmittedProvision_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ConfirmedProvision_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ConfirmedProvision_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ConfirmedProvision_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_NeededSubmissionSeqs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_NeededSubmissionSeqs_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_NeededSubmissionSeqs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Commitments_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Commitments_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Commitments_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Guardians_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Guardians_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Guardians_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Operators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Operators_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Operators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Judges_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Judges_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Judges_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Proposals_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Proposals_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Proposals_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Proposal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Proposal_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Proposal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_NextSeqSend_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_NextSeqSend_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_NextSeqSend_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SeqToBlocknums_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_SeqToBlocknums_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SeqToBlocknums_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GreatestSeqByOperator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GreatestSeqByOperator_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GreatestSeqByOperator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GreatestConsecutiveConfirmedSeq_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_GreatestConsecutiveConfirmedSeq_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_GreatestConsecutiveConfirmedSeq_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SubmittedProvision_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_SubmittedProvision_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SubmittedProvision_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ConfirmedProvision_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_ConfirmedProvision_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ConfirmedProvision_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_NeededSubmissionSeqs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_NeededSubmissionSeqs_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_NeededSubmissionSeqs_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Commitments_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Commitments_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Commitments_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Guardians_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Guardians_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Guardians_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Operators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Operators_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Operators_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Judges_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Judges_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Judges_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Proposals_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Proposals_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Proposals_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Proposal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Proposal_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Proposal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_NextSeqSend_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"lbm", "fbridge", "v1", "sending", "nextseq"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_SeqToBlocknums_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"lbm", "fbridge", "v1", "sending", "blocknums"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GreatestSeqByOperator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"lbm", "fbridge", "v1", "receiving", "operators", "operator", "seq"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GreatestConsecutiveConfirmedSeq_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"lbm", "fbridge", "v1", "receiving", "greatest_confirmed_seq"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_SubmittedProvision_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7}, []string{"lbm", "fbridge", "v1", "receiving", "operators", "operator", "provision", "seq"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_ConfirmedProvision_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"lbm", "fbridge", "v1", "receiving", "provision", "seq"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_NeededSubmissionSeqs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"lbm", "fbridge", "v1", "receiving", "operators", "operator", "needed_submission_seqs"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Commitments_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"lbm", "fbridge", "v1", "receiving", "commitments", "seq"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Guardians_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "guardians"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Operators_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "operators"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Judges_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fbridge", "v1", "judges"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Proposals_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"lbm", "fbridge", "v1", "role", "proposals"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Proposal_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"lbm", "fbridge", "v1", "role", "proposals", "proposal_id"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_NextSeqSend_0 = runtime.ForwardResponseMessage + + forward_Query_SeqToBlocknums_0 = runtime.ForwardResponseMessage + + forward_Query_GreatestSeqByOperator_0 = runtime.ForwardResponseMessage + + forward_Query_GreatestConsecutiveConfirmedSeq_0 = runtime.ForwardResponseMessage + + forward_Query_SubmittedProvision_0 = runtime.ForwardResponseMessage + + forward_Query_ConfirmedProvision_0 = runtime.ForwardResponseMessage + + forward_Query_NeededSubmissionSeqs_0 = runtime.ForwardResponseMessage + + forward_Query_Commitments_0 = runtime.ForwardResponseMessage + + forward_Query_Guardians_0 = runtime.ForwardResponseMessage + + forward_Query_Operators_0 = runtime.ForwardResponseMessage + + forward_Query_Judges_0 = runtime.ForwardResponseMessage + + forward_Query_Proposals_0 = runtime.ForwardResponseMessage + + forward_Query_Proposal_0 = runtime.ForwardResponseMessage +) diff --git a/x/fbridge/types/tx.pb.go b/x/fbridge/types/tx.pb.go new file mode 100644 index 0000000000..91346052d5 --- /dev/null +++ b/x/fbridge/types/tx.pb.go @@ -0,0 +1,4495 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lbm/fbridge/v1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + github_com_Finschia_finschia_sdk_types "github.com/Finschia/finschia-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgTransfer is input values required for bridge transfer +type MsgTransfer struct { + // the sender address on the source chain + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + // the recipient address on the destination chain + Receiver string `protobuf:"bytes,2,opt,name=receiver,proto3" json:"receiver,omitempty"` + // the amount of token to be transferred + Amount github_com_Finschia_finschia_sdk_types.Int `protobuf:"bytes,3,opt,name=amount,proto3,customtype=github.com/Finschia/finschia-sdk/types.Int" json:"amount"` +} + +func (m *MsgTransfer) Reset() { *m = MsgTransfer{} } +func (m *MsgTransfer) String() string { return proto.CompactTextString(m) } +func (*MsgTransfer) ProtoMessage() {} +func (*MsgTransfer) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{0} +} +func (m *MsgTransfer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTransfer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTransfer.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgTransfer) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTransfer.Merge(m, src) +} +func (m *MsgTransfer) XXX_Size() int { + return m.Size() +} +func (m *MsgTransfer) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTransfer.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTransfer proto.InternalMessageInfo + +func (m *MsgTransfer) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgTransfer) GetReceiver() string { + if m != nil { + return m.Receiver + } + return "" +} + +type MsgTransferResponse struct { +} + +func (m *MsgTransferResponse) Reset() { *m = MsgTransferResponse{} } +func (m *MsgTransferResponse) String() string { return proto.CompactTextString(m) } +func (*MsgTransferResponse) ProtoMessage() {} +func (*MsgTransferResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{1} +} +func (m *MsgTransferResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTransferResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTransferResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgTransferResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTransferResponse.Merge(m, src) +} +func (m *MsgTransferResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgTransferResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTransferResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTransferResponse proto.InternalMessageInfo + +// MsgProvision is input values required for provisioning +type MsgProvision struct { + // the operator address + From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` + // the sequence number of the bridge request + Seq uint64 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq,omitempty"` + // the sender address on the source chain + Sender string `protobuf:"bytes,3,opt,name=sender,proto3" json:"sender,omitempty"` + // the recipient address on the destination chain + Receiver string `protobuf:"bytes,4,opt,name=receiver,proto3" json:"receiver,omitempty"` + // the amount of token to be claimed + Amount github_com_Finschia_finschia_sdk_types.Int `protobuf:"bytes,5,opt,name=amount,proto3,customtype=github.com/Finschia/finschia-sdk/types.Int" json:"amount"` +} + +func (m *MsgProvision) Reset() { *m = MsgProvision{} } +func (m *MsgProvision) String() string { return proto.CompactTextString(m) } +func (*MsgProvision) ProtoMessage() {} +func (*MsgProvision) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{2} +} +func (m *MsgProvision) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgProvision) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgProvision.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgProvision) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgProvision.Merge(m, src) +} +func (m *MsgProvision) XXX_Size() int { + return m.Size() +} +func (m *MsgProvision) XXX_DiscardUnknown() { + xxx_messageInfo_MsgProvision.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgProvision proto.InternalMessageInfo + +func (m *MsgProvision) GetFrom() string { + if m != nil { + return m.From + } + return "" +} + +func (m *MsgProvision) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +func (m *MsgProvision) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgProvision) GetReceiver() string { + if m != nil { + return m.Receiver + } + return "" +} + +type MsgProvisionResponse struct { +} + +func (m *MsgProvisionResponse) Reset() { *m = MsgProvisionResponse{} } +func (m *MsgProvisionResponse) String() string { return proto.CompactTextString(m) } +func (*MsgProvisionResponse) ProtoMessage() {} +func (*MsgProvisionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{3} +} +func (m *MsgProvisionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgProvisionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgProvisionResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgProvisionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgProvisionResponse.Merge(m, src) +} +func (m *MsgProvisionResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgProvisionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgProvisionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgProvisionResponse proto.InternalMessageInfo + +// MsgHoldTransfer is input values required for holding transfer +type MsgHoldTransfer struct { + // the judge address + From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` + // the sequence number of the bridge request + Seq uint64 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq,omitempty"` +} + +func (m *MsgHoldTransfer) Reset() { *m = MsgHoldTransfer{} } +func (m *MsgHoldTransfer) String() string { return proto.CompactTextString(m) } +func (*MsgHoldTransfer) ProtoMessage() {} +func (*MsgHoldTransfer) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{4} +} +func (m *MsgHoldTransfer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgHoldTransfer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgHoldTransfer.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgHoldTransfer) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgHoldTransfer.Merge(m, src) +} +func (m *MsgHoldTransfer) XXX_Size() int { + return m.Size() +} +func (m *MsgHoldTransfer) XXX_DiscardUnknown() { + xxx_messageInfo_MsgHoldTransfer.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgHoldTransfer proto.InternalMessageInfo + +func (m *MsgHoldTransfer) GetFrom() string { + if m != nil { + return m.From + } + return "" +} + +func (m *MsgHoldTransfer) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +type MsgHoldTransferResponse struct { +} + +func (m *MsgHoldTransferResponse) Reset() { *m = MsgHoldTransferResponse{} } +func (m *MsgHoldTransferResponse) String() string { return proto.CompactTextString(m) } +func (*MsgHoldTransferResponse) ProtoMessage() {} +func (*MsgHoldTransferResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{5} +} +func (m *MsgHoldTransferResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgHoldTransferResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgHoldTransferResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgHoldTransferResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgHoldTransferResponse.Merge(m, src) +} +func (m *MsgHoldTransferResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgHoldTransferResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgHoldTransferResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgHoldTransferResponse proto.InternalMessageInfo + +// MsgReleaseTransfer is input values required for releasing a held transfer by time lock +type MsgReleaseTransfer struct { + // the guardian address + From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` + // the sequence number of the bridge request + Seq uint64 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq,omitempty"` +} + +func (m *MsgReleaseTransfer) Reset() { *m = MsgReleaseTransfer{} } +func (m *MsgReleaseTransfer) String() string { return proto.CompactTextString(m) } +func (*MsgReleaseTransfer) ProtoMessage() {} +func (*MsgReleaseTransfer) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{6} +} +func (m *MsgReleaseTransfer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgReleaseTransfer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgReleaseTransfer.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgReleaseTransfer) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgReleaseTransfer.Merge(m, src) +} +func (m *MsgReleaseTransfer) XXX_Size() int { + return m.Size() +} +func (m *MsgReleaseTransfer) XXX_DiscardUnknown() { + xxx_messageInfo_MsgReleaseTransfer.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgReleaseTransfer proto.InternalMessageInfo + +func (m *MsgReleaseTransfer) GetFrom() string { + if m != nil { + return m.From + } + return "" +} + +func (m *MsgReleaseTransfer) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +type MsgReleaseTransferResponse struct { +} + +func (m *MsgReleaseTransferResponse) Reset() { *m = MsgReleaseTransferResponse{} } +func (m *MsgReleaseTransferResponse) String() string { return proto.CompactTextString(m) } +func (*MsgReleaseTransferResponse) ProtoMessage() {} +func (*MsgReleaseTransferResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{7} +} +func (m *MsgReleaseTransferResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgReleaseTransferResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgReleaseTransferResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgReleaseTransferResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgReleaseTransferResponse.Merge(m, src) +} +func (m *MsgReleaseTransferResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgReleaseTransferResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgReleaseTransferResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgReleaseTransferResponse proto.InternalMessageInfo + +// MsgRemoveProvision is input values required for removing a specific confirmed provision +type MsgRemoveProvision struct { + // the judge address + From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` + // the sequence number of the bridge request + Seq uint64 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq,omitempty"` +} + +func (m *MsgRemoveProvision) Reset() { *m = MsgRemoveProvision{} } +func (m *MsgRemoveProvision) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveProvision) ProtoMessage() {} +func (*MsgRemoveProvision) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{8} +} +func (m *MsgRemoveProvision) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveProvision) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveProvision.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveProvision) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveProvision.Merge(m, src) +} +func (m *MsgRemoveProvision) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveProvision) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveProvision.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveProvision proto.InternalMessageInfo + +func (m *MsgRemoveProvision) GetFrom() string { + if m != nil { + return m.From + } + return "" +} + +func (m *MsgRemoveProvision) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +type MsgRemoveProvisionResponse struct { +} + +func (m *MsgRemoveProvisionResponse) Reset() { *m = MsgRemoveProvisionResponse{} } +func (m *MsgRemoveProvisionResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveProvisionResponse) ProtoMessage() {} +func (*MsgRemoveProvisionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{9} +} +func (m *MsgRemoveProvisionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveProvisionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveProvisionResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRemoveProvisionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveProvisionResponse.Merge(m, src) +} +func (m *MsgRemoveProvisionResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveProvisionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveProvisionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveProvisionResponse proto.InternalMessageInfo + +// MsgClaimBatch is input values required for claiming multiple claimable provisions +type MsgClaimBatch struct { + // the claimer address + From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` + // the maximum number of claims to be made at once + MaxClaims uint64 `protobuf:"varint,2,opt,name=max_claims,json=maxClaims,proto3" json:"max_claims,omitempty"` +} + +func (m *MsgClaimBatch) Reset() { *m = MsgClaimBatch{} } +func (m *MsgClaimBatch) String() string { return proto.CompactTextString(m) } +func (*MsgClaimBatch) ProtoMessage() {} +func (*MsgClaimBatch) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{10} +} +func (m *MsgClaimBatch) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgClaimBatch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgClaimBatch.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgClaimBatch) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgClaimBatch.Merge(m, src) +} +func (m *MsgClaimBatch) XXX_Size() int { + return m.Size() +} +func (m *MsgClaimBatch) XXX_DiscardUnknown() { + xxx_messageInfo_MsgClaimBatch.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgClaimBatch proto.InternalMessageInfo + +func (m *MsgClaimBatch) GetFrom() string { + if m != nil { + return m.From + } + return "" +} + +func (m *MsgClaimBatch) GetMaxClaims() uint64 { + if m != nil { + return m.MaxClaims + } + return 0 +} + +type MsgClaimBatchResponse struct { +} + +func (m *MsgClaimBatchResponse) Reset() { *m = MsgClaimBatchResponse{} } +func (m *MsgClaimBatchResponse) String() string { return proto.CompactTextString(m) } +func (*MsgClaimBatchResponse) ProtoMessage() {} +func (*MsgClaimBatchResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{11} +} +func (m *MsgClaimBatchResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgClaimBatchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgClaimBatchResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgClaimBatchResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgClaimBatchResponse.Merge(m, src) +} +func (m *MsgClaimBatchResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgClaimBatchResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgClaimBatchResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgClaimBatchResponse proto.InternalMessageInfo + +// MsgClaim is input values required for claiming a provision +type MsgClaim struct { + // the claimer address + From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` + // the sequence number of the bridge request + Seq uint64 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq,omitempty"` +} + +func (m *MsgClaim) Reset() { *m = MsgClaim{} } +func (m *MsgClaim) String() string { return proto.CompactTextString(m) } +func (*MsgClaim) ProtoMessage() {} +func (*MsgClaim) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{12} +} +func (m *MsgClaim) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgClaim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgClaim.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgClaim) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgClaim.Merge(m, src) +} +func (m *MsgClaim) XXX_Size() int { + return m.Size() +} +func (m *MsgClaim) XXX_DiscardUnknown() { + xxx_messageInfo_MsgClaim.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgClaim proto.InternalMessageInfo + +func (m *MsgClaim) GetFrom() string { + if m != nil { + return m.From + } + return "" +} + +func (m *MsgClaim) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +type MsgClaimResponse struct { +} + +func (m *MsgClaimResponse) Reset() { *m = MsgClaimResponse{} } +func (m *MsgClaimResponse) String() string { return proto.CompactTextString(m) } +func (*MsgClaimResponse) ProtoMessage() {} +func (*MsgClaimResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{13} +} +func (m *MsgClaimResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgClaimResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgClaimResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgClaimResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgClaimResponse.Merge(m, src) +} +func (m *MsgClaimResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgClaimResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgClaimResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgClaimResponse proto.InternalMessageInfo + +// MsgUpdateRole is input values required for updating the role of an address +type MsgSuggestRole struct { + // the guardian address + From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` + // the address to update the role + Target string `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"` + // the role to be updated + // - unspecified : 0, used to remove the address from a group + // - guardian : 1 + // - operator : 2 + // - judge : 3 + Role Role `protobuf:"varint,3,opt,name=role,proto3,enum=lbm.fbridge.v1.Role" json:"role,omitempty"` +} + +func (m *MsgSuggestRole) Reset() { *m = MsgSuggestRole{} } +func (m *MsgSuggestRole) String() string { return proto.CompactTextString(m) } +func (*MsgSuggestRole) ProtoMessage() {} +func (*MsgSuggestRole) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{14} +} +func (m *MsgSuggestRole) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSuggestRole) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSuggestRole.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSuggestRole) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSuggestRole.Merge(m, src) +} +func (m *MsgSuggestRole) XXX_Size() int { + return m.Size() +} +func (m *MsgSuggestRole) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSuggestRole.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSuggestRole proto.InternalMessageInfo + +func (m *MsgSuggestRole) GetFrom() string { + if m != nil { + return m.From + } + return "" +} + +func (m *MsgSuggestRole) GetTarget() string { + if m != nil { + return m.Target + } + return "" +} + +func (m *MsgSuggestRole) GetRole() Role { + if m != nil { + return m.Role + } + return Role_UNSPECIFIED +} + +type MsgSuggestRoleResponse struct { +} + +func (m *MsgSuggestRoleResponse) Reset() { *m = MsgSuggestRoleResponse{} } +func (m *MsgSuggestRoleResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSuggestRoleResponse) ProtoMessage() {} +func (*MsgSuggestRoleResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{15} +} +func (m *MsgSuggestRoleResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSuggestRoleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSuggestRoleResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSuggestRoleResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSuggestRoleResponse.Merge(m, src) +} +func (m *MsgSuggestRoleResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSuggestRoleResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSuggestRoleResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSuggestRoleResponse proto.InternalMessageInfo + +type MsgAddVoteForRole struct { + // the guardian address + From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` + // the proposal ID + ProposalId uint64 `protobuf:"varint,2,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + // the vote option + // - yes : true + // - no : false + Option bool `protobuf:"varint,3,opt,name=option,proto3" json:"option,omitempty"` +} + +func (m *MsgAddVoteForRole) Reset() { *m = MsgAddVoteForRole{} } +func (m *MsgAddVoteForRole) String() string { return proto.CompactTextString(m) } +func (*MsgAddVoteForRole) ProtoMessage() {} +func (*MsgAddVoteForRole) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{16} +} +func (m *MsgAddVoteForRole) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddVoteForRole) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddVoteForRole.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAddVoteForRole) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddVoteForRole.Merge(m, src) +} +func (m *MsgAddVoteForRole) XXX_Size() int { + return m.Size() +} +func (m *MsgAddVoteForRole) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddVoteForRole.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddVoteForRole proto.InternalMessageInfo + +func (m *MsgAddVoteForRole) GetFrom() string { + if m != nil { + return m.From + } + return "" +} + +func (m *MsgAddVoteForRole) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *MsgAddVoteForRole) GetOption() bool { + if m != nil { + return m.Option + } + return false +} + +type MsgAddVoteForRoleResponse struct { +} + +func (m *MsgAddVoteForRoleResponse) Reset() { *m = MsgAddVoteForRoleResponse{} } +func (m *MsgAddVoteForRoleResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAddVoteForRoleResponse) ProtoMessage() {} +func (*MsgAddVoteForRoleResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{17} +} +func (m *MsgAddVoteForRoleResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddVoteForRoleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddVoteForRoleResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAddVoteForRoleResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddVoteForRoleResponse.Merge(m, src) +} +func (m *MsgAddVoteForRoleResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAddVoteForRoleResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddVoteForRoleResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddVoteForRoleResponse proto.InternalMessageInfo + +// MsgHalt is input values required for halting the bridge module +type MsgHalt struct { + // the guardian address + Guardian string `protobuf:"bytes,1,opt,name=guardian,proto3" json:"guardian,omitempty"` +} + +func (m *MsgHalt) Reset() { *m = MsgHalt{} } +func (m *MsgHalt) String() string { return proto.CompactTextString(m) } +func (*MsgHalt) ProtoMessage() {} +func (*MsgHalt) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{18} +} +func (m *MsgHalt) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgHalt) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgHalt.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgHalt) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgHalt.Merge(m, src) +} +func (m *MsgHalt) XXX_Size() int { + return m.Size() +} +func (m *MsgHalt) XXX_DiscardUnknown() { + xxx_messageInfo_MsgHalt.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgHalt proto.InternalMessageInfo + +func (m *MsgHalt) GetGuardian() string { + if m != nil { + return m.Guardian + } + return "" +} + +type MsgHaltResponse struct { +} + +func (m *MsgHaltResponse) Reset() { *m = MsgHaltResponse{} } +func (m *MsgHaltResponse) String() string { return proto.CompactTextString(m) } +func (*MsgHaltResponse) ProtoMessage() {} +func (*MsgHaltResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{19} +} +func (m *MsgHaltResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgHaltResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgHaltResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgHaltResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgHaltResponse.Merge(m, src) +} +func (m *MsgHaltResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgHaltResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgHaltResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgHaltResponse proto.InternalMessageInfo + +// MsgResume is input values required for resuming the bridge module +type MsgResume struct { + // the guardian address + From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` +} + +func (m *MsgResume) Reset() { *m = MsgResume{} } +func (m *MsgResume) String() string { return proto.CompactTextString(m) } +func (*MsgResume) ProtoMessage() {} +func (*MsgResume) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{20} +} +func (m *MsgResume) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgResume) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgResume.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgResume) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgResume.Merge(m, src) +} +func (m *MsgResume) XXX_Size() int { + return m.Size() +} +func (m *MsgResume) XXX_DiscardUnknown() { + xxx_messageInfo_MsgResume.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgResume proto.InternalMessageInfo + +func (m *MsgResume) GetFrom() string { + if m != nil { + return m.From + } + return "" +} + +type MsgResumeResponse struct { +} + +func (m *MsgResumeResponse) Reset() { *m = MsgResumeResponse{} } +func (m *MsgResumeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgResumeResponse) ProtoMessage() {} +func (*MsgResumeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_54a336bc5ea063bb, []int{21} +} +func (m *MsgResumeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgResumeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgResumeResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgResumeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgResumeResponse.Merge(m, src) +} +func (m *MsgResumeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgResumeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgResumeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgResumeResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgTransfer)(nil), "lbm.fbridge.v1.MsgTransfer") + proto.RegisterType((*MsgTransferResponse)(nil), "lbm.fbridge.v1.MsgTransferResponse") + proto.RegisterType((*MsgProvision)(nil), "lbm.fbridge.v1.MsgProvision") + proto.RegisterType((*MsgProvisionResponse)(nil), "lbm.fbridge.v1.MsgProvisionResponse") + proto.RegisterType((*MsgHoldTransfer)(nil), "lbm.fbridge.v1.MsgHoldTransfer") + proto.RegisterType((*MsgHoldTransferResponse)(nil), "lbm.fbridge.v1.MsgHoldTransferResponse") + proto.RegisterType((*MsgReleaseTransfer)(nil), "lbm.fbridge.v1.MsgReleaseTransfer") + proto.RegisterType((*MsgReleaseTransferResponse)(nil), "lbm.fbridge.v1.MsgReleaseTransferResponse") + proto.RegisterType((*MsgRemoveProvision)(nil), "lbm.fbridge.v1.MsgRemoveProvision") + proto.RegisterType((*MsgRemoveProvisionResponse)(nil), "lbm.fbridge.v1.MsgRemoveProvisionResponse") + proto.RegisterType((*MsgClaimBatch)(nil), "lbm.fbridge.v1.MsgClaimBatch") + proto.RegisterType((*MsgClaimBatchResponse)(nil), "lbm.fbridge.v1.MsgClaimBatchResponse") + proto.RegisterType((*MsgClaim)(nil), "lbm.fbridge.v1.MsgClaim") + proto.RegisterType((*MsgClaimResponse)(nil), "lbm.fbridge.v1.MsgClaimResponse") + proto.RegisterType((*MsgSuggestRole)(nil), "lbm.fbridge.v1.MsgSuggestRole") + proto.RegisterType((*MsgSuggestRoleResponse)(nil), "lbm.fbridge.v1.MsgSuggestRoleResponse") + proto.RegisterType((*MsgAddVoteForRole)(nil), "lbm.fbridge.v1.MsgAddVoteForRole") + proto.RegisterType((*MsgAddVoteForRoleResponse)(nil), "lbm.fbridge.v1.MsgAddVoteForRoleResponse") + proto.RegisterType((*MsgHalt)(nil), "lbm.fbridge.v1.MsgHalt") + proto.RegisterType((*MsgHaltResponse)(nil), "lbm.fbridge.v1.MsgHaltResponse") + proto.RegisterType((*MsgResume)(nil), "lbm.fbridge.v1.MsgResume") + proto.RegisterType((*MsgResumeResponse)(nil), "lbm.fbridge.v1.MsgResumeResponse") +} + +func init() { proto.RegisterFile("lbm/fbridge/v1/tx.proto", fileDescriptor_54a336bc5ea063bb) } + +var fileDescriptor_54a336bc5ea063bb = []byte{ + // 757 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xcd, 0x4e, 0xdb, 0x4a, + 0x14, 0x4e, 0x6e, 0x42, 0x48, 0x0e, 0xdc, 0x00, 0x06, 0x92, 0x60, 0x20, 0x01, 0xdf, 0xcb, 0xbd, + 0x14, 0xa9, 0x09, 0xd0, 0x45, 0xa5, 0xae, 0xda, 0x20, 0xa1, 0x82, 0x6a, 0xb5, 0x72, 0x7f, 0x54, + 0x75, 0x51, 0x3a, 0x89, 0x27, 0x83, 0x55, 0xdb, 0x93, 0x7a, 0x26, 0x51, 0xfa, 0x10, 0x95, 0xfa, + 0x04, 0x7d, 0x8a, 0x3e, 0x04, 0x4b, 0x96, 0x55, 0x17, 0xa8, 0x82, 0x17, 0xa9, 0xec, 0xd8, 0x83, + 0x1d, 0xec, 0x04, 0xd4, 0xdd, 0x4c, 0xbe, 0x9f, 0x73, 0x8e, 0x67, 0xbe, 0xd8, 0x50, 0x36, 0x5b, + 0x56, 0xa3, 0xd3, 0x72, 0x0c, 0x9d, 0xe0, 0x46, 0x7f, 0xaf, 0xc1, 0x07, 0xf5, 0xae, 0x43, 0x39, + 0x95, 0x8a, 0x66, 0xcb, 0xaa, 0xfb, 0x40, 0xbd, 0xbf, 0x27, 0x2f, 0x11, 0x4a, 0xa8, 0x07, 0x35, + 0xdc, 0xd5, 0x90, 0x25, 0xaf, 0x8d, 0xc8, 0x03, 0x81, 0x87, 0x2a, 0x5f, 0xd2, 0x30, 0xa3, 0x32, + 0xf2, 0xca, 0x41, 0x36, 0xeb, 0x60, 0x47, 0x2a, 0x41, 0x8e, 0x61, 0x5b, 0xc7, 0x4e, 0x25, 0xbd, + 0x91, 0xde, 0x2e, 0x68, 0xfe, 0x4e, 0x92, 0x21, 0xef, 0xe0, 0x36, 0x36, 0xfa, 0xd8, 0xa9, 0xfc, + 0xe5, 0x21, 0x62, 0x2f, 0x1d, 0x43, 0x0e, 0x59, 0xb4, 0x67, 0xf3, 0x4a, 0xc6, 0x45, 0x9a, 0xfb, + 0x67, 0x17, 0xb5, 0xd4, 0xcf, 0x8b, 0xda, 0x0e, 0x31, 0xf8, 0x69, 0xaf, 0x55, 0x6f, 0x53, 0xab, + 0x71, 0x68, 0xd8, 0xac, 0x7d, 0x6a, 0xa0, 0x46, 0xc7, 0x5f, 0xdc, 0x67, 0xfa, 0xc7, 0x06, 0xff, + 0xdc, 0xc5, 0xac, 0x7e, 0x64, 0x73, 0xcd, 0x77, 0x50, 0x96, 0x61, 0x31, 0xd4, 0x8e, 0x86, 0x59, + 0x97, 0xda, 0x0c, 0x2b, 0xdf, 0xd3, 0x30, 0xab, 0x32, 0xf2, 0xc2, 0xa1, 0x7d, 0x83, 0x19, 0xd4, + 0x96, 0x24, 0xc8, 0x76, 0x1c, 0x6a, 0xf9, 0x5d, 0x7a, 0x6b, 0x69, 0x1e, 0x32, 0x0c, 0x7f, 0xf2, + 0xda, 0xcb, 0x6a, 0xee, 0x32, 0x34, 0x4d, 0x26, 0x71, 0x9a, 0x6c, 0xe2, 0x34, 0x53, 0x7f, 0x3c, + 0x4d, 0x09, 0x96, 0xc2, 0x5d, 0x8b, 0x71, 0x1e, 0xc2, 0x9c, 0xca, 0xc8, 0x53, 0x6a, 0xea, 0xe2, + 0xc1, 0xdf, 0x6a, 0x20, 0x65, 0x05, 0xca, 0x23, 0x42, 0xe1, 0xf9, 0x08, 0x24, 0x95, 0x11, 0x0d, + 0x9b, 0x18, 0x31, 0x7c, 0x47, 0xdb, 0x35, 0x90, 0x6f, 0x6a, 0x6f, 0x38, 0x5b, 0xb4, 0x8f, 0xef, + 0x78, 0x02, 0xc2, 0x39, 0xa2, 0x15, 0xce, 0x4d, 0xf8, 0x5b, 0x65, 0xe4, 0xc0, 0x44, 0x86, 0xd5, + 0x44, 0xbc, 0x7d, 0x1a, 0x6b, 0xba, 0x0e, 0x60, 0xa1, 0xc1, 0x49, 0xdb, 0x65, 0x31, 0xdf, 0xbb, + 0x60, 0xa1, 0x81, 0x27, 0x63, 0x4a, 0x19, 0x96, 0x23, 0x1e, 0xc2, 0x7c, 0x17, 0xf2, 0x01, 0x70, + 0xcb, 0x66, 0x25, 0x98, 0x0f, 0x14, 0xc2, 0xa5, 0x03, 0x45, 0x95, 0x91, 0x97, 0x3d, 0x42, 0x30, + 0xe3, 0x1a, 0x35, 0x71, 0xac, 0x57, 0x09, 0x72, 0x1c, 0x39, 0x04, 0x73, 0x3f, 0x1c, 0xfe, 0x4e, + 0xda, 0x86, 0xac, 0x43, 0x4d, 0xec, 0x5d, 0xbf, 0xe2, 0xfe, 0x52, 0x3d, 0x9a, 0xd8, 0xba, 0xeb, + 0xa7, 0x79, 0x0c, 0xa5, 0x02, 0xa5, 0x68, 0x1d, 0xd1, 0xc1, 0x07, 0x58, 0x50, 0x19, 0x79, 0xa2, + 0xeb, 0x6f, 0x28, 0xc7, 0x87, 0xd4, 0x49, 0x6c, 0xa2, 0x06, 0x33, 0x5d, 0x87, 0x76, 0x29, 0x43, + 0xe6, 0x89, 0xa1, 0xfb, 0x83, 0x41, 0xf0, 0xd3, 0x91, 0xee, 0x76, 0x49, 0xbb, 0xdc, 0xa0, 0xb6, + 0xd7, 0x4f, 0x5e, 0xf3, 0x77, 0xca, 0x2a, 0xac, 0xdc, 0xa8, 0x20, 0xca, 0x6f, 0xc1, 0xb4, 0x7b, + 0xe5, 0x90, 0xc9, 0xdd, 0xd8, 0x90, 0x1e, 0x72, 0x74, 0x03, 0xd9, 0x7e, 0x61, 0xb1, 0x57, 0x16, + 0x86, 0x57, 0x1a, 0x99, 0x5c, 0x28, 0x6b, 0x50, 0xf0, 0xce, 0x9e, 0xf5, 0xac, 0xd8, 0x86, 0x95, + 0x45, 0x6f, 0xb2, 0x21, 0x21, 0x50, 0xed, 0x7f, 0x9b, 0x86, 0x8c, 0xca, 0x88, 0xf4, 0x0c, 0xf2, + 0xe2, 0x16, 0xaf, 0x8e, 0x3e, 0xb8, 0xd0, 0x7f, 0x84, 0xfc, 0xcf, 0x18, 0x30, 0x70, 0x95, 0x9e, + 0x43, 0xe1, 0xfa, 0xea, 0xae, 0xc5, 0x28, 0x04, 0x2a, 0xff, 0x3b, 0x0e, 0x15, 0x86, 0x6f, 0x61, + 0x36, 0x92, 0xdf, 0x5a, 0x8c, 0x2a, 0x4c, 0x90, 0xff, 0x9f, 0x40, 0x10, 0xce, 0x08, 0xe6, 0x46, + 0x53, 0xac, 0xc4, 0x68, 0x47, 0x38, 0xf2, 0xce, 0x64, 0x4e, 0xb4, 0x44, 0x34, 0xce, 0xf1, 0x25, + 0x22, 0x9c, 0x84, 0x12, 0xb1, 0xd1, 0x96, 0x34, 0x80, 0x50, 0xae, 0xd7, 0x63, 0x94, 0xd7, 0xb0, + 0xbc, 0x35, 0x16, 0x16, 0x9e, 0x07, 0x30, 0x35, 0x8c, 0x73, 0x25, 0x89, 0x2f, 0x6f, 0x24, 0x21, + 0xc2, 0xe4, 0x35, 0xcc, 0x84, 0xd3, 0x5c, 0x8d, 0x11, 0x84, 0x70, 0xf9, 0xbf, 0xf1, 0xb8, 0xb0, + 0x7d, 0x0f, 0xc5, 0x91, 0x88, 0x6e, 0xc6, 0x28, 0xa3, 0x14, 0xf9, 0xde, 0x44, 0x8a, 0xf0, 0x7f, + 0x0c, 0x59, 0x2f, 0x83, 0xe5, 0xb8, 0x6b, 0x84, 0x4c, 0x2e, 0xd7, 0x12, 0x00, 0xe1, 0x70, 0x08, + 0x39, 0x3f, 0x8b, 0x2b, 0xb1, 0xe7, 0xe8, 0x42, 0xf2, 0x66, 0x22, 0x14, 0xf8, 0x34, 0x8f, 0xcf, + 0x2e, 0xab, 0xe9, 0xf3, 0xcb, 0x6a, 0xfa, 0xd7, 0x65, 0x35, 0xfd, 0xf5, 0xaa, 0x9a, 0x3a, 0xbf, + 0xaa, 0xa6, 0x7e, 0x5c, 0x55, 0x53, 0xef, 0x76, 0x27, 0xbe, 0x22, 0x07, 0xe2, 0x4b, 0xc4, 0x7b, + 0x59, 0xb6, 0x72, 0xde, 0x57, 0xc8, 0x83, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x35, 0x3e, 0xad, + 0x09, 0xe4, 0x08, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // Submit a transfer request to the bridge module. + Transfer(ctx context.Context, in *MsgTransfer, opts ...grpc.CallOption) (*MsgTransferResponse, error) + // Submit a provision to the bridge module. + Provision(ctx context.Context, in *MsgProvision, opts ...grpc.CallOption) (*MsgProvisionResponse, error) + // Set the time lock value from default value to uint64.max for specific confirmed provision. + HoldTransfer(ctx context.Context, in *MsgHoldTransfer, opts ...grpc.CallOption) (*MsgHoldTransferResponse, error) + // Set the time lock value to 0 for specific confirmed provision. + ReleaseTransfer(ctx context.Context, in *MsgReleaseTransfer, opts ...grpc.CallOption) (*MsgReleaseTransferResponse, error) + // Remove a specific confirmed provision (reset for specific sequence number). + RemoveProvision(ctx context.Context, in *MsgRemoveProvision, opts ...grpc.CallOption) (*MsgRemoveProvisionResponse, error) + // ClaimBatch processes the claiming of multiple claimable provisions in a single operation + ClaimBatch(ctx context.Context, in *MsgClaimBatch, opts ...grpc.CallOption) (*MsgClaimBatchResponse, error) + // Claim processes the claiming of a provision with a specific sequence number + Claim(ctx context.Context, in *MsgClaim, opts ...grpc.CallOption) (*MsgClaimResponse, error) + // SuggestRole suggests updating the role of an address in the bridge module. + // The role can be one of the following: guardian, operator, judge. + // The proposal will be passed only with the consent of +2/3 Guardian members. + SuggestRole(ctx context.Context, in *MsgSuggestRole, opts ...grpc.CallOption) (*MsgSuggestRoleResponse, error) + // AddVoteForRole adds a vote for a role change proposal. + AddVoteForRole(ctx context.Context, in *MsgAddVoteForRole, opts ...grpc.CallOption) (*MsgAddVoteForRoleResponse, error) + // Halt the bridge module. + Halt(ctx context.Context, in *MsgHalt, opts ...grpc.CallOption) (*MsgHaltResponse, error) + // Resume the bridge module. + Resume(ctx context.Context, in *MsgResume, opts ...grpc.CallOption) (*MsgResumeResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) Transfer(ctx context.Context, in *MsgTransfer, opts ...grpc.CallOption) (*MsgTransferResponse, error) { + out := new(MsgTransferResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Msg/Transfer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Provision(ctx context.Context, in *MsgProvision, opts ...grpc.CallOption) (*MsgProvisionResponse, error) { + out := new(MsgProvisionResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Msg/Provision", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) HoldTransfer(ctx context.Context, in *MsgHoldTransfer, opts ...grpc.CallOption) (*MsgHoldTransferResponse, error) { + out := new(MsgHoldTransferResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Msg/HoldTransfer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) ReleaseTransfer(ctx context.Context, in *MsgReleaseTransfer, opts ...grpc.CallOption) (*MsgReleaseTransferResponse, error) { + out := new(MsgReleaseTransferResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Msg/ReleaseTransfer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RemoveProvision(ctx context.Context, in *MsgRemoveProvision, opts ...grpc.CallOption) (*MsgRemoveProvisionResponse, error) { + out := new(MsgRemoveProvisionResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Msg/RemoveProvision", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) ClaimBatch(ctx context.Context, in *MsgClaimBatch, opts ...grpc.CallOption) (*MsgClaimBatchResponse, error) { + out := new(MsgClaimBatchResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Msg/ClaimBatch", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Claim(ctx context.Context, in *MsgClaim, opts ...grpc.CallOption) (*MsgClaimResponse, error) { + out := new(MsgClaimResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Msg/Claim", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SuggestRole(ctx context.Context, in *MsgSuggestRole, opts ...grpc.CallOption) (*MsgSuggestRoleResponse, error) { + out := new(MsgSuggestRoleResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Msg/SuggestRole", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) AddVoteForRole(ctx context.Context, in *MsgAddVoteForRole, opts ...grpc.CallOption) (*MsgAddVoteForRoleResponse, error) { + out := new(MsgAddVoteForRoleResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Msg/AddVoteForRole", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Halt(ctx context.Context, in *MsgHalt, opts ...grpc.CallOption) (*MsgHaltResponse, error) { + out := new(MsgHaltResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Msg/Halt", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Resume(ctx context.Context, in *MsgResume, opts ...grpc.CallOption) (*MsgResumeResponse, error) { + out := new(MsgResumeResponse) + err := c.cc.Invoke(ctx, "/lbm.fbridge.v1.Msg/Resume", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // Submit a transfer request to the bridge module. + Transfer(context.Context, *MsgTransfer) (*MsgTransferResponse, error) + // Submit a provision to the bridge module. + Provision(context.Context, *MsgProvision) (*MsgProvisionResponse, error) + // Set the time lock value from default value to uint64.max for specific confirmed provision. + HoldTransfer(context.Context, *MsgHoldTransfer) (*MsgHoldTransferResponse, error) + // Set the time lock value to 0 for specific confirmed provision. + ReleaseTransfer(context.Context, *MsgReleaseTransfer) (*MsgReleaseTransferResponse, error) + // Remove a specific confirmed provision (reset for specific sequence number). + RemoveProvision(context.Context, *MsgRemoveProvision) (*MsgRemoveProvisionResponse, error) + // ClaimBatch processes the claiming of multiple claimable provisions in a single operation + ClaimBatch(context.Context, *MsgClaimBatch) (*MsgClaimBatchResponse, error) + // Claim processes the claiming of a provision with a specific sequence number + Claim(context.Context, *MsgClaim) (*MsgClaimResponse, error) + // SuggestRole suggests updating the role of an address in the bridge module. + // The role can be one of the following: guardian, operator, judge. + // The proposal will be passed only with the consent of +2/3 Guardian members. + SuggestRole(context.Context, *MsgSuggestRole) (*MsgSuggestRoleResponse, error) + // AddVoteForRole adds a vote for a role change proposal. + AddVoteForRole(context.Context, *MsgAddVoteForRole) (*MsgAddVoteForRoleResponse, error) + // Halt the bridge module. + Halt(context.Context, *MsgHalt) (*MsgHaltResponse, error) + // Resume the bridge module. + Resume(context.Context, *MsgResume) (*MsgResumeResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) Transfer(ctx context.Context, req *MsgTransfer) (*MsgTransferResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Transfer not implemented") +} +func (*UnimplementedMsgServer) Provision(ctx context.Context, req *MsgProvision) (*MsgProvisionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Provision not implemented") +} +func (*UnimplementedMsgServer) HoldTransfer(ctx context.Context, req *MsgHoldTransfer) (*MsgHoldTransferResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HoldTransfer not implemented") +} +func (*UnimplementedMsgServer) ReleaseTransfer(ctx context.Context, req *MsgReleaseTransfer) (*MsgReleaseTransferResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReleaseTransfer not implemented") +} +func (*UnimplementedMsgServer) RemoveProvision(ctx context.Context, req *MsgRemoveProvision) (*MsgRemoveProvisionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveProvision not implemented") +} +func (*UnimplementedMsgServer) ClaimBatch(ctx context.Context, req *MsgClaimBatch) (*MsgClaimBatchResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClaimBatch not implemented") +} +func (*UnimplementedMsgServer) Claim(ctx context.Context, req *MsgClaim) (*MsgClaimResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Claim not implemented") +} +func (*UnimplementedMsgServer) SuggestRole(ctx context.Context, req *MsgSuggestRole) (*MsgSuggestRoleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SuggestRole not implemented") +} +func (*UnimplementedMsgServer) AddVoteForRole(ctx context.Context, req *MsgAddVoteForRole) (*MsgAddVoteForRoleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddVoteForRole not implemented") +} +func (*UnimplementedMsgServer) Halt(ctx context.Context, req *MsgHalt) (*MsgHaltResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Halt not implemented") +} +func (*UnimplementedMsgServer) Resume(ctx context.Context, req *MsgResume) (*MsgResumeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Resume not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_Transfer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgTransfer) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Transfer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Msg/Transfer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Transfer(ctx, req.(*MsgTransfer)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Provision_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgProvision) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Provision(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Msg/Provision", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Provision(ctx, req.(*MsgProvision)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_HoldTransfer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgHoldTransfer) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).HoldTransfer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Msg/HoldTransfer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).HoldTransfer(ctx, req.(*MsgHoldTransfer)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ReleaseTransfer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgReleaseTransfer) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ReleaseTransfer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Msg/ReleaseTransfer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ReleaseTransfer(ctx, req.(*MsgReleaseTransfer)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RemoveProvision_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveProvision) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveProvision(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Msg/RemoveProvision", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveProvision(ctx, req.(*MsgRemoveProvision)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ClaimBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgClaimBatch) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ClaimBatch(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Msg/ClaimBatch", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ClaimBatch(ctx, req.(*MsgClaimBatch)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Claim_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgClaim) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Claim(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Msg/Claim", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Claim(ctx, req.(*MsgClaim)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SuggestRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSuggestRole) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SuggestRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Msg/SuggestRole", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SuggestRole(ctx, req.(*MsgSuggestRole)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_AddVoteForRole_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAddVoteForRole) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).AddVoteForRole(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Msg/AddVoteForRole", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).AddVoteForRole(ctx, req.(*MsgAddVoteForRole)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Halt_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgHalt) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Halt(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Msg/Halt", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Halt(ctx, req.(*MsgHalt)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Resume_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgResume) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Resume(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fbridge.v1.Msg/Resume", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Resume(ctx, req.(*MsgResume)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "lbm.fbridge.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Transfer", + Handler: _Msg_Transfer_Handler, + }, + { + MethodName: "Provision", + Handler: _Msg_Provision_Handler, + }, + { + MethodName: "HoldTransfer", + Handler: _Msg_HoldTransfer_Handler, + }, + { + MethodName: "ReleaseTransfer", + Handler: _Msg_ReleaseTransfer_Handler, + }, + { + MethodName: "RemoveProvision", + Handler: _Msg_RemoveProvision_Handler, + }, + { + MethodName: "ClaimBatch", + Handler: _Msg_ClaimBatch_Handler, + }, + { + MethodName: "Claim", + Handler: _Msg_Claim_Handler, + }, + { + MethodName: "SuggestRole", + Handler: _Msg_SuggestRole_Handler, + }, + { + MethodName: "AddVoteForRole", + Handler: _Msg_AddVoteForRole_Handler, + }, + { + MethodName: "Halt", + Handler: _Msg_Halt_Handler, + }, + { + MethodName: "Resume", + Handler: _Msg_Resume_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "lbm/fbridge/v1/tx.proto", +} + +func (m *MsgTransfer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgTransfer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTransfer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Receiver) > 0 { + i -= len(m.Receiver) + copy(dAtA[i:], m.Receiver) + i = encodeVarintTx(dAtA, i, uint64(len(m.Receiver))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgTransferResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgTransferResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTransferResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgProvision) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgProvision) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgProvision) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.Receiver) > 0 { + i -= len(m.Receiver) + copy(dAtA[i:], m.Receiver) + i = encodeVarintTx(dAtA, i, uint64(len(m.Receiver))) + i-- + dAtA[i] = 0x22 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x1a + } + if m.Seq != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x10 + } + if len(m.From) > 0 { + i -= len(m.From) + copy(dAtA[i:], m.From) + i = encodeVarintTx(dAtA, i, uint64(len(m.From))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgProvisionResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgProvisionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgProvisionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgHoldTransfer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgHoldTransfer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgHoldTransfer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Seq != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x10 + } + if len(m.From) > 0 { + i -= len(m.From) + copy(dAtA[i:], m.From) + i = encodeVarintTx(dAtA, i, uint64(len(m.From))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgHoldTransferResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgHoldTransferResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgHoldTransferResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgReleaseTransfer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgReleaseTransfer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgReleaseTransfer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Seq != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x10 + } + if len(m.From) > 0 { + i -= len(m.From) + copy(dAtA[i:], m.From) + i = encodeVarintTx(dAtA, i, uint64(len(m.From))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgReleaseTransferResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgReleaseTransferResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgReleaseTransferResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgRemoveProvision) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveProvision) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveProvision) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Seq != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x10 + } + if len(m.From) > 0 { + i -= len(m.From) + copy(dAtA[i:], m.From) + i = encodeVarintTx(dAtA, i, uint64(len(m.From))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveProvisionResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRemoveProvisionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveProvisionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgClaimBatch) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgClaimBatch) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgClaimBatch) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MaxClaims != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.MaxClaims)) + i-- + dAtA[i] = 0x10 + } + if len(m.From) > 0 { + i -= len(m.From) + copy(dAtA[i:], m.From) + i = encodeVarintTx(dAtA, i, uint64(len(m.From))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgClaimBatchResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgClaimBatchResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgClaimBatchResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgClaim) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgClaim) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Seq != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Seq)) + i-- + dAtA[i] = 0x10 + } + if len(m.From) > 0 { + i -= len(m.From) + copy(dAtA[i:], m.From) + i = encodeVarintTx(dAtA, i, uint64(len(m.From))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgClaimResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgClaimResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgClaimResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgSuggestRole) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSuggestRole) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSuggestRole) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Role != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Role)) + i-- + dAtA[i] = 0x18 + } + if len(m.Target) > 0 { + i -= len(m.Target) + copy(dAtA[i:], m.Target) + i = encodeVarintTx(dAtA, i, uint64(len(m.Target))) + i-- + dAtA[i] = 0x12 + } + if len(m.From) > 0 { + i -= len(m.From) + copy(dAtA[i:], m.From) + i = encodeVarintTx(dAtA, i, uint64(len(m.From))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSuggestRoleResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSuggestRoleResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSuggestRoleResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgAddVoteForRole) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgAddVoteForRole) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddVoteForRole) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Option { + i-- + if m.Option { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.ProposalId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x10 + } + if len(m.From) > 0 { + i -= len(m.From) + copy(dAtA[i:], m.From) + i = encodeVarintTx(dAtA, i, uint64(len(m.From))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgAddVoteForRoleResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgAddVoteForRoleResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddVoteForRoleResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgHalt) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgHalt) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgHalt) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Guardian) > 0 { + i -= len(m.Guardian) + copy(dAtA[i:], m.Guardian) + i = encodeVarintTx(dAtA, i, uint64(len(m.Guardian))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgHaltResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgHaltResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgHaltResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgResume) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgResume) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgResume) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.From) > 0 { + i -= len(m.From) + copy(dAtA[i:], m.From) + i = encodeVarintTx(dAtA, i, uint64(len(m.From))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgResumeResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgResumeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgResumeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgTransfer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Receiver) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgTransferResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgProvision) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.From) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Seq != 0 { + n += 1 + sovTx(uint64(m.Seq)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Receiver) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgProvisionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgHoldTransfer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.From) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Seq != 0 { + n += 1 + sovTx(uint64(m.Seq)) + } + return n +} + +func (m *MsgHoldTransferResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgReleaseTransfer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.From) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Seq != 0 { + n += 1 + sovTx(uint64(m.Seq)) + } + return n +} + +func (m *MsgReleaseTransferResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgRemoveProvision) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.From) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Seq != 0 { + n += 1 + sovTx(uint64(m.Seq)) + } + return n +} + +func (m *MsgRemoveProvisionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgClaimBatch) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.From) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.MaxClaims != 0 { + n += 1 + sovTx(uint64(m.MaxClaims)) + } + return n +} + +func (m *MsgClaimBatchResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgClaim) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.From) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Seq != 0 { + n += 1 + sovTx(uint64(m.Seq)) + } + return n +} + +func (m *MsgClaimResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSuggestRole) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.From) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Target) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Role != 0 { + n += 1 + sovTx(uint64(m.Role)) + } + return n +} + +func (m *MsgSuggestRoleResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgAddVoteForRole) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.From) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.ProposalId != 0 { + n += 1 + sovTx(uint64(m.ProposalId)) + } + if m.Option { + n += 2 + } + return n +} + +func (m *MsgAddVoteForRoleResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgHalt) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Guardian) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgHaltResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgResume) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.From) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgResumeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgTransfer) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgTransfer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTransfer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgTransferResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgTransferResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTransferResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgProvision) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgProvision: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgProvision: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.From = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Receiver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Receiver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgProvisionResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgProvisionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgProvisionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgHoldTransfer) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgHoldTransfer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgHoldTransfer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.From = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgHoldTransferResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgHoldTransferResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgHoldTransferResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgReleaseTransfer) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgReleaseTransfer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgReleaseTransfer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.From = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgReleaseTransferResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgReleaseTransferResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgReleaseTransferResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRemoveProvision) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRemoveProvision: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveProvision: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.From = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRemoveProvisionResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRemoveProvisionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveProvisionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgClaimBatch) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgClaimBatch: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgClaimBatch: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.From = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxClaims", wireType) + } + m.MaxClaims = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxClaims |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgClaimBatchResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgClaimBatchResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgClaimBatchResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgClaim) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgClaim: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgClaim: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.From = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) + } + m.Seq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgClaimResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgClaimResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgClaimResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSuggestRole) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSuggestRole: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSuggestRole: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.From = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Target = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType) + } + m.Role = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Role |= Role(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSuggestRoleResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSuggestRoleResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSuggestRoleResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAddVoteForRole) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAddVoteForRole: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddVoteForRole: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.From = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Option = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAddVoteForRoleResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAddVoteForRoleResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddVoteForRoleResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgHalt) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgHalt: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgHalt: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Guardian", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Guardian = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgHaltResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgHaltResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgHaltResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgResume) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgResume: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgResume: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.From = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgResumeResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgResumeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgResumeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/fswap/client/cli/query.go b/x/fswap/client/cli/query.go new file mode 100644 index 0000000000..46c87aa868 --- /dev/null +++ b/x/fswap/client/cli/query.go @@ -0,0 +1,112 @@ +package cli + +import ( + "fmt" + + "github.com/spf13/cobra" + + "github.com/Finschia/finschia-sdk/client" + "github.com/Finschia/finschia-sdk/client/flags" + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +// GetQueryCmd returns the cli query commands for this module +func GetQueryCmd(queryRoute string) *cobra.Command { + // Group fswap queries under a subcommand + cmd := &cobra.Command{ + Use: queryRoute, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + CmdQuerySwapped(), + CmdQueryTotalSwappableAmount(), + CmdQuerySwaps(), + ) + return cmd +} + +func CmdQuerySwapped() *cobra.Command { + cmd := &cobra.Command{ + Use: "swapped [from_denom] [to_denom]", + Short: "shows the current swap status, including both old and new coin amount", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + req := &types.QuerySwappedRequest{ + FromDenom: args[0], + ToDenom: args[1], + } + res, err := queryClient.Swapped(cmd.Context(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +func CmdQueryTotalSwappableAmount() *cobra.Command { + cmd := &cobra.Command{ + Use: "total-swappable-amount [from_denom] [to_denom]", + Short: "shows the current total amount of new coin that're swappable", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + req := &types.QueryTotalSwappableToCoinAmountRequest{ + FromDenom: args[0], + ToDenom: args[1], + } + res, err := queryClient.TotalSwappableToCoinAmount(cmd.Context(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +func CmdQuerySwaps() *cobra.Command { + cmd := &cobra.Command{ + Use: "swaps", + Short: "shows the all the swaps that proposed", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Swaps(cmd.Context(), &types.QuerySwapsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/fswap/client/cli/tx.go b/x/fswap/client/cli/tx.go new file mode 100644 index 0000000000..433c8ae33e --- /dev/null +++ b/x/fswap/client/cli/tx.go @@ -0,0 +1,255 @@ +package cli + +import ( + "encoding/json" + "fmt" + + "github.com/spf13/cobra" + + "github.com/Finschia/finschia-sdk/client" + "github.com/Finschia/finschia-sdk/client/flags" + "github.com/Finschia/finschia-sdk/client/tx" + sdk "github.com/Finschia/finschia-sdk/types" + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" + bank "github.com/Finschia/finschia-sdk/x/bank/types" + "github.com/Finschia/finschia-sdk/x/fswap/types" + govcli "github.com/Finschia/finschia-sdk/x/gov/client/cli" + gov "github.com/Finschia/finschia-sdk/x/gov/types" +) + +const ( + FlagFromDenom = "from-denom" + FlagToDenom = "to-denom" + FlagAmountCapForToDenom = "to-coin-amount-cap" + FlagSwapRate = "swap-rate" +) + +// GetTxCmd returns the transaction commands for this module +func GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + cmd.AddCommand( + CmdTxMsgSwap(), + CmdTxMsgSwapAll(), + ) + + return cmd +} + +func CmdTxMsgSwap() *cobra.Command { + cmd := &cobra.Command{ + Use: "swap [from] [from_coin_amount] [to_denom]", + Short: "swap amount of from-coin to to-coin", + Args: cobra.ExactArgs(3), + RunE: func(cmd *cobra.Command, args []string) error { + from := args[0] + if err := cmd.Flags().Set(flags.FlagFrom, from); err != nil { + return err + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + amount, err := sdk.ParseCoinNormalized(args[1]) + if err != nil { + return err + } + + toDenom := args[2] + + msg := &types.MsgSwap{ + FromAddress: from, + FromCoinAmount: amount, + ToDenom: toDenom, + } + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +func CmdTxMsgSwapAll() *cobra.Command { + cmd := &cobra.Command{ + Use: "swap-all [from_address] [from_denom] [to_denom]", + Short: "swap all the from-coin to to-coin", + Args: cobra.ExactArgs(3), + RunE: func(cmd *cobra.Command, args []string) error { + from := args[0] + if err := cmd.Flags().Set(flags.FlagFrom, from); err != nil { + return err + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + fromDenom := args[1] + toDenom := args[2] + msg := &types.MsgSwapAll{ + FromAddress: clientCtx.GetFromAddress().String(), + FromDenom: fromDenom, + ToDenom: toDenom, + } + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +// NewCmdMakeSwapProposal implements a command handler for submitting a swap init proposal transaction. +func NewCmdMakeSwapProposal() *cobra.Command { + cmd := &cobra.Command{ + Use: "make-swap [messages-json]", + Args: cobra.ExactArgs(1), + Short: "todo", + Long: ` +Parameters: + messages-json: messages in json format that will be executed if the proposal is accepted. + +Example of the content of messages-json: + +{ + "metadata": { + "description": "the base coin of Finschia mainnet", + "denom_units": [ + { + "denom": "cony", + "exponent": 0, + "aliases": [ + "microfinschia" + ] + }, + { + "denom": "finschia", + "exponent": 6, + "aliases": [] + } + ], + "base": "cony", + "display": "finschia", + "name": "FINSCHIA", + "symbol": "FNSA" + } +} +`, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + from := clientCtx.GetFromAddress() + + title, err := cmd.Flags().GetString(govcli.FlagTitle) + if err != nil { + return err + } + + description, err := cmd.Flags().GetString(govcli.FlagDescription) + if err != nil { + return err + } + + fromDenom, err := cmd.Flags().GetString(FlagFromDenom) + if err != nil { + return err + } + + toDenom, err := cmd.Flags().GetString(FlagToDenom) + if err != nil { + return err + } + amountCapStr, err := cmd.Flags().GetString(FlagAmountCapForToDenom) + if err != nil { + return err + } + amountCap, ok := sdk.NewIntFromString(amountCapStr) + if !ok { + return sdkerrors.ErrInvalidRequest.Wrapf("failed to parse %s %s", FlagAmountCapForToDenom, amountCap.String()) + } + + swapRate, err := cmd.Flags().GetString(FlagSwapRate) + if err != nil { + return err + } + swapRateDec, err := sdk.NewDecFromStr(swapRate) + if err != nil { + return err + } + swap := types.Swap{ + FromDenom: fromDenom, + ToDenom: toDenom, + AmountCapForToDenom: amountCap, + SwapRate: swapRateDec, + } + + toDenomMetadata, err := parseToDenomMetadata(args[0]) + if err != nil { + return err + } + + content := types.NewMakeSwapProposal(title, description, swap, toDenomMetadata) + + depositStr, err := cmd.Flags().GetString(govcli.FlagDeposit) + if err != nil { + return err + } + deposit, err := sdk.ParseCoinsNormalized(depositStr) + if err != nil { + return err + } + + msg, err := gov.NewMsgSubmitProposal(content, deposit, from) + if err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + cmd.Flags().String(govcli.FlagTitle, "", "title of proposal") + cmd.Flags().String(govcli.FlagDescription, "", "description of proposal") + cmd.Flags().String(govcli.FlagDeposit, "", "deposit of proposal") + cmd.Flags().String(FlagFromDenom, "", "cony") + cmd.Flags().String(FlagToDenom, "", "PDT") + cmd.Flags().String(FlagAmountCapForToDenom, "0", "tbd") + cmd.Flags().String(FlagSwapRate, "0", "tbd") + + return cmd +} + +func parseToDenomMetadata(jsonDenomMetadata string) (bank.Metadata, error) { + type toDenomMeta struct { + Metadata bank.Metadata `json:"metadata"` + } + denomMeta := toDenomMeta{} + if err := json.Unmarshal([]byte(jsonDenomMetadata), &denomMeta); err != nil { + return bank.Metadata{}, err + } + + if err := denomMeta.Metadata.Validate(); err != nil { + return bank.Metadata{}, err + } + + return denomMeta.Metadata, nil +} diff --git a/x/fswap/client/proposal_handler.go b/x/fswap/client/proposal_handler.go new file mode 100644 index 0000000000..72c073b733 --- /dev/null +++ b/x/fswap/client/proposal_handler.go @@ -0,0 +1,8 @@ +package client + +import ( + "github.com/Finschia/finschia-sdk/x/fswap/client/cli" + govclient "github.com/Finschia/finschia-sdk/x/gov/client" +) + +var ProposalHandler = govclient.NewProposalHandler(cli.NewCmdMakeSwapProposal) diff --git a/x/fswap/codec/codec.go b/x/fswap/codec/codec.go new file mode 100644 index 0000000000..7cbd4f6a69 --- /dev/null +++ b/x/fswap/codec/codec.go @@ -0,0 +1,18 @@ +package codec + +import ( + "github.com/Finschia/finschia-sdk/codec" + cryptocodec "github.com/Finschia/finschia-sdk/crypto/codec" + sdk "github.com/Finschia/finschia-sdk/types" +) + +var ( + Amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(Amino) +) + +func init() { + cryptocodec.RegisterCrypto(Amino) + codec.RegisterEvidences(Amino) + sdk.RegisterLegacyAminoCodec(Amino) +} diff --git a/x/fswap/handler.go b/x/fswap/handler.go new file mode 100644 index 0000000000..7bae485c7e --- /dev/null +++ b/x/fswap/handler.go @@ -0,0 +1,27 @@ +package fswap + +import ( + sdk "github.com/Finschia/finschia-sdk/types" + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" + "github.com/Finschia/finschia-sdk/x/fswap/keeper" + "github.com/Finschia/finschia-sdk/x/fswap/types" + govtypes "github.com/Finschia/finschia-sdk/x/gov/types" +) + +// NewSwapHandler creates a governance handler to manage new proposal types. +// It enables Swap to propose a swap init +func NewSwapHandler(k keeper.Keeper) govtypes.Handler { + return func(ctx sdk.Context, content govtypes.Content) error { + switch c := content.(type) { + case *types.MakeSwapProposal: + return handleMakeSwapProposal(ctx, k, c) + + default: + return sdkerrors.ErrUnknownRequest.Wrapf("unrecognized sawp proposal content type: %T", c) + } + } +} + +func handleMakeSwapProposal(ctx sdk.Context, k keeper.Keeper, p *types.MakeSwapProposal) error { + return k.MakeSwap(ctx, p.Swap, p.ToDenomMetadata) +} diff --git a/x/fswap/keeper/calc.go b/x/fswap/keeper/calc.go new file mode 100644 index 0000000000..930bfdbf43 --- /dev/null +++ b/x/fswap/keeper/calc.go @@ -0,0 +1,7 @@ +package keeper + +import "github.com/Finschia/finschia-sdk/types" + +func CalcSwap(swapRate types.Dec, fromCoinAmount types.Int) types.Int { + return swapRate.MulTruncate(types.NewDecFromBigInt(fromCoinAmount.BigInt())).TruncateInt() +} diff --git a/x/fswap/keeper/calc_test.go b/x/fswap/keeper/calc_test.go new file mode 100644 index 0000000000..ed8cece9f5 --- /dev/null +++ b/x/fswap/keeper/calc_test.go @@ -0,0 +1,65 @@ +package keeper + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/require" + + sdk "github.com/Finschia/finschia-sdk/types" +) + +func TestCalcSwap(t *testing.T) { + rateDot5, err := sdk.NewDecFromStr("0.5") + require.NoError(t, err) + rateDot3maxPrecision, err := sdk.NewDecFromStr("0.333333333333333333") + require.NoError(t, err) + + finschiaSwapRate, err := sdk.NewDecFromStr("148.079656") + require.NoError(t, err) + conySwapRate := finschiaSwapRate.Mul(sdk.NewDec(1000000)) + pebSwapRateForCony, err := sdk.NewDecFromStr("148079656000000") + require.NoError(t, err) + testCases := map[string]struct { + fromAmount sdk.Int + expectedAmount sdk.Int + swapRate sdk.Dec + }{ + "swapRate 0.5": { + fromAmount: sdk.ZeroInt(), + swapRate: rateDot5, + expectedAmount: sdk.ZeroInt(), + }, + "swapRate 0.333333333333333333": { + fromAmount: sdk.NewInt(3), + swapRate: rateDot3maxPrecision, + expectedAmount: sdk.ZeroInt(), + }, + "swapRate conySwapRate(148.079656 * 10^6) fromAmount(1)": { + fromAmount: sdk.NewInt(1), + swapRate: conySwapRate, + expectedAmount: sdk.NewInt(148079656), + }, + "swapRate conySwapRate(148.079656 * 10^6) fromAmount(3)": { + fromAmount: sdk.NewInt(3), + swapRate: conySwapRate, + expectedAmount: sdk.NewInt(444238968), + }, + "pebSwapRateForCony pebSwapRateForCony(148.079656 * 10^12) fromAmount(1)": { + fromAmount: sdk.NewInt(1), + swapRate: pebSwapRateForCony, + expectedAmount: sdk.NewInt(148079656000000), + }, + "pebSwapRateForCony pebSwapRateForCony(148.079656 * 10^12) fromAmount(3)": { + fromAmount: sdk.NewInt(3), + swapRate: pebSwapRateForCony, + expectedAmount: sdk.NewInt(444238968000000), + }, + } + for name, tc := range testCases { + t.Run(name, func(t *testing.T) { + actualAmount := CalcSwap(tc.swapRate, tc.fromAmount) + require.Equal(t, tc.expectedAmount, actualAmount, fmt.Sprintf("tc.expectedAmount = %v, actualAmount = %v", tc.expectedAmount, actualAmount)) + }) + } +} diff --git a/x/fswap/keeper/expected_keepers.go b/x/fswap/keeper/expected_keepers.go new file mode 100644 index 0000000000..08934e1c3c --- /dev/null +++ b/x/fswap/keeper/expected_keepers.go @@ -0,0 +1,19 @@ +package keeper + +import ( + sdk "github.com/Finschia/finschia-sdk/types" + banktypes "github.com/Finschia/finschia-sdk/x/bank/types" +) + +type ( + BankKeeper interface { + GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin + SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + IsSendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) error + GetDenomMetaData(ctx sdk.Context, denom string) (banktypes.Metadata, bool) + SetDenomMetaData(ctx sdk.Context, denomMetaData banktypes.Metadata) + MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + } +) diff --git a/x/fswap/keeper/genesis.go b/x/fswap/keeper/genesis.go new file mode 100644 index 0000000000..d27c80785a --- /dev/null +++ b/x/fswap/keeper/genesis.go @@ -0,0 +1,57 @@ +package keeper + +import ( + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +// InitGenesis initializes the module's state from a provided genesis state. +func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) error { + if err := genState.Validate(); err != nil { + return err + } + + if len(genState.GetSwaps()) > k.config.MaxSwaps && !k.isUnlimited() { + return types.ErrCanNotHaveMoreSwap.Wrapf("cannot initialize genesis state, there are more than %d swaps", k.config.MaxSwaps) + } + + if len(genState.GetSwappeds()) > k.config.MaxSwaps && !k.isUnlimited() { + return types.ErrCanNotHaveMoreSwap.Wrapf("cannot initialize genesis state, there are more than %d swapped", k.config.MaxSwaps) + } + + if err := k.setSwapStats(ctx, genState.GetSwapStats()); err != nil { + return err + } + + for _, swap := range genState.GetSwaps() { + if err := k.setSwap(ctx, swap); err != nil { + panic(err) + } + } + + for _, swapped := range genState.GetSwappeds() { + err := k.setSwapped(ctx, swapped) + if err != nil { + return err + } + } + + return nil +} + +func (k Keeper) isUnlimited() bool { + return k.config.MaxSwaps == 0 +} + +// ExportGenesis returns the module's exported genesis. +func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + stats, err := k.getSwapStats(ctx) + if err != nil { + panic(err) + } + return &types.GenesisState{ + Swaps: k.getAllSwaps(ctx), + SwapStats: stats, + Swappeds: k.getAllSwapped(ctx), + } +} diff --git a/x/fswap/keeper/genesis_test.go b/x/fswap/keeper/genesis_test.go new file mode 100644 index 0000000000..c4fa1a0e99 --- /dev/null +++ b/x/fswap/keeper/genesis_test.go @@ -0,0 +1,21 @@ +package keeper_test + +import ( + "fmt" + + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +func (s *KeeperTestSuite) TestInitAndExportGenesis() { + ctx, _ := s.ctx.CacheContext() + defaultGenesis := types.DefaultGenesis() + err := s.keeper.InitGenesis(ctx, defaultGenesis) + s.Require().NoError(err) + + exportGenesis := s.keeper.ExportGenesis(ctx) + fmt.Println(len(exportGenesis.GetSwaps())) + s.Require().Equal(defaultGenesis, exportGenesis) + s.Require().Equal(defaultGenesis.GetSwaps(), exportGenesis.GetSwaps()) + s.Require().Equal(defaultGenesis.GetSwapStats(), exportGenesis.GetSwapStats()) + s.Require().Equal(defaultGenesis.GetSwappeds(), exportGenesis.GetSwappeds()) +} diff --git a/x/fswap/keeper/grpc_query.go b/x/fswap/keeper/grpc_query.go new file mode 100644 index 0000000000..def3ee5ffb --- /dev/null +++ b/x/fswap/keeper/grpc_query.go @@ -0,0 +1,70 @@ +package keeper + +import ( + "context" + + "github.com/Finschia/finschia-sdk/store/prefix" + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/types/query" + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +var _ types.QueryServer = QueryServer{} + +type QueryServer struct { + Keeper +} + +func NewQueryServer(keeper Keeper) *QueryServer { + return &QueryServer{ + keeper, + } +} + +func (s QueryServer) Swapped(ctx context.Context, req *types.QuerySwappedRequest) (*types.QuerySwappedResponse, error) { + c := sdk.UnwrapSDKContext(ctx) + + swapped, err := s.Keeper.getSwapped(c, req.GetFromDenom(), req.GetToDenom()) + if err != nil { + return nil, err + } + + return &types.QuerySwappedResponse{ + FromCoinAmount: swapped.GetFromCoinAmount(), + ToCoinAmount: swapped.GetToCoinAmount(), + }, nil +} + +func (s QueryServer) TotalSwappableToCoinAmount(ctx context.Context, req *types.QueryTotalSwappableToCoinAmountRequest) (*types.QueryTotalSwappableToCoinAmountResponse, error) { + c := sdk.UnwrapSDKContext(ctx) + + amount, err := s.Keeper.getSwappableNewCoinAmount(c, req.GetFromDenom(), req.GetToDenom()) + if err != nil { + return &types.QueryTotalSwappableToCoinAmountResponse{}, err + } + + return &types.QueryTotalSwappableToCoinAmountResponse{SwappableAmount: amount}, nil +} + +func (s QueryServer) Swaps(ctx context.Context, req *types.QuerySwapsRequest) (*types.QuerySwapsResponse, error) { + c := sdk.UnwrapSDKContext(ctx) + + swaps := []types.Swap{} + store := c.KVStore(s.storeKey) + swapStore := prefix.NewStore(store, swapPrefix) + pageResponse, err := query.Paginate(swapStore, req.Pagination, func(key, value []byte) error { + swap := types.Swap{} + if err := s.Keeper.cdc.Unmarshal(value, &swap); err != nil { + return err + } + swaps = append(swaps, swap) + return nil + }) + if err != nil { + return nil, err + } + return &types.QuerySwapsResponse{ + Swaps: swaps, + Pagination: pageResponse, + }, nil +} diff --git a/x/fswap/keeper/keeper.go b/x/fswap/keeper/keeper.go new file mode 100644 index 0000000000..f21a246cea --- /dev/null +++ b/x/fswap/keeper/keeper.go @@ -0,0 +1,203 @@ +package keeper + +import ( + "fmt" + + "github.com/tendermint/tendermint/libs/log" + + "github.com/Finschia/finschia-sdk/codec" + "github.com/Finschia/finschia-sdk/store/prefix" + storetypes "github.com/Finschia/finschia-sdk/store/types" + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +type Keeper struct { + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + + config types.Config + + BankKeeper +} + +func NewKeeper(cdc codec.BinaryCodec, storeKey storetypes.StoreKey, config types.Config, bk BankKeeper) Keeper { + return Keeper{ + cdc, + storeKey, + config, + bk, + } +} + +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} + +func (k Keeper) Swap(ctx sdk.Context, addr sdk.AccAddress, fromCoinAmount sdk.Coin, toDenom string) error { + swap, err := k.getSwap(ctx, fromCoinAmount.Denom, toDenom) + if err != nil { + return err + } + + newCoinAmountInt := CalcSwap(swap.SwapRate, fromCoinAmount.Amount) + newCoinAmount := sdk.NewCoin(toDenom, newCoinAmountInt) + swapped, err := k.getSwapped(ctx, swap.GetFromDenom(), swap.GetToDenom()) + if err != nil { + return err + } + + updateSwapped, err := k.updateSwapped(ctx, swapped, fromCoinAmount, newCoinAmount) + if err != nil { + return err + } + + if err := k.checkSwapCap(swap, updateSwapped); err != nil { + return err + } + + if err := k.SendCoinsFromAccountToModule(ctx, addr, types.ModuleName, sdk.NewCoins(fromCoinAmount)); err != nil { + return err + } + + if err := k.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(fromCoinAmount)); err != nil { + return err + } + + if err := k.MintCoins(ctx, types.ModuleName, sdk.NewCoins(newCoinAmount)); err != nil { + return err + } + + if err := k.SendCoinsFromModuleToAccount(ctx, types.ModuleName, addr, sdk.NewCoins(newCoinAmount)); err != nil { + return err + } + + if err := ctx.EventManager().EmitTypedEvent(&types.EventSwapCoins{ + Address: addr.String(), + FromCoinAmount: fromCoinAmount, + ToCoinAmount: newCoinAmount, + }); err != nil { + return err + } + return nil +} + +func (k Keeper) getAllSwapped(ctx sdk.Context) []types.Swapped { + swappedSlice := []types.Swapped{} + k.iterateAllSwapped(ctx, func(swapped types.Swapped) bool { + swappedSlice = append(swappedSlice, swapped) + return false + }) + return swappedSlice +} + +func (k Keeper) iterateAllSwapped(ctx sdk.Context, cb func(swapped types.Swapped) (stop bool)) { + store := ctx.KVStore(k.storeKey) + swappedDataStore := prefix.NewStore(store, swappedKeyPrefix) + + iterator := swappedDataStore.Iterator(nil, nil) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + swapped := types.Swapped{} + k.cdc.MustUnmarshal(iterator.Value(), &swapped) + if cb(swapped) { + break + } + } +} + +func (k Keeper) getSwapped(ctx sdk.Context, fromDenom, toDenom string) (types.Swapped, error) { + store := ctx.KVStore(k.storeKey) + key := swappedKey(fromDenom, toDenom) + bz := store.Get(key) + if bz == nil { + return types.Swapped{}, types.ErrSwappedNotFound + } + + swapped := types.Swapped{} + if err := k.cdc.Unmarshal(bz, &swapped); err != nil { + return types.Swapped{}, err + } + return swapped, nil +} + +func (k Keeper) setSwapped(ctx sdk.Context, swapped types.Swapped) error { + key := swappedKey(swapped.FromCoinAmount.Denom, swapped.ToCoinAmount.Denom) + bz, err := k.cdc.Marshal(&swapped) + if err != nil { + return err + } + + store := ctx.KVStore(k.storeKey) + store.Set(key, bz) + return nil +} + +func (k Keeper) getSwappableNewCoinAmount(ctx sdk.Context, fromDenom, toDenom string) (sdk.Coin, error) { + swap, err := k.getSwap(ctx, fromDenom, toDenom) + if err != nil { + return sdk.Coin{}, err + } + + swapped, err := k.getSwapped(ctx, fromDenom, toDenom) + if err != nil { + return sdk.Coin{}, err + } + + swapCap := swap.AmountCapForToDenom + remainingAmount := swapCap.Sub(swapped.GetToCoinAmount().Amount) + + return sdk.NewCoin(toDenom, remainingAmount), nil +} + +func (k Keeper) updateSwapped(ctx sdk.Context, curSwapped types.Swapped, fromAmount, toAmount sdk.Coin) (types.Swapped, error) { + updatedSwapped := types.Swapped{ + FromCoinAmount: fromAmount.Add(curSwapped.FromCoinAmount), + ToCoinAmount: toAmount.Add(curSwapped.ToCoinAmount), + } + + key := swappedKey(fromAmount.Denom, toAmount.Denom) + bz, err := k.cdc.Marshal(&updatedSwapped) + if err != nil { + return types.Swapped{}, err + } + + store := ctx.KVStore(k.storeKey) + store.Set(key, bz) + return updatedSwapped, nil +} + +func (k Keeper) checkSwapCap(swap types.Swap, swapped types.Swapped) error { + swapCap := swap.AmountCapForToDenom + if swapCap.LT(swapped.ToCoinAmount.Amount) { + return types.ErrExceedSwappableToCoinAmount + } + return nil +} + +func (k Keeper) getSwapStats(ctx sdk.Context) (types.SwapStats, error) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(swapStatsKey) + if bz == nil { + return types.SwapStats{}, nil + } + + stats := types.SwapStats{} + err := k.cdc.Unmarshal(bz, &stats) + if err != nil { + return types.SwapStats{}, err + } + return stats, nil +} + +func (k Keeper) setSwapStats(ctx sdk.Context, stats types.SwapStats) error { + bz, err := k.cdc.Marshal(&stats) + if err != nil { + return err + } + + store := ctx.KVStore(k.storeKey) + store.Set(swapStatsKey, bz) + return nil +} diff --git a/x/fswap/keeper/keeper_test.go b/x/fswap/keeper/keeper_test.go new file mode 100644 index 0000000000..fdf9e95d25 --- /dev/null +++ b/x/fswap/keeper/keeper_test.go @@ -0,0 +1,189 @@ +package keeper_test + +import ( + "context" + "testing" + + "github.com/stretchr/testify/suite" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + + "github.com/Finschia/finschia-sdk/crypto/keys/secp256k1" + "github.com/Finschia/finschia-sdk/simapp" + "github.com/Finschia/finschia-sdk/testutil/testdata" + sdk "github.com/Finschia/finschia-sdk/types" + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" + bank "github.com/Finschia/finschia-sdk/x/bank/types" + "github.com/Finschia/finschia-sdk/x/fswap/keeper" + "github.com/Finschia/finschia-sdk/x/fswap/types" + minttypes "github.com/Finschia/finschia-sdk/x/mint/types" +) + +type KeeperTestSuite struct { + suite.Suite + + ctx sdk.Context + goCtx context.Context + keeper keeper.Keeper + queryServer types.QueryServer + msgServer types.MsgServer + + accWithFromCoin sdk.AccAddress + accWithToCoin sdk.AccAddress + initBalance sdk.Int + + swap types.Swap + toDenomMetadata bank.Metadata +} + +func (s *KeeperTestSuite) createRandomAccounts(n int) []sdk.AccAddress { + seenAddresses := make(map[string]bool, n) + addresses := make([]sdk.AccAddress, n) + for i := range addresses { + var address sdk.AccAddress + for { + pk := secp256k1.GenPrivKey().PubKey() + address = sdk.AccAddress(pk.Address()) + if !seenAddresses[address.String()] { + seenAddresses[address.String()] = true + break + } + } + addresses[i] = address + } + return addresses +} + +func (s *KeeperTestSuite) SetupTest() { + checkTx := false + app := simapp.Setup(checkTx) + testdata.RegisterInterfaces(app.InterfaceRegistry()) + testdata.RegisterMsgServer(app.MsgServiceRouter(), testdata.MsgServerImpl{}) + s.ctx = app.BaseApp.NewContext(checkTx, tmproto.Header{}) + s.goCtx = sdk.WrapSDKContext(s.ctx) + s.keeper = app.FswapKeeper + s.queryServer = keeper.NewQueryServer(s.keeper) + s.msgServer = keeper.NewMsgServer(s.keeper) + + numAcc := int64(2) + s.initBalance = sdk.NewInt(123456789) + pebSwapRateForCony, err := sdk.NewDecFromStr("148079656000000") + s.Require().NoError(err) + swapCap := sdk.NewIntFromBigInt(pebSwapRateForCony.Mul(s.initBalance.ToDec()).BigInt()) + swapCap = swapCap.Mul(sdk.NewInt(numAcc)) + s.Require().NoError(err) + s.swap = types.Swap{ + FromDenom: "fromdenom", + ToDenom: "todenom", + AmountCapForToDenom: swapCap, + SwapRate: pebSwapRateForCony, + } + s.toDenomMetadata = bank.Metadata{ + Description: "This is metadata for to-coin", + DenomUnits: []*bank.DenomUnit{ + {Denom: s.swap.ToDenom, Exponent: 0}, + }, + Base: "dummy", + Display: "dummycoin", + Name: "DUMMY", + Symbol: "DUM", + } + s.createAccountsWithInitBalance(app) + app.AccountKeeper.GetModuleAccount(s.ctx, types.ModuleName) +} + +func (s *KeeperTestSuite) createAccountsWithInitBalance(app *simapp.SimApp) { + addresses := []*sdk.AccAddress{ + &s.accWithFromCoin, + &s.accWithToCoin, + } + for i, address := range s.createRandomAccounts(len(addresses)) { + *addresses[i] = address + } + minter := app.AccountKeeper.GetModuleAccount(s.ctx, minttypes.ModuleName).GetAddress() + fromAmount := sdk.NewCoins(sdk.NewCoin(s.swap.GetFromDenom(), s.initBalance)) + s.Require().NoError(app.BankKeeper.MintCoins(s.ctx, minttypes.ModuleName, fromAmount)) + s.Require().NoError(app.BankKeeper.SendCoins(s.ctx, minter, s.accWithFromCoin, fromAmount)) + + toAmount := sdk.NewCoins(sdk.NewCoin(s.swap.GetToDenom(), s.initBalance)) + s.Require().NoError(app.BankKeeper.MintCoins(s.ctx, minttypes.ModuleName, toAmount)) + s.Require().NoError(app.BankKeeper.SendCoins(s.ctx, minter, s.accWithToCoin, toAmount)) +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, &KeeperTestSuite{}) +} + +func (s *KeeperTestSuite) TestSwap() { + swap2ExpectedAmount, ok := sdk.NewIntFromString("296159312000000") + s.Require().True(ok) + swap100ExpectedAmount, ok := sdk.NewIntFromString("14807965600000000") + s.Require().True(ok) + swapAllExpectedBalance, ok := sdk.NewIntFromString("18281438845984584000000") + s.Require().True(ok) + testCases := map[string]struct { + from sdk.AccAddress + amountToSwap sdk.Coin + toDenom string + expectedAmount sdk.Int + shouldThrowError bool + expectedError error + }{ + "swap 2 from-denom": { + s.accWithFromCoin, + sdk.NewCoin(s.swap.GetFromDenom(), sdk.NewInt(2)), + s.swap.GetToDenom(), + swap2ExpectedAmount, + false, + nil, + }, + "swap some": { + s.accWithFromCoin, + sdk.NewCoin(s.swap.GetFromDenom(), sdk.NewInt(100)), + s.swap.GetToDenom(), + swap100ExpectedAmount, + false, + nil, + }, + "swap all the balance": { + s.accWithFromCoin, + sdk.NewCoin(s.swap.GetFromDenom(), s.initBalance), + s.swap.GetToDenom(), + swapAllExpectedBalance, + false, + nil, + }, + "swap without holding enough balance": { + s.accWithFromCoin, + sdk.NewCoin(s.swap.GetFromDenom(), sdk.OneInt().Add(s.initBalance)), + s.swap.GetToDenom(), + sdk.ZeroInt(), + true, + sdkerrors.ErrInsufficientFunds, + }, + "account holding new coin only": { + s.accWithToCoin, + sdk.NewCoin(s.swap.GetFromDenom(), sdk.NewInt(100)), + s.swap.GetToDenom(), + sdk.ZeroInt(), + true, + sdkerrors.ErrInsufficientFunds, + }, + } + for name, tc := range testCases { + s.Run(name, func() { + ctx, _ := s.ctx.CacheContext() + err := s.keeper.MakeSwap(ctx, s.swap, s.toDenomMetadata) + s.Require().NoError(err) + + err = s.keeper.Swap(ctx, tc.from, tc.amountToSwap, tc.toDenom) + if tc.shouldThrowError { + s.Require().ErrorIs(err, tc.expectedError) + return + } + s.Require().NoError(err) + + actualAmount := s.keeper.GetBalance(ctx, tc.from, s.swap.GetToDenom()).Amount + s.Require().Equal(tc.expectedAmount, actualAmount) + }) + } +} diff --git a/x/fswap/keeper/keys.go b/x/fswap/keeper/keys.go new file mode 100644 index 0000000000..04e36660f8 --- /dev/null +++ b/x/fswap/keeper/keys.go @@ -0,0 +1,19 @@ +package keeper + +var ( + swapPrefix = []byte{0x01} + swapStatsKey = []byte{0x02} + swappedKeyPrefix = []byte{0x03} +) + +// swapKey key(prefix + fromDenom + toDenom) +func swapKey(fromDenom, toDenom string) []byte { + key := append(swapPrefix, fromDenom...) + return append(key, toDenom...) +} + +// swappedKey key(prefix + fromDenom + toDenom) +func swappedKey(fromDenom, toDenom string) []byte { + key := append(swappedKeyPrefix, fromDenom...) + return append(key, toDenom...) +} diff --git a/x/fswap/keeper/msg_server.go b/x/fswap/keeper/msg_server.go new file mode 100644 index 0000000000..1f3086fc4f --- /dev/null +++ b/x/fswap/keeper/msg_server.go @@ -0,0 +1,62 @@ +package keeper + +import ( + "context" + + sdk "github.com/Finschia/finschia-sdk/types" + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +var _ types.MsgServer = MsgServer{} + +type MsgServer struct { + keeper Keeper +} + +func NewMsgServer(keeper Keeper) *MsgServer { + return &MsgServer{keeper} +} + +func (s MsgServer) Swap(ctx context.Context, req *types.MsgSwap) (*types.MsgSwapResponse, error) { + c := sdk.UnwrapSDKContext(ctx) + + from, err := sdk.AccAddressFromBech32(req.FromAddress) + if err != nil { + return nil, err + } + + if err := s.keeper.IsSendEnabledCoins(c, req.GetFromCoinAmount()); err != nil { + return &types.MsgSwapResponse{}, err + } + + if err := s.keeper.Swap(c, from, req.GetFromCoinAmount(), req.GetToDenom()); err != nil { + return nil, err + } + + return &types.MsgSwapResponse{}, nil +} + +func (s MsgServer) SwapAll(ctx context.Context, req *types.MsgSwapAll) (*types.MsgSwapAllResponse, error) { + c := sdk.UnwrapSDKContext(ctx) + + from, err := sdk.AccAddressFromBech32(req.FromAddress) + if err != nil { + return nil, err + } + + balance := s.keeper.GetBalance(c, from, req.FromDenom) + if balance.IsZero() { + return nil, sdkerrors.ErrInsufficientFunds + } + + if err := s.keeper.IsSendEnabledCoins(c, balance); err != nil { + return nil, err + } + + if err := s.keeper.Swap(c, from, balance, req.GetToDenom()); err != nil { + return nil, err + } + + return &types.MsgSwapAllResponse{}, nil +} diff --git a/x/fswap/keeper/msg_server_test.go b/x/fswap/keeper/msg_server_test.go new file mode 100644 index 0000000000..6e7953ac64 --- /dev/null +++ b/x/fswap/keeper/msg_server_test.go @@ -0,0 +1,135 @@ +package keeper_test + +import ( + sdk "github.com/Finschia/finschia-sdk/types" + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +func (s *KeeperTestSuite) TestMsgSwap() { + swap2ExpectedAmount, ok := sdk.NewIntFromString("296159312000000") + s.Require().True(ok) + swap100ExpectedAmount, ok := sdk.NewIntFromString("14807965600000000") + s.Require().True(ok) + swapAllExpectedBalance, ok := sdk.NewIntFromString("18281438845984584000000") + s.Require().True(ok) + testCases := map[string]struct { + request *types.MsgSwap + expectedAmount sdk.Int + shouldThrowError bool + expectedError error + }{ + "swap 2 from-denom": { + &types.MsgSwap{ + FromAddress: s.accWithFromCoin.String(), + FromCoinAmount: sdk.NewCoin(s.swap.GetFromDenom(), sdk.NewInt(2)), + ToDenom: s.swap.GetToDenom(), + }, + swap2ExpectedAmount, + false, + nil, + }, + "swap some": { + &types.MsgSwap{ + FromAddress: s.accWithFromCoin.String(), + FromCoinAmount: sdk.NewCoin(s.swap.GetFromDenom(), sdk.NewInt(100)), + ToDenom: s.swap.GetToDenom(), + }, + swap100ExpectedAmount, + false, + nil, + }, + "swap all the balance": { + &types.MsgSwap{ + FromAddress: s.accWithFromCoin.String(), + FromCoinAmount: sdk.NewCoin(s.swap.GetFromDenom(), s.initBalance), + ToDenom: s.swap.GetToDenom(), + }, + swapAllExpectedBalance, + false, + nil, + }, + "account holding to-coin only": { + &types.MsgSwap{ + FromAddress: s.accWithToCoin.String(), + FromCoinAmount: sdk.NewCoin(s.swap.GetFromDenom(), sdk.NewInt(100)), + ToDenom: s.swap.GetToDenom(), + }, + sdk.ZeroInt(), + true, + sdkerrors.ErrInsufficientFunds, + }, + } + for name, tc := range testCases { + s.Run(name, func() { + ctx, _ := s.ctx.CacheContext() + err := s.keeper.MakeSwap(ctx, s.swap, s.toDenomMetadata) + s.Require().NoError(err) + + swapResponse, err := s.msgServer.Swap(sdk.WrapSDKContext(ctx), tc.request) + if tc.shouldThrowError { + s.Require().ErrorIs(err, tc.expectedError) + return + } + s.Require().NotNil(swapResponse) + s.Require().NoError(err) + + from, err := sdk.AccAddressFromBech32(tc.request.FromAddress) + s.Require().NoError(err) + actualAmount := s.keeper.GetBalance(ctx, from, tc.request.GetToDenom()).Amount + s.Require().Equal(tc.expectedAmount, actualAmount) + }) + } +} + +func (s *KeeperTestSuite) TestMsgSwapAll() { + swapAllExpectedBalance, ok := sdk.NewIntFromString("18281438845984584000000") + s.Require().True(ok) + testCases := map[string]struct { + request *types.MsgSwapAll + expectedAmount sdk.Int + shouldThrowError bool + expectedError error + }{ + "swapAll": { + &types.MsgSwapAll{ + FromAddress: s.accWithFromCoin.String(), + FromDenom: s.swap.GetFromDenom(), + ToDenom: s.swap.GetToDenom(), + }, + swapAllExpectedBalance, + false, + nil, + }, + "account holding to-coin only": { + &types.MsgSwapAll{ + FromAddress: s.accWithToCoin.String(), + FromDenom: s.swap.GetFromDenom(), + ToDenom: s.swap.GetToDenom(), + }, + s.initBalance, + true, + sdkerrors.ErrInsufficientFunds, + }, + } + for name, tc := range testCases { + s.Run(name, func() { + ctx, _ := s.ctx.CacheContext() + err := s.keeper.MakeSwap(ctx, s.swap, s.toDenomMetadata) + s.Require().NoError(err) + + swapResponse, err := s.msgServer.SwapAll(sdk.WrapSDKContext(ctx), tc.request) + if tc.shouldThrowError { + s.Require().ErrorIs(err, tc.expectedError) + return + } + s.Require().NotNil(swapResponse) + s.Require().NoError(err) + + from, err := sdk.AccAddressFromBech32(tc.request.FromAddress) + s.Require().NoError(err) + actualAmount := s.keeper.GetBalance(ctx, from, tc.request.GetToDenom()).Amount + s.Require().Equal(tc.expectedAmount, actualAmount) + }) + } +} diff --git a/x/fswap/keeper/proposal.go b/x/fswap/keeper/proposal.go new file mode 100644 index 0000000000..1c726e67a6 --- /dev/null +++ b/x/fswap/keeper/proposal.go @@ -0,0 +1,163 @@ +package keeper + +import ( + "github.com/Finschia/finschia-sdk/store/prefix" + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/types/errors" + bank "github.com/Finschia/finschia-sdk/x/bank/types" + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +func (k Keeper) MakeSwap(ctx sdk.Context, swap types.Swap, toDenomMetadata bank.Metadata) error { + isNewSwap := true + if _, err := k.getSwap(ctx, swap.FromDenom, swap.ToDenom); err == nil { + isNewSwap = false + } + + if !isNewSwap && !k.config.UpdateAllowed { + return errors.ErrInvalidRequest.Wrap("update existing swap not allowed") + } + + if isNewSwap { + if err := k.increaseSwapCount(ctx); err != nil { + return err + } + } + + stats, err := k.getSwapStats(ctx) + if err != nil { + return err + } + + if int(stats.SwapCount) > k.config.MaxSwaps && !k.isUnlimited() { + return types.ErrCanNotHaveMoreSwap.Wrapf("cannot make more swaps, max swaps is %d", k.config.MaxSwaps) + } + + if isNewSwap { + swapped := types.Swapped{ + FromCoinAmount: sdk.Coin{ + Denom: swap.GetFromDenom(), + Amount: sdk.ZeroInt(), + }, + ToCoinAmount: sdk.Coin{ + Denom: swap.GetToDenom(), + Amount: sdk.ZeroInt(), + }, + } + if err := k.setSwapped(ctx, swapped); err != nil { + return err + } + } + + if err := k.setSwap(ctx, swap); err != nil { + return err + } + + existingMetadata, ok := k.GetDenomMetaData(ctx, swap.ToDenom) + if !ok { + k.SetDenomMetaData(ctx, toDenomMetadata) + return nil + } + if !denomMetadataEqual(existingMetadata, toDenomMetadata) { + return errors.ErrInvalidRequest.Wrap("changing existing metadata not allowed") + } + + return nil +} + +func denomMetadataEqual(metadata, otherMetadata bank.Metadata) bool { + if metadata.Description != otherMetadata.Description { + return false + } + if len(metadata.DenomUnits) != len(otherMetadata.DenomUnits) { + return false + } + for i, unit := range metadata.DenomUnits { + if unit.Denom != otherMetadata.DenomUnits[i].Denom { + return false + } + } + if metadata.Base != otherMetadata.Base { + return false + } + if metadata.Display != otherMetadata.Display { + return false + } + if metadata.Name != otherMetadata.Name { + return false + } + if metadata.Symbol != otherMetadata.Symbol { + return false + } + return true +} + +func (k Keeper) increaseSwapCount(ctx sdk.Context) error { + stats, err := k.getSwapStats(ctx) + if err != nil { + return err + } + + prev := stats.SwapCount + stats.SwapCount += 1 + if stats.SwapCount < prev { + return types.ErrInvalidState.Wrap("overflow detected") + } + + if err := k.setSwapStats(ctx, stats); err != nil { + return err + } + return nil +} + +func (k Keeper) setSwap(ctx sdk.Context, swap types.Swap) error { + key := swapKey(swap.FromDenom, swap.ToDenom) + bz, err := k.cdc.Marshal(&swap) + if err != nil { + return err + } + + store := ctx.KVStore(k.storeKey) + store.Set(key, bz) + return nil +} + +func (k Keeper) getSwap(ctx sdk.Context, fromDenom, toDenom string) (types.Swap, error) { + store := ctx.KVStore(k.storeKey) + key := swapKey(fromDenom, toDenom) + bz := store.Get(key) + if bz == nil { + return types.Swap{}, errors.ErrNotFound.Wrap("swap not found") + } + + swap := types.Swap{} + if err := k.cdc.Unmarshal(bz, &swap); err != nil { + return types.Swap{}, err + } + + return swap, nil +} + +func (k Keeper) getAllSwaps(ctx sdk.Context) []types.Swap { + swaps := []types.Swap{} + k.iterateAllSwaps(ctx, func(swap types.Swap) bool { + swaps = append(swaps, swap) + return false + }) + return swaps +} + +func (k Keeper) iterateAllSwaps(ctx sdk.Context, cb func(swapped types.Swap) (stop bool)) { + store := ctx.KVStore(k.storeKey) + swapDataStore := prefix.NewStore(store, swapPrefix) + + iterator := swapDataStore.Iterator(nil, nil) + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + swap := types.Swap{} + k.cdc.MustUnmarshal(iterator.Value(), &swap) + if cb(swap) { + break + } + } +} diff --git a/x/fswap/keeper/proposal_test.go b/x/fswap/keeper/proposal_test.go new file mode 100644 index 0000000000..4dbe0e63b2 --- /dev/null +++ b/x/fswap/keeper/proposal_test.go @@ -0,0 +1,138 @@ +package keeper_test + +import ( + sdk "github.com/Finschia/finschia-sdk/types" + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" + bank "github.com/Finschia/finschia-sdk/x/bank/types" + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +func (s *KeeperTestSuite) TestMakeSwapProposal() { + testCases := map[string]struct { + swap types.Swap + toDenomMeta bank.Metadata + existingMetadata bool + expectedError error + }{ + "valid": { + types.Swap{ + FromDenom: "fromD", + ToDenom: "toD", + AmountCapForToDenom: sdk.OneInt(), + SwapRate: sdk.OneDec(), + }, + s.toDenomMetadata, + false, + nil, + }, + "to-denom metadata change not allowed": { + types.Swap{ + FromDenom: "fromD", + ToDenom: "toD", + AmountCapForToDenom: sdk.OneInt(), + SwapRate: sdk.OneDec(), + }, + bank.Metadata{ + Description: s.toDenomMetadata.Description, + DenomUnits: s.toDenomMetadata.DenomUnits, + Base: "change", + Display: s.toDenomMetadata.Display, + Name: s.toDenomMetadata.Name, + Symbol: s.toDenomMetadata.Symbol, + }, + true, + sdkerrors.ErrInvalidRequest, + }, + } + for name, tc := range testCases { + s.Run(name, func() { + ctx, _ := s.ctx.CacheContext() + err := s.keeper.MakeSwap(ctx, tc.swap, s.toDenomMetadata) + if tc.existingMetadata { + err := s.keeper.MakeSwap(ctx, tc.swap, s.toDenomMetadata) + s.Require().ErrorIs(err, tc.expectedError) + } else { + s.Require().ErrorIs(err, tc.expectedError) + } + }) + } +} + +func (s *KeeperTestSuite) TestSwapValidateBasic() { + testCases := map[string]struct { + swap types.Swap + shouldThrowError bool + expectedError error + }{ + "valid": { + types.Swap{ + FromDenom: "fromD", + ToDenom: "toD", + AmountCapForToDenom: sdk.OneInt(), + SwapRate: sdk.OneDec(), + }, + false, + nil, + }, + "invalid empty from-denom": { + types.Swap{ + FromDenom: "", + ToDenom: "toD", + AmountCapForToDenom: sdk.OneInt(), + SwapRate: sdk.OneDec(), + }, + true, + sdkerrors.ErrInvalidRequest, + }, + "invalid empty to-denom": { + types.Swap{ + FromDenom: "fromD", + ToDenom: "", + AmountCapForToDenom: sdk.OneInt(), + SwapRate: sdk.OneDec(), + }, + true, + sdkerrors.ErrInvalidRequest, + }, + "invalid zero amount cap for to-denom": { + types.Swap{ + FromDenom: "fromD", + ToDenom: "toD", + AmountCapForToDenom: sdk.ZeroInt(), + SwapRate: sdk.OneDec(), + }, + true, + sdkerrors.ErrInvalidRequest, + }, + "invalid zero swap-rate": { + types.Swap{ + FromDenom: "fromD", + ToDenom: "toD", + AmountCapForToDenom: sdk.OneInt(), + SwapRate: sdk.ZeroDec(), + }, + true, + sdkerrors.ErrInvalidRequest, + }, + "invalid the same from-denom and to-denom": { + types.Swap{ + FromDenom: "same", + ToDenom: "same", + AmountCapForToDenom: sdk.OneInt(), + SwapRate: sdk.OneDec(), + }, + true, + sdkerrors.ErrInvalidRequest, + }, + } + for name, tc := range testCases { + s.Run(name, func() { + err := tc.swap.ValidateBasic() + if tc.shouldThrowError { + s.Require().ErrorIs(err, tc.expectedError) + return + } + s.Require().NoError(err) + }) + } +} diff --git a/x/fswap/module.go b/x/fswap/module.go new file mode 100644 index 0000000000..d561bbe296 --- /dev/null +++ b/x/fswap/module.go @@ -0,0 +1,159 @@ +package fswap + +import ( + "encoding/json" + "fmt" + + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + abci "github.com/tendermint/tendermint/abci/types" + + "github.com/Finschia/finschia-sdk/client" + "github.com/Finschia/finschia-sdk/codec" + cdctypes "github.com/Finschia/finschia-sdk/codec/types" + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/types/module" + "github.com/Finschia/finschia-sdk/x/fswap/client/cli" + "github.com/Finschia/finschia-sdk/x/fswap/keeper" + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + _ module.EndBlockAppModule = AppModule{} +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface for the fswap module. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the fswap module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) {} + +// RegisterInterfaces registers the module's interface types +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns the fswap module's default genesis state. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis performs genesis state validation for the fswap module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + // this line is used by starport scaffolding # 2 +} + +// GetTxCmd returns the fswap module's root tx command. +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the fswap module's root query command. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd(types.StoreKey) +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface for the fswap module. +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + bankKeeper keeper.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + bankKeeper keeper.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + bankKeeper: bankKeeper, + } +} + +// Name returns the fswap module's name. +func (am AppModule) Name() string { + return am.AppModuleBasic.Name() +} + +// Route returns the fswap module's message routing key. +func (AppModule) Route() sdk.Route { return sdk.Route{} } + +// QuerierRoute returns the fswap module's query routing key. +func (AppModule) QuerierRoute() string { return types.QuerierRoute } + +// LegacyQuerierHandler returns the fswap module's Querier. +func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { + return nil +} + +// RegisterServices registers a GRPC query service to respond to the +// module-specific GRPC queries. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServer(am.keeper)) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServer(am.keeper)) +} + +// RegisterInvariants registers the fswap module's invariants. +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the fswap module's genesis initialization It returns +// no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { + genState := types.GenesisState{} + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + if err := am.keeper.InitGenesis(ctx, &genState); err != nil { + panic(err) + } + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the fswap module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := am.keeper.ExportGenesis(ctx) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion implements ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock executes all ABCI BeginBlock logic respective to the fswap module. +func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} + +// EndBlock executes all ABCI EndBlock logic respective to the fswap module. It +// returns no validator updates. +func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return []abci.ValidatorUpdate{} +} diff --git a/x/fswap/module_simulation.go b/x/fswap/module_simulation.go new file mode 100644 index 0000000000..1a4d90d6be --- /dev/null +++ b/x/fswap/module_simulation.go @@ -0,0 +1,40 @@ +package fswap + +import ( + "math/rand" + + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/types/module" + simtypes "github.com/Finschia/finschia-sdk/types/simulation" + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +var _ module.AppModuleSimulation = AppModule{} + +// GenerateGenesisState creates a randomized GenState of the module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + fswapGenesis := types.DefaultGenesis() + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(fswapGenesis) +} + +// RegisterStoreDecoder registers a decoder. +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} + +// ProposalContents doesn't return any content functions for governance proposals. +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { + return nil +} + +// WeightedOperations returns the all the gov module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + operations := make([]simtypes.WeightedOperation, 0) + + // this line is used by starport scaffolding # simapp/module/operation + + return operations +} + +// RandomizedParams creates randomized slashing param changes for the simulator. +func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { + return nil +} diff --git a/x/fswap/proposal_handler_test.go b/x/fswap/proposal_handler_test.go new file mode 100644 index 0000000000..c55bd5a2e4 --- /dev/null +++ b/x/fswap/proposal_handler_test.go @@ -0,0 +1,40 @@ +package fswap_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + + "github.com/Finschia/finschia-sdk/simapp" + sdk "github.com/Finschia/finschia-sdk/types" + bank "github.com/Finschia/finschia-sdk/x/bank/types" + "github.com/Finschia/finschia-sdk/x/fswap" + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +func testProposal(swap types.Swap) *types.MakeSwapProposal { + return types.NewMakeSwapProposal("Test", "description", swap, bank.Metadata{Base: "DUM"}) +} + +func TestProposalHandlerPassed(t *testing.T) { + app := simapp.Setup(false) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + + forConyRate, err := sdk.NewDecFromStr("148079656000000") + require.NoError(t, err) + swap := types.Swap{ + FromDenom: "aaa", + ToDenom: "bbb", + AmountCapForToDenom: sdk.NewInt(100), + SwapRate: forConyRate, + } + tp := testProposal(swap) + hdlr := fswap.NewSwapHandler(app.FswapKeeper) + require.NoError(t, hdlr(ctx, tp)) + + // todo check contents +} + +// todo check failed +// func TestProposalHandlerFailed(t *testing.T) {} diff --git a/x/fswap/simulation/genesis.go b/x/fswap/simulation/genesis.go new file mode 100644 index 0000000000..02eddda2ba --- /dev/null +++ b/x/fswap/simulation/genesis.go @@ -0,0 +1 @@ +package simulation diff --git a/x/fswap/simulation/genesis_test.go b/x/fswap/simulation/genesis_test.go new file mode 100644 index 0000000000..5c6452f9a0 --- /dev/null +++ b/x/fswap/simulation/genesis_test.go @@ -0,0 +1 @@ +package simulation_test diff --git a/x/fswap/spec/README.md b/x/fswap/spec/README.md new file mode 100644 index 0000000000..ee7423f27c --- /dev/null +++ b/x/fswap/spec/README.md @@ -0,0 +1,16 @@ +``` +make build +make install +zsh init_node.sh sim 1 +``` + +open the `./.simapp/simapp0/config/genesis.json` change the value of `voting_params.voting_period` to `10s` +``` +simd start --home ~/.simapp/simapp0 +simd tx gov submit-proposal swap-init --title "test" --description "test" --from link146asaycmtydq45kxc8evntqfgepagygelel00h --from-denom "cony" --to-denom "PDT" --swap-rate 123 --amount-limit 1000 --deposit 10000000stake --chain-id=sim --keyring-backend=test --gas-prices 1000stake --gas 10000000 --gas-adjustment 1.5 --home ~/.simapp/simapp0 -b block -y +simd tx gov vote 1 yes --from link146asaycmtydq45kxc8evntqfgepagygelel00h --chain-id=sim --keyring-backend=test --home ~/.simapp/simapp0 -b block -y +``` + +``` +simd query fswap swapped --chain-id=sim +``` \ No newline at end of file diff --git a/x/fswap/testutil/expected_keepers_mocks.go b/x/fswap/testutil/expected_keepers_mocks.go new file mode 100644 index 0000000000..8718d93937 --- /dev/null +++ b/x/fswap/testutil/expected_keepers_mocks.go @@ -0,0 +1,153 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: x/fswap/keeper/expected_keepers.go + +// Package testutil is a generated GoMock package. +package testutil + +import ( + reflect "reflect" + + types "github.com/Finschia/finschia-sdk/snapshots/types" + types0 "github.com/Finschia/finschia-sdk/types" + types1 "github.com/Finschia/finschia-sdk/x/bank/types" + gomock "github.com/golang/mock/gomock" +) + +// MockBankKeeper is a mock of BankKeeper interface. +type MockBankKeeper struct { + ctrl *gomock.Controller + recorder *MockBankKeeperMockRecorder +} + +// MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. +type MockBankKeeperMockRecorder struct { + mock *MockBankKeeper +} + +// NewMockBankKeeper creates a new mock instance. +func NewMockBankKeeper(ctrl *gomock.Controller) *MockBankKeeper { + mock := &MockBankKeeper{ctrl: ctrl} + mock.recorder = &MockBankKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder { + return m.recorder +} + +// BurnCoins mocks base method. +func (m *MockBankKeeper) BurnCoins(ctx types0.Context, moduleName string, amt types0.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BurnCoins", ctx, moduleName, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// BurnCoins indicates an expected call of BurnCoins. +func (mr *MockBankKeeperMockRecorder) BurnCoins(ctx, moduleName, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BurnCoins", reflect.TypeOf((*MockBankKeeper)(nil).BurnCoins), ctx, moduleName, amt) +} + +// GetBalance mocks base method. +func (m *MockBankKeeper) GetBalance(ctx types0.Context, addr types0.AccAddress, denom string) types0.Coin { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetBalance", ctx, addr, denom) + ret0, _ := ret[0].(types0.Coin) + return ret0 +} + +// GetBalance indicates an expected call of GetBalance. +func (mr *MockBankKeeperMockRecorder) GetBalance(ctx, addr, denom interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBalance", reflect.TypeOf((*MockBankKeeper)(nil).GetBalance), ctx, addr, denom) +} + +// GetDenomMetaData mocks base method. +func (m *MockBankKeeper) GetDenomMetaData(ctx types0.Context, denom string) (types.Metadata, bool) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetDenomMetaData", ctx, denom) + ret0, _ := ret[0].(types.Metadata) + ret1, _ := ret[1].(bool) + return ret0, ret1 +} + +// GetDenomMetaData indicates an expected call of GetDenomMetaData. +func (mr *MockBankKeeperMockRecorder) GetDenomMetaData(ctx, denom interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDenomMetaData", reflect.TypeOf((*MockBankKeeper)(nil).GetDenomMetaData), ctx, denom) +} + +// IsSendEnabledCoins mocks base method. +func (m *MockBankKeeper) IsSendEnabledCoins(ctx types0.Context, coins ...types0.Coin) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range coins { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "IsSendEnabledCoins", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// IsSendEnabledCoins indicates an expected call of IsSendEnabledCoins. +func (mr *MockBankKeeperMockRecorder) IsSendEnabledCoins(ctx interface{}, coins ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, coins...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSendEnabledCoins", reflect.TypeOf((*MockBankKeeper)(nil).IsSendEnabledCoins), varargs...) +} + +// MintCoins mocks base method. +func (m *MockBankKeeper) MintCoins(ctx types0.Context, moduleName string, amt types0.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "MintCoins", ctx, moduleName, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// MintCoins indicates an expected call of MintCoins. +func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, moduleName, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MintCoins", reflect.TypeOf((*MockBankKeeper)(nil).MintCoins), ctx, moduleName, amt) +} + +// SendCoinsFromAccountToModule mocks base method. +func (m *MockBankKeeper) SendCoinsFromAccountToModule(ctx types0.Context, senderAddr types0.AccAddress, recipientModule string, amt types0.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendCoinsFromAccountToModule", ctx, senderAddr, recipientModule, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendCoinsFromAccountToModule indicates an expected call of SendCoinsFromAccountToModule. +func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromAccountToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt) +} + +// SendCoinsFromModuleToAccount mocks base method. +func (m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx types0.Context, senderModule string, recipientAddr types0.AccAddress, amt types0.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendCoinsFromModuleToAccount", ctx, senderModule, recipientAddr, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendCoinsFromModuleToAccount indicates an expected call of SendCoinsFromModuleToAccount. +func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt) +} + +// SetDenomMetaData mocks base method. +func (m *MockBankKeeper) SetDenomMetaData(ctx types0.Context, denomMetaData types1.Metadata) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetDenomMetaData", ctx, denomMetaData) +} + +// SetDenomMetaData indicates an expected call of SetDenomMetaData. +func (mr *MockBankKeeperMockRecorder) SetDenomMetaData(ctx, denomMetaData interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDenomMetaData", reflect.TypeOf((*MockBankKeeper)(nil).SetDenomMetaData), ctx, denomMetaData) +} diff --git a/x/fswap/types/codec.go b/x/fswap/types/codec.go new file mode 100644 index 0000000000..de8865ec57 --- /dev/null +++ b/x/fswap/types/codec.go @@ -0,0 +1,39 @@ +package types + +import ( + "github.com/Finschia/finschia-sdk/codec" + "github.com/Finschia/finschia-sdk/codec/legacy" + "github.com/Finschia/finschia-sdk/codec/types" + sdk "github.com/Finschia/finschia-sdk/types" + "github.com/Finschia/finschia-sdk/types/msgservice" + fscodec "github.com/Finschia/finschia-sdk/x/fswap/codec" + govcodec "github.com/Finschia/finschia-sdk/x/gov/codec" + govtypes "github.com/Finschia/finschia-sdk/x/gov/types" +) + +// RegisterLegacyAminoCodec registers concrete types on the LegacyAmino codec +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + legacy.RegisterAminoMsg(cdc, &MsgSwap{}, "lbm-sdk/MsgSwap") + legacy.RegisterAminoMsg(cdc, &MsgSwapAll{}, "lbm-sdk/MsgSwapAll") + + cdc.RegisterConcrete(&MakeSwapProposal{}, "lbm-sdk/MakeSwapProposal", nil) +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgSwap{}, + &MsgSwapAll{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) + + registry.RegisterImplementations( + (*govtypes.Content)(nil), + &MakeSwapProposal{}, + ) +} + +func init() { + RegisterLegacyAminoCodec(govcodec.Amino) + RegisterLegacyAminoCodec(fscodec.Amino) +} diff --git a/x/fswap/types/config.go b/x/fswap/types/config.go new file mode 100644 index 0000000000..071a0cab1f --- /dev/null +++ b/x/fswap/types/config.go @@ -0,0 +1,13 @@ +package types + +type Config struct { + MaxSwaps int + UpdateAllowed bool +} + +func DefaultConfig() Config { + return Config{ + MaxSwaps: 1, + UpdateAllowed: false, + } +} diff --git a/x/fswap/types/errors.go b/x/fswap/types/errors.go new file mode 100644 index 0000000000..24e0fa6c11 --- /dev/null +++ b/x/fswap/types/errors.go @@ -0,0 +1,15 @@ +package types + +// DONTCOVER + +import ( + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" +) + +// x/fswap module sentinel errors +var ( + ErrInvalidState = sdkerrors.Register(ModuleName, 2, "swap module invalid state") + ErrCanNotHaveMoreSwap = sdkerrors.Register(ModuleName, 3, "no more swap allowed") + ErrSwappedNotFound = sdkerrors.Register(ModuleName, 4, "swapped does not exist") + ErrExceedSwappableToCoinAmount = sdkerrors.Register(ModuleName, 5, "exceed swappable to-coin amount") +) diff --git a/x/fswap/types/event.pb.go b/x/fswap/types/event.pb.go new file mode 100644 index 0000000000..6461787a83 --- /dev/null +++ b/x/fswap/types/event.pb.go @@ -0,0 +1,434 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lbm/fswap/v1/event.proto + +package types + +import ( + fmt "fmt" + types "github.com/Finschia/finschia-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type EventSwapCoins struct { + // holder's address + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // from-coin amount + FromCoinAmount types.Coin `protobuf:"bytes,2,opt,name=from_coin_amount,json=fromCoinAmount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"from_coin_amount"` + // to-coin amount + ToCoinAmount types.Coin `protobuf:"bytes,3,opt,name=to_coin_amount,json=toCoinAmount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"to_coin_amount"` +} + +func (m *EventSwapCoins) Reset() { *m = EventSwapCoins{} } +func (m *EventSwapCoins) String() string { return proto.CompactTextString(m) } +func (*EventSwapCoins) ProtoMessage() {} +func (*EventSwapCoins) Descriptor() ([]byte, []int) { + return fileDescriptor_92d5edbd64a725af, []int{0} +} +func (m *EventSwapCoins) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventSwapCoins) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventSwapCoins.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventSwapCoins) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventSwapCoins.Merge(m, src) +} +func (m *EventSwapCoins) XXX_Size() int { + return m.Size() +} +func (m *EventSwapCoins) XXX_DiscardUnknown() { + xxx_messageInfo_EventSwapCoins.DiscardUnknown(m) +} + +var xxx_messageInfo_EventSwapCoins proto.InternalMessageInfo + +func (m *EventSwapCoins) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *EventSwapCoins) GetFromCoinAmount() types.Coin { + if m != nil { + return m.FromCoinAmount + } + return types.Coin{} +} + +func (m *EventSwapCoins) GetToCoinAmount() types.Coin { + if m != nil { + return m.ToCoinAmount + } + return types.Coin{} +} + +func init() { + proto.RegisterType((*EventSwapCoins)(nil), "lbm.fswap.v1.EventSwapCoins") +} + +func init() { proto.RegisterFile("lbm/fswap/v1/event.proto", fileDescriptor_92d5edbd64a725af) } + +var fileDescriptor_92d5edbd64a725af = []byte{ + // 289 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x91, 0xc1, 0x4a, 0xc3, 0x30, + 0x1c, 0xc6, 0x9b, 0x09, 0x8a, 0x75, 0x14, 0x29, 0x1e, 0xea, 0x0e, 0xd9, 0xf0, 0x34, 0x10, 0x13, + 0xea, 0x9e, 0xc0, 0x89, 0xe2, 0x79, 0xde, 0xbc, 0x8c, 0xa4, 0x4d, 0xbb, 0xe2, 0xd2, 0x7f, 0x69, + 0xb2, 0x6e, 0xbe, 0x85, 0x67, 0x1f, 0xc1, 0x27, 0xd9, 0x71, 0x47, 0x4f, 0x2a, 0xed, 0x8b, 0x48, + 0xd2, 0x8a, 0x78, 0xf2, 0xe4, 0xed, 0x0b, 0x5f, 0xbe, 0xdf, 0x0f, 0x12, 0x37, 0x58, 0x72, 0x49, + 0x13, 0xb5, 0x66, 0x05, 0xad, 0x42, 0x2a, 0x2a, 0x91, 0x6b, 0x52, 0x94, 0xa0, 0xc1, 0xef, 0x2f, + 0xb9, 0x24, 0xb6, 0x21, 0x55, 0x38, 0x38, 0x49, 0x21, 0x05, 0x5b, 0x50, 0x93, 0xda, 0x3b, 0x03, + 0x1c, 0x81, 0x92, 0xa0, 0x28, 0x67, 0x4a, 0xd0, 0x2a, 0xe4, 0x42, 0xb3, 0x90, 0x46, 0x90, 0xe5, + 0x6d, 0x7f, 0xf6, 0xd2, 0x73, 0xbd, 0x1b, 0xc3, 0xbc, 0x5f, 0xb3, 0xe2, 0x1a, 0xb2, 0x5c, 0xf9, + 0x81, 0x7b, 0xc0, 0xe2, 0xb8, 0x14, 0x4a, 0x05, 0x68, 0x84, 0xc6, 0x87, 0xb3, 0xef, 0xa3, 0xbf, + 0x71, 0x8f, 0x93, 0x12, 0xe4, 0xdc, 0xec, 0xe7, 0x4c, 0xc2, 0x2a, 0xd7, 0x41, 0x6f, 0x84, 0xc6, + 0x47, 0x97, 0xa7, 0xa4, 0xf5, 0x10, 0xe3, 0x21, 0x9d, 0x87, 0x18, 0xde, 0x74, 0xb2, 0x7d, 0x1f, + 0x3a, 0xaf, 0x1f, 0xc3, 0xf3, 0x34, 0xd3, 0x8b, 0x15, 0x27, 0x11, 0x48, 0x7a, 0x9b, 0xe5, 0x2a, + 0x5a, 0x64, 0x8c, 0x26, 0x5d, 0xb8, 0x50, 0xf1, 0x23, 0xd5, 0x4f, 0x85, 0x50, 0x76, 0x34, 0xf3, + 0x8c, 0xc7, 0xa4, 0x2b, 0x6b, 0xf1, 0xb5, 0xeb, 0x69, 0xf8, 0xe5, 0xdd, 0xfb, 0x17, 0x6f, 0x5f, + 0xc3, 0x8f, 0x75, 0x7a, 0xb7, 0xad, 0x31, 0xda, 0xd5, 0x18, 0x7d, 0xd6, 0x18, 0x3d, 0x37, 0xd8, + 0xd9, 0x35, 0xd8, 0x79, 0x6b, 0xb0, 0xf3, 0x40, 0xfe, 0x84, 0x6e, 0xba, 0x3f, 0xb3, 0x70, 0xbe, + 0x6f, 0x5f, 0x7b, 0xf2, 0x15, 0x00, 0x00, 0xff, 0xff, 0xe2, 0xc5, 0x6e, 0x30, 0xcd, 0x01, 0x00, + 0x00, +} + +func (m *EventSwapCoins) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventSwapCoins) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventSwapCoins) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.ToCoinAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.FromCoinAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintEvent(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintEvent(dAtA []byte, offset int, v uint64) int { + offset -= sovEvent(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EventSwapCoins) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovEvent(uint64(l)) + } + l = m.FromCoinAmount.Size() + n += 1 + l + sovEvent(uint64(l)) + l = m.ToCoinAmount.Size() + n += 1 + l + sovEvent(uint64(l)) + return n +} + +func sovEvent(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvent(x uint64) (n int) { + return sovEvent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EventSwapCoins) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventSwapCoins: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventSwapCoins: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromCoinAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FromCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ToCoinAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ToCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvent(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEvent + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvent + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvent + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvent = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvent = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvent = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/fswap/types/fswap.go b/x/fswap/types/fswap.go new file mode 100644 index 0000000000..c307c826b3 --- /dev/null +++ b/x/fswap/types/fswap.go @@ -0,0 +1,76 @@ +package types + +import ( + "gopkg.in/yaml.v2" + + sdk "github.com/Finschia/finschia-sdk/types" + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" +) + +// ValidateBasic validates the set of Swap +func (s *Swap) ValidateBasic() error { + if s.FromDenom == "" { + return sdkerrors.ErrInvalidRequest.Wrap("from denomination cannot be empty") + } + if s.ToDenom == "" { + return sdkerrors.ErrInvalidRequest.Wrap("to denomination cannot be empty") + } + if s.FromDenom == s.ToDenom { + return sdkerrors.ErrInvalidRequest.Wrap("from denomination cannot be equal to to denomination") + } + if s.AmountCapForToDenom.LT(sdk.OneInt()) { + return sdkerrors.ErrInvalidRequest.Wrap("amount cannot be less than one") + } + if s.SwapRate.IsZero() { + return sdkerrors.ErrInvalidRequest.Wrap("swap rate cannot be zero") + } + return nil +} + +func (s *Swap) String() string { + out, _ := yaml.Marshal(s) + return string(out) +} + +func (s *SwapStats) ValidateBasic() error { + if s.SwapCount < 0 { + return ErrInvalidState.Wrap("swap count cannot be negative") + } + return nil +} + +func (s *SwapStats) String() string { + out, _ := yaml.Marshal(s) + return string(out) +} + +// ValidateBasic validates the set of Swapped +func (s *Swapped) ValidateBasic() error { + if err := validateCoinAmount(s.FromCoinAmount); err != nil { + return err + } + if err := validateCoinAmount(s.ToCoinAmount); err != nil { + return err + } + return nil +} + +func validateCoinAmount(i interface{}) error { + v, ok := i.(sdk.Coin) + if !ok { + return sdkerrors.ErrInvalidCoins.Wrapf("invalid coin amount: %T", i) + } + if v.IsNil() { + return sdkerrors.ErrInvalidCoins.Wrap("coin amount must be not nil") + } + if err := v.Validate(); err != nil { + return sdkerrors.ErrInvalidCoins.Wrap(err.Error()) + } + return nil +} + +// String implements the Stringer interface. +func (s *Swapped) String() string { + out, _ := yaml.Marshal(s) + return string(out) +} diff --git a/x/fswap/types/fswap.pb.go b/x/fswap/types/fswap.pb.go new file mode 100644 index 0000000000..4449b20bec --- /dev/null +++ b/x/fswap/types/fswap.pb.go @@ -0,0 +1,1247 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lbm/fswap/v1/fswap.proto + +package types + +import ( + fmt "fmt" + github_com_Finschia_finschia_sdk_types "github.com/Finschia/finschia-sdk/types" + types1 "github.com/Finschia/finschia-sdk/types" + types "github.com/Finschia/finschia-sdk/x/bank/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type Swap struct { + FromDenom string `protobuf:"bytes,1,opt,name=from_denom,json=fromDenom,proto3" json:"from_denom,omitempty"` + ToDenom string `protobuf:"bytes,2,opt,name=to_denom,json=toDenom,proto3" json:"to_denom,omitempty"` + AmountCapForToDenom github_com_Finschia_finschia_sdk_types.Int `protobuf:"bytes,3,opt,name=amount_cap_for_to_denom,json=amountCapForToDenom,proto3,customtype=github.com/Finschia/finschia-sdk/types.Int" json:"amount_cap_for_to_denom"` + SwapRate github_com_Finschia_finschia_sdk_types.Dec `protobuf:"bytes,4,opt,name=swap_rate,json=swapRate,proto3,customtype=github.com/Finschia/finschia-sdk/types.Dec" json:"swap_rate"` +} + +func (m *Swap) Reset() { *m = Swap{} } +func (*Swap) ProtoMessage() {} +func (*Swap) Descriptor() ([]byte, []int) { + return fileDescriptor_42ca60eaf37a2b67, []int{0} +} +func (m *Swap) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Swap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Swap.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Swap) XXX_Merge(src proto.Message) { + xxx_messageInfo_Swap.Merge(m, src) +} +func (m *Swap) XXX_Size() int { + return m.Size() +} +func (m *Swap) XXX_DiscardUnknown() { + xxx_messageInfo_Swap.DiscardUnknown(m) +} + +var xxx_messageInfo_Swap proto.InternalMessageInfo + +func (m *Swap) GetFromDenom() string { + if m != nil { + return m.FromDenom + } + return "" +} + +func (m *Swap) GetToDenom() string { + if m != nil { + return m.ToDenom + } + return "" +} + +type SwapStats struct { + SwapCount int32 `protobuf:"varint,1,opt,name=swap_count,json=swapCount,proto3" json:"swap_count,omitempty"` +} + +func (m *SwapStats) Reset() { *m = SwapStats{} } +func (*SwapStats) ProtoMessage() {} +func (*SwapStats) Descriptor() ([]byte, []int) { + return fileDescriptor_42ca60eaf37a2b67, []int{1} +} +func (m *SwapStats) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SwapStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SwapStats.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SwapStats) XXX_Merge(src proto.Message) { + xxx_messageInfo_SwapStats.Merge(m, src) +} +func (m *SwapStats) XXX_Size() int { + return m.Size() +} +func (m *SwapStats) XXX_DiscardUnknown() { + xxx_messageInfo_SwapStats.DiscardUnknown(m) +} + +var xxx_messageInfo_SwapStats proto.InternalMessageInfo + +func (m *SwapStats) GetSwapCount() int32 { + if m != nil { + return m.SwapCount + } + return 0 +} + +// From cosmos-sdk 0.46.0 they deprecated this way, but currently finschia-sdk based on 0.45.10 +type MakeSwapProposal struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Swap Swap `protobuf:"bytes,3,opt,name=swap,proto3" json:"swap"` + ToDenomMetadata types.Metadata `protobuf:"bytes,4,opt,name=to_denom_metadata,json=toDenomMetadata,proto3" json:"to_denom_metadata" yaml:"denom_metadata"` +} + +func (m *MakeSwapProposal) Reset() { *m = MakeSwapProposal{} } +func (*MakeSwapProposal) ProtoMessage() {} +func (*MakeSwapProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_42ca60eaf37a2b67, []int{2} +} +func (m *MakeSwapProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MakeSwapProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MakeSwapProposal.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MakeSwapProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_MakeSwapProposal.Merge(m, src) +} +func (m *MakeSwapProposal) XXX_Size() int { + return m.Size() +} +func (m *MakeSwapProposal) XXX_DiscardUnknown() { + xxx_messageInfo_MakeSwapProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_MakeSwapProposal proto.InternalMessageInfo + +func (m *MakeSwapProposal) GetTitle() string { + if m != nil { + return m.Title + } + return "" +} + +func (m *MakeSwapProposal) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *MakeSwapProposal) GetSwap() Swap { + if m != nil { + return m.Swap + } + return Swap{} +} + +func (m *MakeSwapProposal) GetToDenomMetadata() types.Metadata { + if m != nil { + return m.ToDenomMetadata + } + return types.Metadata{} +} + +type Swapped struct { + FromCoinAmount types1.Coin `protobuf:"bytes,1,opt,name=from_coin_amount,json=fromCoinAmount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"from_coin_amount"` + ToCoinAmount types1.Coin `protobuf:"bytes,2,opt,name=to_coin_amount,json=toCoinAmount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"to_coin_amount"` +} + +func (m *Swapped) Reset() { *m = Swapped{} } +func (*Swapped) ProtoMessage() {} +func (*Swapped) Descriptor() ([]byte, []int) { + return fileDescriptor_42ca60eaf37a2b67, []int{3} +} +func (m *Swapped) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Swapped) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Swapped.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Swapped) XXX_Merge(src proto.Message) { + xxx_messageInfo_Swapped.Merge(m, src) +} +func (m *Swapped) XXX_Size() int { + return m.Size() +} +func (m *Swapped) XXX_DiscardUnknown() { + xxx_messageInfo_Swapped.DiscardUnknown(m) +} + +var xxx_messageInfo_Swapped proto.InternalMessageInfo + +func (m *Swapped) GetFromCoinAmount() types1.Coin { + if m != nil { + return m.FromCoinAmount + } + return types1.Coin{} +} + +func (m *Swapped) GetToCoinAmount() types1.Coin { + if m != nil { + return m.ToCoinAmount + } + return types1.Coin{} +} + +func init() { + proto.RegisterType((*Swap)(nil), "lbm.fswap.v1.Swap") + proto.RegisterType((*SwapStats)(nil), "lbm.fswap.v1.SwapStats") + proto.RegisterType((*MakeSwapProposal)(nil), "lbm.fswap.v1.MakeSwapProposal") + proto.RegisterType((*Swapped)(nil), "lbm.fswap.v1.Swapped") +} + +func init() { proto.RegisterFile("lbm/fswap/v1/fswap.proto", fileDescriptor_42ca60eaf37a2b67) } + +var fileDescriptor_42ca60eaf37a2b67 = []byte{ + // 539 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x93, 0xbf, 0x6f, 0xd3, 0x40, + 0x14, 0xc7, 0xe3, 0x92, 0xd2, 0xe4, 0x52, 0x95, 0x62, 0x8a, 0x48, 0x2b, 0xc5, 0xae, 0x32, 0x21, + 0x7e, 0xd8, 0x4a, 0xca, 0x94, 0x8d, 0xa4, 0xaa, 0x60, 0xa8, 0x40, 0x2e, 0x13, 0x8b, 0x75, 0x76, + 0x2e, 0x89, 0x15, 0xdb, 0xcf, 0xf2, 0xbd, 0xa6, 0xed, 0x1f, 0xc0, 0xce, 0xc8, 0xd8, 0x99, 0xbf, + 0xa4, 0x63, 0x47, 0xc4, 0x10, 0x50, 0xb2, 0x74, 0xe6, 0x1f, 0x00, 0xbd, 0x3b, 0x37, 0x4d, 0xc5, + 0x00, 0x42, 0x62, 0x7b, 0xf7, 0xde, 0xbb, 0xf7, 0xb9, 0xfb, 0x7e, 0xef, 0x58, 0x3d, 0x0e, 0x12, + 0x77, 0x20, 0x4f, 0x78, 0xe6, 0x4e, 0x5a, 0x3a, 0x70, 0xb2, 0x1c, 0x10, 0xcc, 0xf5, 0x38, 0x48, + 0x1c, 0x9d, 0x98, 0xb4, 0x76, 0xb6, 0x86, 0x30, 0x04, 0x55, 0x70, 0x29, 0xd2, 0x3d, 0x3b, 0x56, + 0x08, 0x32, 0x01, 0xe9, 0x06, 0x5c, 0x0a, 0x77, 0xd2, 0x0a, 0x04, 0xf2, 0x96, 0x1b, 0x42, 0x94, + 0xfe, 0x56, 0x4f, 0xc7, 0x8b, 0x3a, 0x2d, 0x74, 0xbd, 0xf9, 0x61, 0x85, 0x95, 0x8f, 0x4e, 0x78, + 0x66, 0x36, 0x18, 0x1b, 0xe4, 0x90, 0xf8, 0x7d, 0x91, 0x42, 0x52, 0x37, 0x76, 0x8d, 0xc7, 0x55, + 0xaf, 0x4a, 0x99, 0x7d, 0x4a, 0x98, 0xdb, 0xac, 0x82, 0x50, 0x14, 0x57, 0x54, 0x71, 0x0d, 0x41, + 0x97, 0x46, 0xec, 0x11, 0x4f, 0xe0, 0x38, 0x45, 0x3f, 0xe4, 0x99, 0x3f, 0x80, 0xdc, 0x5f, 0x74, + 0xde, 0xa1, 0xce, 0x6e, 0xfb, 0x62, 0x6a, 0x97, 0xbe, 0x4e, 0xed, 0x27, 0xc3, 0x08, 0x47, 0xc7, + 0x81, 0x13, 0x42, 0xe2, 0x1e, 0x44, 0xa9, 0x0c, 0x47, 0x11, 0x77, 0x07, 0x45, 0xf0, 0x5c, 0xf6, + 0xc7, 0x2e, 0x9e, 0x65, 0x42, 0x3a, 0xaf, 0x53, 0xf4, 0x1e, 0xe8, 0x91, 0x3d, 0x9e, 0x1d, 0x40, + 0xfe, 0xae, 0x20, 0xbd, 0x61, 0x55, 0x52, 0xc3, 0xcf, 0x39, 0x8a, 0x7a, 0xf9, 0x9f, 0x66, 0xef, + 0x8b, 0xd0, 0xab, 0xd0, 0x10, 0x8f, 0xa3, 0xe8, 0x54, 0x3e, 0x9d, 0xdb, 0xa5, 0xab, 0x73, 0xdb, + 0x68, 0xbe, 0x60, 0x55, 0x92, 0xe1, 0x08, 0x39, 0x4a, 0xd2, 0x42, 0x71, 0x42, 0x3a, 0x82, 0xd2, + 0x62, 0xd5, 0x53, 0xe4, 0x1e, 0x25, 0x96, 0x76, 0x5d, 0x19, 0x6c, 0xf3, 0x90, 0x8f, 0x05, 0x6d, + 0x7d, 0x9b, 0x43, 0x06, 0x92, 0xc7, 0xe6, 0x16, 0x5b, 0xc5, 0x08, 0x63, 0x51, 0x88, 0xa8, 0x17, + 0xe6, 0x2e, 0xab, 0xf5, 0x85, 0x0c, 0xf3, 0x28, 0xc3, 0x08, 0xd2, 0x42, 0xc3, 0xe5, 0x94, 0xf9, + 0x8c, 0x95, 0x89, 0xa1, 0x44, 0xab, 0xb5, 0x4d, 0x67, 0xd9, 0x7d, 0x87, 0x08, 0xdd, 0x32, 0x5d, + 0xd6, 0x53, 0x5d, 0xe6, 0x88, 0xdd, 0xbf, 0x96, 0xd9, 0x4f, 0x04, 0xf2, 0x3e, 0x47, 0xae, 0x34, + 0xa9, 0xb5, 0x1b, 0x8e, 0x36, 0xdd, 0x51, 0x3e, 0x17, 0xa6, 0x3b, 0x87, 0x45, 0x53, 0xb7, 0x41, + 0x53, 0x7e, 0x4c, 0xed, 0x87, 0x67, 0x3c, 0x89, 0x3b, 0xcd, 0xdb, 0x23, 0x9a, 0xde, 0xbd, 0xc2, + 0xd7, 0xeb, 0xfe, 0x4e, 0x99, 0xae, 0xdb, 0xfc, 0x69, 0xb0, 0x35, 0x3a, 0x44, 0x26, 0xfa, 0xe6, + 0x29, 0xdb, 0x54, 0x6f, 0x85, 0xde, 0x99, 0xaf, 0x8d, 0x52, 0x97, 0xad, 0xb5, 0xb7, 0x6f, 0xd0, + 0x52, 0x2c, 0xd0, 0x3d, 0x88, 0xd2, 0xee, 0x1e, 0x61, 0x3f, 0x7f, 0xb3, 0x9f, 0xfe, 0xa5, 0x53, + 0xb4, 0xc9, 0xdb, 0x20, 0x0e, 0x45, 0x2f, 0x15, 0xc5, 0x44, 0xb6, 0x81, 0x70, 0x8b, 0xbb, 0xf2, + 0x5f, 0xb8, 0xeb, 0x08, 0x37, 0x54, 0xad, 0x40, 0xf7, 0xd5, 0xc5, 0xcc, 0x32, 0x2e, 0x67, 0x96, + 0xf1, 0x7d, 0x66, 0x19, 0x1f, 0xe7, 0x56, 0xe9, 0x72, 0x6e, 0x95, 0xbe, 0xcc, 0xad, 0xd2, 0x7b, + 0xe7, 0x8f, 0xa3, 0x4f, 0x8b, 0x1f, 0xae, 0x10, 0xc1, 0x5d, 0xf5, 0xf7, 0xf6, 0x7e, 0x05, 0x00, + 0x00, 0xff, 0xff, 0x9d, 0x2f, 0x11, 0xda, 0xfb, 0x03, 0x00, 0x00, +} + +func (this *Swap) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Swap) + if !ok { + that2, ok := that.(Swap) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.FromDenom != that1.FromDenom { + return false + } + if this.ToDenom != that1.ToDenom { + return false + } + if !this.AmountCapForToDenom.Equal(that1.AmountCapForToDenom) { + return false + } + if !this.SwapRate.Equal(that1.SwapRate) { + return false + } + return true +} +func (this *SwapStats) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*SwapStats) + if !ok { + that2, ok := that.(SwapStats) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.SwapCount != that1.SwapCount { + return false + } + return true +} +func (m *Swap) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Swap) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Swap) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.SwapRate.Size() + i -= size + if _, err := m.SwapRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintFswap(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.AmountCapForToDenom.Size() + i -= size + if _, err := m.AmountCapForToDenom.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintFswap(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ToDenom) > 0 { + i -= len(m.ToDenom) + copy(dAtA[i:], m.ToDenom) + i = encodeVarintFswap(dAtA, i, uint64(len(m.ToDenom))) + i-- + dAtA[i] = 0x12 + } + if len(m.FromDenom) > 0 { + i -= len(m.FromDenom) + copy(dAtA[i:], m.FromDenom) + i = encodeVarintFswap(dAtA, i, uint64(len(m.FromDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SwapStats) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SwapStats) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SwapStats) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SwapCount != 0 { + i = encodeVarintFswap(dAtA, i, uint64(m.SwapCount)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MakeSwapProposal) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MakeSwapProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MakeSwapProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.ToDenomMetadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFswap(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size, err := m.Swap.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFswap(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintFswap(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintFswap(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Swapped) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Swapped) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Swapped) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.ToCoinAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFswap(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.FromCoinAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintFswap(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintFswap(dAtA []byte, offset int, v uint64) int { + offset -= sovFswap(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Swap) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FromDenom) + if l > 0 { + n += 1 + l + sovFswap(uint64(l)) + } + l = len(m.ToDenom) + if l > 0 { + n += 1 + l + sovFswap(uint64(l)) + } + l = m.AmountCapForToDenom.Size() + n += 1 + l + sovFswap(uint64(l)) + l = m.SwapRate.Size() + n += 1 + l + sovFswap(uint64(l)) + return n +} + +func (m *SwapStats) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SwapCount != 0 { + n += 1 + sovFswap(uint64(m.SwapCount)) + } + return n +} + +func (m *MakeSwapProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovFswap(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovFswap(uint64(l)) + } + l = m.Swap.Size() + n += 1 + l + sovFswap(uint64(l)) + l = m.ToDenomMetadata.Size() + n += 1 + l + sovFswap(uint64(l)) + return n +} + +func (m *Swapped) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.FromCoinAmount.Size() + n += 1 + l + sovFswap(uint64(l)) + l = m.ToCoinAmount.Size() + n += 1 + l + sovFswap(uint64(l)) + return n +} + +func sovFswap(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozFswap(x uint64) (n int) { + return sovFswap(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Swap) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Swap: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Swap: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFswap + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FromDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ToDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFswap + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ToDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AmountCapForToDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFswap + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.AmountCapForToDenom.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SwapRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFswap + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SwapRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFswap(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFswap + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SwapStats) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SwapStats: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SwapStats: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SwapCount", wireType) + } + m.SwapCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SwapCount |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipFswap(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFswap + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MakeSwapProposal) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MakeSwapProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MakeSwapProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFswap + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthFswap + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Swap", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFswap + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Swap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ToDenomMetadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFswap + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ToDenomMetadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFswap(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFswap + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Swapped) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Swapped: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Swapped: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromCoinAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFswap + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FromCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ToCoinAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthFswap + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthFswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ToCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipFswap(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthFswap + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipFswap(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFswap + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFswap + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowFswap + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthFswap + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupFswap + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthFswap + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthFswap = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowFswap = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupFswap = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/fswap/types/genesis.go b/x/fswap/types/genesis.go new file mode 100644 index 0000000000..08c1d79338 --- /dev/null +++ b/x/fswap/types/genesis.go @@ -0,0 +1,39 @@ +package types + +// DefaultGenesis returns the default Capability genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + Swaps: []Swap{}, + SwapStats: SwapStats{}, + Swappeds: []Swapped{}, + } +} + +// Validate performs basic genesis state validation returning an error upon any failure. +func (gs *GenesisState) Validate() error { + for _, swap := range gs.GetSwaps() { + if err := swap.ValidateBasic(); err != nil { + return err + } + } + + if err := gs.SwapStats.ValidateBasic(); err != nil { + return err + } + + for _, swapped := range gs.GetSwappeds() { + if err := swapped.ValidateBasic(); err != nil { + return err + } + } + + if len(gs.GetSwaps()) != len(gs.GetSwappeds()) { + return ErrInvalidState.Wrap("number of swaps does not match number of Swappeds") + } + + if len(gs.GetSwaps()) != int(gs.GetSwapStats().SwapCount) { + return ErrInvalidState.Wrap("number of swaps does not match swap count in SwapStats") + } + + return nil +} diff --git a/x/fswap/types/genesis.pb.go b/x/fswap/types/genesis.pb.go new file mode 100644 index 0000000000..89415e9484 --- /dev/null +++ b/x/fswap/types/genesis.pb.go @@ -0,0 +1,448 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lbm/fswap/v1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the fswap module's genesis state. +type GenesisState struct { + Swaps []Swap `protobuf:"bytes,1,rep,name=swaps,proto3" json:"swaps"` + SwapStats SwapStats `protobuf:"bytes,2,opt,name=swap_stats,json=swapStats,proto3" json:"swap_stats"` + Swappeds []Swapped `protobuf:"bytes,3,rep,name=swappeds,proto3" json:"swappeds"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_94e309cb1db27661, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetSwaps() []Swap { + if m != nil { + return m.Swaps + } + return nil +} + +func (m *GenesisState) GetSwapStats() SwapStats { + if m != nil { + return m.SwapStats + } + return SwapStats{} +} + +func (m *GenesisState) GetSwappeds() []Swapped { + if m != nil { + return m.Swappeds + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "lbm.fswap.v1.GenesisState") +} + +func init() { proto.RegisterFile("lbm/fswap/v1/genesis.proto", fileDescriptor_94e309cb1db27661) } + +var fileDescriptor_94e309cb1db27661 = []byte{ + // 255 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xca, 0x49, 0xca, 0xd5, + 0x4f, 0x2b, 0x2e, 0x4f, 0x2c, 0xd0, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, + 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xc9, 0x49, 0xca, 0xd5, 0x03, 0xcb, 0xe9, 0x95, + 0x19, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x25, 0xf4, 0x41, 0x2c, 0x88, 0x1a, 0x29, 0x09, + 0x14, 0xfd, 0x10, 0xc5, 0x60, 0x19, 0xa5, 0xad, 0x8c, 0x5c, 0x3c, 0xee, 0x10, 0xf3, 0x82, 0x4b, + 0x12, 0x4b, 0x52, 0x85, 0xf4, 0xb8, 0x58, 0x41, 0xd2, 0xc5, 0x12, 0x8c, 0x0a, 0xcc, 0x1a, 0xdc, + 0x46, 0x42, 0x7a, 0xc8, 0xc6, 0xeb, 0x05, 0x97, 0x27, 0x16, 0x38, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, + 0x10, 0x04, 0x51, 0x26, 0x64, 0xc3, 0xc5, 0x05, 0x62, 0xc4, 0x17, 0x97, 0x24, 0x96, 0x14, 0x4b, + 0x30, 0x29, 0x30, 0x6a, 0x70, 0x1b, 0x89, 0x63, 0x6a, 0x02, 0x19, 0x5e, 0x0c, 0xd5, 0xc9, 0x59, + 0x0c, 0x13, 0x10, 0x32, 0xe7, 0xe2, 0x00, 0x71, 0x0a, 0x52, 0x53, 0x8a, 0x25, 0x98, 0xc1, 0x16, + 0x8a, 0x62, 0xea, 0x2d, 0x48, 0x4d, 0x81, 0xea, 0x84, 0x2b, 0x76, 0xf2, 0x38, 0xf1, 0x48, 0x8e, + 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, + 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xbd, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, + 0xfc, 0x5c, 0x7d, 0xb7, 0xcc, 0xbc, 0xe2, 0xe4, 0x8c, 0xcc, 0x44, 0xfd, 0x34, 0x28, 0x43, 0xb7, + 0x38, 0x25, 0x5b, 0xbf, 0x02, 0x1a, 0x14, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0x80, + 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x4f, 0x1a, 0xa2, 0xb3, 0x64, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Swappeds) > 0 { + for iNdEx := len(m.Swappeds) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Swappeds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + { + size, err := m.SwapStats.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Swaps) > 0 { + for iNdEx := len(m.Swaps) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Swaps[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Swaps) > 0 { + for _, e := range m.Swaps { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + l = m.SwapStats.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.Swappeds) > 0 { + for _, e := range m.Swappeds { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Swaps", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Swaps = append(m.Swaps, Swap{}) + if err := m.Swaps[len(m.Swaps)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SwapStats", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SwapStats.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Swappeds", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Swappeds = append(m.Swappeds, Swapped{}) + if err := m.Swappeds[len(m.Swappeds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/fswap/types/genesis_test.go b/x/fswap/types/genesis_test.go new file mode 100644 index 0000000000..29308ea519 --- /dev/null +++ b/x/fswap/types/genesis_test.go @@ -0,0 +1,33 @@ +package types_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/Finschia/finschia-sdk/x/fswap/types" +) + +// todo: add tests +func TestGenesisStateValidate(t *testing.T) { + for _, tc := range []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + } { + t.Run(tc.desc, func(t *testing.T) { + err := tc.genState.Validate() + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/fswap/types/keys.go b/x/fswap/types/keys.go new file mode 100644 index 0000000000..d69f08c9e0 --- /dev/null +++ b/x/fswap/types/keys.go @@ -0,0 +1,15 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "fswap" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // RouterKey is the message route for slashing + RouterKey = ModuleName + + // QuerierRoute defines the module's query routing key + QuerierRoute = ModuleName +) diff --git a/x/fswap/types/msgs.go b/x/fswap/types/msgs.go new file mode 100644 index 0000000000..eae8c6a2c2 --- /dev/null +++ b/x/fswap/types/msgs.go @@ -0,0 +1,79 @@ +package types + +import ( + sdk "github.com/Finschia/finschia-sdk/types" + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" + "github.com/Finschia/finschia-sdk/x/fswap/codec" +) + +var _ sdk.Msg = &MsgSwap{} + +// ValidateBasic Implements Msg. +func (m *MsgSwap) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(m.FromAddress) + if err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("Invalid address (%s)", err) + } + + if !m.FromCoinAmount.IsValid() { + return sdkerrors.ErrInvalidCoins.Wrap(m.FromCoinAmount.String()) + } + + if !m.FromCoinAmount.IsPositive() { + return sdkerrors.ErrInvalidCoins.Wrap(m.FromCoinAmount.String()) + } + + if len(m.GetToDenom()) == 0 { + return sdkerrors.ErrInvalidRequest.Wrap("invalid denom (empty denom)") + } + + return nil +} + +// GetSigners Implements Msg. +func (m *MsgSwap) GetSigners() []sdk.AccAddress { + from, err := sdk.AccAddressFromBech32(m.FromAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{from} +} + +// GetSignBytes implements the LegacyMsg.GetSignBytes method. +func (m *MsgSwap) GetSignBytes() []byte { + return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(m)) +} + +var _ sdk.Msg = &MsgSwapAll{} + +// ValidateBasic Implements Msg. +func (m *MsgSwapAll) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(m.FromAddress) + if err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("Invalid address (%s)", err) + } + + if len(m.GetFromDenom()) == 0 { + return sdkerrors.ErrInvalidRequest.Wrap("invalid denom (empty denom)") + } + + if len(m.GetToDenom()) == 0 { + return sdkerrors.ErrInvalidRequest.Wrap("invalid denom (empty denom)") + } + + return nil +} + +// GetSigners Implements Msg. +func (m *MsgSwapAll) GetSigners() []sdk.AccAddress { + from, err := sdk.AccAddressFromBech32(m.FromAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{from} +} + +// GetSignBytes implements the LegacyMsg.GetSignBytes method. +func (m *MsgSwapAll) GetSignBytes() []byte { + return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(m)) +} diff --git a/x/fswap/types/proposal.go b/x/fswap/types/proposal.go new file mode 100644 index 0000000000..99048caa57 --- /dev/null +++ b/x/fswap/types/proposal.go @@ -0,0 +1,54 @@ +package types + +import ( + "gopkg.in/yaml.v2" + + sdkerrors "github.com/Finschia/finschia-sdk/types/errors" + bank "github.com/Finschia/finschia-sdk/x/bank/types" + gov "github.com/Finschia/finschia-sdk/x/gov/types" +) + +const ( + ProposalTypeMakeSwap string = "MakeSwap" +) + +// NewMakeSwapProposal creates a new SwapProposal instance. +// Deprecated: this proposal is considered legacy and is deprecated in favor of +// Msg-based gov proposals. See MakeSwapProposal. +func NewMakeSwapProposal(title, description string, swap Swap, toDenomMetadata bank.Metadata) *MakeSwapProposal { + return &MakeSwapProposal{title, description, swap, toDenomMetadata} +} + +// Implements Proposal Interface +var _ gov.Content = &MakeSwapProposal{} + +func init() { + gov.RegisterProposalType(ProposalTypeMakeSwap) +} + +// ProposalRoute gets the proposal's router key +func (m *MakeSwapProposal) ProposalRoute() string { return RouterKey } + +// ProposalType is "Swap" +func (m *MakeSwapProposal) ProposalType() string { return ProposalTypeMakeSwap } + +// String implements the Stringer interface. +func (m *MakeSwapProposal) String() string { + out, _ := yaml.Marshal(m) + return string(out) +} + +// ValidateBasic validates the proposal +func (m *MakeSwapProposal) ValidateBasic() error { + if err := m.Swap.ValidateBasic(); err != nil { + return err + } + if err := m.ToDenomMetadata.Validate(); err != nil { + return err + } + if m.Swap.ToDenom != m.ToDenomMetadata.Base { + return sdkerrors.ErrInvalidRequest.Wrapf("denomination does not match %s != %s", m.Swap.ToDenom, m.ToDenomMetadata.Base) + } + + return gov.ValidateAbstract(m) +} diff --git a/x/fswap/types/query.pb.go b/x/fswap/types/query.pb.go new file mode 100644 index 0000000000..80beb5195a --- /dev/null +++ b/x/fswap/types/query.pb.go @@ -0,0 +1,1603 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lbm/fswap/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + types "github.com/Finschia/finschia-sdk/types" + query "github.com/Finschia/finschia-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type QuerySwappedRequest struct { + FromDenom string `protobuf:"bytes,1,opt,name=fromDenom,proto3" json:"fromDenom,omitempty"` + ToDenom string `protobuf:"bytes,2,opt,name=toDenom,proto3" json:"toDenom,omitempty"` +} + +func (m *QuerySwappedRequest) Reset() { *m = QuerySwappedRequest{} } +func (m *QuerySwappedRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySwappedRequest) ProtoMessage() {} +func (*QuerySwappedRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_01deae9da7816d6a, []int{0} +} +func (m *QuerySwappedRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySwappedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySwappedRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySwappedRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySwappedRequest.Merge(m, src) +} +func (m *QuerySwappedRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySwappedRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySwappedRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySwappedRequest proto.InternalMessageInfo + +func (m *QuerySwappedRequest) GetFromDenom() string { + if m != nil { + return m.FromDenom + } + return "" +} + +func (m *QuerySwappedRequest) GetToDenom() string { + if m != nil { + return m.ToDenom + } + return "" +} + +type QuerySwappedResponse struct { + FromCoinAmount types.Coin `protobuf:"bytes,1,opt,name=from_coin_amount,json=fromCoinAmount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"from_coin_amount"` + ToCoinAmount types.Coin `protobuf:"bytes,2,opt,name=to_coin_amount,json=toCoinAmount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"to_coin_amount"` +} + +func (m *QuerySwappedResponse) Reset() { *m = QuerySwappedResponse{} } +func (m *QuerySwappedResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySwappedResponse) ProtoMessage() {} +func (*QuerySwappedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_01deae9da7816d6a, []int{1} +} +func (m *QuerySwappedResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySwappedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySwappedResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySwappedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySwappedResponse.Merge(m, src) +} +func (m *QuerySwappedResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySwappedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySwappedResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySwappedResponse proto.InternalMessageInfo + +func (m *QuerySwappedResponse) GetFromCoinAmount() types.Coin { + if m != nil { + return m.FromCoinAmount + } + return types.Coin{} +} + +func (m *QuerySwappedResponse) GetToCoinAmount() types.Coin { + if m != nil { + return m.ToCoinAmount + } + return types.Coin{} +} + +type QueryTotalSwappableToCoinAmountRequest struct { + FromDenom string `protobuf:"bytes,1,opt,name=fromDenom,proto3" json:"fromDenom,omitempty"` + ToDenom string `protobuf:"bytes,2,opt,name=toDenom,proto3" json:"toDenom,omitempty"` +} + +func (m *QueryTotalSwappableToCoinAmountRequest) Reset() { + *m = QueryTotalSwappableToCoinAmountRequest{} +} +func (m *QueryTotalSwappableToCoinAmountRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTotalSwappableToCoinAmountRequest) ProtoMessage() {} +func (*QueryTotalSwappableToCoinAmountRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_01deae9da7816d6a, []int{2} +} +func (m *QueryTotalSwappableToCoinAmountRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalSwappableToCoinAmountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalSwappableToCoinAmountRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTotalSwappableToCoinAmountRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalSwappableToCoinAmountRequest.Merge(m, src) +} +func (m *QueryTotalSwappableToCoinAmountRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalSwappableToCoinAmountRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalSwappableToCoinAmountRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalSwappableToCoinAmountRequest proto.InternalMessageInfo + +func (m *QueryTotalSwappableToCoinAmountRequest) GetFromDenom() string { + if m != nil { + return m.FromDenom + } + return "" +} + +func (m *QueryTotalSwappableToCoinAmountRequest) GetToDenom() string { + if m != nil { + return m.ToDenom + } + return "" +} + +type QueryTotalSwappableToCoinAmountResponse struct { + SwappableAmount types.Coin `protobuf:"bytes,1,opt,name=swappable_amount,json=swappableAmount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"swappable_amount"` +} + +func (m *QueryTotalSwappableToCoinAmountResponse) Reset() { + *m = QueryTotalSwappableToCoinAmountResponse{} +} +func (m *QueryTotalSwappableToCoinAmountResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTotalSwappableToCoinAmountResponse) ProtoMessage() {} +func (*QueryTotalSwappableToCoinAmountResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_01deae9da7816d6a, []int{3} +} +func (m *QueryTotalSwappableToCoinAmountResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTotalSwappableToCoinAmountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTotalSwappableToCoinAmountResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTotalSwappableToCoinAmountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTotalSwappableToCoinAmountResponse.Merge(m, src) +} +func (m *QueryTotalSwappableToCoinAmountResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTotalSwappableToCoinAmountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTotalSwappableToCoinAmountResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTotalSwappableToCoinAmountResponse proto.InternalMessageInfo + +func (m *QueryTotalSwappableToCoinAmountResponse) GetSwappableAmount() types.Coin { + if m != nil { + return m.SwappableAmount + } + return types.Coin{} +} + +type QuerySwapsRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QuerySwapsRequest) Reset() { *m = QuerySwapsRequest{} } +func (m *QuerySwapsRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySwapsRequest) ProtoMessage() {} +func (*QuerySwapsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_01deae9da7816d6a, []int{4} +} +func (m *QuerySwapsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySwapsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySwapsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySwapsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySwapsRequest.Merge(m, src) +} +func (m *QuerySwapsRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySwapsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySwapsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySwapsRequest proto.InternalMessageInfo + +func (m *QuerySwapsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QuerySwapsResponse struct { + Swaps []Swap `protobuf:"bytes,1,rep,name=swaps,proto3" json:"swaps"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QuerySwapsResponse) Reset() { *m = QuerySwapsResponse{} } +func (m *QuerySwapsResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySwapsResponse) ProtoMessage() {} +func (*QuerySwapsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_01deae9da7816d6a, []int{5} +} +func (m *QuerySwapsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySwapsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySwapsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QuerySwapsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySwapsResponse.Merge(m, src) +} +func (m *QuerySwapsResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySwapsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySwapsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySwapsResponse proto.InternalMessageInfo + +func (m *QuerySwapsResponse) GetSwaps() []Swap { + if m != nil { + return m.Swaps + } + return nil +} + +func (m *QuerySwapsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +func init() { + proto.RegisterType((*QuerySwappedRequest)(nil), "lbm.fswap.v1.QuerySwappedRequest") + proto.RegisterType((*QuerySwappedResponse)(nil), "lbm.fswap.v1.QuerySwappedResponse") + proto.RegisterType((*QueryTotalSwappableToCoinAmountRequest)(nil), "lbm.fswap.v1.QueryTotalSwappableToCoinAmountRequest") + proto.RegisterType((*QueryTotalSwappableToCoinAmountResponse)(nil), "lbm.fswap.v1.QueryTotalSwappableToCoinAmountResponse") + proto.RegisterType((*QuerySwapsRequest)(nil), "lbm.fswap.v1.QuerySwapsRequest") + proto.RegisterType((*QuerySwapsResponse)(nil), "lbm.fswap.v1.QuerySwapsResponse") +} + +func init() { proto.RegisterFile("lbm/fswap/v1/query.proto", fileDescriptor_01deae9da7816d6a) } + +var fileDescriptor_01deae9da7816d6a = []byte{ + // 590 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0xcf, 0x6e, 0xd3, 0x4e, + 0x10, 0xc7, 0xe3, 0xf4, 0xd7, 0x5f, 0xd5, 0x6d, 0x55, 0xca, 0xb6, 0x15, 0xc1, 0x14, 0x27, 0xf8, + 0xd0, 0x56, 0xfc, 0xd9, 0x55, 0xd2, 0xf2, 0x00, 0x04, 0x54, 0xb8, 0x20, 0x41, 0xe8, 0x09, 0x0e, + 0x61, 0x9d, 0x6e, 0x5c, 0x8b, 0xd8, 0xe3, 0x66, 0x37, 0x69, 0x73, 0xe5, 0xc0, 0x0d, 0x09, 0x89, + 0x47, 0x80, 0x13, 0x2f, 0xc1, 0xb5, 0xc7, 0x4a, 0x5c, 0x38, 0x01, 0x4a, 0x78, 0x10, 0xb4, 0xeb, + 0x75, 0x63, 0x8b, 0x86, 0x08, 0xa1, 0xde, 0x36, 0x3b, 0xdf, 0x99, 0xef, 0x67, 0x27, 0x33, 0x46, + 0xa5, 0x8e, 0x17, 0xd2, 0xb6, 0x38, 0x62, 0x31, 0xed, 0x57, 0xe9, 0x61, 0x8f, 0x77, 0x07, 0x24, + 0xee, 0x82, 0x04, 0xbc, 0xd8, 0xf1, 0x42, 0xa2, 0x23, 0xa4, 0x5f, 0xb5, 0xd7, 0x7d, 0x00, 0xbf, + 0xc3, 0x29, 0x8b, 0x03, 0xca, 0xa2, 0x08, 0x24, 0x93, 0x01, 0x44, 0x22, 0xd1, 0xda, 0xab, 0x3e, + 0xf8, 0xa0, 0x8f, 0x54, 0x9d, 0xcc, 0xed, 0xcd, 0x16, 0x88, 0x10, 0x04, 0xf5, 0x98, 0xe0, 0x49, + 0x69, 0xda, 0xaf, 0x7a, 0x5c, 0xb2, 0x2a, 0x8d, 0x99, 0x1f, 0x44, 0xba, 0x84, 0xd1, 0x3a, 0x59, + 0x6d, 0xaa, 0x6a, 0x41, 0x90, 0xc6, 0xf3, 0x9c, 0x09, 0x96, 0x8e, 0xb8, 0x8f, 0xd1, 0xca, 0x53, + 0x55, 0xfb, 0xd9, 0x11, 0x8b, 0x63, 0xbe, 0xdf, 0xe0, 0x87, 0x3d, 0x2e, 0x24, 0x5e, 0x47, 0xf3, + 0xed, 0x2e, 0x84, 0x0f, 0x78, 0x04, 0x61, 0xc9, 0xaa, 0x58, 0x5b, 0xf3, 0x8d, 0xf1, 0x05, 0x2e, + 0xa1, 0x39, 0x09, 0x49, 0xac, 0xa8, 0x63, 0xe9, 0x4f, 0xf7, 0x4d, 0x11, 0xad, 0xe6, 0xeb, 0x89, + 0x18, 0x22, 0xc1, 0xf1, 0x31, 0x5a, 0x56, 0xf9, 0x4d, 0x05, 0xd5, 0x64, 0x21, 0xf4, 0x22, 0xa9, + 0xeb, 0x2e, 0xd4, 0xae, 0x92, 0x04, 0x9e, 0x28, 0x78, 0x62, 0xe0, 0xc9, 0x7d, 0x08, 0xa2, 0xfa, + 0xf6, 0xc9, 0xb7, 0x72, 0xe1, 0xd3, 0xf7, 0xf2, 0x2d, 0x3f, 0x90, 0x07, 0x3d, 0x8f, 0xb4, 0x20, + 0xa4, 0xbb, 0x41, 0x24, 0x5a, 0x07, 0x01, 0xa3, 0x6d, 0x73, 0xb8, 0x23, 0xf6, 0x5f, 0x51, 0x39, + 0x88, 0xb9, 0xd0, 0x49, 0x8d, 0x25, 0xe5, 0xa3, 0x4e, 0xf7, 0xb4, 0x0b, 0x96, 0x68, 0x49, 0x42, + 0xce, 0xb7, 0x78, 0x21, 0xbe, 0x8b, 0x12, 0xc6, 0xae, 0xee, 0x4b, 0xb4, 0xa1, 0xfb, 0xb0, 0x07, + 0x92, 0x75, 0x74, 0x33, 0x98, 0xd7, 0xe1, 0x7b, 0x19, 0xc9, 0xbf, 0xb6, 0xfa, 0xa3, 0x85, 0x36, + 0xa7, 0x5a, 0x98, 0xee, 0x0f, 0xd0, 0xb2, 0x48, 0x05, 0x17, 0xdb, 0xfd, 0x4b, 0x67, 0x3e, 0xa6, + 0x11, 0x2f, 0xd0, 0xe5, 0xb3, 0x81, 0x10, 0xe9, 0x9b, 0x77, 0x11, 0x1a, 0xcf, 0xb0, 0x21, 0xd9, + 0xc8, 0x91, 0x24, 0xbb, 0x94, 0xf2, 0x3c, 0x61, 0x3e, 0x37, 0xb9, 0x8d, 0x4c, 0xa6, 0xfb, 0xd6, + 0x42, 0x38, 0x5b, 0xdd, 0x3c, 0x97, 0xa0, 0x59, 0x85, 0x21, 0x4a, 0x56, 0x65, 0x66, 0x6b, 0xa1, + 0x86, 0x49, 0x76, 0x19, 0x89, 0xd2, 0xd6, 0xff, 0x53, 0x8f, 0x6b, 0x24, 0x32, 0xfc, 0x30, 0x87, + 0x93, 0x8c, 0xc7, 0xe6, 0x54, 0x9c, 0xc4, 0x2c, 0xcb, 0x53, 0xfb, 0x30, 0x83, 0x66, 0x35, 0x0f, + 0x06, 0x34, 0x67, 0x56, 0x00, 0xdf, 0xc8, 0xdb, 0x9f, 0xb3, 0x6e, 0xb6, 0xfb, 0x27, 0x49, 0xe2, + 0xe3, 0x5e, 0x7f, 0xfd, 0xe5, 0xe7, 0xfb, 0xe2, 0x15, 0xbc, 0x46, 0x73, 0xcb, 0x2c, 0x8c, 0xcb, + 0x67, 0x0b, 0xd9, 0x93, 0x27, 0x01, 0xef, 0x9c, 0xe3, 0x30, 0x75, 0x36, 0xed, 0xbb, 0x7f, 0x99, + 0x65, 0x50, 0x77, 0x34, 0x2a, 0xc1, 0xb7, 0xf3, 0xa8, 0x52, 0x65, 0x36, 0xc7, 0x83, 0x98, 0x5f, + 0x4b, 0xec, 0xa3, 0x59, 0xfd, 0x37, 0xe2, 0xf2, 0x84, 0x6e, 0xa4, 0xe3, 0x63, 0x57, 0x26, 0x0b, + 0x0c, 0xc1, 0x35, 0x4d, 0xb0, 0x86, 0x57, 0x7e, 0x6f, 0x96, 0xa8, 0x3f, 0x3a, 0x19, 0x3a, 0xd6, + 0xe9, 0xd0, 0xb1, 0x7e, 0x0c, 0x1d, 0xeb, 0xdd, 0xc8, 0x29, 0x9c, 0x8e, 0x9c, 0xc2, 0xd7, 0x91, + 0x53, 0x78, 0x4e, 0xa6, 0x8e, 0xfa, 0xb1, 0x29, 0xa6, 0x47, 0xde, 0xfb, 0x5f, 0x7f, 0x44, 0xb7, + 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0x4e, 0x87, 0x53, 0x1d, 0x08, 0x06, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Swapped queries the current swapped status that includes a burnt amount of from-coin and a minted amount of + // to-coin. + Swapped(ctx context.Context, in *QuerySwappedRequest, opts ...grpc.CallOption) (*QuerySwappedResponse, error) + // TotalSwappableToCoinAmount queries the current swappable amount for to-coin. + TotalSwappableToCoinAmount(ctx context.Context, in *QueryTotalSwappableToCoinAmountRequest, opts ...grpc.CallOption) (*QueryTotalSwappableToCoinAmountResponse, error) + // Swaps queries all the swap that registered + Swaps(ctx context.Context, in *QuerySwapsRequest, opts ...grpc.CallOption) (*QuerySwapsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Swapped(ctx context.Context, in *QuerySwappedRequest, opts ...grpc.CallOption) (*QuerySwappedResponse, error) { + out := new(QuerySwappedResponse) + err := c.cc.Invoke(ctx, "/lbm.fswap.v1.Query/Swapped", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) TotalSwappableToCoinAmount(ctx context.Context, in *QueryTotalSwappableToCoinAmountRequest, opts ...grpc.CallOption) (*QueryTotalSwappableToCoinAmountResponse, error) { + out := new(QueryTotalSwappableToCoinAmountResponse) + err := c.cc.Invoke(ctx, "/lbm.fswap.v1.Query/TotalSwappableToCoinAmount", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Swaps(ctx context.Context, in *QuerySwapsRequest, opts ...grpc.CallOption) (*QuerySwapsResponse, error) { + out := new(QuerySwapsResponse) + err := c.cc.Invoke(ctx, "/lbm.fswap.v1.Query/Swaps", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Swapped queries the current swapped status that includes a burnt amount of from-coin and a minted amount of + // to-coin. + Swapped(context.Context, *QuerySwappedRequest) (*QuerySwappedResponse, error) + // TotalSwappableToCoinAmount queries the current swappable amount for to-coin. + TotalSwappableToCoinAmount(context.Context, *QueryTotalSwappableToCoinAmountRequest) (*QueryTotalSwappableToCoinAmountResponse, error) + // Swaps queries all the swap that registered + Swaps(context.Context, *QuerySwapsRequest) (*QuerySwapsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Swapped(ctx context.Context, req *QuerySwappedRequest) (*QuerySwappedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Swapped not implemented") +} +func (*UnimplementedQueryServer) TotalSwappableToCoinAmount(ctx context.Context, req *QueryTotalSwappableToCoinAmountRequest) (*QueryTotalSwappableToCoinAmountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TotalSwappableToCoinAmount not implemented") +} +func (*UnimplementedQueryServer) Swaps(ctx context.Context, req *QuerySwapsRequest) (*QuerySwapsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Swaps not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Swapped_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySwappedRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Swapped(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fswap.v1.Query/Swapped", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Swapped(ctx, req.(*QuerySwappedRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_TotalSwappableToCoinAmount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTotalSwappableToCoinAmountRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TotalSwappableToCoinAmount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fswap.v1.Query/TotalSwappableToCoinAmount", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TotalSwappableToCoinAmount(ctx, req.(*QueryTotalSwappableToCoinAmountRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Swaps_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySwapsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Swaps(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fswap.v1.Query/Swaps", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Swaps(ctx, req.(*QuerySwapsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "lbm.fswap.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Swapped", + Handler: _Query_Swapped_Handler, + }, + { + MethodName: "TotalSwappableToCoinAmount", + Handler: _Query_TotalSwappableToCoinAmount_Handler, + }, + { + MethodName: "Swaps", + Handler: _Query_Swaps_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "lbm/fswap/v1/query.proto", +} + +func (m *QuerySwappedRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QuerySwappedRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySwappedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ToDenom) > 0 { + i -= len(m.ToDenom) + copy(dAtA[i:], m.ToDenom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ToDenom))) + i-- + dAtA[i] = 0x12 + } + if len(m.FromDenom) > 0 { + i -= len(m.FromDenom) + copy(dAtA[i:], m.FromDenom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.FromDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QuerySwappedResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QuerySwappedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySwappedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.ToCoinAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.FromCoinAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryTotalSwappableToCoinAmountRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTotalSwappableToCoinAmountRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalSwappableToCoinAmountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ToDenom) > 0 { + i -= len(m.ToDenom) + copy(dAtA[i:], m.ToDenom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ToDenom))) + i-- + dAtA[i] = 0x12 + } + if len(m.FromDenom) > 0 { + i -= len(m.FromDenom) + copy(dAtA[i:], m.FromDenom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.FromDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTotalSwappableToCoinAmountResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTotalSwappableToCoinAmountResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTotalSwappableToCoinAmountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.SwappableAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QuerySwapsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QuerySwapsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySwapsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QuerySwapsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QuerySwapsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySwapsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Swaps) > 0 { + for iNdEx := len(m.Swaps) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Swaps[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QuerySwappedRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FromDenom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ToDenom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySwappedResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.FromCoinAmount.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.ToCoinAmount.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryTotalSwappableToCoinAmountRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FromDenom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ToDenom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTotalSwappableToCoinAmountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.SwappableAmount.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QuerySwapsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySwapsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Swaps) > 0 { + for _, e := range m.Swaps { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QuerySwappedRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySwappedRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySwappedRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FromDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ToDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ToDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySwappedResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySwappedResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySwappedResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromCoinAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FromCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ToCoinAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ToCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTotalSwappableToCoinAmountRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTotalSwappableToCoinAmountRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalSwappableToCoinAmountRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FromDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ToDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ToDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTotalSwappableToCoinAmountResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTotalSwappableToCoinAmountResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTotalSwappableToCoinAmountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SwappableAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SwappableAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySwapsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySwapsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySwapsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySwapsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QuerySwapsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySwapsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Swaps", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Swaps = append(m.Swaps, Swap{}) + if err := m.Swaps[len(m.Swaps)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/fswap/types/query.pb.gw.go b/x/fswap/types/query.pb.gw.go new file mode 100644 index 0000000000..00786290bd --- /dev/null +++ b/x/fswap/types/query.pb.gw.go @@ -0,0 +1,326 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: lbm/fswap/v1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage + +var ( + filter_Query_Swapped_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Swapped_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySwappedRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Swapped_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Swapped(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Swapped_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySwappedRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Swapped_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Swapped(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_TotalSwappableToCoinAmount_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_TotalSwappableToCoinAmount_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalSwappableToCoinAmountRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TotalSwappableToCoinAmount_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.TotalSwappableToCoinAmount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TotalSwappableToCoinAmount_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTotalSwappableToCoinAmountRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TotalSwappableToCoinAmount_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.TotalSwappableToCoinAmount(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Swaps_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Swaps_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySwapsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Swaps_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Swaps(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Swaps_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySwapsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Swaps_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Swaps(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Swapped_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Swapped_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Swapped_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TotalSwappableToCoinAmount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_TotalSwappableToCoinAmount_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TotalSwappableToCoinAmount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Swaps_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Swaps_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Swaps_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Swapped_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Swapped_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Swapped_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TotalSwappableToCoinAmount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_TotalSwappableToCoinAmount_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TotalSwappableToCoinAmount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Swaps_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Swaps_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Swaps_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Swapped_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fswap", "v1", "swapped"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_TotalSwappableToCoinAmount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fswap", "v1", "total_swappable_to_coin_amount"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Swaps_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"lbm", "fswap", "v1", "swaps"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Swapped_0 = runtime.ForwardResponseMessage + + forward_Query_TotalSwappableToCoinAmount_0 = runtime.ForwardResponseMessage + + forward_Query_Swaps_0 = runtime.ForwardResponseMessage +) diff --git a/x/fswap/types/tx.pb.go b/x/fswap/types/tx.pb.go new file mode 100644 index 0000000000..288ada4778 --- /dev/null +++ b/x/fswap/types/tx.pb.go @@ -0,0 +1,1069 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lbm/fswap/v1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + types "github.com/Finschia/finschia-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type MsgSwap struct { + // holder's address + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + // from-coin amount + FromCoinAmount types.Coin `protobuf:"bytes,2,opt,name=from_coin_amount,json=fromCoinAmount,proto3,castrepeated=github.com/Finschia/finschia-sdk/types.Coin" json:"from_coin_amount"` + ToDenom string `protobuf:"bytes,3,opt,name=to_denom,json=toDenom,proto3" json:"to_denom,omitempty"` +} + +func (m *MsgSwap) Reset() { *m = MsgSwap{} } +func (m *MsgSwap) String() string { return proto.CompactTextString(m) } +func (*MsgSwap) ProtoMessage() {} +func (*MsgSwap) Descriptor() ([]byte, []int) { + return fileDescriptor_65c77cf1d9b67323, []int{0} +} +func (m *MsgSwap) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwap.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSwap) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwap.Merge(m, src) +} +func (m *MsgSwap) XXX_Size() int { + return m.Size() +} +func (m *MsgSwap) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwap.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwap proto.InternalMessageInfo + +func (m *MsgSwap) GetFromAddress() string { + if m != nil { + return m.FromAddress + } + return "" +} + +func (m *MsgSwap) GetFromCoinAmount() types.Coin { + if m != nil { + return m.FromCoinAmount + } + return types.Coin{} +} + +func (m *MsgSwap) GetToDenom() string { + if m != nil { + return m.ToDenom + } + return "" +} + +type MsgSwapResponse struct { +} + +func (m *MsgSwapResponse) Reset() { *m = MsgSwapResponse{} } +func (m *MsgSwapResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSwapResponse) ProtoMessage() {} +func (*MsgSwapResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_65c77cf1d9b67323, []int{1} +} +func (m *MsgSwapResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwapResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwapResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSwapResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapResponse.Merge(m, src) +} +func (m *MsgSwapResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSwapResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwapResponse proto.InternalMessageInfo + +type MsgSwapAll struct { + // holder's address + FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty"` + FromDenom string `protobuf:"bytes,2,opt,name=from_denom,json=fromDenom,proto3" json:"from_denom,omitempty"` + ToDenom string `protobuf:"bytes,3,opt,name=to_denom,json=toDenom,proto3" json:"to_denom,omitempty"` +} + +func (m *MsgSwapAll) Reset() { *m = MsgSwapAll{} } +func (m *MsgSwapAll) String() string { return proto.CompactTextString(m) } +func (*MsgSwapAll) ProtoMessage() {} +func (*MsgSwapAll) Descriptor() ([]byte, []int) { + return fileDescriptor_65c77cf1d9b67323, []int{2} +} +func (m *MsgSwapAll) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwapAll) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwapAll.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSwapAll) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapAll.Merge(m, src) +} +func (m *MsgSwapAll) XXX_Size() int { + return m.Size() +} +func (m *MsgSwapAll) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapAll.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwapAll proto.InternalMessageInfo + +func (m *MsgSwapAll) GetFromAddress() string { + if m != nil { + return m.FromAddress + } + return "" +} + +func (m *MsgSwapAll) GetFromDenom() string { + if m != nil { + return m.FromDenom + } + return "" +} + +func (m *MsgSwapAll) GetToDenom() string { + if m != nil { + return m.ToDenom + } + return "" +} + +type MsgSwapAllResponse struct { +} + +func (m *MsgSwapAllResponse) Reset() { *m = MsgSwapAllResponse{} } +func (m *MsgSwapAllResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSwapAllResponse) ProtoMessage() {} +func (*MsgSwapAllResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_65c77cf1d9b67323, []int{3} +} +func (m *MsgSwapAllResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwapAllResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwapAllResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSwapAllResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapAllResponse.Merge(m, src) +} +func (m *MsgSwapAllResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSwapAllResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapAllResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwapAllResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgSwap)(nil), "lbm.fswap.v1.MsgSwap") + proto.RegisterType((*MsgSwapResponse)(nil), "lbm.fswap.v1.MsgSwapResponse") + proto.RegisterType((*MsgSwapAll)(nil), "lbm.fswap.v1.MsgSwapAll") + proto.RegisterType((*MsgSwapAllResponse)(nil), "lbm.fswap.v1.MsgSwapAllResponse") +} + +func init() { proto.RegisterFile("lbm/fswap/v1/tx.proto", fileDescriptor_65c77cf1d9b67323) } + +var fileDescriptor_65c77cf1d9b67323 = []byte{ + // 387 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xbd, 0x6e, 0xe2, 0x40, + 0x10, 0xc7, 0xbd, 0x70, 0x3a, 0x8e, 0x05, 0xdd, 0x87, 0x05, 0x92, 0xb1, 0x84, 0xe1, 0xa8, 0x90, + 0x4e, 0xb7, 0x2b, 0x43, 0x7b, 0x8d, 0xb9, 0xbb, 0x28, 0x0d, 0x0d, 0xe9, 0xd2, 0x20, 0x7f, 0x61, + 0xac, 0xd8, 0x1e, 0x8b, 0x5d, 0x3e, 0xf2, 0x0a, 0xa9, 0xf2, 0x1c, 0x79, 0x8b, 0x74, 0x94, 0x94, + 0xa9, 0x92, 0x08, 0x5e, 0x24, 0xda, 0xb5, 0xad, 0xa4, 0x20, 0x1f, 0xdd, 0xf8, 0x3f, 0xff, 0x9d, + 0xdf, 0x8c, 0x67, 0x70, 0x33, 0x72, 0x62, 0x3a, 0x63, 0x6b, 0x3b, 0xa5, 0x2b, 0x93, 0xf2, 0x0d, + 0x49, 0x17, 0xc0, 0x41, 0xad, 0x47, 0x4e, 0x4c, 0xa4, 0x4c, 0x56, 0xa6, 0xde, 0x08, 0x20, 0x00, + 0x99, 0xa0, 0x22, 0xca, 0x3c, 0xba, 0xe1, 0x02, 0x8b, 0x81, 0x51, 0xc7, 0x66, 0x3e, 0x5d, 0x99, + 0x8e, 0xcf, 0x6d, 0x93, 0xba, 0x10, 0x26, 0x59, 0xbe, 0x77, 0x8b, 0x70, 0x65, 0xcc, 0x82, 0xb3, + 0xb5, 0x9d, 0xaa, 0x3f, 0x71, 0x7d, 0xb6, 0x80, 0x78, 0x6a, 0x7b, 0xde, 0xc2, 0x67, 0x4c, 0x43, + 0x5d, 0xd4, 0xaf, 0x4e, 0x6a, 0x42, 0xb3, 0x32, 0x49, 0xdd, 0xe0, 0xef, 0xd2, 0x22, 0x2a, 0x4c, + 0xed, 0x18, 0x96, 0x09, 0xd7, 0x4a, 0x5d, 0xd4, 0xaf, 0x0d, 0x5a, 0x24, 0x23, 0x11, 0x41, 0x22, + 0x39, 0x89, 0xfc, 0x85, 0x30, 0x19, 0x0d, 0xb7, 0xf7, 0x1d, 0xe5, 0xe6, 0xa1, 0xf3, 0x2b, 0x08, + 0xf9, 0x7c, 0xe9, 0x10, 0x17, 0x62, 0x7a, 0x12, 0x26, 0xcc, 0x9d, 0x87, 0x36, 0x9d, 0xe5, 0xc1, + 0x6f, 0xe6, 0x5d, 0x50, 0x7e, 0x99, 0xfa, 0x4c, 0x3e, 0x9a, 0x7c, 0x15, 0x1c, 0x11, 0x59, 0x92, + 0xa2, 0xb6, 0xf0, 0x17, 0x0e, 0x53, 0xcf, 0x4f, 0x20, 0xd6, 0xca, 0xb2, 0xb1, 0x0a, 0x87, 0x7f, + 0xe2, 0xb3, 0xf7, 0x03, 0x7f, 0xcb, 0x47, 0x98, 0xf8, 0x2c, 0x85, 0x84, 0xf9, 0xbd, 0x10, 0xe3, + 0x5c, 0xb2, 0xa2, 0xe8, 0x23, 0x83, 0xb5, 0x31, 0x96, 0x96, 0x0c, 0x50, 0x92, 0x86, 0xaa, 0x50, + 0x24, 0xe2, 0x2d, 0x7a, 0x03, 0xab, 0xcf, 0xa8, 0xa2, 0x81, 0xc1, 0x15, 0xc2, 0xe5, 0x31, 0x0b, + 0xd4, 0x3f, 0xf8, 0x93, 0xfc, 0xb7, 0x4d, 0xf2, 0x72, 0x59, 0x24, 0x7f, 0xa1, 0xb7, 0x8f, 0xca, + 0x45, 0x15, 0xf5, 0x3f, 0xae, 0x14, 0x33, 0x68, 0x47, 0x9d, 0x56, 0x14, 0xe9, 0xdd, 0xd7, 0x32, + 0x45, 0x99, 0xd1, 0xe9, 0x76, 0x6f, 0xa0, 0xdd, 0xde, 0x40, 0x8f, 0x7b, 0x03, 0x5d, 0x1f, 0x0c, + 0x65, 0x77, 0x30, 0x94, 0xbb, 0x83, 0xa1, 0x9c, 0x93, 0x77, 0x57, 0xb2, 0xc9, 0x0f, 0x4f, 0xae, + 0xc6, 0xf9, 0x2c, 0xaf, 0x66, 0xf8, 0x14, 0x00, 0x00, 0xff, 0xff, 0xb0, 0x18, 0x17, 0xb0, 0x92, + 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + Swap(ctx context.Context, in *MsgSwap, opts ...grpc.CallOption) (*MsgSwapResponse, error) + SwapAll(ctx context.Context, in *MsgSwapAll, opts ...grpc.CallOption) (*MsgSwapAllResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) Swap(ctx context.Context, in *MsgSwap, opts ...grpc.CallOption) (*MsgSwapResponse, error) { + out := new(MsgSwapResponse) + err := c.cc.Invoke(ctx, "/lbm.fswap.v1.Msg/Swap", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SwapAll(ctx context.Context, in *MsgSwapAll, opts ...grpc.CallOption) (*MsgSwapAllResponse, error) { + out := new(MsgSwapAllResponse) + err := c.cc.Invoke(ctx, "/lbm.fswap.v1.Msg/SwapAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + Swap(context.Context, *MsgSwap) (*MsgSwapResponse, error) + SwapAll(context.Context, *MsgSwapAll) (*MsgSwapAllResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) Swap(ctx context.Context, req *MsgSwap) (*MsgSwapResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Swap not implemented") +} +func (*UnimplementedMsgServer) SwapAll(ctx context.Context, req *MsgSwapAll) (*MsgSwapAllResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SwapAll not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_Swap_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSwap) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Swap(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fswap.v1.Msg/Swap", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Swap(ctx, req.(*MsgSwap)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SwapAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSwapAll) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SwapAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lbm.fswap.v1.Msg/SwapAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SwapAll(ctx, req.(*MsgSwapAll)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "lbm.fswap.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Swap", + Handler: _Msg_Swap_Handler, + }, + { + MethodName: "SwapAll", + Handler: _Msg_SwapAll_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "lbm/fswap/v1/tx.proto", +} + +func (m *MsgSwap) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSwap) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwap) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ToDenom) > 0 { + i -= len(m.ToDenom) + copy(dAtA[i:], m.ToDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.ToDenom))) + i-- + dAtA[i] = 0x1a + } + { + size, err := m.FromCoinAmount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.FromAddress) > 0 { + i -= len(m.FromAddress) + copy(dAtA[i:], m.FromAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSwapResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSwapResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwapResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgSwapAll) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSwapAll) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwapAll) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ToDenom) > 0 { + i -= len(m.ToDenom) + copy(dAtA[i:], m.ToDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.ToDenom))) + i-- + dAtA[i] = 0x1a + } + if len(m.FromDenom) > 0 { + i -= len(m.FromDenom) + copy(dAtA[i:], m.FromDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.FromDenom))) + i-- + dAtA[i] = 0x12 + } + if len(m.FromAddress) > 0 { + i -= len(m.FromAddress) + copy(dAtA[i:], m.FromAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSwapAllResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSwapAllResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwapAllResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgSwap) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FromAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.FromCoinAmount.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.ToDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSwapResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSwapAll) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FromAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.FromDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ToDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSwapAllResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgSwap) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSwap: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSwap: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FromAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromCoinAmount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FromCoinAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ToDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ToDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSwapResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSwapResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSwapResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSwapAll) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSwapAll: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSwapAll: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FromAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FromDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ToDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ToDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSwapAllResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSwapAllResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSwapAllResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +)